Statements control
C API

## Detailed Description

Those functions give extra information about OCILIB statements and can modify their behavior.

## Functions

OCI_EXPORT unsigned int OCI_API | OCI_GetStatementType (OCI_Statement *stmt)
| Return the type of a SQL statement. More...
OCI_EXPORT boolean OCI_API | OCI_SetFetchMode (OCI_Statement *stmt, unsigned int mode)
| Set the fetch mode of a SQL statement. More...
OCI_EXPORT unsigned int OCI_API | OCI_GetFetchMode (OCI_Statement *stmt)
| Return the fetch mode of a SQL statement. More...
OCI_EXPORT boolean OCI_API | OCI_SetBindMode (OCI_Statement *stmt, unsigned int mode)
| Set the binding mode of a SQL statement. More...
OCI_EXPORT unsigned int OCI_API | OCI_GetBindMode (OCI_Statement *stmt)
| Return the binding mode of a SQL statement. More...
OCI_EXPORT boolean OCI_API | OCI_SetBindAllocation (OCI_Statement *stmt, unsigned int mode)
| Set the current bind allocation mode that will be used for subsequent binding calls. More...
OCI_EXPORT unsigned int OCI_API | OCI_GetBindAllocation (OCI_Statement *stmt)
| Return the current bind allocation mode used for subsequent binding calls. More...
OCI_EXPORT boolean OCI_API | OCI_SetFetchSize (OCI_Statement *stmt, unsigned int size)
| Set the number of rows fetched per internal server fetch call. More...
OCI_EXPORT unsigned int OCI_API | OCI_GetFetchSize (OCI_Statement *stmt)
| Return the number of rows fetched per internal server fetch call. More...
OCI_EXPORT boolean OCI_API | OCI_SetPrefetchSize (OCI_Statement *stmt, unsigned int size)
| Set the number of rows pre-fetched by OCI Client. More...
OCI_EXPORT unsigned int OCI_API | OCI_GetPrefetchSize (OCI_Statement *stmt)
| Return the number of rows pre-fetched by OCI Client. More...
OCI_EXPORT boolean OCI_API | OCI_SetPrefetchMemory (OCI_Statement *stmt, unsigned int size)
| Set the amount of memory pre-fetched by OCI Client. More...
OCI_EXPORT unsigned int OCI_API | OCI_GetPrefetchMemory (OCI_Statement *stmt)
| Return the amount of memory used to retrieve rows pre-fetched by OCI Client. More...
OCI_EXPORT boolean OCI_API | OCI_SetLongMaxSize (OCI_Statement *stmt, unsigned int size)
| Set the LONG data type piece buffer size. More...
OCI_EXPORT unsigned int OCI_API | OCI_GetLongMaxSize (OCI_Statement *stmt)
| Return the LONG data type piece buffer size. More...
OCI_EXPORT boolean OCI_API | OCI_SetLongMode (OCI_Statement *stmt, unsigned int mode)
| Set the long data type handling mode of a SQL statement. More...
OCI_EXPORT unsigned int OCI_API | OCI_GetLongMode (OCI_Statement *stmt)
| Return the long data type handling mode of a SQL statement. More...
OCI_EXPORT OCI_Connection *OCI_API | OCI_StatementGetConnection (OCI_Statement *stmt)
| Return the connection handle associated with a statement handle. More...

## Function Documentation

## OCI_GetStatementType()

OCI_EXPORT unsigned int OCI_API OCI_GetStatementType | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the type of a SQL statement.

Parameters

  stmt | - Statement handle

Note
  Possible values are :

- OCI_CST_SELECT : select statement
- OCI_CST_UPDATE : update statement
- OCI_CST_DELETE : delete statement
- OCI_CST_INSERT : insert statement
- OCI_CST_CREATE : create statement
- OCI_CST_DROP : drop statement
- OCI_CST_ALTER : alter statement
- OCI_CST_BEGIN : begin (pl/sql) statement
- OCI_CST_DECLARE : declare (pl/sql) statement
- OCI_CST_CALL : kpu call

Returns
  The statement type on success or OCI_UNKOWN on error

Referenced by ocilib::Statement::GetStatementType().

## OCI_SetFetchMode()

OCI_EXPORT boolean OCI_API OCI_SetFetchMode | ( | OCI_Statement * | stmt,
|  | unsigned int | mode
| ) |  |

`#include <ocilib.h>`

Set the fetch mode of a SQL statement.

Parameters

  stmt | - Statement handle
  mode | - fetch mode value

Warning
  OCI_SetFetchMode() MUST be called before any OCI_ExecuteXXX() call

Note
  Possible values are :
  - OCI_SFM_DEFAULT
  - OCI_SFM_SCROLLABLE

Referenced by ocilib::Statement::SetFetchMode().

## OCI_GetFetchMode()

OCI_EXPORT unsigned int OCI_API OCI_GetFetchMode | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the fetch mode of a SQL statement.

Parameters

  stmt | - Statement handle

Note
  See OCI_SetFetchMode() for possible values Default value is OCI_SFM_DEFAULT

Referenced by ocilib::Statement::GetFetchMode().

## OCI_SetBindMode()

OCI_EXPORT boolean OCI_API OCI_SetBindMode | ( | OCI_Statement * | stmt,
|  | unsigned int | mode
| ) |  |

`#include <ocilib.h>`

Set the binding mode of a SQL statement.

Parameters

  stmt | - Statement handle
  mode | - binding mode value

Note
  Possible values are :
  - OCI_BIND_BY_POS : position binding
  - OCI_BIND_BY_NAME : name binding

Referenced by ocilib::Statement::SetBindMode().

## OCI_GetBindMode()

OCI_EXPORT unsigned int OCI_API OCI_GetBindMode | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the binding mode of a SQL statement.

Parameters

  stmt | - Statement handle

Note
  See OCI_SetBindMode() for possible values Default value is OCI_BIND_BY_NAME
  if stmt is NULL, the return value is OCI_UNKNOWN

Referenced by ocilib::Statement::GetBindMode().

## OCI_SetBindAllocation()

OCI_EXPORT boolean OCI_API OCI_SetBindAllocation | ( | OCI_Statement * | stmt,
|  | unsigned int | mode
| ) |  |

`#include <ocilib.h>`

Set the current bind allocation mode that will be used for subsequent binding calls.

Parameters

  stmt | - Statement handle
  mode | - bind allocation mode value

Note
  Possible values are :
  - OCI_BAM_EXTERNAL : bind variable are allocated by user code
  - OCI_BAM_INTERNAL : bind variable are allocated internally

Warning
  This call has to be made after preparing a statement as OCI_Prepare() reset it by default to OCI_BAM_EXTERNAL. When calling an OCI_BindXXXX() call, this value is used and stored in the OCI_Bind object created during the bind call. Each bind can have is own allocation mode that is returned by OCI_BindGetAllocationMode() OCI_SetBindAllocation() can be called before each binding call if needed, resulting having some bind allocated externally and other ones internally.

Note
  Refer to the section "Binding variables and arrays" of the documention about allocation mode as OCI_BAM_INTERNAL is not compatible with all bind calls

## OCI_GetBindAllocation()

OCI_EXPORT unsigned int OCI_API OCI_GetBindAllocation | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the current bind allocation mode used for subsequent binding calls.

Parameters

  stmt | - Statement handle

Note
  See OCI_SetBindAllocation() for possible values Default value is OCI_BAM_EXTERNAL

Warning
  Each OCI_Bind object has its own allocation mode that may differ from the one returned by OCI_GetBindAllocation() The return value of OCI_GetBindAllocation() is the mode that will be used for any subsequent OCI_BindXXXX() calls

Note
  if stmt is NULL, the return value is OCI_UNKNOWN

## OCI_SetFetchSize()

OCI_EXPORT boolean OCI_API OCI_SetFetchSize | ( | OCI_Statement * | stmt,
|  | unsigned int | size
| ) |  |

`#include <ocilib.h>`

Set the number of rows fetched per internal server fetch call.

Parameters

  stmt | - Statement handle
  size | - number of rows to fetch

Returns
  TRUE on success otherwise FALSE

Referenced by ocilib::Statement::SetFetchSize().

## OCI_GetFetchSize()

OCI_EXPORT unsigned int OCI_API OCI_GetFetchSize | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the number of rows fetched per internal server fetch call.

Parameters

  stmt | - Statement handle

Note
  Default value is set to constant OCI_FETCH_SIZE

Referenced by ocilib::Statement::GetFetchSize().

## OCI_SetPrefetchSize()

OCI_EXPORT boolean OCI_API OCI_SetPrefetchSize | ( | OCI_Statement * | stmt,
|  | unsigned int | size
| ) |  |

`#include <ocilib.h>`

Set the number of rows pre-fetched by OCI Client.

Parameters

  stmt | - Statement handle
  size | - number of rows to pre-fetch

Note
  To turn off pre-fetching, set both attributes (size and memory) to 0.

Returns
  TRUE on success otherwise FALSE

Referenced by ocilib::Statement::SetPrefetchSize().

## OCI_GetPrefetchSize()

OCI_EXPORT unsigned int OCI_API OCI_GetPrefetchSize | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the number of rows pre-fetched by OCI Client.

Parameters

  stmt | - Statement handle

Note
  Default value is set to constant OCI_PREFETCH_SIZE

Referenced by ocilib::Statement::GetPrefetchSize().

## OCI_SetPrefetchMemory()

OCI_EXPORT boolean OCI_API OCI_SetPrefetchMemory | ( | OCI_Statement * | stmt,
|  | unsigned int | size
| ) |  |

`#include <ocilib.h>`

Set the amount of memory pre-fetched by OCI Client.

Parameters

  stmt | - Statement handle
  size | - amount of memory to fetch

Note
  Default value is 0 and the pre-fetch size attribute is used instead. When both attributes are set (pre-fetch size and memory) and pre-fetch memory value can hold more rows than specified by pre-fetch size, OCI uses pre-fetch size instead.
  OCILIB set pre-fetch attribute to OCI_PREFETCH_SIZE when a statement is created. To setup a big value for OCI_SetPrefetchMemory(), you must call OCI_SetPrefetchSize() to 0 to make OCI consider this attribute.

Returns
  TRUE on success otherwise FALSE

Referenced by ocilib::Statement::SetPrefetchMemory().

## OCI_GetPrefetchMemory()

OCI_EXPORT unsigned int OCI_API OCI_GetPrefetchMemory | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the amount of memory used to retrieve rows pre-fetched by OCI Client.

Parameters

  stmt | - Statement handle

Note
  Default value is 0

Referenced by ocilib::Statement::GetPrefetchMemory().

## OCI_SetLongMaxSize()

OCI_EXPORT boolean OCI_API OCI_SetLongMaxSize | ( | OCI_Statement * | stmt,
|  | unsigned int | size
| ) |  |

`#include <ocilib.h>`

Set the LONG data type piece buffer size.

Parameters

  stmt | - Statement handle
  size | - maximum size for long buffer

Returns
  TRUE on success otherwise FALSE

Referenced by ocilib::Statement::SetLongMaxSize().

## OCI_GetLongMaxSize()

OCI_EXPORT unsigned int OCI_API OCI_GetLongMaxSize | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the LONG data type piece buffer size.

Parameters

  stmt | - Statement handle

Note
  Default value is set to constant OCI_SIZE_LONG

Referenced by ocilib::Statement::GetLongMaxSize().

## OCI_SetLongMode()

OCI_EXPORT boolean OCI_API OCI_SetLongMode | ( | OCI_Statement * | stmt,
|  | unsigned int | mode
| ) |  |

`#include <ocilib.h>`

Set the long data type handling mode of a SQL statement.

Parameters

  stmt | - Statement handle
  mode | - long mode value

Note
  Possible values are :

- OCI_LONG_EXPLICIT : LONGs are explicitly handled by OCI_Long type

- OCI_LONG_IMPLICIT : LONGs are implicitly mapped to string type in the limits of VARCHAR2 size capacity

  LONG RAWs can't be handled with OCI_LONG_IMPLICIT

Referenced by ocilib::Statement::SetLongMode().

## OCI_GetLongMode()

OCI_EXPORT unsigned int OCI_API OCI_GetLongMode | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the long data type handling mode of a SQL statement.

Parameters

  stmt | - Statement handle

Note
  See OCI_SetLongMode() for possible values

Referenced by ocilib::Statement::GetLongMode().

## OCI_StatementGetConnection()

OCI_EXPORT OCI_Connection* OCI_API OCI_StatementGetConnection | ( | OCI_Statement * | stmt | ) |

`#include <ocilib.h>`

Return the connection handle associated with a statement handle.

Parameters

  stmt | - Statement handle

Referenced by ocilib::Statement::GetConnection().