Difference between revisions of "OpenDBX/C API/odbx get option"

From Linuxnetworks
< OpenDBX‎ | C API
Jump to: navigation, search
(header)
(description)
Line 8: Line 8:
 
     void* '''value''' )  
 
     void* '''value''' )  
  
= Description: =
+
= Description =
  
Asks the backend for supported options. Look in odbx.h for available options.
+
'''odbx_get_option()''' asks the backend module associated to '''handle''' by [[OpenDBX_init|odbx_init()]] for implemented options and their current values. This function can be used after [[OpenDBX_init|odbx_init()]] returned successfully. Its primary use is to find out supported features of the backend module and to enable them with [[OpenDBX_set_option|odbx_set_option()]] before the connection to the database server is established by calling [[OpenDBX_bind|odbx_bind()]].
  
= Parameters: =
+
The first parameter '''handle''' is the connection object created and returned by [[OpenDBX_init|odbx_init()]] which becomes invalid as soon as it was supplied to [[OpenDBX_finish|odbx_finish()]].
  
* handle: Connection object created by [[OpenDBX_init|odbx_init()]]
+
There are several '''options''' defined as named constants in the '''odbx.h''' header file. A few of them are for informational purpose only while most of the options can also be set to different values by [[OpenDBX_set_option|odbx_set_option()]] to change the behavior of the backend module.
* option: Options listed below
+
* value: Pointer to a integer variable where the option result should be stored
+
  
 +
'''value''' must be a pointer to an integer variable where the backend module will store the result for the supplied option. If it's not stated otherwise, the value assigned to the passed '''value''' parameter by '''odbx_get_option()''' will be of boolean nature and therefore will only consist of one ("1") for a supported option or zero ("0") for an option which isn't supported.
  
{| class="wikitable"
+
The available options are:
|- style="background: #F0F0F0"
+
! Option !! Description !! Value !! Release
+
|-
+
| ODBX_OPT_API_VERSION || Api version of the backend || integer ||
+
|-
+
| ODBX_OPT_THREAD_SAFE || Thread safe backend || boolean ||
+
|-
+
| ODBX_OPT_TLS || Encryption (SSL/TLS) support || boolean ||
+
|-
+
| ODBX_OPT_MULTI_STATEMENTS || Multiple statments per query || boolean ||
+
|-
+
| ODBX_OPT_PAGED_RESULTS || Transfer of multiple rows at once || boolean ||
+
|-
+
| ODBX_OPT_COMPRESS || Support of compressed || boolean ||
+
|-
+
| ODBX_OPT_MODE || Backend specific (SQL) mode support || boolean || 1.1.4
+
|}
+
  
= Return values: =
+
; ODBX_OPT_API_VERSION : The API version implemented by the backend. Currently, it returns only zero and is reserved for the future.
 +
; ODBX_OPT_THREAD_SAFE : If it is safe to use this backend and especially the native database client library in an application which uses threads where more than one thread opens database connections via the OpenDBX library
 +
; ODBX_OPT_TLS : The database client library may support encryption via SSL or TLS
 +
; ODBX_OPT_MULTI_STATEMENTS : The database server may be able to support multiple statements in one query sent with [[OpenDBX_query|odbx_query()]]
 +
; ODBX_OPT_PAGED_RESULTS : All database client libraries are able to transfer one row per [[OpenDBX_row_fetch|odbx_row_fetch()]]. Sometimes they can also transfer multiple rows at once to minimize network traffic and latency.
 +
; ODBX_OPT_COMPRESS : Support of compressed transfer
 +
; ODBX_OPT_MODE : Backend specific (SQL) mode support (supported since 1.1.4)
 +
 
 +
= Return values =
  
 
* ODBX_ERR_SUCCESS on success
 
* ODBX_ERR_SUCCESS on success
 
* Less than zero if an error occured
 
* Less than zero if an error occured
  
= Errors: =
+
= Errors =
  
 
* -ODBX_ERR_PARAM: "handle" is NULL or the structure is invalid
 
* -ODBX_ERR_PARAM: "handle" is NULL or the structure is invalid
 
* -ODBX_ERR_OPTION: Unknown option
 
* -ODBX_ERR_OPTION: Unknown option
  
= See also: =
+
= See also =
  
 
* [[OpenDBX_bind]]
 
* [[OpenDBX_bind]]

Revision as of 00:03, 2 March 2007


#include <odbx.h>

int odbx_get_option(
    odbx_t* handle,
    unsigned int option,
    void* value ) 

Description

odbx_get_option() asks the backend module associated to handle by odbx_init() for implemented options and their current values. This function can be used after odbx_init() returned successfully. Its primary use is to find out supported features of the backend module and to enable them with odbx_set_option() before the connection to the database server is established by calling odbx_bind().

The first parameter handle is the connection object created and returned by odbx_init() which becomes invalid as soon as it was supplied to odbx_finish().

There are several options defined as named constants in the odbx.h header file. A few of them are for informational purpose only while most of the options can also be set to different values by odbx_set_option() to change the behavior of the backend module.

value must be a pointer to an integer variable where the backend module will store the result for the supplied option. If it's not stated otherwise, the value assigned to the passed value parameter by odbx_get_option() will be of boolean nature and therefore will only consist of one ("1") for a supported option or zero ("0") for an option which isn't supported.

The available options are:

ODBX_OPT_API_VERSION 
The API version implemented by the backend. Currently, it returns only zero and is reserved for the future.
ODBX_OPT_THREAD_SAFE 
If it is safe to use this backend and especially the native database client library in an application which uses threads where more than one thread opens database connections via the OpenDBX library
ODBX_OPT_TLS 
The database client library may support encryption via SSL or TLS
ODBX_OPT_MULTI_STATEMENTS 
The database server may be able to support multiple statements in one query sent with odbx_query()
ODBX_OPT_PAGED_RESULTS 
All database client libraries are able to transfer one row per odbx_row_fetch(). Sometimes they can also transfer multiple rows at once to minimize network traffic and latency.
ODBX_OPT_COMPRESS 
Support of compressed transfer
ODBX_OPT_MODE 
Backend specific (SQL) mode support (supported since 1.1.4)

Return values

  • ODBX_ERR_SUCCESS on success
  • Less than zero if an error occured

Errors

  • -ODBX_ERR_PARAM: "handle" is NULL or the structure is invalid
  • -ODBX_ERR_OPTION: Unknown option

See also



Back to Overview