Database Vuser Functions (LRD) > Alphabetical List of Functions > lrd_stmt

lrd_stmt

Example: lrd_stmt Statement Handling Functions

Sets an SQL statement to be processed.

LRDRET lrd_stmt( LRD_CURSOR *mptCursor, char *mpcText, long mliTextLen, LRDOS_INT4 mjOpt1, LRDOS_INT4 mjOpt2, int miDBErrorSeverity );


mptCursor A pointer to an LRD_CURSOR structure.
mpcText A pointer to SQL statement text.
mliTextLen The length of the text, or -1 to take the full length of a null terminated string.
mjOpt1 A database-dependent statement option, Option 1
mjOpt2 A database-dependent statement option, Option 2
miDBErrorSeverity The Error Severity Levels of a failure in a database routine.

The lrd_stmt function associates a character string (usually an SQL statement) with a cursor.

Note that when working with ODBC, you can specify direct execution by setting mjOpt1 to 1.

The lrd_exec function resets the contents of the SQL statement set by lrd_stmt; you must provide a new SQL statement after every lrd_exec function call.

For more details refer to the Function Header File lrd.h in the include directory.

Note: Up to and including version 8.0, if the SQL query text contained a parameter whose value contained an apostrophe, the apostrophe was doubled during the script run. For example,
SELECT `{param}' FROM DUAL
where the value of {param} is "can't", evaluated to
SELECT `can''t' FROM DUAL.
In new scripts created after version 8.0, the apostrophe is no longer doubled, and the same query evaluates to
SELECT `can't' FROM DUAL.

Return Values

See LRD Return Values.

Parameterization

The following argument can be parameterized using standard parameterization: mpcValStr