Difference between revisions of "OpenDBX/C API/odbx bind"

From Linuxnetworks
< OpenDBX‎ | C API
Jump to: navigation, search
(header)
(Description)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
'''Available since release 1.1.1'''
 
  
 
  '''#include <odbx.h>'''
 
  '''#include <odbx.h>'''
Line 11: Line 9:
 
     const char* '''cred''',
 
     const char* '''cred''',
 
     int '''method''' )  
 
     int '''method''' )  
 +
 +
int '''odbx_bind_simple'''(
 +
    odbx_t* '''handle''',
 +
    const char* '''database''',
 +
    const char* '''username''',
 +
    const char* '''password''' )
 +
 +
= Description =
 +
 +
'''odbx_bind()''' associates a connection created by [[OpenDBX_init|odbx_init()]] to a specific database instance after the server verified and accepted the authentication details. All further operations will (normally) only affect the tables and records within this database instance. They may be limited to certain subset depending on the privileges granted to the given user account. If binding to the database instance succeeded, '''odbx_bind()''' also enables compatibility to the ANSI SQL standard if this is possible for the database server implementation.
  
= Description: =
+
'''odbx_bind_simple()''' performs the same tasks as '''odbx_bind()''' but can't do anything else than simple username/password authentication. It shouldn't be used in applications linking to the OpenDBX library version 1.1.1 or later and it will be removed from the library at a later stage.
  
Opens the database located on the database server specified in [[OpenDBX_init|odbx_init()]]. The authentication is done by using the specified method and the given credentials which may be NULL if they are not used by the backend. If any options should be set by [[OpenDBX_set_option|odbx_set_option()]], it must be done before calling this function.
+
If any options should be set by [[OpenDBX_set_option|odbx_set_option()]], it must be done before calling this function.
  
 
Rebinding with other parameter and options can be performed by calling this function again after invoking [[OpenDBX_unbind|odbx_unbind()]] before.
 
Rebinding with other parameter and options can be performed by calling this function again after invoking [[OpenDBX_unbind|odbx_unbind()]] before.
  
= Parameters: =
+
= Parameters =
  
 
* handle: Connection object created by [[OpenDBX_init|odbx_init()]]
 
* handle: Connection object created by [[OpenDBX_init|odbx_init()]]
Line 26: Line 34:
 
* method: Authentication method used for login (currently only ODBX_BIND_SIMPLE)
 
* method: Authentication method used for login (currently only ODBX_BIND_SIMPLE)
  
= Errors: =
+
= Errors =
  
 
* -ODBX_ERR_BACKEND: Any error occured in the backend
 
* -ODBX_ERR_BACKEND: Any error occured in the backend
Line 33: Line 41:
 
* -ODBX_ERR_TOOLONG: The length of a string exceeded the buffer size
 
* -ODBX_ERR_TOOLONG: The length of a string exceeded the buffer size
  
= See also: =
+
= See also =
  
 
* [[OpenDBX_error]]
 
* [[OpenDBX_error]]

Revision as of 17:49, 18 February 2007


#include <odbx.h>

int odbx_bind(
    odbx_t* handle,
    const char* database,
    const char* who,
    const char* cred,
    int method ) 

int odbx_bind_simple(
    odbx_t* handle,
    const char* database,
    const char* username,
    const char* password )

Description

odbx_bind() associates a connection created by odbx_init() to a specific database instance after the server verified and accepted the authentication details. All further operations will (normally) only affect the tables and records within this database instance. They may be limited to certain subset depending on the privileges granted to the given user account. If binding to the database instance succeeded, odbx_bind() also enables compatibility to the ANSI SQL standard if this is possible for the database server implementation.

odbx_bind_simple() performs the same tasks as odbx_bind() but can't do anything else than simple username/password authentication. It shouldn't be used in applications linking to the OpenDBX library version 1.1.1 or later and it will be removed from the library at a later stage.

If any options should be set by odbx_set_option(), it must be done before calling this function.

Rebinding with other parameter and options can be performed by calling this function again after invoking odbx_unbind() before.

Parameters

  • handle: Connection object created by odbx_init()
  • database: Name of the database
  • who: User to connect to the database
  • cred: Password string for authentication
  • method: Authentication method used for login (currently only ODBX_BIND_SIMPLE)

Errors

  • -ODBX_ERR_BACKEND: Any error occured in the backend
  • -ODBX_ERR_PARAM: One of the parameters is NULL or handle is invalid
  • -ODBX_ERR_NOMEM: Allocating new memory failed
  • -ODBX_ERR_TOOLONG: The length of a string exceeded the buffer size

See also



Back to Overview