OpenDBX/C API/odbx init

From Linuxnetworks
< OpenDBX‎ | C API
Revision as of 18:05, 1 October 2005 by Nose (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


int odbx_init(
    odbx_t** handle,
    const char* backend,
    const char* host,
    const char* port ) 

Description:

Allocates and initializes the opaque object for connecting to the database server. The pointer to the newly created object is stored in handle and it have to be used in all further OpenDBX functions.

Parameters:

  • handle: Pointer where the connection object pointer should be stored
  • backend: Name of the used backend, e.g. mysql, pgsql or sqlite (depends on the installed libraries)
  • host: Host name or ip address of the database server
  • port: Port number the database server is listening

Return values:

  • Zero on success
  • Non-zero if an error occured

Errors:

  • -ODBX_ERR_PARAM: One of the parameters or its content is invalid
  • -ODBX_ERR_NOMEM: Allocating new memory failed
  • -ODBX_ERR_TOOLONG: The length of a string exceeded the buffer size
  • -ODBX_ERR_NOEXIST: Backend library was not found
  • -ODBX_ERR_NOOP: The function does not exist in the backend
  • -1: Any error retured by the backend



Back to Overview