On Windows platforms, the target programming language must support the __cdecl calling convention
In the parameter list, every output placeholder MUST be preceded by an integer parameter that indicates the type of the placeholder in order to handle correctly the given pointer.
#include "ocilib.h" int main(void) { OCI_Connection *cn; OCI_Statement *st; OCI_Resultset *rs; int code = 1; char name[50]; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) return EXIT_FAILURE; cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); st = OCI_StatementCreate(cn); /* sql format with params ----------------------------------------------- */ OCI_ExecuteStmtFmt(st, "select article from test_fetch where code = %i", code); rs = OCI_GetResultset(st); while (OCI_FetchNext(rs)) printf("article : %s\n", OCI_GetString(rs, 1)); /* sql immediate (parse, exec, one fetch) ------------------------------- */ OCI_Immediate(cn, "select code, article from test_fetch where code = 1", OCI_ARG_INT, &code, OCI_ARG_TEXT, name); printf("article : %s - code %i\n", name, code); /* sql immediate (parse, exec, one fetch) with params ------------------- */ OCI_ImmediateFmt(cn, "select article from test_fetch where code = %i", code, OCI_ARG_TEXT, name); printf("article : %s\n", name); OCI_Cleanup(); return EXIT_SUCCESS; }
Functions | |
OCI_EXPORT boolean | OCI_Immediate (OCI_Connection *con, const mtext *sql,...) |
Perform 3 calls (prepare+execute+fetch) in 1 call. | |
OCI_EXPORT boolean | OCI_ImmediateFmt (OCI_Connection *con, const mtext *sql,...) |
Performs 4 call (prepare+bind+execute+fetch) in 1 call. | |
OCI_EXPORT boolean | OCI_PrepareFmt (OCI_Statement *stmt, const mtext *sql,...) |
Prepare a formatted SQL statement or PL/SQL block. | |
OCI_EXPORT boolean | OCI_ExecuteStmtFmt (OCI_Statement *stmt, const mtext *sql,...) |
Parse and execute a formatted SQL statement or PL/SQL block. |
OCI_EXPORT boolean OCI_ExecuteStmtFmt | ( | OCI_Statement * | stmt, | |
const mtext * | sql, | |||
... | ||||
) |
Parse and execute a formatted SQL statement or PL/SQL block.
stmt | - Statement handle | |
sql | - SQL statement | |
... | - List of program values to format the SQL |
Definition at line 1634 of file statement.c.
References OCI_Execute(), and OCI_Prepare().
OCI_EXPORT boolean OCI_Immediate | ( | OCI_Connection * | con, | |
const mtext * | sql, | |||
... | ||||
) |
Perform 3 calls (prepare+execute+fetch) in 1 call.
con | - Connection handle | |
sql | - SQL statement | |
... | - List of program variables address to store the result of fetch operation |
Definition at line 1687 of file statement.c.
References OCI_ExecuteStmt(), OCI_GetStatementType(), OCI_StatementCreate(), and OCI_StatementFree().
OCI_EXPORT boolean OCI_ImmediateFmt | ( | OCI_Connection * | con, | |
const mtext * | sql, | |||
... | ||||
) |
Performs 4 call (prepare+bind+execute+fetch) in 1 call.
con | - Connection handle | |
sql | - SQL statement | |
... | - List of program values to format the SQL followed by the output variables addresses for the fetch operation |
Definition at line 1725 of file statement.c.
References OCI_Execute(), OCI_GetStatementType(), OCI_Prepare(), OCI_StatementCreate(), and OCI_StatementFree().
OCI_EXPORT boolean OCI_PrepareFmt | ( | OCI_Statement * | stmt, | |
const mtext * | sql, | |||
... | ||||
) |
Prepare a formatted SQL statement or PL/SQL block.
stmt | - Statement handle | |
sql | - SQL statement | |
... | - List of program values to format the SQL |
Definition at line 1581 of file statement.c.
References OCI_Prepare().