1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
>Public Database Query Functions</TITLE
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10
TITLE="Database Independent Abstraction Layer for C"
11
HREF="index.html"><LINK
13
TITLE="Driver Functions"
14
HREF="driverfuncs.html"><LINK
16
TITLE="Internal Database Query Functions"
17
HREF="driverfuncs-dbquery.html"><LINK
19
TITLE="DBD Helper Functions"
20
HREF="helperfuncs.html"></HEAD
31
SUMMARY="Header navigation table"
40
>Database Independent Abstraction Layer for C: libdbi Driver Author's Guide</TH
48
HREF="driverfuncs-dbquery.html"
56
>Chapter 2. Driver Functions</TD
62
HREF="helperfuncs.html"
76
NAME="DRIVERFUNCS-PUBLICDBQUERY"
77
>2.3. Public Database Query Functions</A
84
NAME="DBD-GET-ENCODING"
85
>2.3.1. dbd_get_encoding</A
111
>Returns the character encoding used by the current connection.</P
124
>: The target connection.</P
130
>A zero-terminated string containing the IANA name of the character encoding.</P
140
NAME="DBD-ENCODING-TO-IANA"
141
>2.3.2. dbd_encoding_to_iana</A
156
>dbd_encoding_to_iana</B
167
>Converts the database-engine-specific name of a character encoding to the corresponging IANA name.</P
180
>: A pointer to a string containing the character encoding name.</P
186
>A zero-terminated string containing the IANA name of the character encoding. If there is no equivalent IANA name, the original string will be returned.</P
196
NAME="DBD-ENCODING-FROM-IANA"
197
>2.3.3. dbd_encoding_from_iana</A
212
>dbd_encoding_from_iana</B
223
>Converts the IANA name of a character encoding to the corresponging database-engine-specific name.</P
236
>: A pointer to a string containing the character encoding name.</P
242
>A zero-terminated string containing the database-engine-specific name of the character encoding. If there is no equivalent IANA name, the original string will be returned.</P
252
NAME="DBD-GET-ENGINE-VERSION"
253
>2.3.4. dbd_get_engine_version</A
268
>dbd_get_engine_version</B
282
>Returns the version string of the database engine that serves the current connection.</P
295
>: The current connection.</P
300
>: A pointer to a string that can hold at least VERSIONSTRING_LENGTH bytes, including the trailing NULL byte. The function will write the version string to this buffer.</P
309
> which now contains a zero-terminated string representing the database engine version. This string contains only digits and periods. Returns an empty string in case of an error.</P
320
>2.3.5. dbd_list_dbs</A
349
>Performs a query that retrieves the list of databases, with the database name as the first column in the result set. If <CODE
352
> is non-NULL, only databases whose name match <CODE
368
>: The target connection.</P
373
>: A SQL regular expression that limits the search, or NULL to list all tables.</P
379
>A DBI result object, or NULL if an error occurs.</P
389
NAME="DBD-LIST-TABLES"
390
>2.3.6. dbd_list_tables</A
422
>Performs a query that retrieves the list of tables in the specified database, with the table name as the first column in the result set. If <CODE
425
> is non-NULL, lists only the tables that match <CODE
441
>: The target connection.</P
446
>: The name of the database where tables should be looked for.</P
451
>: A SQL regular expression that limits the search, or NULL to list all tables.</P
457
>A DBI result object, or NULL if an error occurs.</P
467
NAME="DBD-QUOTE-STRING"
468
>2.3.7. dbd_quote_string</A
500
>Given a string, wrap quotes around that string and escape any characters that the database server needs escaped.</P
508
>The use of this function in user programs is deprecated, but drivers must still implement it at the moment. If the quoting and escaping does not depend on the connection parameters, it is perfectly legal to let your implementation of <A
509
HREF="driverfuncs-publicdbquery.html#DBD-CONN-QUOTE-STRING"
510
>dbd_conn_quote_string</A
511
> call this function (it is not possible to do it the other way). libdbi makes sure that both <CODE
517
> are non-NULL before calling this function.</P
532
>: A pointer to the driver itself, which may be useful in weird cases.</P
537
>: The string to quote and escape.</P
542
>: The destination for the new string, which is already allocated as (strlen(orig)*2)+4+1. In the worst case, each character will need to be escaped, with two quote characters at both the beginning and end of the string, plus one for the terminating NULL.</P
548
>The length of the new string.</P
558
NAME="DBD-CONN-QUOTE-STRING"
559
>2.3.8. dbd_conn_quote_string</A
574
>dbd_conn_quote_string</B
591
>Given a string, wrap quotes around that string and escape any characters that the database server needs escaped.</P
599
>The use of this function in user programs is preferred over <A
600
HREF="driverfuncs-publicdbquery.html#DBD-QUOTE-STRING"
602
>. If the quoting and escaping does not depend on the connection parameters, it is perfectly legal to let your implementation of this function call <A
603
HREF="driverfuncs-publicdbquery.html#DBD-QUOTE-STRING"
605
>. libdbi makes sure that both <CODE
611
> are non-NULL before calling this function.</P
626
>: A pointer to the current connection.</P
631
>: The string to quote and escape.</P
636
>: The destination for the new string, which is already allocated as (strlen(orig)*2)+4+1. In the worst case, each character will need to be escaped, with two quote characters at both the beginning and end of the string, plus one for the terminating NULL.</P
642
>The length of the new string.</P
652
NAME="DBD-QUOTE-BINARY"
653
>2.3.9. dbd_quote_binary</A
688
>Given a binary string (which may contain NULL bytes and other non-printable characters), wrap quotes around that string and escape any characters that the database server needs escaped. If the function returns an error, *<CODE
691
> is not a valid pointer to a string.</P
704
>: A pointer to the current connection.</P
709
>: The string to quote and escape.</P
714
>: The length, in bytes, of the binary string.</P
719
>: A pointer to the destination of the new zero-terminated string. The function allocates the required memory as required and updates the pointer that <CODE
722
> points to accordingly.</P
728
>The length of the new string, or DBI_LENGTH_ERROR in case of an error.</P
739
>2.3.10. dbd_query</A
768
>Performs a query and keeps track of meta-information about the query. Also see the <A
769
HREF="helperfuncs.html#INTERNAL-DBD-RESULT-CREATE"
770
>_dbd_result_create</A
771
> helper function.</P
784
>: The target connection.</P
789
>: The zero-terminated query string to execute.</P
795
>A DBI result object, or NULL on error.</P
805
NAME="DBD-QUERY-NULL"
806
>2.3.11. dbd_query_null</A
826
>, const unsigned char *<VAR
838
>Performs a query using a binary query string and keeps track of meta-information about the query. Also see the <A
839
HREF="helperfuncs.html#INTERNAL-DBD-RESULT-CREATE"
840
>_dbd_result_create</A
841
> helper function.</P
854
>: The target connection.</P
859
>: The query string to execute, which may contain NULL bytes and other non-printable characters.</P
864
>: The length of the binary query string.</P
870
>A DBI result object, or NULL on error.</P
881
>2.3.12. dbd_select_db</A
910
>Selects a new database on the server.</P
923
>: The target connection.</P
928
>: The name of the database to switch to.</P
934
>The database name on success, NULL on error, or an empty string if the operation is not supported by the database server.</P
944
NAME="DBD-GET-SEQ-LAST"
945
>2.3.13. dbd_get_seq_last</A
958
>unsigned long long <B
974
>Returns the row ID generated by the last <B
990
>: The target connection.</P
995
>: The name of the sequence if the database engine requires this, or NULL if it is not required.</P
1001
>The row ID if successful, otherwise 0.</P
1011
NAME="DBD-GET-SEQ-NEXT"
1012
>2.3.14. dbd_get_seq_next</A
1015
CLASS="FUNCSYNOPSIS"
1025
>unsigned long long <B
1027
>dbd_get_seq_next</B
1041
>Increments the sequence counter by the preset increment, and returns the resulting row ID.</P
1045
CLASS="VARIABLELIST"
1054
>: The target connection.</P
1059
>: The name of the sequence if the database engine requires this, or NULL if it is not required.</P
1065
>The row ID if successful, otherwise 0. Also return 0 if the database engine does not implement this feature.</P
1076
>2.3.15. dbd_ping</A
1079
CLASS="FUNCSYNOPSIS"
1102
>Checks whether the database connection is still alive.</P
1106
CLASS="VARIABLELIST"
1115
>: The target connection.</P
1121
>1 if the connection is alive, otherwise 0. This function may be implemented such that it automatically attempts to reconnect if the connection went down. If the reconnect is successful, the function should also return 1.</P
1132
SUMMARY="Footer navigation table"
1143
HREF="driverfuncs-dbquery.html"
1161
HREF="helperfuncs.html"
1171
>Internal Database Query Functions</TD
1177
HREF="driverfuncs.html"
1185
>DBD Helper Functions</TD
b'\\ No newline at end of file'