Skip to content

4. iLoader API#

iLoader API Overview#

The Altibase iLoader API is an application programming interface that lets you create applications that use function calls to download data from, or upload data to, an Altibase database server. Data are downloaded or uploaded in units of tables. The iLoader API provides the same functionality as the iLoader utility. For more information about the iLoader utility, please refer to the Altibase iLoader User's Manual.

The following table summarizes the functions available in the iLoader API.

Function Name Description
altibase_iloader_init Allocates an iLoader handle
altibase_iloader_final Frees a handle and all associated resources
altibase_iloader_options_init Initializes the option structure to its default values
altibase_iloader_formout Creates a table format file (FORM file)
altibase_iloader_dataout Downloads data from a table in a database and writes the data to a file
altibase_iloader_datain Uploads data into a table in a database
CallbackFunctionName A user-defined callback function


Using the iLoader API#

Header Files#

The header file that should be included in the application.

$ALTIBASE_HOME/include/iloaderApi.h

Libraries#

The iLoader API library files that are required in order to develop an application that uses the iLoader API reside in the $ALTIBASE_HOME/lib directory. The iLoader API applications must always link with the following libraries:

  • UNIX

    libiloader.a, libodbccli.a
    

Samples#

Sample iLoader API applications can be found in the $ALTIBASE_HOME/sample/ILOADERAPI directory.


iLoader API Data Structures#

This section describes the C types that are provided for use in applications written using the iLoader API.

These types are:

  • iLoader Handle
  • Error Structure
  • Log Structure
  • Option Structure
  • iLoader API Enumerator (enum)

iLoader Handle#

The iLoader handle is an opaque data structure that is defined by the iLoader API library. It is used to store information pertaining to the behavior of applications that use the iLoader API.

  • ALTIBASE_ILOADER_HANDLE
    This is an iLoader handle. The iLoader handle is primarily used when downloading data, uploading data and creating FORM files.
    The iLoader handle is allocated with altibase_iloader_init() and freed with altibase_iloader_final().

Error Structure#

  • ALTIBASE_ILOADER_ERROR
    This structure is used to store information for diagnosing errors that occur during the execution of an application that was written using the iLoader API. This structure is defined as follows:

    typedef struct ALTIBASE_ILOADER_ERROR
    {
        int errorCode;      /* Error Code */
        char *errorState;   /* SQLSTATE Code */
        char *errorMessage; /* Error Message */
    } ALTIBASE_ILOADER_ERROR;
    

Log Structure#

The iLoader API provides the following two structures for use in logging the progress of an iLoader task:

  • ALTIBASE_ILOADER_LOG
    This structure is passed to an application's callback function every time an error occurs during the execution of an iLoader task.
    It is also passed to a callback function upon completion of an iLoader task. At this time, the record, recordData, recordColCount, and errorMgr members are not passed. The purpose of this structure is to report errors that occur during the execution of an iLoader task, and to provide information about the results of execution of a task. This structure is defined as follows:

    typedef struct ALTIBASE_ILOADER_LOG
    {
      char tableName[50];
        int totalCount;
        int loadCount;
        int errorCount;
        int record;
        char **recordData;
        int recordColCount;
        ALTIBASE_ILOADER_ERROR errorMgr;
    } ALTIBASE_ILOADER_LOG;
    
    Member Description
    tableName This is the name of the table being uploaded or downloaded.
    totalCount This is the total number of rows for which an upload or download attempt has been made.
    loadCount This is the total number of rows that have been successfully uploaded or downloaded.
    errorCount This is the number of rows that could not be uploaded or downloaded due to the occurrence of an error. Note that when an error occurs, this count does not include the current error. That is, it is a count of all errors preceding the current error.
    record When an error occurs, this indicates the position of the record that could not be uploaded or downloaded.
    recordData When an error occurs, this is the data stored in the record that could not be uploaded or downloaded.
    recordColCount When an error occurs, this is the number of columns in the record that could not be uploaded or downloaded.
    errorMgr When an error occurs, this is an error structure that contains information about the error.
  • ALTIBASE_ILOADER_STATIC_LOG
    This structure is periodically passed to an application's callback function during the execution of an iLoader task. The frequency with which it is passed is determined by the setRowFrequency option in the Option Structure.
    This structure is used to pass statistics about the execution of an iLoader task. These statistics are: the time at which the task started, the total number of rows to be uploaded or downloaded, the number of rows that have been successfully uploaded or downloaded, and the number of rows that could not be uploaded or downloaded due to the occurrence of an error.

    This structure is defined as follows:

    typedef struct ALTIBASE_ILOADER_STATISTIC_LOG
    {
     char tableName[50];
        time_t startTime;
        int totalCount;
        int loadCount;
        int errorCount;
    } ALTIBASE_ILOADER_STATISTIC_LOG;
    
    Member Description
    tableName The name of the table being uploaded or downloaded.
    startTime This is the time at which the upload or download task started.
    totalCount This is the total number of rows to be uploaded. This member is not used when downloading data.
    loadCount This is the total number of rows that have been successfully uploaded or downloaded.
    errorCount This is the number of rows that could not be uploaded or downloaded due to the occurrence of an error.

Option Structure#

  • ALTIBASE_ILOADER_OPTION_V1
    Most of the members of the ALTIBASE_ILOADER_OPTION_V1 structure correspond to iLoader options. The corresponding option is noted in the comment following each member. For detailed information on the iLoader options, please refer to the Altibase iLoader User's Manual.
    The definitions of the iloBool, iloLoadMode, iloDirectMode and ALTIBASE_ILOADER_LOG_TYPE enumerators can be found iLoader API Enumerators.

    This structure is defined as follows:

    typedef struct ALTIBASE_ILOADER_OPTIONS_V1
    {
        int            version;
        char           loginID[128 * 2];        /* -u login_id */
        char           password[128];           /* -p password */
        char           serverName[128];         /* -s server_name */
        int            portNum;                 /* -port port_no */
        char           NLS[128];                /* -nls_use characterset */
        char           DBName[128];
        char           tableOwner[50];
        char           tableName[50];           /* -T table_name */
        char           formFile[1024];          /* -f formatfile */
        char           dataFile[32][1024];      /* -d datafile */
        int            dataFileNum;
        int            firstRow;                /* -F firstrow */
        int            lastRow;                 /* -L lastrow */
        char           fieldTerm[11];           /* -t field_term */
        char           rowTerm[11];             /* -r row_term */
        char           enclosingChar[11];       /* -e enclosing_term */
        iloBool        useLobFile;              /* -lob use_lob_file */
        iloBool        useSeparateFile;         /* -lob use_separate_file */
        char           lobFileSize[11];         /* -lob log_file_size */
        char           lobIndicator[11];        /* -lob lob_indicator*/
        iloBool        replication;             /* -replication true/false */
        iloLoadMode    loadModeType;            /* -mode mode_type */
        char           bad[1024];               /* -bad bad_file */
        char           log[1024];               /* -log log_file */
        int            splitRowCount;           /* -split n */
        int            errorCount;              /* -errors count */
        int            arrayCount;              /* -array array_size */
        int            commitUnit;              /* -commit commit_unit */
        iloBool        atomic;                  /* -atomic */
        iloDirectMode  directLog;               /* -direct log/nolog */
        int            parallelCount;           /* -parallel count */
        int            readSize;                /* -readSize size */
        iloBool        informix;
        iloBool        flock;
        iloBool        mssql;
        iloBool        getTotalRowCount;
        int            setRowFrequency;
    } ALTIBASE_ILOADER_OPTIONS_V1;
    
    Member Description
    version This must be set to the same value as the version argument that is passed by altibase_iloader_options_init().
    tableOwner This is used to specify the name of the table owner.
    loadModeType ILO_APPEND: This is the same as APPEND, one of the possible values for the iLoader -mode option.
    ILO_REPLACE: This is the same as REPLACE, one of the possible values for the iLoader -mode option.
    ILO_TRUNCATE: This is the same as TRUNCATE, one of the possible values for the iLoader -mode option.
    The default value is ILO_APPEND.
    atomic This is used to specify whether to use Atomic Array INSERT. It can be either ILO_TRUE or ILO_FALSE.
    The default value is ILO_FALSE.
    directLog This is used to specify whether to use direct-path INSERT.
    If it is set to ILO_DIRECT_NONE, Direct-Path INSERT is not used.
    If it is set to ILO_DIRECT_LOG, Direct-Path INSERT is executed in logging mode.
    If it is set to ILO_DIRECT_NOLOG, Direct-Path INSERT is executed in nologging mode.
    The default value is ILO_DIRECT_NONE.
    dataFileNum This is used to specify the number of datafiles for the dataFile member in this structure.
    getTotalRowCount This specifies whether to get the total number of rows in the datafiles and set the totalCount member in the ALTIBASE_ILOADER_STATISTIC_LOG structure to this number when uploading data.
    It can be either ILO_TRUE or ILO_FALSE.
    The default value is ILO_FALSE.
    setRowFrequency The user callback function is called every time the number of rows specified here is uploaded or downloaded.
    The default value is 0. If this value is set to 0, the callback function is never called.

iLoader API Enumerators (enum)#

typedef enum
{
    ILO_FALSE = 0,                /* false */
    ILO_TRUE  = 1                 /* true */
} iloBool;
typedef enum
{
    ILO_APPEND,
    ILO_REPLACE,
    ILO_TRUNCATE
} iloLoadMode;
typedef enum
{
    ILO_DIRECT_NONE,
    ILO_DIRECT_LOG,
    ILO_DIRECT_NOLOG
} iloDirectMode;
typedef enum
{
    ILO_LOG,
    ILO_STATISTIC_LOG
} ALTIBASE_ILOADER_LOG_TYPE;


iLoader API#

This section describes each of the functions in the iLoader API.

The following information is provided for each function.

  • The name and purpose of the function
  • The function syntax A list of arguments for the function
  • The function's return values
  • Diagnostics for the function
  • Notes related to use of the function
  • A list of related functions
  • An example of use of the function in code

altibase_iloader_datain#

This function is used to upload data into a database table.

Syntax#

int altibase_iloader_datain (
 ALTIBASE_ILOADER_HANDLE * handle,
 int version
 void * options
 ALTIBASE_ILOADER_CALLBACK logCallback,
 ALTIBASE_ILOADER_ERROR * error );

Arguments#

Argumetn In/Output Description
handle Input This is the pointer to the iLoader handle.
version Input This is the version of the iLoader API.
options Input This is the pointer to the option structure.
logCallback Input This is the name of a log callback function. It may be a user-defined function. It can be NULL.
error Output This is the pointer to the error structure in which to return information for diagnosing errors.
For more information about the error structure, please refer to iLoader API Data Structures.

Return Values#

ALTIBASE_ILO_SUCCESS, ALTIBASE_ILO_ERROR, or ALTIBASE_ILO_WARNING

If the overall upload operation succeeded but one or more errors occurred, ALTIBASE_ILO_WARNING is returned.

Diagnosis#

When altibase_iloader_datain()returns either ALTIBASE_ILO_ERROR or ALTIBASE_ILO_WARNING, the associated error information is returned in error.

Description#

altibase_iloader_datain() is used to upload data from a file into a database table.

The value of the version argument must be ALTIBASE_ILOADER_V1.

If a user-defined log callback function is being used, specify the name of the function in logCallback. Set logCallback to NULL when not using a user-defined log callback function.

  • altibase_iloader_init
  • altibase_iloader_options_init
  • altibase_iloader_formout
  • altibase_iloader_final

Example#

The following example shows how to specify a format file and a data file when uploading data, both when using the iLoader utility directly and when calling the iLoader API from within an application.

  • Uploading Data using the iLoader Utility

    iloader in -s 127.0.0.1 -u sys -p manager -f t1.fmt -d t1.dat
    
  • Uploading Data Using an Application that Calls the iLoader API

    int main()
    {
        ALTIBASE_ILOADER_HANDLE      handle = ALTIBASE_ILOADER_NULL_HANDLE;
        ALTIBASE_ILOADER_OPTIONS_V1  opt;
        ALTIBASE_ILOADER_ERROR       err;
        int rc;
    
        /* Allocate an ILOADER handle */
        rc = altibase_iloader_init(&handle);
    
        if ( rc != ALTIBASE_ILO_SUCCESS )
        {
            printf("altibase_iloader_init() failed: %d\n", rc);
            return 1;
        }
    
        /* Initialize an option structure */
        altibase_iloader_options_init(ALTIBASE_ILOADER_V1, &opt);
    
        strcpy(opt.serverName, "127.0.0.1");
        strcpy(opt.loginID, "sys");
        strcpy(opt.password, "manager");
        strcpy(opt.formFile, "t1.fmt");
        strcpy(opt.dataFile[0], "t1.dat");
        opt.dataFileNum = 1;
    
        /* Upload data */
        rc = altibase_iloader_datain(&handle, ALTIBASE_ILOADER_V1, &opt, NULL, &err);
    
        if ( rc == ALTIBASE_ILO_SUCCESS )
        {
            printf("SUCCESS\n");
        }
        else
        {
            printf("ERR-%05X [%s] %s\n",
                    err.errorCode,
                    err.errorState,
                    err.errorMessage);
        }
    
        if ( handle != ALTIBASE_ILOADER_NULL_HANDLE )
        {
            altibase_iloader_final(&handle);
        }
    
        return 0;
    }
    

altibase_iloader_dataout#

This function is used to download data from a database table and write the data to a file.

Syntax#

int altibase_iloader_dataout (
 ALTIBASE_ILOADER_HANDLE * handle,
 int version
 void * options
 ALTIBASE_ILOADER_CALLBACK logCallback,
 ALTIBASE_ILOADER_ERROR *   error );

Arguments#

Argument In/Output Description
handle Input This is the pointer to the iLoader handle.
version Input This is the version of the iLoader API.
options Input This is the pointer to the option structure
logCallback Input This is the name of a log callback function. It may be a user-defined function.
error Output This is the pointer to the diagnostic error structure in which to return information for diagnosing errors.
For more information about this structure, please refer to iLoader API Data Structures.

Result Values#

ALTIBASE_ILO_SUCCESS or ALTIBASE_ILO_ERROR

Diagnosis#

When altibase_iloader_dataout()returns ALTIBASE_ILO_ERROR, the associated error information is returned in error.

Description#

altibase_iloader_dataout() is used to download data from a database table and write the data to a file.

The value of the version argument must be ALTIBASE_ILOADER_V1.

If a user-defined log callback function is being used, specify the name of the function in logCallback. Set logCallback to NULL when not using a user-defined log callback function.

  • altibase_iloader_init
  • altibase_iloader_options_init
  • altibase_iloader_formout
  • altibase_iloader_final

Example#

The following example shows how to specify a format file and a data file when downloading data, both when using the iLoader utility directly and when calling the iLoader API from within an application.

  • Downloading Data Using the iLoader Utility

    iloader out -s 127.0.0.1 -u sys -p manager -f t1.fmt -d t1.dat
    
  • Downloading Data Using an Application that Calls the iLoader API

    int main()
    {
        ALTIBASE_ILOADER_HANDLE      handle = ALTIBASE_ILOADER_NULL_HANDLE;
        ALTIBASE_ILOADER_OPTIONS_V1  opt;
        ALTIBASE_ILOADER_ERROR       err;
        int rc;
    
        /* Allocate an iLoader handle */
        rc = altibase_iloader_init(&handle);
    
        if ( rc != ALTIBASE_ILO_SUCCESS )
        {
            printf("altibase_iloader_init() failed: %d\n", rc);
            return 1;
        }
    
        /* Initialize an option structure */
        altibase_iloader_options_init(ALTIBASE_ILOADER_V1, &opt);
    
        strcpy(opt.serverName, "127.0.0.1");
        strcpy(opt.loginID, "sys");
        strcpy(opt.password, "manager");
        strcpy(opt.formFile, "t1.fmt");
        strcpy(opt.dataFile[0], "t1.dat");
        opt.dataFileNum = 1;
    
        /* Download data */
        rc = altibase_iloader_dataout(&handle, ALTIBASE_ILOADER_V1, &opt, NULL, &err);
    
        if ( rc == ALTIBASE_ILO_SUCCESS )
        {
            printf("SUCCESS\n");
        }
        else
        {
            printf("ERR-%05X [%s] %s\n",
                    err.errorCode,
                    err.errorState,
                    err.errorMessage);
        }
    
        if ( handle != ALTIBASE_ILOADER_NULL_HANDLE )
        {
            altibase_iloader_final(&handle);
        }
    
        return 0;
    }
    

altibase_iloader_final#

This function is used to free a handle and all associated resources.

Syntax#

int altibase_iloader_final (ALTIBASE_ILOADER_HANDLE * handle );

Arguments#

Argument In/Output Description
handle Input This is the pointer to the iLoader handle to be freed.

Return Values#

ALTIBASE_ILO_SUCCESS or ALTIBASE_ILO_ERROR

Description#

altibase_iloader_final() frees the resources associated with the specified iLoader handle. After a handle has been freed, it cannot be used by the application.

altibase_iloader_init

Example#

Please refer to altibase_iloader_init.

altibase_iloader_formout#

This function is used to create a table format file (i.e. FORM file).

Syntax#

int altibase_iloader_formout (
 ALTIBASE_ILOADER_HANDLE * handle,
 int version
 void * options
 ALTIBASE_ILOADER_ERROR * error );

Arguments#

Argument In/Output Description
handle Input This is the pointer to the iLoader handle.
version Input This is the version of the iLoader API.
options Input This is the pointer to the option structure.
error Output This is the pointer to the error structure in which to return information for diagnosing errors.
For more information about this structure, please refer to iLoader API Data Structures.
Return Values#

ALTIBASE_ILO_SUCCESS or ALTIBASE_ILO_ERROR

Diagnosis#

When altibase_iloader_formout()returns ALTIBASE_ILO_ERROR, the associated error information is returned in error.

Description#

altibase_iloader_formout() is used to create a format file (FORM file) that describes a database table.

This function can be called only after altibase_iloader_init() and altibase_iloader_options_init() have been called.

The value of the version argument must be ALTIBASE_ILOADER_V1.

  • altibase_iloader_init
  • altibase_iloader_options_init
  • altibase_iloader_datain
  • altibase_iloader_dataout
  • altibase_iloader_final

Example#

The following example shows how to create a format file that describes table T1, both when using the iLoader utility directly and when calling the iLoader API from within an application.

  • Creating a format file using the iLoader Utility

    iloader formout -s 127.0.0.1 -u sys -p manager -T T1 -f t1.fmt
    
  • Creating a format file using an application that calls the iLoader API.

    int main()
    {
        ALTIBASE_ILOADER_HANDLE     handle = ALTIBASE_ILOADER_NULL_HANDLE;
        ALTIBASE_ILOADER_OPTIONS_V1 opt;
        ALTIBASE_ILOADER_ERROR      err;
        int rc;
    
        /* Allocate an iLoader handle */
        rc = altibase_iloader_init(&handle);
    
        if ( rc != ALTIBASE_ILO_SUCCESS )
        {
            printf("Failed to altibase_iloader_init() failed: %d\n", rc);
            return 1;
        }
    
        /* Initialize an option structure */
        altibase_iloader_options_init(ALTIBASE_ILOADER_V1, &opt);
    
        strcpy(opt.serverName, "127.0.0.1");
        strcpy(opt.loginID, "sys");
        strcpy(opt.password, "manager");
        strcpy(opt.tableName, "t1");
        strcpy(opt.formFile, "t1.fmt");
    
        /* formout */
        rc = altibase_iloader_formout(&handle, ALTIBASE_ILOADER_V1, &opt, &err);
    
        if ( rc == ALTIBASE_ILO_SUCCESS )
        {
            printf("SUCCESS\n");
        }
        else
        {
            printf("ERR-%05X [%s] %s\n",
                    err.errorCode,
                    err.errorState,
                    err.errorMessage);
        }
    
        if ( handle != ALTIBASE_ILOADER_NULL_HANDLE )
        {
            altibase_iloader_final(&handle);
        }
    
        return 0;
    }
    

altibase_iloader_init#

This function allocates an iLoader handle.

Syntax#

int altibase_iloader_init (ALTIBASE_ILOADER_HANDLE * handle );

Argument#

Argument In/Output Description
handle Output This is a pointer to a buffer in which the handle to the newly allocated data structure is returned.

Return Values#

ALTIBASE_ILO_SUCCESS or ALTIBASE_ILO_ERROR

Description#

altibase_iloader_init() allocates a handle that is used when creating a table format file, downloading data, or uploading data.

One handle cannot be shared by multiple threads, even if the threads are part of the same process.

  • altibase_iloader_datain
  • altibase_iloader_dataout
  • altibase_iloader_formout
  • altibase_iloader_final

Example#

int main()
{
    ALTIBASE_ILOADER_HANDLE handle = ALTIBASE_ILOADER_NULL_HANDLE;
    int rc;

    rc = altibase_iloader_init( &handle );
    if ( rc != ILOADER_SUCCESS )
    {
        printf( "altibase_iloader_init() failed: %d\n",rc );
    }

    /* ... omit ... */

    if( handle != ALTIBASE_ILOADER_NULL_HANDLE )
    {
        altibase_iloader_final( &handle );
    }

    return 0;
}

altibase_iloader_options_init#

This function initializes an option structure to the default values.

Syntax#

int altibase_iloader_options_init (
            int version,
            void * options );

Arguments#

Argument In/Output Description
handle Input This is the version of the iLoader API.
options Input This is the pointer to the option structure.

Return Values#

ALTIBASE_ILO_SUCCESS or ALTIBASE_ILO_ERROR

Description#

altibase_iloader_options_init() initializes an option structure to the default values. For detailed information about the default values, please refer to iLoader API Data Structures and to the Altibase iLoader User's Manual.

The option structure must be initialized using this function before setting the option structure.

altibase_iloader_init

Example#

Please refer to the examples for the altibase_iloader_datain and altibase_iloader_dataout function.

CallbackFunctionName#

This function is a user-defined callback function for handling the log information that is generated during the execution of an applicaiton that uses the iLoader API.

Syntax#

int CallbackFuncationName (
        ALTIBASE_ILOADER_LOG_TYPE type,
        void * log );

Arguments#

Argument In/Output Description
type Input This is the type of the log structure to return. It may be either ILO_LOG or ILO_STATISTIC_LOG.
log Input This is the pointer to the log structure.
Depending on the value of type, this argument will point to an ALTIBASE_ILOADER_LOG structure or to an ALTIBASE_ILOADER_STATISTIC_LOG structure.
If type is ILO_LOG, log is a pointer to an ALTIBASE_ILOADER_LOG structure, whereas if type is ILO_STATISTIC_LOG, log is a pointer to an ALTIBASE_ILOADER_STATISTIC_LOG structure.
For more information about the structures, please refer to Log Structure.

Return Values#

If ILO_STATISTIC_LOG is specified for type when a user-defined callback function is called, and the user-defined callback function returns anything other than 0 (zero), execution of the current upload or download task will stop.

Description#

The Altibase iLoader API has the capability to execute user-specific code in addition to iLoader API calls. This functionality allows users to control execution of their applications based on the contents of iLoader logs. When altibase_iloader_datain() or altibase_iloader_dataout() is called, a callback function, which may be a user-defined function, can be registered. When the callback function is called, it receives the following iLoader log information: the time at which the task started, the total number of rows to be uploaded or downloaded, the number of rows that have been successfully uploaded or downloaded, and the number of rows that could not be uploaded or downloaded due to the occurrence of an error.

The application's callback function will be called at the following times:

  • When an error occurs during the course of an upload or download operation.
    At this time, the structure that is passed to the callback function is ILO_LOG (ALTIBASE_ILOADER_LOG). The ALTIBASE_ILOADER_LOG structure contains an Error Structure, which contains an errorCode member. If the value of that member is not 0, this means that an error has occurred.

  • After an iLoader task has completely executed following a call to altibase_iloader_datain() or altibase_iloader_dataout():
    At this time, the structure that is passed to the callback function is ILO_LOG (ALTIBASE_ILOADER_LOG). If the value of the record member of the log structure is 0, this means that execution has completed.

  • Every time the number of rows specified in setRowFrequency, a member of the Option Structure, is uploaded or downloaded:
    At this time, the structure that is passed to the callback function is ILO_STATISTIC_LOG (ALTIBASE_ILOADER_STATISTIC_LOG). If a user-defined callback function returns anything other than 0 (zero), execution of the current upload or download task will stop. Note that at that point, the value of loadCount may be incorrect. Note that although the user callback function is supposed to be called whenever the number of rows specified in the setRowFrequency member is uploaded or downloaded, this behavior may not be exhibited in the following cases:

    • When the value of the arrayCount member of the option structure is greater than 1, a user callback function cannot be called during the execution of an upload task.
    • When the value of the parallelCount member of the option structure is greater than 1, a user callback function may not be called for reasons related to synchronization between multiple threads.
  • altibase_iloader_datain
  • altibase_iloader_dataout

Example#

  • Defining user callback

    int print_callback ( ALTIBASE_ILOADER_LOG_TYPE type, void *log)
    {
        int i;
    
        ALTIBASE_ILOADER_LOG           *slog;
        ALTIBASE_ILOADER_STATISTIC_LOG *statisticlog;
    
        if ( type == ILO_LOG )
        {
            slog = (ALTIBASE_ILOADER_LOG *) log;
    
            if ( slog->record == 0 )
            {
                printf("LOG Total Count : %d\n", slog->totalCount);
                printf("LOG Load Count : %d\n", slog->loadCount);
                printf("LOG Error Count : %d\n", slog->errorCount);
            }
            else
            {
                printf("LOG %d\n", slog->record);
                for (i = 0; i < slog->recordColCount; i++)
                {
                    printf("    [%d] : %s\n", i, slog->recordData[i]);
                }
            }
    
            if ( slog->errorMgr.errorCode != 0 )
            {
                printf("    ERR-%05X [%s] %s\n",
                        slog->errorMgr.errorCode,
                        slog->errorMgr.errorState,
                        slog->errorMgr.errorMessage);
            }
        }
        else if ( type == ILO_STATISTIC_LOG )
        {
            statisticlog = (ALTIBASE_ILOADER_STATISTIC_LOG *) log;
    
            printf("STATISTIC LOG Start Time  : %s\n", ctime(&statisticlog->startTime));
            printf("STATISTIC LOG Table Name  : %s\n", statisticlog->tableName );
            printf("STATISTIC LOG Total Count : %d\n", statisticlog->totalCount );
            printf("STATISTIC LOG Load Count  : %d\n", statisticlog->loadCount);
            printf("STATISTIC LOG Error Count : %d\n", statisticlog->errorCount);
        }
    
        return 0;
    }
    
  • Registering user callback.

    /* upload data */
    altibase_iloader_datain(&handle,
                            ALTIBASE_ILOADER_V1,
                            &opt,
                            print_callback,
                            &err);