<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Driver Infrastructure</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Database Independent Abstraction Layer for C" HREF="index.html"><LINK REL="UP" TITLE="libdbi API Reference" HREF="reference.html"><LINK REL="PREVIOUS" TITLE="Core Library Functions" HREF="reference-core.html"><LINK REL="NEXT" TITLE="Connection Infrastructure" HREF="reference-conn.html"></HEAD ><BODY CLASS="SECTION" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Database Independent Abstraction Layer for C: libdbi Programmer's Guide</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="reference-core.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 4. libdbi API Reference</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="reference-conn.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECTION" ><H1 CLASS="SECTION" ><A NAME="REFERENCE-DRIVER" >4.2. Driver Infrastructure</A ></H1 ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="DBI-DRIVER-LIST" >4.2.1. dbi_driver_list</A ></H2 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN418" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >dbi_driver <B CLASS="FSFUNC" >dbi_driver_list</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Current</VAR >);</CODE ></P ><P ></P ></DIV ><P >Enumerates all loaded drivers. If Current is NULL, the first available driver will be returned. If Current is a valid driver, the next available driver will be returned.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Current</TT >: The current driver in the list of drivers.</P ></DD ><DT >Returns</DT ><DD ><P >The next available driver, or NULL if there is an error or no more are available.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="DBI-DRIVER-OPEN" >4.2.2. dbi_driver_open</A ></H2 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN437" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >dbi_driver <B CLASS="FSFUNC" >dbi_driver_open</B ></CODE >(const char *<VAR CLASS="PDPARAM" >name</VAR >);</CODE ></P ><P ></P ></DIV ><P >Locate the driver with the specified name.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >name</TT >: The name of the driver to open.</P ></DD ><DT >Returns</DT ><DD ><P >The requested driver, or NULL if there is no such driver.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="DBI-DRIVER-IS-RESERVED-WORD" >4.2.3. dbi_driver_is_reserved_word</A ></H2 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN456" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >int <B CLASS="FSFUNC" >dbi_driver_is_reserved_word</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >, const char *<VAR CLASS="PDPARAM" >word</VAR >);</CODE ></P ><P ></P ></DIV ><P >Looks for the specified word in the list of reserved words. The result of this function may vary between databases. Case does not matter.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ><P ><TT CLASS="LITERAL" >word</TT >: The word to check against the reserved word list.</P ></DD ><DT >Returns</DT ><DD ><P >-1 if an error occurs, 0 if the word is not reserved, 1 otherwise.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="DBI-DRIVER-SPECIFIC-FUNCTION" >4.2.4. dbi_driver_specific_function</A ></H2 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN479" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >void *<B CLASS="FSFUNC" >dbi_driver_specific_function</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >, const char *<VAR CLASS="PDPARAM" >name</VAR >);</CODE ></P ><P ></P ></DIV ><P >Returns a function pointer to the specifed custom function. This can be used to access database-specific functionality, but it will restrict your code to one particular database, lessening the benefits of using libdbi.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ><P ><TT CLASS="LITERAL" >name</TT >: The name of the custom function.</P ></DD ><DT >Returns</DT ><DD ><P >If the custom function is found, a pointer to that function. If not, returns NULL.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="DBI-DRIVER-QUOTE-STRING" >4.2.5. dbi_driver_quote_string</A ></H2 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN502" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >int <B CLASS="FSFUNC" >dbi_driver_quote_string</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >, <VAR CLASS="PDPARAM" >char **orig</VAR >);</CODE ></P ><P ></P ></DIV ><P >Encloses the target string in the types of quotes that the database expects, and escapes any special characters. The original string will be freed and <CODE CLASS="PARAMETER" >orig</CODE > will point to a newly allocated one (which you still must free on your own). If an error occurs, the original string will not be freed.</P ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B >This function is deprecated. Use <A HREF="reference-query.html#DBI-CONN-QUOTE-STRING" >dbi_conn_quote_string</A > instead.</P ></BLOCKQUOTE ></DIV ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ><P ><TT CLASS="LITERAL" >orig</TT >: A pointer to the string to quote and escape.</P ></DD ><DT >Returns</DT ><DD ><P >The new string's length in bytes, excluding the terminating zero byte, or 0 in case of an error. The length of a quoted empty string is 2 bytes.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="DBI-DRIVER-QUOTE-STRING-COPY" >4.2.6. dbi_driver_quote_string_copy</A ></H2 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN529" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >int <B CLASS="FSFUNC" >dbi_driver_quote_string_copy</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >, char **<VAR CLASS="PDPARAM" >orig</VAR >, char **<VAR CLASS="PDPARAM" >newstr</VAR >);</CODE ></P ><P ></P ></DIV ><P >Encloses the target string in the types of quotes that the database expects, and escapes any special characters. The original string will be left alone, and <CODE CLASS="PARAMETER" >newstr</CODE > will point to a newly allocated string containing the quoted string (which you still must free on your own). In case of an error, <CODE CLASS="PARAMETER" >newstr</CODE > is an invalid pointer which you must not attempt to deallocate.</P ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B >This function is deprecated. Use <A HREF="reference-query.html#DBI-CONN-QUOTE-STRING-COPY" >dbi_conn_quote_string_copy</A > instead.</P ></BLOCKQUOTE ></DIV ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ><P ><TT CLASS="LITERAL" >orig</TT >: A pointer to the string to quote and escape.</P ><P ><TT CLASS="LITERAL" >newstr</TT >: After the function returns, this pointer will point to the quoted and escaped string.</P ></DD ><DT >Returns</DT ><DD ><P >The quoted string's length in bytes, excluding the terminating zero byte, or 0 in case of an error. The length of a quoted empty string is 2 bytes.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="DBI-DRIVER-ENCODING-FROM-IANA" >4.2.7. dbi_driver_encoding_from_iana</A ></H2 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN561" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_encoding_from_iana</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >, const char *<VAR CLASS="PDPARAM" >iana_encoding</VAR >);</CODE ></P ><P ></P ></DIV ><P >Requests the database engine specific name of the character encoding identified by its name as known to <A HREF="http://www.iana.org" TARGET="_top" >IANA</A >. Use this function to pass the database engine specific encoding name to SQL queries , e.g. as part of a <B CLASS="COMMAND" >CREATE DATABASE</B > command.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ><P ><TT CLASS="LITERAL" >iana_encoding</TT >: The IANA name of the character encoding.</P ></DD ><DT >Returns</DT ><DD ><P >A string containing the database engine specific encoding name. If the encoding name cannot be translated, the IANA name is returned without translation.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="DBI-DRIVER-ENCODING-TO-IANA" >4.2.8. dbi_driver_encoding_to_iana</A ></H2 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN586" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_encoding_to_iana</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >, const char *<VAR CLASS="PDPARAM" >db_encoding</VAR >);</CODE ></P ><P ></P ></DIV ><P >Requests the <A HREF="http://www.iana.org" TARGET="_top" >IANA</A > name of the character encoding identified by its database engine specific name. Use this function to convert the database engine specific name returned by SQL queries to the corresponding common name.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ><P ><TT CLASS="LITERAL" >db_encoding</TT >: The database engine specific name of the character encoding.</P ></DD ><DT >Returns</DT ><DD ><P >A string containing the IANA encoding name. If the encoding name cannot be translated, the database engine specific name is returned without translation.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H2 CLASS="SECTION" ><A NAME="REFERENCE-DRIVER-INFO" >4.2.9. Driver Information</A ></H2 ><DIV CLASS="SECTION" ><H3 CLASS="SECTION" ><A NAME="DBI-DRIVER-GET-NAME" >4.2.9.1. dbi_driver_get_name</A ></H3 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN612" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_get_name</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >);</CODE ></P ><P ></P ></DIV ><P >Requests the name of the specified driver. The calling program must not attempt to free the returned string.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ></DD ><DT >Returns</DT ><DD ><P >A string containing the driver's name.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H3 CLASS="SECTION" ><A NAME="DBI-DRIVER-GET-FILENAME" >4.2.9.2. dbi_driver_get_filename</A ></H3 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN631" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_get_filename</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >);</CODE ></P ><P ></P ></DIV ><P >Requests the filename of the specified driver. The calling program must not attempt to free the returned string.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ></DD ><DT >Returns</DT ><DD ><P >A string containing the driver's full path and file name.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H3 CLASS="SECTION" ><A NAME="DBI-DRIVER-GET-DESCRIPTION" >4.2.9.3. dbi_driver_get_description</A ></H3 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN650" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_get_description</B ></CODE >(dbi_driver Driver);</CODE ></P ><P ></P ></DIV ><P >Requests a description of the specified driver. The calling program must not attempt to free the returned string.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ></DD ><DT >Returns</DT ><DD ><P >A string containing the driver's description. It will be one or two short sentences with no newlines.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H3 CLASS="SECTION" ><A NAME="DBI-DRIVER-GET-MAINTAINER" >4.2.9.4. dbi_driver_get_maintainer</A ></H3 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN668" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_get_maintainer</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >);</CODE ></P ><P ></P ></DIV ><P >Requests the maintainer of the specified driver. The calling program must not attempt to free the returned string.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ></DD ><DT >Returns</DT ><DD ><P >A string containing the driver maintainer's full name and email address.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H3 CLASS="SECTION" ><A NAME="DBI-DRIVER-GET-URL" >4.2.9.5. dbi_driver_get_url</A ></H3 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN687" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_get_url</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >);</CODE ></P ><P ></P ></DIV ><P >Requests the maintainer's URL for the specified driver. This is useful for drivers maintained by a third party. The calling program must not attempt to free the returned string.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H3 CLASS="SECTION" ><A NAME="DBI-DRIVER-GET-VERSION" >4.2.9.6. dbi_driver_get_version</A ></H3 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN702" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_get_version</B ></CODE >(<VAR CLASS="PDPARAM" >dbi_driver Driver</VAR >);</CODE ></P ><P ></P ></DIV ><P >Requests the version of the specified driver. The calling program must not attempt to free the returned string.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ></DD ><DT >Returns</DT ><DD ><P >A string containing the driver's version.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECTION" ><H3 CLASS="SECTION" ><A NAME="DBI-DRIVER-GET-DATE-COMPILED" >4.2.9.7. dbi_driver_get_date_compiled</A ></H3 ><DIV CLASS="FUNCSYNOPSIS" ><P ></P ><A NAME="AEN721" ></A ><P ><CODE ><CODE CLASS="FUNCDEF" >const char *<B CLASS="FSFUNC" >dbi_driver_get_date_compiled</B ></CODE >(dbi_driver <VAR CLASS="PDPARAM" >Driver</VAR >);</CODE ></P ><P ></P ></DIV ><P >Requests the compilation date of the specified driver. The calling program must not attempt to free the returned string.</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >Arguments</DT ><DD ><P ><TT CLASS="LITERAL" >Driver</TT >: The target driver.</P ></DD ><DT >Returns</DT ><DD ><P >A string containing the date the driver was compiled.</P ></DD ></DL ></DIV ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="reference-core.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="reference-conn.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Core Library Functions</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="reference.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Connection Infrastructure</TD ></TR ></TABLE ></DIV ></BODY ></HTML >