Vous êtes sur la page 1sur 4

Transbase Version 6.7.

Tbtar SDK

Copyright © 1987 - 2008 by:

Transaction Software GmbH


Willy-Brandt-Allee 2
D-81829 Munich
Germany
Telephone: 0 89 / 6 27 09 0
Telefax: 0 89 / 6 27 09 11
Electronic Mail: tas@transaction.de
Table of Contents

1 Concepts................................................................................................................ 3

2 Building an application ........................................................................................ 3

3 Installing your application ................................................................................... 3

4 Tbtar SDK reference guide .................................................................................. 3


Tbtar SDK,V6.7, 08/03/31

1 Concepts
The tbtar sdk is designed very closely to the tbtar archiving tool. For each tbtars’s main
function there is an appropriate API which serves for that functionality.

Each API has to be called with the target- or sourcedirectory, a databasename and an ASCII
parameterstring. A callback for standardio and a callback for erroroutput can be supplied.
Optional parameters may be given by an argumentstring.

For each API needing a sParamString parameter specfiying a NULL pointer is equivalent to
specifying an empty string and means no additional parameters given.

Each API returns boolean TRUE in case of success, and FALSE otherwise. In case of no
success an appropriate error code and error message can be retrieved.

The Tbtar SDK comes together with the Transbase Server package. For using your own tbtar
application a Transbase Server license is required.

2 Building an application
For compiling your application you must include tbadmsdk.h within your sourcecode.
Building the application must be done by linking against tbtard32.lib.

3 Installing your application


At runtime tbtard32.dll is needed. This DLL is an add on for a standard Transbase Server
installation. This implies that other DLL’s like tbker32.dll and a Transbase Server license are
required too.

4 Tbtar SDK reference guide


In the following each API is documented in detail

Bool TbtarWrite(char *sDbname, char *sArgstring, PtbtarCallback pStdout,


PtbtarCallback pStderr)
Function: Equivalent to tbtar –w sDbname sArgstring

Example: TbtarWrite( “db”, “”, NULL, NULL);

Bool TbtarRead(char* sArchive, char *sDbname, char *sArgstring, PtbtarCallback


pStdout, PtbtarCallback pStderr)
Function: Equivalent to: tbtar –r sDbname sArgstring
Tbtar SDK,V6.7, 08/03/31

Example: TbtarRead( “db”, “”, NULL, NULL);

Bool TbtarGetLastErrorCode(long* pErrorCode)


Function: Returns the error code for the last API call.

Example:
Long nCode;
If(FALSE==API(…)){
TbtarGetLastError(&nCode);
Printf(“Error: %ld\n”, nCode,);
}

Bool TbtarGetLastErrorText(char** pErrorString)


Function:
Returns a pointer to the error text for the last API call.

Example:
Char *pText;
If(FALSE==API(…)){
TbtarGetLastErrorText(&pText);
Printf(“Error: %s\n”, pText);
}

Bool TbTarCallback(char *sFormat, …)


Function: Is called for output operation.

Note: The return value is ignored.

Example:
Bool TbTarOut(char *sFormat, …)
{
va_list vam;
va_start(vam, f);
vfprintf(stderr,f, vam);
fflush(stderr);
va_end(vam);
return TRUE;
}

PTbadmCallback pTbtarCallback=(PTbtarCallback) TbTarOut;


TbtarWrite( “db”, “”, pTbtarCallback, pTbtarCallback);

Vous aimerez peut-être aussi