Basic Commands

The following commands are available:


tac_admin

int tac_admin(TAC_HANDLE handle, const char *request)

Submits an administration command to the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
request - a string containing the request. See Requests using X-Machine Commands, The _admin command for more details.

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_define

int tac_define(TAC_HANDLE handle, const char *schema)

Defines or redefines a schema or collection in the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
schema - a string buffer containing the schema definition.

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_delete

int tac_delete(TAC_HANDLE handle, const char *collection, const char *query)

Deletes document(s) from the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
collection - a string containing the name of the collection to be used.
query - a string containing an X-Query expression. See Requests using X-Machine Commands, The _delete command for more details.

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_diagnose

int tac_diagnose(TAC_HANDLE handle, const char *request)

Submits a diagnose command to the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
request - a string containing the request, e.g. "version". See Requests using X-Machine Commands, The _diagnose command for more details.

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_end

int tac_end(TAC_HANDLE handle)

Closes a specific connection to a Tamino XML Server. It has no X-Machine equivalent. In a multi-threading environment, each thread must issue its own tac_end() command.

Takes Parameters:

handle - a valid handle obtained from tac_init().

Returns:

The predefined constant TAC_SUCCESS upon success, or a negative value upon failure.

tac_get_encoding

int tac_get_encoding(TAC_HANDLE handle, const char **encoding)

Gets the encoding of the current Tamino response, if it was in XML format.

Takes Parameters:

handle - a valid handle obtained from tac_init().
encoding - a pointer to a string that will contain the encoding of the Tamino response, if it was in XML format; otherwise a pointer to an empty string is returned.

Returns:

The predefined constant TAC_SUCCESS upon success, or a negative value upon failure.

tac_get_inoID

int tac_get_inoID(TAC_HANDLE handle, long int *ino_id)

Gives the ino:id in the argument ino_id under which the last document was stored in the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
ino_id - will contain the ino:id of the last Tamino request if available, otherwise a value of -1; mostly used after a tac_load() request.

Returns:

The predefined constant TAC_SUCCESS upon success, or a negative value upon failure.

tac_get_messagetext

int tac_get_messagetext(TAC_HANDLE handle, const char **message)

Returns an XML string that contains the message text from the last request to the Tamino XML Server which contains helpful information if a Tamino error occurred. See Return and Error Codes for more details.

Takes Parameters:

handle - a valid handle obtained from tac_init().
message - a pointer to the message text as an XML string.

Returns:

The predefined constant TAC_SUCCESS upon success, or a negative value upon failure.

tac_init

TAC_HANDLE tac_init(const char *dbname)

Prepares a new connection to a Tamino XML Server. It has no X-Machine equivalent. In a multi-threading environment, each thread must issue its own tac_init() command.

Takes Parameters:

dbname - a string containing the name of the Tamino database used for this handle, where the name was registered through Tamino from the start-up of the database via XTS.

Returns:

A valid handle upon success, or the predefined constant TAC_INVALID_HANDLE upon failure to allocate a new handle structure.

tac_last_xml_response

int tac_last_xml_response(TAC_HANDLE handle, const char **response)

Returns the XML response from the last request to the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
response - a pointer to a string that will contain the Tamino response as an XML string if available; otherwise a pointer to an empty string.

Returns:

The predefined constant TAC_SUCCESS upon success, or a negative value upon failure.

tac_load

int tac_load(TAC_HANDLE handle, const char *collection, const char *docname, const char *document, long int size, const char *mime_type)

Inserts a single document into the Tamino XML Server.

The single command transaction parameters are not passed with this command. If required, use tac_process() instead for XML documents.

Takes Parameters:

handle - a valid handle obtained from tac_init().
collection - a string containing the name of the collection to be used.
docname - a string containing the doctype, a slash ('/'), and the name of the document, e.g. "images/property1.jpg".
document - a pointer to the byte buffer that contains the document.
size - the size of the buffer in bytes.
mime_type - a string containing the MIME-type of the document, e.g. "image/jpeg".

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_process

int tac_process(TAC_HANDLE handle, const char *collection, const char *xml)

Inserts one or more XML documents into the Tamino XML Server.

For multiple documents one must use the file format as specified in the section Tamino Data Loaders of the Tamino XML Server documentation.

Takes Parameters:

handle - a valid handle obtained from tac_init().
collection - a string containing the name of the collection to be used.
xml - a string buffer containing the XML document(s).

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_retrieve

int tac_retrieve(TAC_HANDLE handle, const char *collection, const char *docname, const char **document, long int *size, const char **mime_type)

Gets a single document from the Tamino XML Server.

The single command transaction parameters are not passed with this command. If required, use tac_xql() or tac_xquery() instead for XML documents.

Takes Parameters:

handle - a valid handle obtained from tac_init().
collection - a string containing the name of the collection to be used.
docname - a string containing the doctype, a slash ('/'), and the name of the document, e.g. "property/property1.jpg".
document - a pointer to the byte buffer that contains the document.
size - the size of the buffer in bytes.
mime_type - a pointer to a string that will contain the MIME-type of the returned document, e.g. "image/jpeg".

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_set_encoding

int tac_set_encoding(TAC_HANDLE handle, const char *encoding)

Sets the desired encoding for the subsequent Tamino responses. If not used, the default encoding of the Tamino API for C uses "utf-8".

Takes Parameters:

handle - a valid handle obtained from tac_init().
encoding - a string specifying the desired encoding, e.g. "iso-8859-1".

Returns:

The predefined constant TAC_SUCCESS upon success, or a negative value upon failure.

tac_set_user_info

int tac_set_user_info(TAC_HANDLE handle, const char *username, const char *password)

Sets the credentials for the Tamino communication. It has no X-Machine equivalent. Please note that Tamino XML Server 4.1 does not use SSL for communications.

Takes Parameters:

handle - a valid handle obtained from tac_init().
username - a string containing the username, which can include the domain.
password - a string containing the password.

Returns:

The predefined constant TAC_SUCCESS upon success, or a negative value upon failure.

tac_undefine

int tac_undefine(TAC_HANDLE handle, const char *name)

Undefines a collection, schema or doctype in the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
name - a string containing the name to be deleted. For more details on the syntax, see Requests using X-Machine Commands, The _undefine command for more details.

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_xql

int tac_xql(TAC_HANDLE handle, const char *collection, const char *query)

Submits a query in X-Query syntax to the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
collection - a string containing the name of the collection to be used for the query.
query - the query string, e.g. "/property"; for more details, see the X-Query Reference Guide in the Tamino XML Server documentation.

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).

tac_xquery

int tac_xquery(TAC_HANDLE handle, const char *collection, const char *query)

Submits a query in XQuery 4 syntax to the Tamino XML Server.

Takes Parameters:

handle - a valid handle obtained from tac_init().
collection - a string containing the name of the collection to be used for the query.
query - the query string, e.g. "input()/property"; for more details, see the XQuery 4 Reference Guide in the Tamino XML Server documentation.

Returns:

The predefined constant TAC_SUCCESS upon success, or an error code upon failure (see Return and Error Codes).