libfq 0.6.1 Documentation | |||
---|---|---|---|
Prev | Up | Chapter 4. libfq functions | Next |
The following functions handle connection initiation and termination to/from a Firebird backend server
FQconnect
Simple function to create a connection to a Firebird database providing only the database path, username and password.
FBconn * FQconnect(const char *db_path, const char *uname, const char *upass);
This is a wrapper around FQconnectdbParams
;
see that function for details about error handling.
FQconnectdbParams
Makes a new connection to the database server.
FBconn *FQconnectdbParams(const char * const *keywords, const char * const *values);
This function opens a new database connection using the parameters taken from two NULL-terminated arrays. The first, keywords, is defined as an array of strings, each one being a keyword. The second, values, gives the value for each keyword.
The constant FBCONN_MAX_PARAMS defines the maximum number
of parameters supported by FQconnectdbParams
.
Following keywords are currently supported:
To determine if the connection was successful, call FQstatus
.
If the connection was not successful (CONNECTION_BAD is returned),
an error message containing more details can be retrieved with FQerrorMessage
.
Note that even if the connection was unsuccessful, the connection object should
be deallocated with FQclear
.
FQfinish
Closes the connection to the server. Also frees
memory used by the FBconn object.
Caller must not use the pointer again after FQfinish
has been called.
void FQfinish(FBconn *conn);
FQsetClientMinMessages
Sets the minimum log level (e.g. DEBUG1). See src/libfq.h for a list of valid log level constants.
int FQsetClientMinMessages(FBconn *conn, int log_level)
FQsetClientMinMessagesString
Sets the minimum log level specified by string literal (e.g. "DEBUG1"). See src/libfq.h for a list of valid log level constants.
int FQsetClientMinMessagesString(FBconn *conn, const char *log_level);
FQsetTimeZoneNames
Specify whether time zones stored in TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE columns as time zone names should be returned as-is (e.g. Asia/Tokyo or as numeric time zone offsets (e.g. +09:00).
int FQsetTimeZoneNames(FBconn *conn, bool time_zone_names);
FQsetIsqlValues
Specify whether certain data types (currently: FLOAT and DOUBLE PRECISION) should be displayed in the same way isql would display them.
int FQsetIsqlValues(FBconn *conn, bool isql_values);