Oracle® TimesTen In-Memory Database C Developer's Guide 11g Release 2 (11.2.2) Part Number E21637-04 |
|
|
PDF · Mobi · ePub |
The TimesTen Utility Library C language functions documented in this chapter provide a programmable interface to some of the command line utilities documented in "Utilities" in Oracle TimesTen In-Memory Database Reference.
Applications that use this set of C language functions must include ttutillib.h
and link with both the TimesTen driver library (libtten
on UNIX or ttdv1122.lib
and tten1122.lib
on Windows) and the TimesTen utility library (libttutil
on UNIX and ttutil1122.lib
on Windows platforms).
Important:
Applications must call thettUtilAllocEnv
C function before calling any other TimesTen utility library function. In addition, applications must call the ttUtilFreeEnv
C function when done using the TimesTen utility library interface.These functions are not supported with TimesTen Client or for Java applications. They are supported only for TimesTen ODBC applications using the direct driver.
Unless otherwise indicated, the utility functions return these codes as defined in ttutillib.h
.
Code | Description |
---|---|
TTUTIL_SUCCESS |
Indicates success. |
TTUTIL_ERROR |
Indicates an error occurs. |
TTUTIL_WARNING |
Upon success, indicates a warning has been generated. |
TTUTIL_INVALID_HANDLE |
Indicates an invalid utility library handle is specified. |
Note:
The application must call thettUtilGetError
C function to retrieve all actual error or warning information.Creates either a full or an incremental backup copy of the database specified by connStr
. You can back up a database either to a set of files or to a stream. You can restore the database at a later time using either the ttRestore
function or the ttRestore
utility.
For an overview of the TimesTen backup and restore facility, see "Migration, Backup, and Restoration" in Oracle TimesTen In-Memory Database Installation Guide.
ADMIN
ttBackup (ttUtilHandle handle, const char* connStr, ttBackUpType type, ttBooleanType atomic, const char* backupDir, const char* baseName, ttUtFileHandle stream)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char* |
This is a null-terminated string specifying a connection string that describes the database to be backed up. |
type |
ttBackupType |
Specifies the type of backup to be performed. Valid values are as follows:
|
atomic |
ttBooleanType |
Specifies the disposition of an existing backup with the same baseName and backupDir while the new backup is being created.
This parameter has an effect only on full file backups when there is an existing backup with the same The following are valid values:
|
backupDir |
const char* |
Specifies the backup directory for file backups. It is ignored for stream backups. Otherwise it must be non-null.
For For |
baseName |
const char* |
Specifies the file prefix for the backup files in the backup directory specified by the backupDir parameter for file backups.
It is ignored for stream backups. If For |
stream |
ttUtFileHandle |
For stream backups, this parameter specifies the stream to which the backup is to be written.
On UNIX, it is an integer file descriptor that can be written to by using On Windows, it is a handle that can be written to using This parameter is ignored for file backups. The application can pass |
This example backs up the database for the payroll
DSN into C:\backup
.
ttUtilHandle utilHandle; int rc; rc = ttBackup (utilHandle, "DSN=payroll", TT_BACKUP_FILE_FULL, TT_TRUE, "c:\\backup", NULL, TTUTIL_INVALID_FILE_HANDLE);
Upon successful backup, all files are created in the C:\backup
directory.
Each database supports only eight incremental-enabled backups.
ttRestore
Destroys a database, including all checkpoint files, transaction logs and daemon catalog entries corresponding to the database specified by the connection string. It does not delete the DSN itself defined in the sys.odbc.ini
or user odbc.ini
file on the supported UNIX platforms or in Windows registry on the supported Windows platforms.
Instance administrator
ttDestroyDataStore (ttUtilHandle handle, const char* connStr, unsigned int timeout)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char* |
This is a null-terminated string specifying the connection string that describes the database to be destroyed. All attributes in this connection string, except the DSN and the DataStore attribute, are ignored. |
timeout |
unsigned int |
Specifies the number of times to retry before returning to the caller. ttDestroyDataStore continually retries the destroy operation every second until it is successful or the timeout is reached. This is useful in those situations where the destroy fails due to some temporary condition, such as when the database is in use.
No retry is performed if this parameter value is 0. |
This example destroys a database defined by the payroll
DSN, consisting of files C:\dsns\payroll.ds0
, C:\dsns\payroll.ds1
, and several transaction log files C:\dsns\payroll.log
n
.
char errBuff [256]; int rc; unsigned int retCode; ttUtilErrType retType; ttUtilHandle utilHandle; ... ... rc = ttDestroyDataStore (utilHandle, "DSN=payroll", 30); if (rc == TTUTIL_SUCCESS) printf ("Datastore payroll successfully destroyed.\n"); else if (rc == TTUTIL_INVALID_HANDLE) printf ("TimesTen utility library handle is invalid.\n"); else while ((rc = ttUtilGetError (utilHandle, 0, &retCode, &retType, errBuff, sizeof (errBuff), NULL)) != TTUTIL_NODATA) { ... ... }
Destroys a database, including all checkpoint files, transaction logs and daemon catalog entries corresponding to the database specified by the connection string. It does not delete the DSN itself defined in the sys.odbc.ini
or user odbc.ini
file on the supported UNIX platforms or in the Windows registry on supported Windows platforms.
Instance administrator
ttDestroyDataStoreForce (ttUtilHandle handle, const char* connstr, unsigned int timeout)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char* |
This is a null-terminated string specifying the connection string that describes the database to be destroyed. All attributes in this connection string, except the DSN and the DataStore attribute, are ignored. |
timeout |
unsigned int |
Specifies the number of seconds to retry before returning to the caller. The ttDestroyDataStoreForce utility continually retries the destroy operation every second until it is successful or the timeout is reached. This is useful when the destroy fails due to some temporary condition, such as when the database is in use.
No retry is performed if this parameter value is 0. |
This example destroys a database defined by the payroll
DSN, consisting of files C:\dsns\payroll.ds0
, C:\dsns\payroll.ds1
, and several transaction log files C:\dsns\payroll.log
n
.
char errBuff [256]; int rc; unsigned int retCode; ttUtilErrType retType; ttUtilHandle utilHandle; ... ... rc = ttDestroyDataStoreForce (utilHandle, "DSN=payroll", 30); if (rc == TTUTIL_SUCCESS) printf ("Datastore payroll successfully destroyed.\n"); else if (rc == TTUTIL_INVALID_HANDLE) printf ("TimesTen utility library handle is invalid.\n"); else while ((rc = ttUtilGetError (utilHandle, 0, &retCode, &retType, errBuff, sizeof (errBuff), NULL)) != TTUTIL_NODATA) { ... ... }
Specifies the number of seconds the database specified by the connection string is kept in RAM by TimesTen after the last application disconnects from the database. TimesTen then unloads the database. This grace period can be set or reset at any time but is only in effect if the RAM policy is TT_RAMPOL_INUSE
.
Instance administrator
ttRamGrace (ttUtilHandle handle, const char* connStr, unsigned int seconds)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char* |
This is a null-terminated string specifying a connection string that describes the database for which the RAM grace period is set. |
seconds |
unsigned int |
Specifies the number of seconds TimesTen keeps the database in RAM after the last application disconnects from the database. TimesTen then unloads the database. |
This example sets the RAM grace period of 10 seconds for the payroll
DSN.
ttUtilHandle utilHandle; int rc; rc = ttRamGrace (utilHandle, "DSN=payroll", 10);
ttRamLoad
ttRamPolicy
ttRamUnload
Causes TimesTen to load the database specified by the connection string into the system RAM. For a permanent database, a call to ttRamLoad
is valid only when RamPolicy
is set to TT_RAMPOL_MANUAL
. For a temporary database, a call to ttRamLoad
loads the database into RAM.
Refer to "ttRamPolicySet" in Oracle TimesTen In-Memory Database Reference or to ttRamPolicy
for related information.
Instance administrator
ttRamLoad (ttUtilHandle handle, const char* connStr)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char* |
This is a null-terminated string specifying a connection string that describes the database to be loaded into RAM. |
This example loads the database for the payroll
DSN.
ttUtilHandle utilHandle; int rc; rc = ttRamLoad (utilHandle, "DSN=payroll");
ttRamGrace
ttRamPolicy
ttRamUnload
Defines the policy used to determine when TimesTen loads the database specified by the connection string into the system RAM.
Instance administrator
ttRamPolicy (ttUtilHandle handle, const char* connStr, ttRamPolicyType policy)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char* |
This is a null-terminated string specifying a connection string that describes the database for which the RAM policy is to be set. |
policy |
ttRamPolicyType |
Specifies the policy used to determine when TimesTen loads the specified database into system RAM. Valid values are the following:
If you do not explicitly set the RAM policy for the specified database, the default RAM policy is |
This example sets the RAM policy to manual for the payroll
DSN.
ttUtilHandle utilHandle; int rc; rc = ttRamPolicy (utilHandle, "DSN=payroll", TT_RAMPOL_MANUAL);
The policy cannot be set for a temporary database.
ttRamGrace
ttRamLoad
ttRamUnload
Causes TimesTen to unload the database specified by the connection string from the system RAM if the TimesTen RAM policy is set to manual
. For a permanent database, this call is valid only when RAM policy is set to TT_RAMPOL_MANUAL
. For a temporary database, a call to ttRamUnload
always tries to unload the database from RAM because RAM policy cannot be set for such a database.
Refer to "ttRamPolicySet" in Oracle TimesTen In-Memory Database Reference or to ttRamPolicy
for related information.
Instance administrator
ttRamUnload (ttUtilHandle handle, const char* connStr)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char* |
This is a null-terminated string specifying a connection string for the database to be unloaded from RAM. |
This example unloads the database from RAM for the payroll
DSN.
ttUtilHandle utilHandle; int rc; rc = ttRamUnload (utilHandle, "DSN=payroll");
When using this function with a temporary database, TimesTen always attempts to unload the database.
ttRamGrace
ttRamLoad
ttRamPolicy
Creates a replica of a remote database on the local system. The process is initiated from the receiving local system. From there, a connection is made to the remote source database to perform the duplicate operation.
Notes:
This utility has features to recover from a site failure by creating a disaster recovery (DR) read-only subscriber as part of the active standby pair replication scheme. See "Using a disaster recovery subscriber in an active standby pair" in Oracle TimesTen In-Memory Database Replication Guide for additional information.
If the database does not use cache groups, the following items discussed below are not relevant: cacheuid
and cachepwd
data structure elements; TT_REPDUP_NOKEEPCG
, TT_REPDUP_RECOVERINGNODE
, TT_REPDUP_INITCACHEDR
, and TT_REPDUP_DEFERCACHEUPDATE
flag values.
There are elements in the ttRepDuplicateExArg
structure that is a parameter of this utility, localIP
and remoteIP
, that allow you to optionally specify which local network interface to use, which remote network interface to use, or both.
Requires an instance administrator on the receiving local database (where ttRepDuplicateEx
is called) and a user with ADMIN
privilege on the remote source database. Create the internal user on the remote source store as necessary.
In addition, be aware of the following requirements to execute ttRepDuplicateEx
:
The operating system user name of the instance administrator on the receiving local database must be the same as the operating system user name of the instance administrator on the remote source database.
When ttRepDuplicateEx
is called, the uid
and pwd
data structure elements must specify the user name and password of the user with ADMIN
privilege on the remote source database. This user name is used to connect to the remote source database to perform the duplicate operation.
ttRepDuplicateEx (ttUtilHandle handle, const char* destConnStr, const char* srcDatabase, const char* remoteHost, ttRepDuplicateExArg* arg ) typedef struct { unsigned int size; /*set to size of(ttRepDuplicateExArg) */ unsigned int flags; const char* uid; const char* pwd; const char* pwdcrypt; const char* cacheuid; const char* cachepwd; const char* localHost; int truncListLen; const char** truncList; int dropListLen; const char** dropList; int maxkbytesPerSec; int remoteDaemonPort; int nThreads4initDR; const char* localIP const char* remoteIP int crsManaged; /*new struct elements can only be added here at the end */ } ttRepDuplicateExArg
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
destConnStr |
const char* |
This is a null-terminated string specifying the connection string for a local database into which the replica of the remote database is created. |
srcDatabase |
const char* |
This is a null-terminated string specifying the remote source database name. This name is the last component of the database path name. |
remoteHost |
const char* |
This is a null-terminated string specifying the TCP/IP host name of the system where the remote source database is located. |
arg |
ttRepDuplicateExArg* |
This is the address of the structure containing the desired ttRepDuplicateEx arguments. If NULL is passed in for arg or if the value of arg -> size is invalid, TimesTen returns error 12230, "Invalid argument value ", and TTUTIL_ERROR . |
The ttRepDuplicateExArg
structure contains these elements:
Element | Type | Description |
---|---|---|
size |
unsigned int |
Size
This must be set up to |
flags |
unsigned int |
Bit-wise union of values chosen from the list in the table of flag values |
uid |
const char* |
User name of a user on the remote source database with ADMIN privileges
This user name is used to connect to the remote source database to perform the duplicate operation. |
pwd |
const char* |
Password associated with the user ID |
pwdcrypt |
const char* |
Encrypted password associated with the user ID |
cacheuid |
const char* |
Cache administration user ID |
cachepwd |
const char* |
Cache administration user password |
localHost |
const char* |
Null-terminated string specifying the TCP/IP host name of the local system
This element is ignored if |
truncListLen |
int |
Number of elements in the truncList |
truncList |
const char** |
List of non-replicated tables to truncate after duplicate |
dropListLen |
int |
Number of elements in dropList |
dropList |
const char** |
List of non-replicated tables to drop after the duplicate operation |
maxkbytesPerSec |
int |
Maximum kilobytes per second
Setting this to a nonzero value specifies that the duplicate operation should not put more than |
remoteDaemonPort |
int |
Remote daemon port
Setting this to 0 results in the daemon port number for the target database being set to the port number used for the daemon on the source database. This option cannot be used in duplicate operations for databases with automatic port configuration. |
nThreads4initDR |
int |
Number of threads for initialization
For the disaster recovery subscriber, this determines the number of threads used to initialize the Oracle database on the disaster recovery site. After the TimesTen database is copied to the disaster recovery system, the Oracle database tables are truncated and the data from the TimesTen cache groups is copied to the Oracle database on the disaster recovery system. Also see the |
localIP |
const char* |
A null-terminated string specifying the alias or IP address (IPv4 or IPv6) of the local network interface to use for the duplicate operation. Set this to NULL if you do not want to specify the local network interface, in which case any compatible interface may be used. |
remoteIP |
const char* |
A null-terminated string specifying the alias or IP address (IPv4 or IPv6) of the remote network interface to use for the duplicate operation. Set this to NULL if you do not want to specify the remote network interface, in which case any compatible interface may be used.
Note: You can specify both |
crsManaged |
int |
For internal use
This should be set to 0 (default). |
The ttRepDuplicateExArg
flags
element is constructed from these values:
Value | Description |
---|---|
TT_REPDUP_NOFLAGS |
Indicates no flags. |
TT_REPDUP_COMPRESS |
Enables compression of the data transmitted over the network for the duplicate operation. |
TT_REPDUP_REPSTART |
Directs ttRepDuplicateEx to set the replication state (with respect to the local database) in the remote database to the start state before the remote database is copied across the network. This ensures that all updates made after the duplicate operation are replicated from the remote database to the newly created or restored local database. |
TT_REPDUP_RAMLOAD |
Keeps the database in memory upon completion of the duplicate operation. It changes the RAM policy for the database to manual . |
TT_REPDUP_DELXLA |
Directs ttRepDuplicateEx to remove all the XLA bookmarks as part of the duplicate operation. |
TT_REPDUP_NOKEEPCG |
Do not preserve the cache group definitions; ttRepDuplicateEx converts all cache group tables into regular tables.
By default, cache group definitions are preserved. |
TT_REPDUP_RECOVERINGNODE |
Specifies that ttRepDuplicateEx is being used to recover a failed node for a replication scheme that has an AWT or autorefresh cache group. Do not specify TT_REPDUP_RECOVERINGNODE when rolling out a new or modified replication scheme to a node. If ttRepDuplicateEx cannot update metadata stored on the Oracle database and all incremental autorefresh cache groups are replicated, then updates to the metadata will be automatically deferred until the cache and replication agents are started. |
TT_REPDUP_DEFERCACHEUPDATE |
Forces the deferral of changes to metadata stored on the Oracle database until the cache and replication agents are started and the agents can connect to the Oracle database. Using this option can cause a full autorefresh if some incremental cache groups are not replicated or if ttRepDuplicateEx is being used for rolling out a new or modified replication scheme to a node. |
TT_REPDUP_INITCACHEDR |
Initializes disaster recovery. You must also specify cacheuid and cachepwd in the data structure. Also see nThreads4initDR in the data structure. |
This example creates a replica of a remote TimesTen DSN, remote_payroll
with the database path name C:\dsns\payroll
, to a local DSN local_payroll
.
ttUtilHandle utilHandle; int rc; ttRepDuplicateExArg arg; memset(&arg, 0, sizeof(arg)); arg.size = sizeof(ttRepDuplicateExArg); arg.flags = TT_REPDUP_REPSTART | TT_REPDUP_DELXLA; arg.localHost = "mylocalhost"; arg.uid="myuid"; arg.pwd="mypwd"; rc=ttRepDuplicateEx(utilHandle,"DSN=local_payroll","payroll","remotehost", &arg);
The following built-in procedures are described in "Built-In Procedures" in Oracle TimesTen In-Memory Database Reference.
ttReplicationStatus
ttRepPolicySet
ttRepStop
ttRepSubscriberStateSet
ttRepSyncGet
ttRepSyncSet
Restores a database specified by the connection string from a backup that has been created using the ttBackup
C function or ttBackup
utility. If the database already exists, ttRestore
will not overwrite it.
For an overview of the TimesTen backup and restore facility, see "Migration, Backup, and Restoration" in Oracle TimesTen In-Memory Database Installation Guide.
Instance administrator
ttRestore (ttUtilHandle handle, const char* connStr, ttRestoreType type, const char* backupDir, const char* baseName, ttUtFileHandle stream, unsigned intflags)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char* |
This is a null-terminated string specifying a connection string that describes the database to be restored. |
type |
ttRestoreType |
Indicates whether the database is to be restored from a file or a stream backup. Valid values are the following:
|
backupDir |
const char* |
For TT_RESTORE_FILE , specifies the directory where the backup files are stored.
For |
baseName |
const char* |
For TT_RESTORE_FILE , specifies the file prefix for the backup files in the backup directory specified by the backupDir parameter.
If For |
stream |
ttUtFileHandle |
For TT_RESTORE_STREAM , specifies the stream from which the backup is to be read.
On UNIX, it is an integer file descriptor that can be read from using On Windows, it is a handle that can be read from using For |
flags |
unsigned int |
This is reserved for future use. Set it to 0. |
This example restores the database for the payroll
DSN from C:\backup
.
ttUtilHandle utilHandle; int rc; rc = ttRestore (utilHandle, "DSN=payroll", TT_RESTORE_FILE, "c:\\backup", NULL, TTUTIL_INVALID_FILE_HANDLE, 0);
Allocates memory for a TimesTen utility library environment handle and initializes the TimesTen utility library interface for use by an application. An application must call ttUtilAllocEnv
before calling any other TimesTen utility library function. In addition, an application should call ttUtilFreeEnv
when it is done using the TimesTen utility library interface.
None
ttUtilAllocEnv (ttUtilHandle* handle_ptr, char* errBuff, unsigned int buffLen, unsigned int* errLen)
Parameter | Type | Description |
---|---|---|
handle_ptr |
ttUtilHandle* |
Specifies a pointer to storage where the TimesTen utility library environment handle is returned. |
errBuff |
char* |
This is a user allocated buffer where error messages (if any) are returned. The returned error message is a null-terminated string. If the length of the error message exceeds buffLen -1, it is truncated to buffLen -1. If this parameter is null, buffLen is ignored and TimesTen does not return error messages to the calling application. |
buffLen |
unsigned int |
Specifies the size of the buffer errBuff . If this parameter is 0, TimesTen does not return error messages to the calling application. |
errLen |
unsigned int* |
This is a pointer to an unsigned integer where the actual length of the error message is returned. If it is NULL , this parameter is ignored. |
This utility returns the following code as defined in ttutillib.h
.
Code | Description |
---|---|
TTUTIL_SUCCESS |
Returned upon success. |
Otherwise, it returns a TimesTen-specific error message as defined in tt_errCode.h
and a corresponding error message in the buffer provided by the caller.
This example allocates and initializes a TimesTen utility library environment handle with the name utilHandle
.
char errBuff [256]; int rc; ttUtilHandle utilHandle; rc = ttUtilAllocEnv (&utilHandle, errBuff, sizeof(errBuff), NULL);
ttUtilFreeEnv
ttUtilGetError
ttUtilGetErrorCount
Frees memory associated with the TimesTen utility library handle.
An application must call ttUtilAllocEnv
before calling any other TimesTen utility library function. In addition, an application should call ttUtilFreeEnv
when it is done using the TimesTen utility library interface.
None
ttUtilFreeEnv (ttUtilHandle handle, char* errBuff, unsigned int buffLen, unsigned int* errLen)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
errBuff |
char* |
This is a user-allocated buffer where error messages are to be returned. The returned error message is a null-terminated string. If the length of the error message exceeds buffLen -1, it is truncated to buffLen -1. If this parameter is NULL , buffLen is ignored and TimesTen does not return error messages to the calling application. |
buffLen |
unsigned int |
Specifies the size of the buffer errBuff . If this parameter is 0, TimesTen does not return error messages to the calling application. |
errLen |
unsigned int* |
This is a pointer to an unsigned integer where the actual length of the error message is returned. If it is NULL , this parameter is ignored. |
This utility returns the following codes as defined in ttutillib.h
.
Code | Description |
---|---|
TTUTIL_SUCCESS |
Returned upon success. |
TTUTIL_INVALID_HANDLE |
Returned if an invalid utility library handle is specified. |
Otherwise, it returns a TimesTen-specific error message as defined in tt_errCode.h
and a corresponding error message in the buffer provided by the caller.
This example frees a TimesTen utility library environment handle named utilHandle
.
char errBuff [256]; int rc; ttUtilHandle utilHandle; rc = ttUtilFreeEnv (utilHandle, errBuff, sizeof(errBuff), NULL);
ttUtilAllocEnv
ttUtilGetError
ttUtilGetErrorCount
Retrieves the errors and warnings generated by the last call to the TimesTen C utility library functions excluding ttUtilAllocEnv
and ttUtilFreeEnv
.
None
ttUtilGetError (ttUtilHandle handle, unsigned int errIndex, unsigned int* retCode, ttUtilErrType* retType, char* errbuff, unsigned int buffLen, unsigned int* errLen)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
errIndex |
unsigned int |
Indicates error or warning record to be retrieved from the TimesTen utility library error array. Valid values are as follows:
|
retCode |
unsigned int* |
Returns the TimesTen-specific error or warning codes as defined in tt_errCode.h . |
retType |
ttUtilErrType* |
Indicates whether the returned message is an error or warning. The following are valid return values:
|
errBuff |
char* |
This is a user allocated buffer where error messages (if any) are to be returned. The returned error message is a null-terminated string. If the length of the error message exceeds buffLen -1, it is truncated to buffLen -1. If this parameter is NULL , buffLen is ignored and TimesTen does not return error messages to the calling application. |
buffLen |
unsigned int |
Specifies the size of the buffer errBuff . If this parameter is 0, TimesTen does not return error messages to the calling application. |
errLen |
unsigned int* |
A pointer to an unsigned integer where the actual length of the error message is returned. If it is NULL , TimesTen ignores this parameter. |
This utility returns the following codes as defined in ttutillib.h
.
Code | Description |
---|---|
TTUTIL_SUCCESS |
Returned upon success. |
TTUTIL_INVALID_HANDLE |
Returned if an invalid utility library handle is specified. |
TTUTIL_NODATA |
Returned if no error or warming information is retrieved. |
This example retrieves all error or warning information after calling ttDestroyDataStore
for the DSN named payroll
.
char errBuff[256]; int rc; unsigned int retCode; ttUtilErrType retType; ttUtilHandle utilHandle; rc = ttDestroyDataStore (utilHandle, "DSN=PAYROLL", 30); if ((rc == TTUTIL_SUCCESS) printf ("Datastore payroll successfully destroyed.\n"); else if (rc == TTUTIL_INVALID_HANDLE) printf ("TimesTen utility library handle is invalid.\n"); else while ((rc = ttUtilGetError (utilHandle, 0, &retCode, &retType, errBuff, sizeof (errBuff), NULL)) != TTUTIL_NODATA) { ... ... }
Each of the TimesTen C functions can potentially generate multiple errors and warnings for a single call from an application. To retrieve all of these errors and warnings, the application must make repeated calls to ttUtilGetError
until it returns TTUTIL_NODATA
.
ttUtilAllocEnv
ttUtilFreeEnv
ttUtilGetErrorCount
Retrieves the number of errors and warnings generated by the last call to the TimesTen C utility library functions, excluding ttUtilAllocEnv
and ttUtilFreeEnv
. Each of these functions can potentially generate multiple errors and warnings for a single call from an application. To retrieve all of these errors and warnings, the application must make repeated calls to ttUtilGetError
until it returns TTUTIL_NODATA
.
None
ttUtilGetErrorCount (ttUtilHandle handle, unsigned int* errCount)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
errCount |
unsigned int* |
Indicates the number of errors and warnings generated by the last call, excluding ttUtilAllocEnv and ttUtilFreeEnv , to the TimesTen utility library. |
The utility returns the following codes as defined in ttutillib.h
.
Code | Description |
---|---|
TTUTIL_SUCCESS |
Returned upon success. |
TTUTIL_INVALID_HANDLE |
Returned if an invalid utility library handle is specified. |
This example retrieves the error and warning count information after calling ttDestroyDataStore
for the DSN named payroll
.
int rc; unsigned int errCount; ttUtilHandle utilHandle; rc = ttDestroyDataStore (utilHandle, "DSN=payroll", 30); if (rc == TTUTIL_SUCCESS) printf ("Datastore payroll successfully destroyed.\n") else if (rc == TTUTIL_INVALID_HANDLE) printf ("TimesTen utility library handle is invalid.\n"); else { rc = ttUtilGetErrorCount(utilHandle, &errCount); ... ... }
Each of the TimesTen utility library functions can potentially generate multiple errors and warnings for a single call from an application. To retrieve all of these errors and warnings, the application must make repeated calls to ttUtilGetError
until it returns TTUTIL_NODATA
.
ttUtilAllocEnv
ttUtilFreeEnv
ttUtilGetError
Rolls back the transaction indicated by the transaction ID that is specified. The intended user of ttXactIdRollback
is the ttXactAdmin
utility. However, programs that want to have a thread with the power to roll back the work of other threads must ensure that those threads call the ttXactIdGet
built-in procedure before beginning work and put the results into a location known to the thread that wishes to roll back the transaction. (Refer to "ttXactIdGet" in Oracle TimesTen In-Memory Database Reference.)
ADMIN
ttXactIdRollback (ttUtilHandle handle, const char* connStr, const char* xactId)
Parameter | Type | Description |
---|---|---|
handle |
ttUtilHandle |
Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv . |
connStr |
const char** |
Specifies the connection string of the database, which contains the transaction to be rolled back. |
xactId |
const char* |
Indicates the transaction ID for the transaction to be rolled back. |
This example rolls back a transaction with the ID 3.4567 in the database named payroll
.
char errBuff [256]; int rc; unsigned int retCode; ttUtilErrType retType; ttUtilHandle utilHandle; ... rc = ttXactIdRollback (utilHandle, "DSN=payroll", "3.4567"); if (rc == TTUTIL_SUCCESS) printf ("Transaction ID successfully rolled back.\n"); else if (rc == TTUTIL_INVALID_HANDLE) printf ("TimesTen utility library handle is invalid.\n"); else while ((rc = ttUtilGetError (utilHandle, 0, &retCode, &retType, errBuff, sizeof (errBuff), NULL)) != TTUTIL_NODATA) { ... }