SQL Relay C API
Functions
sqlrclientwrapper

Functions

sqlrcon sqlrcon_alloc (const char *server, uint16_t port, const char *socket, const char *user, const char *password, int32_t retrytime, int32_t tries)
void sqlrcon_free (sqlrcon sqlrconref)
void sqlrcon_setTimeout (sqlrcon sqlrconref, int32_t timeoutsec, int32_t timeoutusec)
void sqlrcon_endSession (sqlrcon sqlrconref)
int sqlrcon_suspendSession (sqlrcon sqlrconref)
uint16_t sqlrcon_getConnectionPort (sqlrcon sqlrconref)
const char * sqlrcon_getConnectionSocket (sqlrcon sqlrconref)
int sqlrcon_resumeSession (sqlrcon sqlrconref, uint16_t port, const char *socket)
int sqlrcon_ping (sqlrcon sqlrconref)
const char * sqlrcon_identify (sqlrcon sqlrconref)
const char * sqlrcon_dbVersion (sqlrcon sqlrconref)
const char * sqlrcon_serverVersion (sqlrcon sqlrconref)
const char * sqlrcon_clientVersion (sqlrcon sqlrconref)
const char * sqlrcon_bindFormat (sqlrcon sqlrconref)
int sqlrcon_selectDatabase (sqlrcon sqlrconref, const char *database)
const char * sqlrcon_getCurrentDatabase (sqlrcon sqlrconref)
uint64_t sqlrcon_getLastInsertId (sqlrcon sqlrconref)
int sqlrcon_autoCommitOn (sqlrcon sqlrconref)
int sqlrcon_autoCommitOff (sqlrcon sqlrconref)
int sqlrcon_commit (sqlrcon sqlrconref)
int sqlrcon_rollback (sqlrcon sqlrconref)
const char * sqlrcon_errorMessage (sqlrcon sqlrconref)
void sqlrcon_debugOn (sqlrcon sqlrconref)
void sqlrcon_debugOff (sqlrcon sqlrconref)
int sqlrcon_getDebug (sqlrcon sqlrconref)
void sqlrcon_debugPrintFunction (sqlrcon sqlrconref, int(*printfunction)(const char *,...))
sqlrcur sqlrcur_alloc (sqlrcon sqlrconref)
void sqlrcur_free (sqlrcur sqlrcurref)
void sqlrcur_setResultSetBufferSize (sqlrcur sqlrcurref, uint64_t rows)
uint64_t sqlrcur_getResultSetBufferSize (sqlrcur sqlrcurref)
void sqlrcur_dontGetColumnInfo (sqlrcur sqlrcurref)
void sqlrcur_getColumnInfo (sqlrcur sqlrcurref)
void sqlrcur_mixedCaseColumnNames (sqlrcur sqlrcurref)
void sqlrcur_upperCaseColumnNames (sqlrcur sqlrcurref)
void sqlrcur_lowerCaseColumnNames (sqlrcur sqlrcurref)
void sqlrcur_cacheToFile (sqlrcur sqlrcurref, const char *filename)
void sqlrcur_setCacheTtl (sqlrcur sqlrcurref, uint32_t ttl)
const char * sqlrcur_getCacheFileName (sqlrcur sqlrcurref)
void sqlrcur_cacheOff (sqlrcur sqlrcurref)
int sqlrcur_getDatabaseList (sqlrcur sqlrcurref, const char *wild)
int sqlrcur_getTableList (sqlrcur sqlrcurref, const char *wild)
int sqlrcur_getColumnList (sqlrcur sqlrcurref, const char *table, const char *wild)
int sqlrcur_sendQuery (sqlrcur sqlrcurref, const char *query)
int sqlrcur_sendQueryWithLength (sqlrcur sqlrcurref, const char *query, uint32_t length)
int sqlrcur_sendFileQuery (sqlrcur sqlrcurref, const char *path, const char *filename)
void sqlrcur_prepareQuery (sqlrcur sqlrcurref, const char *query)
void sqlrcur_prepareQueryWithLength (sqlrcur sqlrcurref, const char *query, uint32_t length)
void sqlrcur_prepareFileQuery (sqlrcur sqlrcurref, const char *path, const char *filename)
void sqlrcur_subString (sqlrcur sqlrcurref, const char *variable, const char *value)
void sqlrcur_subLong (sqlrcur sqlrcurref, const char *variable, int64_t value)
void sqlrcur_subDouble (sqlrcur sqlrcurref, const char *variable, double value, uint32_t precision, uint32_t scale)
void sqlrcur_subStrings (sqlrcur sqlrcurref, const char **variables, const char **values)
void sqlrcur_subLongs (sqlrcur sqlrcurref, const char **variables, const int64_t *values)
void sqlrcur_subDoubles (sqlrcur sqlrcurref, const char **variables, const double *values, const uint32_t *precisions, const uint32_t *scales)
void sqlrcur_inputBindString (sqlrcur sqlrcurref, const char *variable, const char *value)
void sqlrcur_inputBindStringWithLength (sqlrcur sqlrcurref, const char *variable, const char *value, uint32_t valuelength)
void sqlrcur_inputBindLong (sqlrcur sqlrcurref, const char *variable, int64_t value)
void sqlrcur_inputBindDouble (sqlrcur sqlrcurref, const char *variable, double value, uint32_t precision, uint32_t scale)
void sqlrcur_inputBindBlob (sqlrcur sqlrcurref, const char *variable, const char *value, uint32_t size)
void sqlrcur_inputBindClob (sqlrcur sqlrcurref, const char *variable, const char *value, uint32_t size)
void sqlrcur_inputBindStrings (sqlrcur sqlrcurref, const char **variables, const char **values)
void sqlrcur_inputBindLongs (sqlrcur sqlrcurref, const char **variables, const int64_t *values)
void sqlrcur_inputBindDoubles (sqlrcur sqlrcurref, const char **variables, const double *values, const uint32_t *precisions, const uint32_t *scales)
void sqlrcur_defineOutputBindString (sqlrcur sqlrcurref, const char *variable, uint32_t length)
void sqlrcur_defineOutputBindInteger (sqlrcur sqlrcurref, const char *variable)
void sqlrcur_defineOutputBindDouble (sqlrcur sqlrcurref, const char *variable)
void sqlrcur_defineOutputBindBlob (sqlrcur sqlrcurref, const char *variable)
void sqlrcur_defineOutputBindClob (sqlrcur sqlrcurref, const char *variable)
void sqlrcur_defineOutputBindCursor (sqlrcur sqlrcurref, const char *variable)
void sqlrcur_clearBinds (sqlrcur sqlrcurref)
uint16_t sqlrcur_countBindVariables (sqlrcur sqlrcurref)
void sqlrcur_validateBinds (sqlrcur sqlrcurref)
int sqlrcur_validBind (sqlrcur sqlrcurref, const char *variable)
int sqlrcur_executeQuery (sqlrcur sqlrcurref)
int sqlrcur_fetchFromBindCursor (sqlrcur sqlrcurref)
const char * sqlrcur_getOutputBindString (sqlrcur sqlrcurref, const char *variable)
int64_t sqlrcur_getOutputBindInteger (sqlrcur sqlrcurref, const char *variable)
double sqlrcur_getOutputBindDouble (sqlrcur sqlrcurref, const char *variable)
const char * sqlrcur_getOutputBindBlob (sqlrcur sqlrcurref, const char *variable)
const char * sqlrcur_getOutputBindClob (sqlrcur sqlrcurref, const char *variable)
uint32_t sqlrcur_getOutputBindLength (sqlrcur sqlrcurref, const char *variable)
sqlrcur sqlrcur_getOutputBindCursor (sqlrcur sqlrcurref, const char *variable)
int sqlrcur_openCachedResultSet (sqlrcur sqlrcurref, const char *filename)
uint32_t sqlrcur_colCount (sqlrcur sqlrcurref)
uint64_t sqlrcur_rowCount (sqlrcur sqlrcurref)
uint64_t sqlrcur_totalRows (sqlrcur sqlrcurref)
uint64_t sqlrcur_affectedRows (sqlrcur sqlrcurref)
uint64_t sqlrcur_firstRowIndex (sqlrcur sqlrcurref)
int sqlrcur_endOfResultSet (sqlrcur sqlrcurref)
const char * sqlrcur_errorMessage (sqlrcur sqlrcurref)
void sqlrcur_getNullsAsEmptyStrings (sqlrcur sqlrcurref)
void sqlrcur_getNullsAsNulls (sqlrcur sqlrcurref)
const char * sqlrcur_getFieldByIndex (sqlrcur sqlrcurref, uint64_t row, uint32_t col)
const char * sqlrcur_getFieldByName (sqlrcur sqlrcurref, uint64_t row, const char *col)
int64_t sqlrcur_getFieldAsIntegerByIndex (sqlrcur sqlrcurref, uint64_t row, uint32_t col)
int64_t sqlrcur_getFieldAsIntegerByName (sqlrcur sqlrcurref, uint64_t row, const char *col)
double sqlrcur_getFieldAsDoubleByIndex (sqlrcur sqlrcurref, uint64_t row, uint32_t col)
double sqlrcur_getFieldAsDoubleByName (sqlrcur sqlrcurref, uint64_t row, const char *col)
uint32_t sqlrcur_getFieldLengthByIndex (sqlrcur sqlrcurref, uint64_t row, uint32_t col)
uint32_t sqlrcur_getFieldLengthByName (sqlrcur sqlrcurref, uint64_t row, const char *col)
const char *const sqlrcur_getRow (sqlrcur sqlrcurref, uint64_t row)
uint32_t * sqlrcur_getRowLengths (sqlrcur sqlrcurref, uint64_t row)
const char *const sqlrcur_getColumnNames (sqlrcur sqlrcurref)
const char * sqlrcur_getColumnName (sqlrcur sqlrcurref, uint32_t col)
const char * sqlrcur_getColumnTypeByIndex (sqlrcur sqlrcurref, uint32_t col)
const char * sqlrcur_getColumnTypeByName (sqlrcur sqlrcurref, const char *col)
uint32_t sqlrcur_getColumnLengthByIndex (sqlrcur sqlrcurref, uint32_t col)
uint32_t sqlrcur_getColumnLengthByName (sqlrcur sqlrcurref, const char *col)
uint32_t sqlrcur_getColumnPrecisionByIndex (sqlrcur sqlrcurref, uint32_t col)
uint32_t sqlrcur_getColumnPrecisionByName (sqlrcur sqlrcurref, const char *col)
uint32_t sqlrcur_getColumnScaleByIndex (sqlrcur sqlrcurref, uint32_t col)
uint32_t sqlrcur_getColumnScaleByName (sqlrcur sqlrcurref, const char *col)
int sqlrcur_getColumnIsNullableByIndex (sqlrcur sqlrcurref, uint32_t col)
int sqlrcur_getColumnIsNullableByName (sqlrcur sqlrcurref, const char *col)
int sqlrcur_getColumnIsPrimaryKeyByIndex (sqlrcur sqlrcurref, uint32_t col)
int sqlrcur_getColumnIsPrimaryKeyByName (sqlrcur sqlrcurref, const char *col)
int sqlrcur_getColumnIsUniqueByIndex (sqlrcur sqlrcurref, uint32_t col)
int sqlrcur_getColumnIsUniqueByName (sqlrcur sqlrcurref, const char *col)
int sqlrcur_getColumnIsPartOfKeyByIndex (sqlrcur sqlrcurref, uint32_t col)
int sqlrcur_getColumnIsPartOfKeyByName (sqlrcur sqlrcurref, const char *col)
int sqlrcur_getColumnIsUnsignedByIndex (sqlrcur sqlrcurref, uint32_t col)
int sqlrcur_getColumnIsUnsignedByName (sqlrcur sqlrcurref, const char *col)
int sqlrcur_getColumnIsZeroFilledByIndex (sqlrcur sqlrcurref, uint32_t col)
int sqlrcur_getColumnIsZeroFilledByName (sqlrcur sqlrcurref, const char *col)
int sqlrcur_getColumnIsBinaryByIndex (sqlrcur sqlrcurref, uint32_t col)
int sqlrcur_getColumnIsBinaryByName (sqlrcur sqlrcurref, const char *col)
int sqlrcur_getColumnIsAutoIncrementByIndex (sqlrcur sqlrcurref, uint32_t col)
int sqlrcur_getColumnIsAutoIncrementByName (sqlrcur sqlrcurref, const char *col)
uint32_t sqlrcur_getLongestByIndex (sqlrcur sqlrcurref, uint32_t col)
uint32_t sqlrcur_getLongestByName (sqlrcur sqlrcurref, const char *col)
void sqlrcur_suspendResultSet (sqlrcur sqlrcurref)
uint16_t sqlrcur_getResultSetId (sqlrcur sqlrcurref)
int sqlrcur_resumeResultSet (sqlrcur sqlrcurref, uint16_t id)
int sqlrcur_resumeCachedResultSet (sqlrcur sqlrcurref, uint16_t id, const char *filename)

Function Documentation

sqlrcon sqlrcon_alloc ( const char *  server,
uint16_t  port,
const char *  socket,
const char *  user,
const char *  password,
int32_t  retrytime,
int32_t  tries 
)

Initiates a connection to "server" on "port" or to the unix "socket" on the local machine and authenticates with "user" and "password". Failed connections will be retried for "tries" times on interval "retrytime". If "tries" is 0 then retries will continue forever. If "retrytime" is 0 then retries will be attempted on a default interval. If the "socket" parameter is nether NULL nor "" then an attempt will be made to connect through it before attempting to connect to "server" on "port". If it is NULL or "" then no attempt will be made to connect through the socket.

int sqlrcon_autoCommitOff ( sqlrcon  sqlrconref)

Instructs the database to wait for the client to tell it when to commit.

int sqlrcon_autoCommitOn ( sqlrcon  sqlrconref)

Instructs the database to perform a commit after every successful query.

const char* sqlrcon_bindFormat ( sqlrcon  sqlrconref)

Returns a string representing the format of the bind variables used in the db.

const char* sqlrcon_clientVersion ( sqlrcon  sqlrconref)

Returns the version of the sqlrelay client software.

int sqlrcon_commit ( sqlrcon  sqlrconref)

Issues a commit. Returns 1 if the commit succeeded, 0 if it failed and -1 if an error occurred.

const char* sqlrcon_dbVersion ( sqlrcon  sqlrconref)

Returns the version of the database

void sqlrcon_debugOff ( sqlrcon  sqlrconref)

Turns debugging off.

void sqlrcon_debugOn ( sqlrcon  sqlrconref)

Causes verbose debugging information to be sent to standard output. Another way to do this is to start a query with "-- debug\n". Yet another way is to set the environment variable SQLRDEBUG to "ON"

void sqlrcon_debugPrintFunction ( sqlrcon  sqlrconref,
int(*)(const char *,...)  printfunction 
)

Allows you to replace the function used to print debug messages with your own function. The function is expected to take arguments like printf.

void sqlrcon_endSession ( sqlrcon  sqlrconref)

Ends the session.

const char* sqlrcon_errorMessage ( sqlrcon  sqlrconref)

If an operation failed and generated an error, the error message is available here. If there is no error then this method returns NULL

void sqlrcon_free ( sqlrcon  sqlrconref)

Disconnects and ends the session if it hasn't been terminated already.

uint16_t sqlrcon_getConnectionPort ( sqlrcon  sqlrconref)

Returns the inet port that the connection is communicating over. This parameter may be passed to another connection for use in the sqlrcon_resumeSession() command. Note: The result this function returns is only valid after a call to suspendSession().

const char* sqlrcon_getConnectionSocket ( sqlrcon  sqlrconref)

Returns the unix socket that the connection is communicating over. This parameter may be passed to another connection for use in the sqlrcon_resumeSession() command. Note: The result this function returns is only valid after a call to suspendSession().

const char* sqlrcon_getCurrentDatabase ( sqlrcon  sqlrconref)

Returns the database/schema that is currently in use.

int sqlrcon_getDebug ( sqlrcon  sqlrconref)

Returns 0 if debugging is off and 1 if debugging is on.

uint64_t sqlrcon_getLastInsertId ( sqlrcon  sqlrconref)

Returns the value of the autoincrement column for the last insert

const char* sqlrcon_identify ( sqlrcon  sqlrconref)

Returns the type of database: oracle8, postgresql, mysql, etc.

int sqlrcon_ping ( sqlrcon  sqlrconref)

Returns 1 if the database is up and 0 if it's down.

int sqlrcon_resumeSession ( sqlrcon  sqlrconref,
uint16_t  port,
const char *  socket 
)

Resumes a session previously left open using sqlrcon_suspendSession(). Returns 1 on success and 0 on failure.

int sqlrcon_rollback ( sqlrcon  sqlrconref)

Issues a rollback. Returns 1 if the rollback succeeded, 0 if it failed and -1 if an error occurred.

int sqlrcon_selectDatabase ( sqlrcon  sqlrconref,
const char *  database 
)

Sets the current database/schema to "database"

const char* sqlrcon_serverVersion ( sqlrcon  sqlrconref)

Returns the version of the sqlrelay server software.

void sqlrcon_setTimeout ( sqlrcon  sqlrconref,
int32_t  timeoutsec,
int32_t  timeoutusec 
)

Sets the server connect timeout in seconds and milliseconds. Setting either parameter to -1 disables the timeout.

int sqlrcon_suspendSession ( sqlrcon  sqlrconref)

Disconnects this connection from the current session but leaves the session open so that another connection can connect to it using sqlrcon_resumeSession().

uint64_t sqlrcur_affectedRows ( sqlrcur  sqlrcurref)

Returns the number of rows that were updated, inserted or deleted by the query. Not all databases support this call. Don't use it for applications which are designed to be portable across databases. -1 is returned by databases which don't support this option.

sqlrcur sqlrcur_alloc ( sqlrcon  sqlrconref)

Creates a cursor to run queries and fetch result sets using connection "sqlrconref"

void sqlrcur_cacheOff ( sqlrcur  sqlrcurref)

Sets query caching off.

void sqlrcur_cacheToFile ( sqlrcur  sqlrcurref,
const char *  filename 
)

Sets query caching on. Future queries will be cached to the file "filename".

A default time-to-live of 10 minutes is also set.

Note that once sqlrcur_cacheToFile() is called, the result sets of all future queries will be cached to that file until another call to sqlrcur_cacheToFile() changes which file to cache to or a call to sqlrcur_cacheOff() turns off caching.

void sqlrcur_clearBinds ( sqlrcur  sqlrcurref)

Clears all bind variables.

uint32_t sqlrcur_colCount ( sqlrcur  sqlrcurref)

Returns the number of columns in the current result set.

uint16_t sqlrcur_countBindVariables ( sqlrcur  sqlrcurref)

Parses the previously prepared query, counts the number of bind variables defined in it and returns that number.

void sqlrcur_defineOutputBindBlob ( sqlrcur  sqlrcurref,
const char *  variable 
)

Defines a binary lob output bind variable

void sqlrcur_defineOutputBindClob ( sqlrcur  sqlrcurref,
const char *  variable 
)

Defines a character lob output bind variable

void sqlrcur_defineOutputBindCursor ( sqlrcur  sqlrcurref,
const char *  variable 
)

Defines a cursor output bind variable

void sqlrcur_defineOutputBindDouble ( sqlrcur  sqlrcurref,
const char *  variable 
)

Defines an decimal output bind variable.

void sqlrcur_defineOutputBindInteger ( sqlrcur  sqlrcurref,
const char *  variable 
)

Defines an integer output bind variable.

void sqlrcur_defineOutputBindString ( sqlrcur  sqlrcurref,
const char *  variable,
uint32_t  length 
)

Defines a string output bind variable. "length" bytes will be reserved to store the value.

void sqlrcur_dontGetColumnInfo ( sqlrcur  sqlrcurref)

Tells the server not to send any column info (names, types, sizes). If you don't need that info, you should call this function to improve performance.

int sqlrcur_endOfResultSet ( sqlrcur  sqlrcurref)

Returns 0 if part of the result set is still pending on the server and 1 if not. This function can only return 0 if setResultSetBufferSize() has been called with a parameter other than 0.

const char* sqlrcur_errorMessage ( sqlrcur  sqlrcurref)

If a query failed and generated an error, the error message is available here. If the query succeeded then this function returns a NULL.

int sqlrcur_executeQuery ( sqlrcur  sqlrcurref)

Execute the query that was previously prepared and bound.

int sqlrcur_fetchFromBindCursor ( sqlrcur  sqlrcurref)

Fetch from a cursor that was returned as an output bind variable.

uint64_t sqlrcur_firstRowIndex ( sqlrcur  sqlrcurref)

Returns the index of the first buffered row. This is useful when buffering only part of the result set at a time.

void sqlrcur_free ( sqlrcur  sqlrcurref)

Destroys the cursor and cleans up all associated result set data.

const char* sqlrcur_getCacheFileName ( sqlrcur  sqlrcurref)

Returns the name of the file containing the most recently cached result set.

void sqlrcur_getColumnInfo ( sqlrcur  sqlrcurref)

Tells the server to send column info.

int sqlrcur_getColumnIsAutoIncrementByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns 1 if the specified column auto-increments and 0 otherwise.

int sqlrcur_getColumnIsAutoIncrementByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns 1 if the specified column auto-increments and 0 otherwise.

int sqlrcur_getColumnIsBinaryByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns 1 if the specified column contains binary data and 0 otherwise.

int sqlrcur_getColumnIsBinaryByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns 1 if the specified column contains binary data and 0 otherwise.

int sqlrcur_getColumnIsNullableByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns the scale of the specified column. Scale is the total number of digits to the right of the decimal point in a number. eg: 123.45 has a scale of 2.

int sqlrcur_getColumnIsNullableByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns 1 if the specified column can contain nulls and 0 otherwise.

int sqlrcur_getColumnIsPartOfKeyByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns 1 if the specified column is part of a composite key and 0 otherwise.

int sqlrcur_getColumnIsPartOfKeyByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns 1 if the specified column is part of a composite key and 0 otherwise.

int sqlrcur_getColumnIsPrimaryKeyByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns 1 if the specified column is a primary key and 0 otherwise.

int sqlrcur_getColumnIsPrimaryKeyByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns 1 if the specified column is a primary key and 0 otherwise.

int sqlrcur_getColumnIsUniqueByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns 1 if the specified column is unique and 0 otherwise.

int sqlrcur_getColumnIsUniqueByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns 1 if the specified column is unique and 0 otherwise.

int sqlrcur_getColumnIsUnsignedByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns 1 if the specified column is an unsigned number and 0 otherwise.

int sqlrcur_getColumnIsUnsignedByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns 1 if the specified column is an unsigned number and 0 otherwise.

int sqlrcur_getColumnIsZeroFilledByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns 1 if the specified column was created with the zero-fill flag and 0 otherwise.

int sqlrcur_getColumnIsZeroFilledByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns 1 if the specified column was created with the zero-fill flag and 0 otherwise.

uint32_t sqlrcur_getColumnLengthByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns the length of the specified column.

uint32_t sqlrcur_getColumnLengthByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns the length of the specified column.

int sqlrcur_getColumnList ( sqlrcur  sqlrcurref,
const char *  table,
const char *  wild 
)

Sends a query that returns a list of columns in the table specified by the "table" parameter matching "wild". If wild is empty or NULL then a list of all columns will be returned.

const char* sqlrcur_getColumnName ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns the name of the specified column.

const char* const sqlrcur_getColumnNames ( sqlrcur  sqlrcurref)

Returns a null terminated array of the column names of the current result set.

uint32_t sqlrcur_getColumnPrecisionByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns the precision of the specified column. Precision is the total number of digits in a number. eg: 123.45 has a precision of 5. For non-numeric types, it's the number of characters in the string.

uint32_t sqlrcur_getColumnPrecisionByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns the precision of the specified column. Precision is the total number of digits in a number. eg: 123.45 has a precision of 5. For non-numeric types, it's the number of characters in the string.

uint32_t sqlrcur_getColumnScaleByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns the scale of the specified column. Scale is the total number of digits to the right of the decimal point in a number. eg: 123.45 has a scale of 2.

uint32_t sqlrcur_getColumnScaleByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns the scale of the specified column. Scale is the total number of digits to the right of the decimal point in a number. eg: 123.45 has a scale of 2.

const char* sqlrcur_getColumnTypeByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns the type of the specified column.

const char* sqlrcur_getColumnTypeByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns the type of the specified column.

int sqlrcur_getDatabaseList ( sqlrcur  sqlrcurref,
const char *  wild 
)

Sends a query that returns a list of databases/schemas matching "wild". If wild is empty or NULL then a list of all databases/schemas will be returned.

double sqlrcur_getFieldAsDoubleByIndex ( sqlrcur  sqlrcurref,
uint64_t  row,
uint32_t  col 
)

Returns the specified field as an decimal.

double sqlrcur_getFieldAsDoubleByName ( sqlrcur  sqlrcurref,
uint64_t  row,
const char *  col 
)

Returns the specified field as an decimal.

int64_t sqlrcur_getFieldAsIntegerByIndex ( sqlrcur  sqlrcurref,
uint64_t  row,
uint32_t  col 
)

Returns the specified field as an integer.

int64_t sqlrcur_getFieldAsIntegerByName ( sqlrcur  sqlrcurref,
uint64_t  row,
const char *  col 
)

Returns the specified field as an integer.

const char* sqlrcur_getFieldByIndex ( sqlrcur  sqlrcurref,
uint64_t  row,
uint32_t  col 
)

Returns the specified field as a string.

const char* sqlrcur_getFieldByName ( sqlrcur  sqlrcurref,
uint64_t  row,
const char *  col 
)

Returns the specified field as a string.

uint32_t sqlrcur_getFieldLengthByIndex ( sqlrcur  sqlrcurref,
uint64_t  row,
uint32_t  col 
)

Returns the length of the specified row and column.

uint32_t sqlrcur_getFieldLengthByName ( sqlrcur  sqlrcurref,
uint64_t  row,
const char *  col 
)

Returns the length of the specified row and column.

uint32_t sqlrcur_getLongestByIndex ( sqlrcur  sqlrcurref,
uint32_t  col 
)

Returns the length of the longest field in the specified column.

uint32_t sqlrcur_getLongestByName ( sqlrcur  sqlrcurref,
const char *  col 
)

Returns the length of the longest field in the specified column.

void sqlrcur_getNullsAsEmptyStrings ( sqlrcur  sqlrcurref)

Tells the connection to return NULL fields and output bind variables as empty strings. This is the default.

void sqlrcur_getNullsAsNulls ( sqlrcur  sqlrcurref)

Tells the connection to return NULL fields and output bind variables as NULL's.

const char* sqlrcur_getOutputBindBlob ( sqlrcur  sqlrcurref,
const char *  variable 
)

Get the value stored in a previously defined binary lob output bind variable.

const char* sqlrcur_getOutputBindClob ( sqlrcur  sqlrcurref,
const char *  variable 
)

Get the value stored in a previously defined character lob output bind variable.

sqlrcur sqlrcur_getOutputBindCursor ( sqlrcur  sqlrcurref,
const char *  variable 
)

Get the cursor associated with a previously defined output bind variable.

double sqlrcur_getOutputBindDouble ( sqlrcur  sqlrcurref,
const char *  variable 
)

Get the value stored in a previously defined decimal output bind variable.

int64_t sqlrcur_getOutputBindInteger ( sqlrcur  sqlrcurref,
const char *  variable 
)

Get the value stored in a previously defined integer output bind variable.

uint32_t sqlrcur_getOutputBindLength ( sqlrcur  sqlrcurref,
const char *  variable 
)

Get the length of the value stored in a previously defined output bind variable.

const char* sqlrcur_getOutputBindString ( sqlrcur  sqlrcurref,
const char *  variable 
)

Get the value stored in a previously defined string output bind variable.

uint64_t sqlrcur_getResultSetBufferSize ( sqlrcur  sqlrcurref)

Returns the number of result set rows that will be buffered at a time or 0 for the entire result set.

uint16_t sqlrcur_getResultSetId ( sqlrcur  sqlrcurref)

Returns the internal ID of this result set. This parameter may be passed to another statement for use in the resumeResultSet() function. Note: The value this function returns is only valid after a call to suspendResultSet().

const char* const sqlrcur_getRow ( sqlrcur  sqlrcurref,
uint64_t  row 
)

Returns a null terminated array of the values of the fields in the specified row.

uint32_t* sqlrcur_getRowLengths ( sqlrcur  sqlrcurref,
uint64_t  row 
)

Returns a null terminated array of the lengths of the fields in the specified row.

int sqlrcur_getTableList ( sqlrcur  sqlrcurref,
const char *  wild 
)

Sends a query that returns a list of tables matching "wild". If wild is empty or NULL then a list of all tables will be returned.

void sqlrcur_inputBindBlob ( sqlrcur  sqlrcurref,
const char *  variable,
const char *  value,
uint32_t  size 
)

Defines a binary lob input bind variable.

void sqlrcur_inputBindClob ( sqlrcur  sqlrcurref,
const char *  variable,
const char *  value,
uint32_t  size 
)

Defines a character lob input bind variable.

void sqlrcur_inputBindDouble ( sqlrcur  sqlrcurref,
const char *  variable,
double  value,
uint32_t  precision,
uint32_t  scale 
)

Defines a decimal input bind variable. (If you don't have the precision and scale then set them both to 0. However in that case you may get unexpected rounding behavior if the server is faking binds.)

void sqlrcur_inputBindDoubles ( sqlrcur  sqlrcurref,
const char **  variables,
const double *  values,
const uint32_t *  precisions,
const uint32_t *  scales 
)

Defines an array of decimal input bind variables.

void sqlrcur_inputBindLong ( sqlrcur  sqlrcurref,
const char *  variable,
int64_t  value 
)

Defines a integer input bind variable.

void sqlrcur_inputBindLongs ( sqlrcur  sqlrcurref,
const char **  variables,
const int64_t *  values 
)

Defines an array of integer input bind variables.

void sqlrcur_inputBindString ( sqlrcur  sqlrcurref,
const char *  variable,
const char *  value 
)

Defines a string input bind variable.

void sqlrcur_inputBindStrings ( sqlrcur  sqlrcurref,
const char **  variables,
const char **  values 
)

Defines an array of string input bind variables.

void sqlrcur_inputBindStringWithLength ( sqlrcur  sqlrcurref,
const char *  variable,
const char *  value,
uint32_t  valuelength 
)

Defines a string input bind variable.

void sqlrcur_lowerCaseColumnNames ( sqlrcur  sqlrcurref)

Columns names are converted to lower case.

void sqlrcur_mixedCaseColumnNames ( sqlrcur  sqlrcurref)

Columns names are returned in the same case as they are defined in the database. This is the default.

int sqlrcur_openCachedResultSet ( sqlrcur  sqlrcurref,
const char *  filename 
)

Opens a cached result set. Returns 1 on success and 0 on failure.

void sqlrcur_prepareFileQuery ( sqlrcur  sqlrcurref,
const char *  path,
const char *  filename 
)

Prepare to execute the contents of "path"/"filename".

void sqlrcur_prepareQuery ( sqlrcur  sqlrcurref,
const char *  query 
)

Prepare to execute "query".

void sqlrcur_prepareQueryWithLength ( sqlrcur  sqlrcurref,
const char *  query,
uint32_t  length 
)

Prepare to execute "query" with length "length". This function must be used if the query contains binary data.

int sqlrcur_resumeCachedResultSet ( sqlrcur  sqlrcurref,
uint16_t  id,
const char *  filename 
)

Resumes a result set previously left open using suspendSession() and continues caching the result set to "filename". Returns 1 on success and 0 on failure.

int sqlrcur_resumeResultSet ( sqlrcur  sqlrcurref,
uint16_t  id 
)

Resumes a result set previously left open using suspendSession(). Returns 1 on success and 0 on failure.

uint64_t sqlrcur_rowCount ( sqlrcur  sqlrcurref)

Returns the number of rows in the current result set.

int sqlrcur_sendFileQuery ( sqlrcur  sqlrcurref,
const char *  path,
const char *  filename 
)

Sends the query in file "path"/"filename" and gets a result set.

int sqlrcur_sendQuery ( sqlrcur  sqlrcurref,
const char *  query 
)

Sends "query" directly and gets a result set.

int sqlrcur_sendQueryWithLength ( sqlrcur  sqlrcurref,
const char *  query,
uint32_t  length 
)

Sends "query" with length "length" directly and gets a result set. This function must be used if the query contains binary data.

void sqlrcur_setCacheTtl ( sqlrcur  sqlrcurref,
uint32_t  ttl 
)

Sets the time-to-live for cached result sets. The sqlr-cachemanger will remove each cached result set "ttl" seconds after it's created, provided it's scanning the directory containing the cache files.

void sqlrcur_setResultSetBufferSize ( sqlrcur  sqlrcurref,
uint64_t  rows 
)

Sets the number of rows of the result set to buffer at a time. 0 (the default) means buffer the entire result set.

void sqlrcur_subDouble ( sqlrcur  sqlrcurref,
const char *  variable,
double  value,
uint32_t  precision,
uint32_t  scale 
)

Defines a decimal substitution variable.

void sqlrcur_subDoubles ( sqlrcur  sqlrcurref,
const char **  variables,
const double *  values,
const uint32_t *  precisions,
const uint32_t *  scales 
)

Defines an array of decmial substitution variables.

void sqlrcur_subLong ( sqlrcur  sqlrcurref,
const char *  variable,
int64_t  value 
)

Defines a integer substitution variable.

void sqlrcur_subLongs ( sqlrcur  sqlrcurref,
const char **  variables,
const int64_t *  values 
)

Defines an array of integer substitution variables.

void sqlrcur_subString ( sqlrcur  sqlrcurref,
const char *  variable,
const char *  value 
)

Defines a string substitution variable.

void sqlrcur_subStrings ( sqlrcur  sqlrcurref,
const char **  variables,
const char **  values 
)

Defines an array of string substitution variables.

void sqlrcur_suspendResultSet ( sqlrcur  sqlrcurref)

Tells the server to leave this result set open when the connection calls suspendSession() so that another connection can connect to it using resumeResultSet() after it calls resumeSession().

uint64_t sqlrcur_totalRows ( sqlrcur  sqlrcurref)

Returns the total number of rows that will be returned in the result set. Not all databases support this call. Don't use it for applications which are designed to be portable across databases. -1 is returned by databases which don't support this option.

void sqlrcur_upperCaseColumnNames ( sqlrcur  sqlrcurref)

Columns names are converted to upper case.

void sqlrcur_validateBinds ( sqlrcur  sqlrcurref)

If you are binding to any variables that might not actually be in your query, call this to ensure that the database won't try to bind them unless they really are in the query. There is a performance penalty for calling this function

int sqlrcur_validBind ( sqlrcur  sqlrcurref,
const char *  variable 
)

Returns true if "variable" was a valid bind variable of the query.