Debian Codegraph @

doc/driver-guide/driverdata.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Driver data</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9 REL="HOME"
10 TITLE="Database Independent Abstraction Layer for C"
11 HREF="index.html"><LINK
12 REL="UP"
13 TITLE="Driver Infrastructure"
14 HREF="driverinfrastructure.html"><LINK
15 REL="PREVIOUS"
16 TITLE="Database directories"
17 HREF="databasedirectories.html"><LINK
18 REL="NEXT"
19 TITLE="Driver Functions"
20 HREF="driverfuncs.html"></HEAD
21 ><BODY
22 CLASS="SECTION"
23 BGCOLOR="#FFFFFF"
24 TEXT="#000000"
25 LINK="#0000FF"
26 VLINK="#840084"
27 ALINK="#0000FF"
28 ><DIV
29 CLASS="NAVHEADER"
30 ><TABLE
31 SUMMARY="Header navigation table"
32 WIDTH="100%"
33 BORDER="0"
34 CELLPADDING="0"
35 CELLSPACING="0"
36 ><TR
37 ><TH
38 COLSPAN="3"
39 ALIGN="center"
40 >Database Independent Abstraction Layer for C: libdbi Driver Author's Guide</TH
41 ></TR
42 ><TR
43 ><TD
44 WIDTH="10%"
45 ALIGN="left"
46 VALIGN="bottom"
47 ><A
48 HREF="databasedirectories.html"
49 ACCESSKEY="P"
50 >Prev</A
51 ></TD
52 ><TD
53 WIDTH="80%"
54 ALIGN="center"
55 VALIGN="bottom"
56 >Chapter 2. Driver Infrastructure</TD
57 ><TD
58 WIDTH="10%"
59 ALIGN="right"
60 VALIGN="bottom"
61 ><A
62 HREF="driverfuncs.html"
63 ACCESSKEY="N"
64 >Next</A
65 ></TD
66 ></TR
67 ></TABLE
68 ><HR
69 ALIGN="LEFT"
70 WIDTH="100%"></DIV
71 ><DIV
72 CLASS="SECTION"
73 ><H1
74 CLASS="SECTION"
75 ><A
76 NAME="DRIVERDATA"
77 >2.3. Driver data</A
78 ></H1
79 ><P
80 >Each driver has to declare two global string arrays which are queried by libdbi. They provide a list of driver-specific functions and a list of reserved words. Both string arrays must be declared even if they are empty.</P
81 ><DIV
82 CLASS="SECTION"
83 ><H2
84 CLASS="SECTION"
85 ><A
86 NAME="DRIVERSPECIFICFUNCTIONS"
87 >2.3.1. Driver specific functions</A
88 ></H2
89 ><P
90 >libdbi was designed to provide access to a variety of database engines using a single common interface. However, database engines may have client library APIs weird enough to make them badly suited for libdbi. A driver may therefore have to provide additional functions which are specific to this driver. Also, it may be useful to provide access to database engine specific functions (i.e. functions of the database engine client library) if their usage is not covered by the libdbi interface.</P
91 ><P
92 >The following line defines a string array with two representative function names. Please note that the string array must be terminated with a NULL string. This holds true even if the driver does not export any custom functions.</P
93 ><TABLE
94 BORDER="0"
95 BGCOLOR="#E0E0E0"
96 WIDTH="100%"
97 ><TR
98 ><TD
99 ><FONT
100 COLOR="#000000"
101 ><PRE
102 CLASS="PROGRAMLISTING"
103 >static const char *<CODE
104 CLASS="VARNAME"
105 >custom_functions</CODE
106 >[] = {"foo", "bar", NULL};</PRE
107 ></FONT
108 ></TD
109 ></TR
110 ></TABLE
111 ><DIV
112 CLASS="NOTE"
113 ><BLOCKQUOTE
114 CLASS="NOTE"
115 ><P
116 ><B
117 >Note: </B
118 >libdbi internally attempts to create pointers to the named functions. It is not considered an error if the symbol is missing, so it is safe to provide the names of functions which are not present in all versions of a client library. Creating pointers may also fail if functions are implemented as macros by the client library.</P
119 ></BLOCKQUOTE
120 ></DIV
121 ></DIV
122 ><DIV
123 CLASS="SECTION"
124 ><H2
125 CLASS="SECTION"
126 ><A
127 NAME="AEN138"
128 >2.3.2. Reserved words</A
129 ></H2
130 ><P
131 >Database engines use different implementations of the SQL standard. Some language features of the SQL standard may not be supported, whereas some engines implement language features which are not part of the standard. In order to avoid conflicts between e.g. table or column names and "reserved words" (i.e. words which a specific SQL implementation considers part of the language), libdbi provides a function to find out at runtime whether or not a word is a reserved word. Each driver therefore has to provide such a list of reserved words. Again, the string array used to provide this list must be terminated by a NULL string:</P
132 ><TABLE
133 BORDER="0"
134 BGCOLOR="#E0E0E0"
135 WIDTH="100%"
136 ><TR
137 ><TD
138 ><FONT
139 COLOR="#000000"
140 ><PRE
141 CLASS="PROGRAMLISTING"
142 >static const char *<CODE
143 CLASS="VARNAME"
144 >reserved_words</CODE
145 >[] = {"foo", "bar", NULL};</PRE
146 ></FONT
147 ></TD
148 ></TR
149 ></TABLE
150 ></DIV
151 ></DIV
152 ><DIV
153 CLASS="NAVFOOTER"
154 ><HR
155 ALIGN="LEFT"
156 WIDTH="100%"><TABLE
157 SUMMARY="Footer navigation table"
158 WIDTH="100%"
159 BORDER="0"
160 CELLPADDING="0"
161 CELLSPACING="0"
162 ><TR
163 ><TD
164 WIDTH="33%"
165 ALIGN="left"
166 VALIGN="top"
167 ><A
168 HREF="databasedirectories.html"
169 ACCESSKEY="P"
170 >Prev</A
171 ></TD
172 ><TD
173 WIDTH="34%"
174 ALIGN="center"
175 VALIGN="top"
176 ><A
177 HREF="index.html"
178 ACCESSKEY="H"
179 >Home</A
180 ></TD
181 ><TD
182 WIDTH="33%"
183 ALIGN="right"
184 VALIGN="top"
185 ><A
186 HREF="driverfuncs.html"
187 ACCESSKEY="N"
188 >Next</A
189 ></TD
190 ></TR
191 ><TR
192 ><TD
193 WIDTH="33%"
194 ALIGN="left"
195 VALIGN="top"
196 >Database directories</TD
197 ><TD
198 WIDTH="34%"
199 ALIGN="center"
200 VALIGN="top"
201 ><A
202 HREF="driverinfrastructure.html"
203 ACCESSKEY="U"
204 >Up</A
205 ></TD
206 ><TD
207 WIDTH="33%"
208 ALIGN="right"
209 VALIGN="top"
210 >Driver Functions</TD
211 ></TR
212 ></TABLE
213 ></DIV
214 ></BODY
215 ></HTML
216 >