C Driver API 3.0.0
API for the NuoDB C Driver Library
Loading...
Searching...
No Matches
NuoDB_Statement Struct Reference

The data structure for executing a SQL statement. More...

#include <statement.h>

Data Fields

_NuoDB_Statement_state_t * _state
 
NuoDB_Status(* addBatch )(NuoDB_Statement *_this)
 Stores the current set of parameter values as a batch entry.
 
const char *(* analyze )(NuoDB_Statement *_this, int mask)
 Generates table and index statistics for this command.
 
NuoDB_Status(* clearBatch )(NuoDB_Statement *_this)
 Clear the stored batch entries.
 
NuoDB_Status(* clearParameters )(NuoDB_Statement *_this)
 Clears the current parameter values immediately.
 
NuoDB_Status(* close )(NuoDB_Statement *_this)
 Close the statement on the server side.
 
NuoDB_Status(* execute )(NuoDB_Statement *_this)
 Executes a previously prepared SQL statement.
 
NuoDB_Status(* executeBatch )(NuoDB_Statement *_this, NuoDB_BatchResult **results, size_t *resultSize)
 Execute the batch operations added via addBatch.
 
NuoDB_Status(* executeSQL )(NuoDB_Statement *_this, const char *sql, unsigned int flags)
 Executes a non-parameterized SQL statement.
 
NuoDB_Status(* executeUpdateKeyIndices )(NuoDB_Statement *_this, const char *sql, const int *columnIndices, int count)
 Executes the given SQL statement and places the requested generated keys in the generated keys result set.
 
NuoDB_Status(* executeUpdateKeyNames )(NuoDB_Statement *_this, const char *sql, char *const *columnNames, int count)
 Executes the given SQL statement and places the requested generated keys in the generated keys result set.
 
NuoDB_Status(* executeWithFlags )(NuoDB_Statement *_this, unsigned int flags)
 Executes a previously prepared SQL statement.
 
size_t(* getBatchCount )(NuoDB_Statement *_this)
 Return the number of batch operations added via addBatch.
 
NuoDB_Status(* getBoolean )(NuoDB_Statement *_this, int index, nuodb_bool_t *boolPtr)
 Retrieves the value of the designated SQL BOOLEAN parameter as a nuodb_bool_t value.
 
NuoDB_Status(* getByte )(NuoDB_Statement *_this, int index, char *charPtr)
 Retrieves the value of the designated SQL TINYINT parameter as a char value in the C programming language.
 
NuoDB_Connection *(* getConnection )(NuoDB_Statement *_this)
 Returns the NuoDB_Connection for this statement.
 
NuoDB_Status(* getDouble )(NuoDB_Statement *_this, int index, double *doublePtr)
 Retrieves the value of the designated SQL DOUBLE parameter as a double value in the C programming language.
 
NuoDB_ResultSet *(* getGeneratedKeys )(NuoDB_Statement *_this)
 Retrieves any auto-generated keys created as a result of executing this NuoDB_Statement data structure.
 
NuoDB_Status(* getInt )(NuoDB_Statement *_this, int index, int32_t *intPtr)
 Retrieves the value of the designated SQL INTEGER parameter as an int32_t value in the C programming language.
 
NuoDB_Status(* getLastStatementTimeMicros )(NuoDB_Statement *_this, int64_t *result)
 Get the server execution time of the last statement executed on the connection.
 
NuoDB_Status(* getLob )(NuoDB_Statement *_this, int index, NuoDB_Lob_Type lobType, const NuoDB_Lob **lobPtr)
 Retrieves the value of the designated SQL CLOB or BLOB parameter as a NuoDB_Lob data structure.
 
NuoDB_Status(* getLong )(NuoDB_Statement *_this, int index, int64_t *longPtr)
 Retrieves the value of the designated SQL INTEGER parameter as an int64_t value in the C programming language.
 
NuoDB_ResultSetMetaData *(* getMetaData )(NuoDB_Statement *_this)
 Retrieves result set metadata as a NuoDB_ResultSetMetaData data structure for a previously prepared statement which has not been executed yet.
 
NuoDB_Status(* getMoreResults )(NuoDB_Statement *_this, nuodb_bool_t *result)
 Moves to this NuoDB_Statement data structure's next result, returns the new NuoDB_ResultSet and implicitly closes and frees any current NuoDB_ResultSet data structure(s) obtained with the function getResultSet().
 
NuoDB_Status(* getParameterMetaData )(NuoDB_Statement *_this, NuoDB_ParameterMetaData **pmdPtr)
 Retrieves the parameter metadata of the last prepared SQL statement.
 
int64_t(* getQueryTimeout )(NuoDB_Statement *_this)
 Retrieves the number of microseconds the driver will wait for a NuoDB_Statement data structure to execute.
 
NuoDB_ResultSet *(* getResultSet )(NuoDB_Statement *_this)
 Retrieves the current result as a NuoDB_ResultSet data structure.
 
NuoDB_Status(* getShort )(NuoDB_Statement *_this, int index, short *shortPtr)
 Retrieves the value of the designated SQL SHORTINT parameter as a short value in the C programming language.
 
NuoDB_Status(* getString )(NuoDB_Statement *_this, int index, const char **strPtr)
 Retrieves the value of the designated SQL CHAR, VARCHAR, STRING, NUMERIC, DECIMAL or NUMBER parameter as a character string in the C programming language.
 
NuoDB_Status(* getStringWithLength )(NuoDB_Statement *_this, int index, const char **strPtr, size_t *length)
 Retrieves the value of the designated SQL CHAR, VARCHAR, STRING, BINARY or VARBINARY parameter as a character string in the C programming language.
 
NuoDB_Status(* getTemporal )(NuoDB_Statement *_this, int index, NuoDB_Temporal_Type temporalType, NuoDB_Temporal **temporalPtr)
 Retrieves the value of the designated SQL DATE, TIME, TIMESTAMP or TIMESTAMP WITHOUT TIME ZONE parameter as a NuoDB_Temporal data structure.
 
int(* getUpdateCount )(NuoDB_Statement *_this)
 Retrieves the update count.
 
nuodb_bool_t(* lastExecuteStatus )(NuoDB_Statement *_this)
 returns whether the first result from the last execute call was a result set or not
 
NuoDB_Status(* prepare )(NuoDB_Statement *_this, const char *sql, unsigned int flags)
 Prepares a parameterized SQL statement.
 
NuoDB_Status(* prepareUpdateKeyIndices )(NuoDB_Statement *_this, const char *sql, const int *columnIndices, int count)
 Prepare a given DML SQL statement.
 
NuoDB_Status(* prepareUpdateKeyNames )(NuoDB_Statement *_this, const char *sql, char *const *columnNames, int count)
 Prepare a given DML SQL statement.
 
NuoDB_Status(* registerOutParameter )(NuoDB_Statement *_this, int index, NuoDB_Type sqlType)
 Registers the OUT parameter in ordinal position index to the sqlType.
 
NuoDB_Status(* registerOutParameterWithScale )(NuoDB_Statement *_this, int index, NuoDB_Type sqlType, int scale)
 Registers the OUT parameter in ordinal position index to the sqlType.
 
NuoDB_Status(* setBoolean )(NuoDB_Statement *_this, int index, nuodb_bool_t value)
 Sets the designated parameter to the given boolean value.
 
NuoDB_Status(* setByte )(NuoDB_Statement *_this, int index, char value)
 Sets the designated parameter to the given char value.
 
NuoDB_Status(* setBytes )(NuoDB_Statement *_this, int index, const char *stringValue, size_t length)
 Sets the designated parameter to the given binary string value.
 
NuoDB_Status(* setDouble )(NuoDB_Statement *_this, int index, double value)
 Sets the designated parameter to the given double-precision value.
 
NuoDB_Status(* setFetchSize )(NuoDB_Statement *_this, int fetchSize)
 Setup of the fetch size.
 
NuoDB_Status(* setInt )(NuoDB_Statement *_this, int index, int32_t value)
 Sets the designated parameter to the given 32-bit integer value.
 
NuoDB_Status(* setLob )(NuoDB_Statement *_this, int index, NuoDB_Lob *lob)
 Sets the designated parameter to the given Lob value.
 
NuoDB_Status(* setLong )(NuoDB_Statement *_this, int index, int64_t value)
 Sets the designated parameter to the given 64-bit integer value.
 
NuoDB_Status(* setNull )(NuoDB_Statement *_this, int index, int type)
 Sets the designated parameter to SQL NULL.
 
NuoDB_Status(* setQueryTimeout )(NuoDB_Statement *_this, int64_t microSeconds)
 Sets the number of microseconds the client will wait for a NuoDB_Statement data structure to execute to the given number of microseconds.
 
NuoDB_Status(* setShort )(NuoDB_Statement *_this, int index, short value)
 Sets the designated parameter to the given short value.
 
NuoDB_Status(* setString )(NuoDB_Statement *_this, int index, const char *stringValue)
 Sets the designated parameter to the given const char* value.
 
NuoDB_Status(* setStringWithLength )(NuoDB_Statement *_this, int index, const char *stringValue, size_t length)
 Sets the designated parameter to the given const char* value.
 
NuoDB_Status(* setTemporal )(NuoDB_Statement *_this, int index, NuoDB_Temporal *timeValue)
 Sets the designated parameter to the given NuoDB_Temporal value.
 
nuodb_bool_t(* wasNull )(NuoDB_Statement *_this)
 Retrieves whether the last OUT parameter read had the value of SQL NULL.
 

Detailed Description

The data structure for executing a SQL statement.

NuoDB_Statement is a data structure used for executing a static SQL statement and returning the results it produces. NuoDB_Statement supports both parameterized and non-parameterized SQL statements.

Only one NuoDB_ResultSet data structure per NuoDB_Statement data structure can be open at the same time. Therefore, if the reading of one NuoDB_ResultSet data structure is interleaved with the reading of another, each must have been generated by different NuoDB_Statement data structures. All execution function in the NuoDB_Statement data structure implicitly close and free a statement's current NuoDB_ResultSet data structure if an open one exists.

A prepared statement may have a NuoDB_ResultSetMetaData data structure if the statement is a query. Only one NuoDB_ResultSetMetaData data structure can be open from a NuoDB_Statement object. The NuoDB_ResultSetMetaData data structure is implicitly closed and freed when the NuoDB_Statement data structure is released.

Field Documentation

◆ addBatch

NuoDB_Status(* NuoDB_Statement::addBatch) (NuoDB_Statement *_this)

Stores the current set of parameter values as a batch entry.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ analyze

const char *(* NuoDB_Statement::analyze) (NuoDB_Statement *_this, int mask)

Generates table and index statistics for this command.

For more information about generating index statistics see ANALYZE.

Parameters
[in]maskA bitwise-or of one or both of NUODB_ANALYZESTATEMENT_RECORD and NUODB_ANALYZESTATEMENT_EXECUTION
Returns
the results of the analyze. The string will be valid until the next analyze run, or until the statement is deleted. Returns NULL on error, or the empty string if the statement has not been executed.

◆ clearBatch

NuoDB_Status(* NuoDB_Statement::clearBatch) (NuoDB_Statement *_this)

Clear the stored batch entries.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ clearParameters

NuoDB_Status(* NuoDB_Statement::clearParameters) (NuoDB_Statement *_this)

Clears the current parameter values immediately.

In general, parameter values remain in force for repeated use of a statement. Setting a parameter value automatically removes its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling the function clearParameters().

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ close

NuoDB_Status(* NuoDB_Statement::close) (NuoDB_Statement *_this)

Close the statement on the server side.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ execute

NuoDB_Status(* NuoDB_Statement::execute) (NuoDB_Statement *_this)

Executes a previously prepared SQL statement.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ executeBatch

NuoDB_Status(* NuoDB_Statement::executeBatch) (NuoDB_Statement *_this, NuoDB_BatchResult **results, size_t *resultSize)

Execute the batch operations added via addBatch.

Parameters
[in]_thisa pointer to the current (this) data structure.
[out]resultson output, an array of integer holding the result of the corresponding operation
[out]resultSizeon output, the length of the array whose pointer has been placed in the results arguments
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ executeSQL

NuoDB_Status(* NuoDB_Statement::executeSQL) (NuoDB_Statement *_this, const char *sql, unsigned int flags)

Executes a non-parameterized SQL statement.

Clients call this function to immediately execute a non-parameterized SQL statement.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]sqla pointer to a const char* that contains the SQL statement string.
[in]flagsa set of OR'd NuoDB_Statement_Flags values. Clients can pass a zero to indicate there are no options. Clients can provide the NUODB_AUTOGENERATEDKEYS bitfield to indicate that the statement should return any auto generated keys. Clients can provide the NUODB_EXECUTEQUERY bitfield to optimize statements that are expected to return result sets. Client can provide the NUODB_EXECUTEUPDATE bitfield to optimize statements that are expected to update the database.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ executeUpdateKeyIndices

NuoDB_Status(* NuoDB_Statement::executeUpdateKeyIndices) (NuoDB_Statement *_this, const char *sql, const int *columnIndices, int count)

Executes the given SQL statement and places the requested generated keys in the generated keys result set.

See @getGeneratedKeys for details

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]sqlquery to execute
[in]columnIndicesan array of column indexes indicating the columns that should be returned from the inserted row
[in]countthe number of entries in the indices array parameter
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ executeUpdateKeyNames

NuoDB_Status(* NuoDB_Statement::executeUpdateKeyNames) (NuoDB_Statement *_this, const char *sql, char *const *columnNames, int count)

Executes the given SQL statement and places the requested generated keys in the generated keys result set.

See @getGeneratedKeys for details

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]sqlquery to execute
[in]columnNamesan array of column labels indicating the columns that should be returned from the inserted row
[in]countthe number of entries in the columnNames parameter
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ executeWithFlags

NuoDB_Status(* NuoDB_Statement::executeWithFlags) (NuoDB_Statement *_this, unsigned int flags)

Executes a previously prepared SQL statement.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]flagscan be used to overwrite the flags used in prepare
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getBatchCount

size_t(* NuoDB_Statement::getBatchCount) (NuoDB_Statement *_this)

Return the number of batch operations added via addBatch.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
the number of batch operations added to the statement

◆ getBoolean

NuoDB_Status(* NuoDB_Statement::getBoolean) (NuoDB_Statement *_this, int index, nuodb_bool_t *boolPtr)

Retrieves the value of the designated SQL BOOLEAN parameter as a nuodb_bool_t value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[out]boolPtra pointer to a nuodb_bool_t variable where the parameter value is returned. if the value is SQL NULL, the result is false.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getByte

NuoDB_Status(* NuoDB_Statement::getByte) (NuoDB_Statement *_this, int index, char *charPtr)

Retrieves the value of the designated SQL TINYINT parameter as a char value in the C programming language.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[out]charPtra pointer to a char variable where the parameter value is returned. if the value is SQL NULL, the result is 0.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getDouble

NuoDB_Status(* NuoDB_Statement::getDouble) (NuoDB_Statement *_this, int index, double *doublePtr)

Retrieves the value of the designated SQL DOUBLE parameter as a double value in the C programming language.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[out]doublePtra pointer to a double variable where the parameter value is returned. if the value is SQL NULL, the result is 0.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getGeneratedKeys

NuoDB_ResultSet *(* NuoDB_Statement::getGeneratedKeys) (NuoDB_Statement *_this)

Retrieves any auto-generated keys created as a result of executing this NuoDB_Statement data structure.

If this NuoDB_Statement data structure did not generate any keys, an empty NuoDB_ResultSet data structure is returned.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
a pointer to a NuoDB_ResultSet data structure, or NULL to indicate an error.

◆ getInt

NuoDB_Status(* NuoDB_Statement::getInt) (NuoDB_Statement *_this, int index, int32_t *intPtr)

Retrieves the value of the designated SQL INTEGER parameter as an int32_t value in the C programming language.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[out]intPtra pointer to an int32_t variable where the parameter value is returned. if the value is SQL NULL, the result is 0.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getLastStatementTimeMicros

NuoDB_Status(* NuoDB_Statement::getLastStatementTimeMicros) (NuoDB_Statement *_this, int64_t *result)

Get the server execution time of the last statement executed on the connection.

Parameters
[in]_thisa pointer to the current (this) data structure.
[out]resulton output, the execution time in microseconds or -1 if the last statement was a DDL statement
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getLob

NuoDB_Status(* NuoDB_Statement::getLob) (NuoDB_Statement *_this, int index, NuoDB_Lob_Type lobType, const NuoDB_Lob **lobPtr)

Retrieves the value of the designated SQL CLOB or BLOB parameter as a NuoDB_Lob data structure.

The returned NuoDB_Lob is valid only as long as the last executed statement is active in the NuoDB_Statement.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]lobTypethe NuoDB_Lob_Type.
[out]lobPtra pointer to a const NuoDB_Lob* variable where the address of the parameter value held by "_this" data structure is returned. if the value is SQL NULL, the result is NULL.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getLong

NuoDB_Status(* NuoDB_Statement::getLong) (NuoDB_Statement *_this, int index, int64_t *longPtr)

Retrieves the value of the designated SQL INTEGER parameter as an int64_t value in the C programming language.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[out]longPtra pointer to an int64_t variable where the parameter value is returned. if the value is SQL NULL, the result is 0.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getMetaData

NuoDB_ResultSetMetaData *(* NuoDB_Statement::getMetaData) (NuoDB_Statement *_this)

Retrieves result set metadata as a NuoDB_ResultSetMetaData data structure for a previously prepared statement which has not been executed yet.

This function should only be called on a prepared statement before its execution.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
the result set metadata for a previously prepared statement which has not been executed yet. The prepared statement should be a query (select). NULL if the previously preared statement is not a query or it the statement was not previously prepared.

◆ getMoreResults

NuoDB_Status(* NuoDB_Statement::getMoreResults) (NuoDB_Statement *_this, nuodb_bool_t *result)

Moves to this NuoDB_Statement data structure's next result, returns the new NuoDB_ResultSet and implicitly closes and frees any current NuoDB_ResultSet data structure(s) obtained with the function getResultSet().

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
the next NuoDB_ResultSet data structure or NULL if there are no more results.

◆ getParameterMetaData

NuoDB_Status(* NuoDB_Statement::getParameterMetaData) (NuoDB_Statement *_this, NuoDB_ParameterMetaData **pmdPtr)

Retrieves the parameter metadata of the last prepared SQL statement.

Parameters
[in]_thisa pointer to the current (this) data structure.
[out]pmdPtra pointer to a NuoDB_ParameterMetaData* variable that points to a data structure held by "_this" data structure.

The returned NuoDB_ParameterMetaData is valid only as long as the last prepared statement is active in the NuoDB_Statement.

Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getQueryTimeout

int64_t(* NuoDB_Statement::getQueryTimeout) (NuoDB_Statement *_this)

Retrieves the number of microseconds the driver will wait for a NuoDB_Statement data structure to execute.

If the limit is exceeded, the execute() function will return an error code code.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
the current query timeout limit in microseconds; zero means there is no limit; negative numbers are error codes.

◆ getResultSet

NuoDB_ResultSet *(* NuoDB_Statement::getResultSet) (NuoDB_Statement *_this)

Retrieves the current result as a NuoDB_ResultSet data structure.

This function should be called only once per result.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
the current result as a NuoDB_ResultSet data structure or NULL if there are no more results.

◆ getShort

NuoDB_Status(* NuoDB_Statement::getShort) (NuoDB_Statement *_this, int index, short *shortPtr)

Retrieves the value of the designated SQL SHORTINT parameter as a short value in the C programming language.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[out]shortPtra pointer to a short variable where the parameter value is returned. if the value is SQL NULL, the result is 0.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getString

NuoDB_Status(* NuoDB_Statement::getString) (NuoDB_Statement *_this, int index, const char **strPtr)

Retrieves the value of the designated SQL CHAR, VARCHAR, STRING, NUMERIC, DECIMAL or NUMBER parameter as a character string in the C programming language.

The returned string is valid only as long as the last executed statement is active in the NuoDB_Statement. getString() can only be used with nul terminated strings that do not contain any embedded nul characters. If your application allows strings to have embedded nul characters, or if your strings are not nul terminated, then your client should call getStringWithLength() to retrieve the string buffer and length.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[out]strPtra pointer to a const char* variable where the address of the parameter value held by "_this" data structure is returned. if the value is SQL NULL, the result is NULL.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getStringWithLength

NuoDB_Status(* NuoDB_Statement::getStringWithLength) (NuoDB_Statement *_this, int index, const char **strPtr, size_t *length)

Retrieves the value of the designated SQL CHAR, VARCHAR, STRING, BINARY or VARBINARY parameter as a character string in the C programming language.

The returned string is valid only as long as the last executed statement is active in the NuoDB_Statement.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[out]strPtra pointer to a const char* variable where the address of the parameter value held by "_this" data structure is returned. if the value is SQL NULL, the result is NULL.
[out]lengthpointer to size_t that holds the length of the string in bytes.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getTemporal

NuoDB_Status(* NuoDB_Statement::getTemporal) (NuoDB_Statement *_this, int index, NuoDB_Temporal_Type temporalType, NuoDB_Temporal **temporalPtr)

Retrieves the value of the designated SQL DATE, TIME, TIMESTAMP or TIMESTAMP WITHOUT TIME ZONE parameter as a NuoDB_Temporal data structure.

The caller is expected to free returned NuoDB_Temporal using the NuoDB_Temporal_free() function once finished with it.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]temporalTypethe NuoDB_Temporal_Type.
[out]temporalPtra pointer to a NuoDB_Temporal* variable that points to a data structure allocated by this function. if the value is SQL NULL, the result is NULL.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ getUpdateCount

int(* NuoDB_Statement::getUpdateCount) (NuoDB_Statement *_this)

Retrieves the update count.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
the number of rows updated by the current statement. Returns zero if there were no updates.

◆ lastExecuteStatus

nuodb_bool_t(* NuoDB_Statement::lastExecuteStatus) (NuoDB_Statement *_this)

returns whether the first result from the last execute call was a result set or not

Returns
true if first result was a result set, false otherwise

◆ prepare

NuoDB_Status(* NuoDB_Statement::prepare) (NuoDB_Statement *_this, const char *sql, unsigned int flags)

Prepares a parameterized SQL statement.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]sqla pointer to a const char* that contains a valid, optionally parameterized, SQL statement.
[in]flagsa set of OR'd NuoDB_Statement_Flags values. Clients can pass a zero to indicate there are no options. Clients can provided the NUODB_AUTOGENERATEDKEY bitfield to indicate that the statement should return any auto generated keys. Clients can provide the NUODB_EXECUTEQUERY bitfield to optimize statements that are expected to return result sets. Client can provide the NUODB_EXECUTEUPDATE bitfield to optimize statements that are expected to update the database.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ prepareUpdateKeyIndices

NuoDB_Status(* NuoDB_Statement::prepareUpdateKeyIndices) (NuoDB_Statement *_this, const char *sql, const int *columnIndices, int count)

Prepare a given DML SQL statement.

On execute, the requested generated keys are placed in the generated keys result set. See @getGeneratedKeys for details

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]sqlstatement to prepare
[in]columnIndicesan array of column indices indicating the columns that should be returned from the inserted row
[in]countthe number of entries in the indices array parameter
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ prepareUpdateKeyNames

NuoDB_Status(* NuoDB_Statement::prepareUpdateKeyNames) (NuoDB_Statement *_this, const char *sql, char *const *columnNames, int count)

Prepare a given DML SQL statement.

On execute, the requested generated keys are placed in the generated keys result set. See @getGeneratedKeys for details

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]sqlstatement to prepare
[in]columnNamesan array of column labels indicating the columns that should be returned from the inserted row
[in]countthe number of entries in the columnNames parameter
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ registerOutParameter

NuoDB_Status(* NuoDB_Statement::registerOutParameter) (NuoDB_Statement *_this, int index, NuoDB_Type sqlType)

Registers the OUT parameter in ordinal position index to the sqlType.

All OUT parameters must be registered before a stored procedure is executed.

The type specified by sqlType for an OUT parameter determines the type that must be used in the get method to read the value of that parameter.

Parameters
[in]indexparameter index starting with 1
[in]sqlTypethe type code defined by NuoDB_Type.

◆ registerOutParameterWithScale

NuoDB_Status(* NuoDB_Statement::registerOutParameterWithScale) (NuoDB_Statement *_this, int index, NuoDB_Type sqlType, int scale)

Registers the OUT parameter in ordinal position index to the sqlType.

All OUT parameters must be registered before a stored procedure is executed.

The type specified by sqlType for an OUT parameter determines the type that must be used in the get method to read the value of that parameter.

This version of registerOutParameter should be used when the parameter is of type NUODB_NUMERIC or NUODB_DECIMAL.

Parameters
[in]indexparameter index starting with 1
[in]sqlTypethe type code defined by NuoDB_Type.
[in]scalethe desired number of digits to the right of the decimal point. It must be greater than or equal to zero.

◆ setBoolean

NuoDB_Status(* NuoDB_Statement::setBoolean) (NuoDB_Statement *_this, int index, nuodb_bool_t value)

Sets the designated parameter to the given boolean value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]valuethe boolean value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setByte

NuoDB_Status(* NuoDB_Statement::setByte) (NuoDB_Statement *_this, int index, char value)

Sets the designated parameter to the given char value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]valuethe one-byte value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setBytes

NuoDB_Status(* NuoDB_Statement::setBytes) (NuoDB_Statement *_this, int index, const char *stringValue, size_t length)

Sets the designated parameter to the given binary string value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]bytesthe value to which we will set the parameter.
[in]lengththe length of the bytes argument
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setDouble

NuoDB_Status(* NuoDB_Statement::setDouble) (NuoDB_Statement *_this, int index, double value)

Sets the designated parameter to the given double-precision value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]valuethe double-precision value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setFetchSize

NuoDB_Status(* NuoDB_Statement::setFetchSize) (NuoDB_Statement *_this, int fetchSize)

Setup of the fetch size.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]fetchSizethe value of fetch size
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setInt

NuoDB_Status(* NuoDB_Statement::setInt) (NuoDB_Statement *_this, int index, int32_t value)

Sets the designated parameter to the given 32-bit integer value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]valuethe 32-bit integer value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setLob

NuoDB_Status(* NuoDB_Statement::setLob) (NuoDB_Statement *_this, int index, NuoDB_Lob *lob)

Sets the designated parameter to the given Lob value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]valuethe NuoDB_Lob value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setLong

NuoDB_Status(* NuoDB_Statement::setLong) (NuoDB_Statement *_this, int index, int64_t value)

Sets the designated parameter to the given 64-bit integer value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]valuethe 64-bit integer value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setNull

NuoDB_Status(* NuoDB_Statement::setNull) (NuoDB_Statement *_this, int index, int type)

Sets the designated parameter to SQL NULL.

Note: You must specify the parameter's SQL type.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]typethe type code as defined in NUODB_TYPE_* values.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setQueryTimeout

NuoDB_Status(* NuoDB_Statement::setQueryTimeout) (NuoDB_Statement *_this, int64_t microSeconds)

Sets the number of microseconds the client will wait for a NuoDB_Statement data structure to execute to the given number of microseconds.

By default there is no limit on the amount of time allowed for a running statement to complete. If the limit is exceeded, the execute function will return an error code code.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]thenew query timeout limit in microseconds; zero means there is no limit.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setShort

NuoDB_Status(* NuoDB_Statement::setShort) (NuoDB_Statement *_this, int index, short value)

Sets the designated parameter to the given short value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]valuethe short value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setString

NuoDB_Status(* NuoDB_Statement::setString) (NuoDB_Statement *_this, int index, const char *stringValue)

Sets the designated parameter to the given const char* value.

setString() can only be used with nul terminated strings that do not contain any embedded nul characters. If your application allows strings to have embedded nul characters, or if your strings are not nul terminated, then your client should call setStringWithLength() to explicitly set the length of the stringValue.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]stringValuethe value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setStringWithLength

NuoDB_Status(* NuoDB_Statement::setStringWithLength) (NuoDB_Statement *_this, int index, const char *stringValue, size_t length)

Sets the designated parameter to the given const char* value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]stringValuethe value to which we will set the parameter.
[in]lengththe length of the stringValue.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ setTemporal

NuoDB_Status(* NuoDB_Statement::setTemporal) (NuoDB_Statement *_this, int index, NuoDB_Temporal *timeValue)

Sets the designated parameter to the given NuoDB_Temporal value.

Parameters
[in]_thisa pointer to the current (this) data structure.
[in]indexthe first parameter is 1, the second is 2, ...
[in]valuethe NuoDB_Temporal value to which we will set the parameter.
Returns
Enumerated integer NuoDB_Status. NUODB_SUCCESS (integer 0) on success, or a negative integer on failure.

◆ wasNull

nuodb_bool_t(* NuoDB_Statement::wasNull) (NuoDB_Statement *_this)

Retrieves whether the last OUT parameter read had the value of SQL NULL.

Note that this method should be called only after calling a getXXX() function; otherwise, there is no value to use in determining whether it is null or not.

Parameters
[in]_thisa pointer to the current (this) data structure.
Returns
true if the last parameter read was SQL NULL; false otherwise.

The documentation for this struct was generated from the following file: