Oracle® TimesTen In-Memory Database C Developer's Guide Release 11.2.1 Part Number E13066-08 |
|
|
View PDF |
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 ttdv1121.lib
and tten1121.lib
on Windows) and the TimesTen utility library (libttutil
on UNIX and ttutil1121.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 it is done with 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 |
Returned upon success. |
TTUTIL_ERROR |
Returned if an error occurs. |
TTUTIL_WARNING |
Returned upon success, when a warning has been generated. |
TTUTIL_INVALID_HANDLE |
Returned if 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. If the database is in use at the time of the backup, it must be in shared mode to successfully complete this operation.
For an overview of the TimesTen backup and restore facility, see "Migration, backup, and restoration of the database" in the Oracle TimesTen In-Memory Database Operations Guide.
Requires 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* |
A null-terminated string specifying a connection string that describes the database to be backed up. |
type |
ttBackupType |
Specified 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.
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 odbc.ini
file on the supported UNIX platforms or in Windows registry on the supported Windows platforms.
Requires 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* |
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 odbc.ini
file on the supported UNIX platforms or in the Windows registry on supported Windows platforms.
Requires 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* |
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
.
Requires 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* |
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.
Requires 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* |
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.
Requires 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* |
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
. (Refer to "ttRamPolicySet" in Oracle TimesTen In-Memory Database Reference for related information.) 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.
Requires 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* |
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 includes 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 TimesTen to TimesTen 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.
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; 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* |
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* |
A null-terminated string specifying the remote source database name. This name is the last component of the database path name. |
remoteHost |
const char* |
A null-terminated string specifying the TCP/IP host name of the system where the remote source database is located. |
arg |
ttRepDuplicateExArg* |
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 ttRepDuplicateEx
argument structure contains these elements:
Element | Type | Description |
---|---|---|
size |
unsigned int |
Must be set up to sizeof (ttRepDuplicateExArg ). |
flags |
unsigned int |
The bit-wise union of values chosen from the list in the table of flag values. |
uid |
const char* |
The 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* |
The password associated with the user ID. |
pwdcrypt |
const char* |
The encrypted password associated with the user ID. |
cacheuid |
const char* |
Cache administration user ID. |
cachepwd |
const char* |
Cache administration user password. |
localHost |
const char* |
A null-terminated string specifying the TCP/IP host name of the local system. This element is ignored if remoteRepStart is TT_FALSE . This explicitly identifies the local host. This parameter can be null, which is useful if the local host uses a nonstandard name such as an IP address. |
truncListLen |
int |
The number of elements in the truncList . |
truncList |
const char** |
A list of non-replicated tables to truncate after duplicate. |
dropListLen |
int |
The number of elements in dropList . |
dropList |
const char** |
A list of non-replicated tables to drop after the duplicate operation. |
maxkbytesPerSec |
int |
Setting maxkbytesPerSec to a nonzero value specifies that the duplicate operation should not put more than maxkbytesPerSec kilobytes of data per second onto the network. Setting maxkbytesPerSec to 0 or a negative number indicates that the duplicate operation should not attempt to limit its bandwidth. |
remoteDaemonPort |
int |
Specifies the remote daemon port. Setting remoteDaemonPort 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 |
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 |
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 |
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 |
ttRepDuplicateEx removes 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 includes 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 of the database" in Oracle TimesTen In-Memory Database Operations Guide.
Requires 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* |
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 |
Reserved for future use. Specify 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 must call ttUtilFreeEnv
when it is done with 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* |
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* |
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 must call ttUtilFreeEnv
when it is done with 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* |
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* |
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* |
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 executes the rollback.
Requires 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** |
The connection string of the database, which contains the transaction to be rolled back. |
xactId |
const char* |
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) { ... }