OCILIB (C Driver for Oracle) 3.12.1
|
OCILIB supports the Oracle feature 'Returning into' for DML statements.
Let's Oracle talk about this features:
OCILIB implements this features by providing a set of functions that allows to register output placeholders for the returned values. Once the DML is executed with OCI_Execute(), the output returned data is available through a regular resultset object that can be fetched.
#include "ocilib.h" int main(void) { OCI_Connection *cn; OCI_Statement *st; OCI_Resultset *rs; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) return EXIT_FAILURE; cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); st = OCI_StatementCreate(cn); OCI_Prepare(st, "update products set code = code+10 returning code into :i"); OCI_RegisterInt(st, ":i"); OCI_Execute(st); rs = OCI_GetResultset(st); while (OCI_FetchNext(rs)) printf("%i\n", OCI_GetInt(rs, 1)); printf("count : %i\n", OCI_GetRowCount(rs)); OCI_Commit(cn); OCI_Cleanup(); return EXIT_SUCCESS; }
Functions | |
OCI_EXPORT OCI_Resultset *OCI_API | OCI_GetNextResultset (OCI_Statement *stmt) |
Retrieve the next resultset from an executed DML statement using a 'SQL returning' clause. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterShort (OCI_Statement *stmt, const mtext *name) |
Register a short output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterUnsignedShort (OCI_Statement *stmt, const mtext *name) |
Register an unsigned short output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterInt (OCI_Statement *stmt, const mtext *name) |
Register an integer output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterUnsignedInt (OCI_Statement *stmt, const mtext *name) |
Register an unsigned integer output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterBigInt (OCI_Statement *stmt, const mtext *name) |
Register a big integer output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterUnsignedBigInt (OCI_Statement *stmt, const mtext *name) |
Register an unsigned big integer output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterString (OCI_Statement *stmt, const mtext *name, unsigned int len) |
Register a string output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterRaw (OCI_Statement *stmt, const mtext *name, unsigned int len) |
Register an raw output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterDouble (OCI_Statement *stmt, const mtext *name) |
Register a double output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterFloat (OCI_Statement *stmt, const mtext *name) |
Register a float output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterDate (OCI_Statement *stmt, const mtext *name) |
Register a date output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterTimestamp (OCI_Statement *stmt, const mtext *name, unsigned int type) |
Register a timestamp output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterInterval (OCI_Statement *stmt, const mtext *name, unsigned int type) |
Register an interval output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterObject (OCI_Statement *stmt, const mtext *name, OCI_TypeInfo *typinf) |
Register an object output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterLob (OCI_Statement *stmt, const mtext *name, unsigned int type) |
Register a lob output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterFile (OCI_Statement *stmt, const mtext *name, unsigned int type) |
Register a file output bind placeholder. | |
OCI_EXPORT boolean OCI_API | OCI_RegisterRef (OCI_Statement *stmt, const mtext *name, OCI_TypeInfo *typinf) |
Register a Ref output bind placeholder. |
OCI_EXPORT OCI_Resultset* OCI_API OCI_GetNextResultset | ( | OCI_Statement * | stmt | ) |
Retrieve the next resultset from an executed DML statement using a 'SQL returning' clause.
stmt | - Statement handle |
Definition at line 818 of file resultset.c.
OCI_EXPORT boolean OCI_API OCI_RegisterShort | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register a short output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3503 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterUnsignedShort | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register an unsigned short output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3519 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterInt | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register an integer output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3535 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterUnsignedInt | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register an unsigned integer output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3551 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterBigInt | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register a big integer output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3567 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterUnsignedBigInt | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register an unsigned big integer output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3583 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterString | ( | OCI_Statement * | stmt, |
const mtext * | name, | ||
unsigned int | len | ||
) |
Register a string output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
len | - Max length of single string (in characters) |
Definition at line 3599 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterRaw | ( | OCI_Statement * | stmt, |
const mtext * | name, | ||
unsigned int | len | ||
) |
Register an raw output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
len | - Max length of the buffer (in bytes) |
Definition at line 3618 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterDouble | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register a double output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3637 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterFloat | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register a float output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3653 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterDate | ( | OCI_Statement * | stmt, |
const mtext * | name | ||
) |
Register a date output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
Definition at line 3669 of file statement.c.
References OCI_GetVersionConnection().
OCI_EXPORT boolean OCI_API OCI_RegisterTimestamp | ( | OCI_Statement * | stmt, |
const mtext * | name, | ||
unsigned int | type | ||
) |
Register a timestamp output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
type | - Timestamp type |
Definition at line 3698 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterInterval | ( | OCI_Statement * | stmt, |
const mtext * | name, | ||
unsigned int | type | ||
) |
Register an interval output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
type | - Interval type |
Definition at line 3747 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterObject | ( | OCI_Statement * | stmt, |
const mtext * | name, | ||
OCI_TypeInfo * | typinf | ||
) |
Register an object output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
typinf | - Type info handle |
Definition at line 3792 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterLob | ( | OCI_Statement * | stmt, |
const mtext * | name, | ||
unsigned int | type | ||
) |
Register a lob output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
type | - Lob type |
Definition at line 3811 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterFile | ( | OCI_Statement * | stmt, |
const mtext * | name, | ||
unsigned int | type | ||
) |
Register a file output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
type | - File type |
Definition at line 3841 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_RegisterRef | ( | OCI_Statement * | stmt, |
const mtext * | name, | ||
OCI_TypeInfo * | typinf | ||
) |
Register a Ref output bind placeholder.
stmt | - Statement handle |
name | - Output bind name |
typinf | - Type info handle |
Definition at line 3871 of file statement.c.