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

From Linuxnetworks
< OpenDBX‎ | C API
Jump to: navigation, search
(Return values:)
(Errors:)
Line 24: Line 24:
 
'''odbx_get_option()''' returns ODBX_ERR_SUCCESS, or an error code whose value is less than zero if one of the operations couldn't be completed successfully. Possible error codes are listed in the error section and they can be feed to [[OpenDBX_error|odbx_error()]] and [[OpenDBX_error_type|odbx_error_type()]] to get further details.
 
'''odbx_get_option()''' returns ODBX_ERR_SUCCESS, or an error code whose value is less than zero if one of the operations couldn't be completed successfully. Possible error codes are listed in the error section and they can be feed to [[OpenDBX_error|odbx_error()]] and [[OpenDBX_error_type|odbx_error_type()]] to get further details.
  
= Errors: =
+
= Errors =
  
* -ODBX_ERR_BACKEND: Any error returned by the backend
+
* -ODBX_ERR_BACKEND: The native database library returned an error because it wasn't able to handle the query statement correctly
* -ODBX_ERR_PARAM: "handle" or query string are NULL or the structure is invalid
+
; -ODBX_ERR_PARAM : Either '''handle''' or the query string are NULL or '''handle''' is invalid
* -ODBX_ERR_NOMEM: Allocating new memory failed
+
* -ODBX_ERR_NOMEM: Allocating the required memory for the query string failed
  
 
= See also: =
 
= See also: =

Revision as of 22:32, 9 March 2007


#include <odbx.h>

int odbx_query(
    odbx_t* handle,
    const char* query,
    unsigned long length )

Description:

Sends a query string to the database server which must be terminated by a \0 character. Some backends support multiple statements per query, which can be tested by calling odbx_get_option().

After invoking odbx_query(), the results sent back by the server are available via the odbx_result() function.

Parameters:

  • handle: Connection object created by odbx_init()
  • query: String terminated by \0 consisting of one or more statements
  • length: Length of the query string without the terminating \0 character

Return values

odbx_get_option() returns ODBX_ERR_SUCCESS, or an error code whose value is less than zero if one of the operations couldn't be completed successfully. Possible error codes are listed in the error section and they can be feed to odbx_error() and odbx_error_type() to get further details.

Errors

  • -ODBX_ERR_BACKEND: The native database library returned an error because it wasn't able to handle the query statement correctly
-ODBX_ERR_PARAM 
Either handle or the query string are NULL or handle is invalid
  • -ODBX_ERR_NOMEM: Allocating the required memory for the query string failed

See also:



Back to Overview