DB2-Admin

 view release on metacpan or  search on metacpan

Admin.xs  view on Meta::CPAN

# - Failure: undef
#
# NOTE: we ignore the 'int' return value from sqleatin,
#       as IBM does not document it...
#
void
sqleatin(pNodeName, pUserName, pPassword)
     char* pNodeName
     char* pUserName
     char* pPassword
PPCODE:
     {
         SV *Return;

         sqleatin(pNodeName, pUserName, pPassword, &global_sqlca);
         if (global_sqlca.sqlcode == SQL_RC_OK) {
             Return = sv_newmortal();
             sv_setpv(Return, global_sqlca.sqlerrmc);
             XPUSHs(Return);
         } else {
             XSRETURN_UNDEF;

Admin.xs  view on Meta::CPAN

# Returns:
# - Boolean
#
void
db_connect(db_alias, userid, passwd, attrs)
    char *db_alias
    char *userid
    char *passwd
    SV   *attrs;

    PPCODE:
    {
        SQLRETURN   ret;
        SQLHANDLE   db_handle;
        int         error = 0;
        SV        **elem, *value;
        char       *key;
        I32         keylen;
#ifndef _WIN32                  /* Unix-specific */
        /* Check whether process id has changed */
        if (env_pid != 0 && env_pid != getpid()) {

Admin.xs  view on Meta::CPAN

#
# Disconnect from a database
#
# Returns:
# - Boolean
#
void
db_disconnect(db_alias)
     char *db_alias

    PPCODE:
    {
        SQLRETURN   ret;
        SQLHANDLE   db_handle;
        int         error = 0;
        SV        **elem;
#ifndef _WIN32                  /* Unix-specific */
        /* Check whether process id has changed */
        if (env_pid != 0 && env_pid != getpid()) {
            _do_cleanup_connections();
        }

Admin.xs  view on Meta::CPAN

        }
    }


#
# Cleanup all handles at program end.  Invoked from END in perl module.
#
void
cleanup_connections()

     PPCODE:
     {
         _do_cleanup_connections();
     }


#
# Get/Set the monitor switches for this application
#
# Parameters:
# - Ref to hash with switch names and 0/1 value (missing: hold)

Admin.xs  view on Meta::CPAN

# - Node (SQLM_CURRENT_NODE, SQLM_ALL_NODES, number)
# Returns:
# - Ref to sql element buffer with current switch state
#
void
db2MonitorSwitches(switches, version, node)
     SV *switches
     int version
     int node

     PPCODE:
     {
         db2MonitorSwitchesData      switchesData;
         struct sqlm_recording_group switchesList[SQLM_NUM_GROUPS];
         sqluint32                   outputFormat;
         char                       *key;
         I32                         keylen;
         SV                         *value;
         char                        output_buffer[SWITCHES_BUFFER_SIZE];

         if ((!SvROK(switches)) ||

Admin.xs  view on Meta::CPAN

# Returns:
# - Recommended snapshot size / undef on error
#
void
db2GetSnapshotSize(sqlma_data, version, node, class)
     struct sqlma * sqlma_data
     int version
     int node
     int class

     PPCODE:
     {
         sqluint32              size;
         db2GetSnapshotSizeData getSnapshotSizeParam;

         memset(&getSnapshotSizeParam, 0, sizeof(getSnapshotSizeParam));
         getSnapshotSizeParam.piSqlmaData = sqlma_data;
         getSnapshotSizeParam.poBufferSize = &size;
         getSnapshotSizeParam.iVersion = version;
         getSnapshotSizeParam.iNodeNumber = node;
#ifdef SQLM_CLASS_DEFAULT

Admin.xs  view on Meta::CPAN

void
db2GetSnapshot(sqlma_data, version, node, class, buffer_size, buffer_increment, store_results)
     struct sqlma * sqlma_data
     int version
     int node
     int class
     int buffer_size
     int buffer_increment
     int store_results

     PPCODE:
     {
         db2GetSnapshotData getSnapshotParam;
         char              *output_buffer;
         db2Uint32          output_format;

         memset(&getSnapshotParam, 0, sizeof(getSnapshotParam));
         Newz(0, output_buffer, buffer_size, char);
         getSnapshotParam.piSqlmaData = sqlma_data;
         getSnapshotParam.poCollectedData = 0;
         getSnapshotParam.poBuffer = output_buffer;

Admin.xs  view on Meta::CPAN

#   - Automatic (optional)
#   - Computed (optional, V9.1 only)
#
void
db2CfgGet(params, flags, dbname, version)
     SV   *params
     SV   *flags
     char *dbname
     int   version

     PPCODE:
     {
         char        *buffer, *buffer_ptr, *key;
         size_t       buffer_size;
         int          array_length, counter, *sizes, error = 0;
         AV          *params_array;
         HV          *flags_hash;
         I32          keylen;
         SV          *value;
         db2CfgParam *cfgParam;
         db2Cfg       cfgStruct;

Admin.xs  view on Meta::CPAN

# Returns:
# - 1 on success, undef on failure
#
void
db2CfgSet(params, flags, dbname, version)
     SV   *params
     SV   *flags
     char *dbname
     int   version

     PPCODE:
     {
         char        *key;
         int          array_length, counter, error = 0;
         AV          *params_array;
         HV          *flags_hash;
         I32          keylen;
         SV          *value;
         db2CfgParam *cfgParam;
         db2Cfg       cfgStruct;

Admin.xs  view on Meta::CPAN

# Parameters:
# - Path name (optional: empty string will query system database directory)
# Returns:
# - Ref to array of hash-references with fields like 'DBName',
#   'Alias', 'Path' or undef on failure
#
void
db2DatabaseDirectory(path)
     char *path

     PPCODE:
     {
         unsigned short  num_entries;
         SV             *Return;
         AV             *retval;
         int             counter, error = 0;
#ifdef ADMIN_API_HAVE_DB2DBDIR_V8
         struct          db2DbDirOpenScanStruct    open_param;
         struct          db2DbDirNextEntryStruct   next_entry_param;
         struct          db2DbDirCloseScanStruct   close_param;
#elif ADMIN_API_HAVE_DB2DBDIR_V9

Admin.xs  view on Meta::CPAN

#
# Parameters:
# - Reference to a hash with relevant fields
# Returns:
# - Boolean
#
void
sqlecadb(params)
    SV *params

    PPCODE:
    {
        char           *dbname = NULL, *db_alias = NULL, *node_name = NULL;
        char           *path = NULL, *comment = NULL, *principal = NULL;
        unsigned char   db_type = 0x00;
        unsigned short  auth = SQL_AUTHENTICATION_NOT_SPEC;
        char           *key;
        I32             keylen;
        SV             *value;

        if ((!SvROK(params)) ||

Admin.xs  view on Meta::CPAN

#
# Parameters:
# - Database alias
# Returns:
# - Boolean
#
void
sqleuncd(db_alias)
    char *db_alias

    PPCODE:
    {
         sqleuncd(db_alias, &global_sqlca);
         if (global_sqlca.sqlcode != SQL_RC_OK) {
             warn("Call to sqleuncd() failed with sqlcode %d",
                  global_sqlca.sqlcode);
             XSRETURN_UNDEF;
         } else {
             SV *Return;

             Return = sv_newmortal();

Admin.xs  view on Meta::CPAN

# Inquire the node directory
#
# Parameters: none
# Returns:
# - Ref to array of hash-references with fields like 'DBName',
#   'Alias', 'Path' or undef on failure
#
void
db2NodeDirectory()

     PPCODE:
     {
         unsigned short  dir_handle, num_entries;
         SV             *Return;
         AV             *retval;
         int             counter, error = 0;

         sqlenops(&dir_handle, &num_entries, &global_sqlca);
         if (global_sqlca.sqlcode != SQL_RC_OK) {
             if (global_sqlca.sqlcode != SQLE_RC_NONODEDIR) {
                 warn("db2NodeDirectory: sqlenops() failed with sqlcode %d",

Admin.xs  view on Meta::CPAN

#
# Parameters:
# - Reference to a hash with relevant fields
# Returns:
# - Boolean
#
void
sqlectnd(params)
    SV *params

    PPCODE:
    {
        char                     protocol;
        struct sqle_node_struct  generic_node_info = { SQL_NODE_STR_ID, 0, "", "", 0 };
        struct sqle_node_tcpip   tcpip_node_info = { "", "" };
        struct sqle_node_local   local_node_info = { "" };
        void                    *protocol_info;
        char                    *key;
        I32                      keylen;
        SV                      *value, **elem;

Admin.xs  view on Meta::CPAN

#
# Parameters:
# - Node name
# Returns:
# - Boolean
#
void
sqleuncn(node_name)
    char *node_name

    PPCODE:
    {
         sqleuncn(node_name, &global_sqlca);
         if (global_sqlca.sqlcode != SQL_RC_OK) {
             warn("Call to sqleuncn() failed with sqlcode %d",
                  global_sqlca.sqlcode);
             XSRETURN_UNDEF;
         } else {
             SV *Return;

             Return = sv_newmortal();

Admin.xs  view on Meta::CPAN

# Inquire the DCS (gateway) directory
#
# Parameters: none
# Returns:
# - Ref to array of hash-references with fields like 'DBName',
#   'Alias', 'Path' or undef on failure
#
void
db2DCSDirectory()

     PPCODE:
     {
         short  num_entries;
         SV    *Return;
         AV    *retval;
         int    error = 0;

         sqlegdsc(&num_entries, &global_sqlca);
         if (global_sqlca.sqlcode != SQL_RC_OK) {
             if (global_sqlca.sqlcode != SQLE_RC_NO_ENTRY &&
                 global_sqlca.sqlcode != SQLE_RC_LDB_NF) {

Admin.xs  view on Meta::CPAN

#
# Parameters:
# - Reference to a hash with relevant fields
# Returns:
# - Boolean
#
void
sqlegdad(params)
    SV *params

    PPCODE:
    {
        struct sql_dir_entry  dcs_node_info = { SQL_DCS_STR_ID, 0, 0, "", "", "", "", "" };
        char                 *key;
        I32                   keylen;
        SV                   *value;

        if ((!SvROK(params)) ||
            (SvTYPE(SvRV(params)) != SVt_PVHV)) {
            croak("Hash reference expected for parameter 'params'");
        }

Admin.xs  view on Meta::CPAN

#
# Parameters:
# - (Local) Database name
# Returns:
# - Boolean
#
void
sqlegdel(database)
    char *database

    PPCODE:
    {
        struct sql_dir_entry dcs_node_info = { SQL_DCS_STR_ID, 0, 0, "", "", "", "", "" };

        if (strlen(database) > sizeof(dcs_node_info.ldb))
            croak("Database name '%'s is too long - maximum is '%d' characters\n", database, sizeof(dcs_node_info.ldb));
        strncpy(dcs_node_info.ldb, database, sizeof(dcs_node_info.ldb));
        sqlegdel(&dcs_node_info, &global_sqlca);
        if (global_sqlca.sqlcode != SQL_RC_OK) {
            warn("Call to sqlegdel() failed with sqlcode %d",
                 global_sqlca.sqlcode);

Admin.xs  view on Meta::CPAN

#
# Parameters:
# - Ref to array of agent ids / String 'All'
# Returns:
# - Boolean
#
void
sqlefrce(params)
     SV   *params

     PPCODE:
     {
         long       num_agent_ids;
         sqluint32 *agent_ids;

         /*
          * Verify we have a string or an array.
          * - String: must be 'All;
          * - Array: build array of agent ids
          */
         if (!SvROK(params)) {  /* Not a reference - must be string */

Admin.xs  view on Meta::CPAN

    char *file_type
    char *data_file
    char *msg_file
    char *file_options
    SV   *lob_paths
    SV   *lob_files
    SV   *export_options
    SV   *xml_paths
    SV   *xml_files

    PPCODE:
    {
        int                      error = 0;
        void                    *newz_ptr;
        SV                      *Return;
        struct sqlchar          *filetype_mod = NULL;
        struct sqldcol           data_descriptor;
        struct sqlu_media_list  *lob_path_info, *lob_file_info;
        db2ExportStruct          export_info =
            { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0x00, NULL };
        struct sqllob           *action_string = NULL;

Admin.xs  view on Meta::CPAN

     char *import_sql
     char *file_type
     char *data_file
     SV   *input_columns
     char *msg_file
     char *file_options
     SV   *import_options
     SV   *lob_paths
     SV   *xml_paths

     PPCODE:
     {
         int                      error = 0;
         SV                      *value;
         struct sqlchar          *filetype_mod = NULL;
#ifdef ADMIN_API_HAVE_IMPORT_LONG_ACTION /* DB2 V9.5 and up */
         struct sqllob           *action_string = NULL;
#else /* DB2 V9.1 and before */
         struct sqlchar          *action_string = NULL;
#endif
         struct sqldcol          *data_descriptor = NULL;

Admin.xs  view on Meta::CPAN

     SV   *source_list
     char *copy_list
     char *msg_file
     char *tempfiles_path
     char *file_options
     SV   *load_options
     SV   *dpf_options
     SV   *lob_paths
     SV   *xml_paths

     PPCODE:
     {
         int                           error = 0;
         SV                           *value;
         char                         *key;
         void                         *newz_ptr;
         I32                           keylen;
         struct sqlu_media_list       *source_media_info = NULL;
         struct sqlu_media_list       *lob_path_info = NULL;
         struct sqlu_media_list        copy_media_info = { 0 };
         struct sqlu_location_entry    copy_location_info = { 0 };

Admin.xs  view on Meta::CPAN

#
# Returns:
# - Ref to hash with load status
#
void
db2LoadQuery(table_name, msg_type, msg_file)
     char *table_name
     char *msg_type
     char *msg_file

     PPCODE:
     {
         db2LoadQueryStruct       query_info;
         db2LoadQueryOutputStruct output_info;

         memset(&query_info, 0, sizeof(query_info));
         memset(&output_info, 0, sizeof(output_info));
         query_info.iStringType = DB2LOADQUERY_TABLENAME;
         query_info.piString = table_name;
         query_info.poOutputStruct = &output_info;
         query_info.piLocalMessageFile = msg_file;

Admin.xs  view on Meta::CPAN

# - Ref to hash with options
# Returns:
# - Boolean
#
void
sqlarbnd(dbname, package, options)
    char *dbname
    char *package
    SV   *options

    PPCODE:
    {
        struct sqlopt  *rebind_options = NULL;
        int             num_opts, rc, error = 0;

        rc = check_connection(dbname);
        if (rc == 0) {
            error = 1;
            goto leave;
        }

Admin.xs  view on Meta::CPAN

# Returns:
# - Ref to array with history records / undef on error
#
void
db2ListHistory(dbname, action, obj_name, start_time)
    char *dbname
    char *action
    char *obj_name
    char *start_time

    PPCODE:
    {
        struct db2HistoryOpenStruct      open_info =
            { NULL, NULL, NULL, 0, 0, DB2HISTORY_LIST_HISTORY, 0 };
        struct db2HistoryGetEntryStruct  entry_info;
        struct db2HistoryData            entry_data;
        int                              error = 0;
        unsigned int                     counter;
        AV                              *retval;

        /* Translate the action string to an enum */

Admin.xs  view on Meta::CPAN

#   - AccountingString
# Returns:
# - Hash reference with the same keys, but now all present
#   (unless empty strings)
#
void
db2ClientInfo(dbname, client_info)
    char *dbname
    SV   *client_info

    PPCODE:
    {
        struct sqle_client_info  client_app_info[4]; /* Max no of attributes */
        HV                      *info, *retval;
        I32                      keylen;
        SV                      *value, *Return;
        char                    *key;
        int                      no_items = 0;
        unsigned int             len;

        if (!SvROK(client_info))

Admin.xs  view on Meta::CPAN

# Returns:
# - Ref to hash with ApplicationId/Timestamp/BackupSize/SQLCode/NodeInfo/...
#
void
db2Backup(db_alias, target, tbspaces, options)
     char *db_alias;
     SV   *target;
     SV   *tbspaces;
     SV   *options;

     PPCODE:
     {
         db2BackupStruct            backup_info;
         db2MediaListStruct         location_info = { NULL, 0, 0 };
         char                     **locations = NULL;
         db2TablespaceStruct        tablespace_info = { NULL, 0 };
         char                     **tablespaces = NULL;
#ifdef DB2BACKUP_MPP
         db2NodeType               *node_list = NULL;
         db2BackupMPPOutputStruct  *mpp_output = NULL;
#endif /* DB2BACKUP_MPP */

Admin.xs  view on Meta::CPAN


#
# Display the error message for the global sqlca data structure
#
# Returns:
# - String with error message / undef
#
void
sqlaintp()

     PPCODE:
     {
         char buffer[MESSAGE_BUFFER_SIZE];
         int  status;
         SV  *Return;

         status = sqlaintp(buffer, MESSAGE_BUFFER_SIZE, 0, &global_sqlca);
         /* FIXME: Look at status, resize, ... */
         if (status > 0) {
             Return = sv_newmortal();
             sv_setpvn(Return, buffer, status);

Admin.xs  view on Meta::CPAN

# Returns:
# - String with status code message / undef
#
# NOTE: The C version takes an int (sqlca->sqlstate), but we use
#       a sqlca struct to make it look like sqlaintp.
#       as IBM does not document it...
#
void
sqlogstt()

     PPCODE:
     {
         char buffer[MESSAGE_BUFFER_SIZE];
         int  status;
         SV  *Return;

         status = sqlogstt(buffer, MESSAGE_BUFFER_SIZE, 0,
                           global_sqlca.sqlstate);
         /* FIXME: Look at status, resize, ... */
         if (status > 0) {
             Return = sv_newmortal();



( run in 1.257 second using v1.01-cache-2.11-cpan-71847e10f99 )