Debian Codegraph @

doc/driver-guide/driverfuncs-publicdbquery.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 >Public Database Query Functions</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 Functions"
14 HREF="driverfuncs.html"><LINK
15 REL="PREVIOUS"
16 TITLE="Internal Database Query Functions"
17 HREF="driverfuncs-dbquery.html"><LINK
18 REL="NEXT"
19 TITLE="DBD Helper Functions"
20 HREF="helperfuncs.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="driverfuncs-dbquery.html"
49 ACCESSKEY="P"
50 >Prev</A
51 ></TD
52 ><TD
53 WIDTH="80%"
54 ALIGN="center"
55 VALIGN="bottom"
56 >Chapter 3. Driver Functions</TD
57 ><TD
58 WIDTH="10%"
59 ALIGN="right"
60 VALIGN="bottom"
61 ><A
62 HREF="helperfuncs.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="DRIVERFUNCS-PUBLICDBQUERY"
77 >3.3. Public Database Query Functions</A
78 ></H1
79 ><DIV
80 CLASS="SECTION"
81 ><H2
82 CLASS="SECTION"
83 ><A
84 NAME="DBD-GET-ENCODING"
85 >3.3.1. dbd_get_encoding</A
86 ></H2
87 ><DIV
88 CLASS="FUNCSYNOPSIS"
89 ><P
90 ></P
91 ><A
92 NAME="AEN352"
93 ></A
94 ><P
95 ><CODE
96 ><CODE
97 CLASS="FUNCDEF"
98 >const char *<B
99 CLASS="FSFUNC"
100 >dbd_get_encoding</B
101 ></CODE
102 >(dbi_conn_t *<VAR
103 CLASS="PDPARAM"
104 >conn</VAR
105 >);</CODE
106 ></P
107 ><P
108 ></P
109 ></DIV
110 ><P
111 >Returns the character encoding used by the current connection.</P
112 ><P
113 ></P
114 ><DIV
115 CLASS="VARIABLELIST"
116 ><DL
117 ><DT
118 >Arguments</DT
119 ><DD
120 ><P
121 ><TT
122 CLASS="LITERAL"
123 >conn</TT
124 >: The target connection.</P
125 ></DD
126 ><DT
127 >Returns</DT
128 ><DD
129 ><P
130 >A zero-terminated string containing the IANA name of the character encoding.</P
131 ></DD
132 ></DL
133 ></DIV
134 ></DIV
135 ><DIV
136 CLASS="SECTION"
137 ><H2
138 CLASS="SECTION"
139 ><A
140 NAME="DBD-ENCODING-TO-IANA"
141 >3.3.2. dbd_encoding_to_iana</A
142 ></H2
143 ><DIV
144 CLASS="FUNCSYNOPSIS"
145 ><P
146 ></P
147 ><A
148 NAME="AEN371"
149 ></A
150 ><P
151 ><CODE
152 ><CODE
153 CLASS="FUNCDEF"
154 >const char *<B
155 CLASS="FSFUNC"
156 >dbd_encoding_to_iana</B
157 ></CODE
158 >(const char *<VAR
159 CLASS="PDPARAM"
160 >db_encoding</VAR
161 >);</CODE
162 ></P
163 ><P
164 ></P
165 ></DIV
166 ><P
167 >Converts the database-engine-specific name of a character encoding to the corresponging IANA name.</P
168 ><P
169 ></P
170 ><DIV
171 CLASS="VARIABLELIST"
172 ><DL
173 ><DT
174 >Arguments</DT
175 ><DD
176 ><P
177 ><TT
178 CLASS="LITERAL"
179 >db_encoding</TT
180 >: A pointer to a string containing the character encoding name.</P
181 ></DD
182 ><DT
183 >Returns</DT
184 ><DD
185 ><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
187 ></DD
188 ></DL
189 ></DIV
190 ></DIV
191 ><DIV
192 CLASS="SECTION"
193 ><H2
194 CLASS="SECTION"
195 ><A
196 NAME="DBD-ENCODING-FROM-IANA"
197 >3.3.3. dbd_encoding_from_iana</A
198 ></H2
199 ><DIV
200 CLASS="FUNCSYNOPSIS"
201 ><P
202 ></P
203 ><A
204 NAME="AEN390"
205 ></A
206 ><P
207 ><CODE
208 ><CODE
209 CLASS="FUNCDEF"
210 >const char *<B
211 CLASS="FSFUNC"
212 >dbd_encoding_from_iana</B
213 ></CODE
214 >(const char *<VAR
215 CLASS="PDPARAM"
216 >iana_encoding</VAR
217 >);</CODE
218 ></P
219 ><P
220 ></P
221 ></DIV
222 ><P
223 >Converts the IANA name of a character encoding to the corresponging database-engine-specific name.</P
224 ><P
225 ></P
226 ><DIV
227 CLASS="VARIABLELIST"
228 ><DL
229 ><DT
230 >Arguments</DT
231 ><DD
232 ><P
233 ><TT
234 CLASS="LITERAL"
235 >iana_encoding</TT
236 >: A pointer to a string containing the character encoding name.</P
237 ></DD
238 ><DT
239 >Returns</DT
240 ><DD
241 ><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
243 ></DD
244 ></DL
245 ></DIV
246 ></DIV
247 ><DIV
248 CLASS="SECTION"
249 ><H2
250 CLASS="SECTION"
251 ><A
252 NAME="DBD-GET-ENGINE-VERSION"
253 >3.3.4. dbd_get_engine_version</A
254 ></H2
255 ><DIV
256 CLASS="FUNCSYNOPSIS"
257 ><P
258 ></P
259 ><A
260 NAME="AEN409"
261 ></A
262 ><P
263 ><CODE
264 ><CODE
265 CLASS="FUNCDEF"
266 >char *<B
267 CLASS="FSFUNC"
268 >dbd_get_engine_version</B
269 ></CODE
270 >(dbi_conn_t *<VAR
271 CLASS="PDPARAM"
272 >conn</VAR
273 >, char *<VAR
274 CLASS="PDPARAM"
275 >versionstring</VAR
276 >);</CODE
277 ></P
278 ><P
279 ></P
280 ></DIV
281 ><P
282 >Returns the version string of the database engine that serves the current connection.</P
283 ><P
284 ></P
285 ><DIV
286 CLASS="VARIABLELIST"
287 ><DL
288 ><DT
289 >Arguments</DT
290 ><DD
291 ><P
292 ><TT
293 CLASS="LITERAL"
294 >conn</TT
295 >: The current connection.</P
296 ><P
297 ><TT
298 CLASS="LITERAL"
299 >versionstring</TT
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
301 ></DD
302 ><DT
303 >Returns</DT
304 ><DD
305 ><P
306 ><CODE
307 CLASS="PARAMETER"
308 >versionstring</CODE
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
310 ></DD
311 ></DL
312 ></DIV
313 ></DIV
314 ><DIV
315 CLASS="SECTION"
316 ><H2
317 CLASS="SECTION"
318 ><A
319 NAME="DBD-LIST-DBS"
320 >3.3.5. dbd_list_dbs</A
321 ></H2
322 ><DIV
323 CLASS="FUNCSYNOPSIS"
324 ><P
325 ></P
326 ><A
327 NAME="AEN433"
328 ></A
329 ><P
330 ><CODE
331 ><CODE
332 CLASS="FUNCDEF"
333 >dbi_result_t *<B
334 CLASS="FSFUNC"
335 >dbd_list_dbs</B
336 ></CODE
337 >(dbi_conn_t *<VAR
338 CLASS="PDPARAM"
339 >conn</VAR
340 >, const char *<VAR
341 CLASS="PDPARAM"
342 >pattern</VAR
343 >);</CODE
344 ></P
345 ><P
346 ></P
347 ></DIV
348 ><P
349 >Performs a query that retrieves the list of databases, with the database name as the first column in the result set. If <CODE
350 CLASS="PARAMETER"
351 >pattern</CODE
352 > is non-NULL, only databases whose name match <CODE
353 CLASS="PARAMETER"
354 >pattern</CODE
355 > are listed.</P
356 ><P
357 ></P
358 ><DIV
359 CLASS="VARIABLELIST"
360 ><DL
361 ><DT
362 >Arguments</DT
363 ><DD
364 ><P
365 ><TT
366 CLASS="LITERAL"
367 >conn</TT
368 >: The target connection.</P
369 ><P
370 ><TT
371 CLASS="LITERAL"
372 >pattern</TT
373 >: A SQL regular expression that limits the search, or NULL to list all tables.</P
374 ></DD
375 ><DT
376 >Returns</DT
377 ><DD
378 ><P
379 >A DBI result object, or NULL if an error occurs.</P
380 ></DD
381 ></DL
382 ></DIV
383 ></DIV
384 ><DIV
385 CLASS="SECTION"
386 ><H2
387 CLASS="SECTION"
388 ><A
389 NAME="DBD-LIST-TABLES"
390 >3.3.6. dbd_list_tables</A
391 ></H2
392 ><DIV
393 CLASS="FUNCSYNOPSIS"
394 ><P
395 ></P
396 ><A
397 NAME="AEN458"
398 ></A
399 ><P
400 ><CODE
401 ><CODE
402 CLASS="FUNCDEF"
403 >dbi_result_t *<B
404 CLASS="FSFUNC"
405 >dbd_list_tables</B
406 ></CODE
407 >(dbi_conn_t *<VAR
408 CLASS="PDPARAM"
409 >conn</VAR
410 >, const char *<VAR
411 CLASS="PDPARAM"
412 >db</VAR
413 >, const char *<VAR
414 CLASS="PDPARAM"
415 >pattern</VAR
416 >);</CODE
417 ></P
418 ><P
419 ></P
420 ></DIV
421 ><P
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
423 CLASS="PARAMETER"
424 >pattern</CODE
425 > is non-NULL, lists only the tables that match <CODE
426 CLASS="PARAMETER"
427 >pattern</CODE
428 >.</P
429 ><P
430 ></P
431 ><DIV
432 CLASS="VARIABLELIST"
433 ><DL
434 ><DT
435 >Arguments</DT
436 ><DD
437 ><P
438 ><TT
439 CLASS="LITERAL"
440 >conn</TT
441 >: The target connection.</P
442 ><P
443 ><TT
444 CLASS="LITERAL"
445 >db</TT
446 >: The name of the database where tables should be looked for.</P
447 ><P
448 ><TT
449 CLASS="LITERAL"
450 >pattern</TT
451 >: A SQL regular expression that limits the search, or NULL to list all tables.</P
452 ></DD
453 ><DT
454 >Returns</DT
455 ><DD
456 ><P
457 >A DBI result object, or NULL if an error occurs.</P
458 ></DD
459 ></DL
460 ></DIV
461 ></DIV
462 ><DIV
463 CLASS="SECTION"
464 ><H2
465 CLASS="SECTION"
466 ><A
467 NAME="DBD-QUOTE-STRING"
468 >3.3.7. dbd_quote_string</A
469 ></H2
470 ><DIV
471 CLASS="FUNCSYNOPSIS"
472 ><P
473 ></P
474 ><A
475 NAME="AEN487"
476 ></A
477 ><P
478 ><CODE
479 ><CODE
480 CLASS="FUNCDEF"
481 >size_t <B
482 CLASS="FSFUNC"
483 >dbd_quote_string</B
484 ></CODE
485 >(dbi_driver_t *<VAR
486 CLASS="PDPARAM"
487 >driver</VAR
488 >, const char *<VAR
489 CLASS="PDPARAM"
490 >orig</VAR
491 >, char *<VAR
492 CLASS="PDPARAM"
493 >dest</VAR
494 >);</CODE
495 ></P
496 ><P
497 ></P
498 ></DIV
499 ><P
500 >Given a string, wrap quotes around that string and escape any characters that the database server needs escaped.</P
501 ><DIV
502 CLASS="NOTE"
503 ><BLOCKQUOTE
504 CLASS="NOTE"
505 ><P
506 ><B
507 >Note: </B
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
512 CLASS="PARAMETER"
513 >orig</CODE
514 > and <CODE
515 CLASS="PARAMETER"
516 >dest</CODE
517 > are non-NULL before calling this function.</P
518 ></BLOCKQUOTE
519 ></DIV
520 ><P
521 ></P
522 ><DIV
523 CLASS="VARIABLELIST"
524 ><DL
525 ><DT
526 >Arguments</DT
527 ><DD
528 ><P
529 ><TT
530 CLASS="LITERAL"
531 >driver</TT
532 >: A pointer to the driver itself, which may be useful in weird cases.</P
533 ><P
534 ><TT
535 CLASS="LITERAL"
536 >orig</TT
537 >: The string to quote and escape.</P
538 ><P
539 ><TT
540 CLASS="LITERAL"
541 >dest</TT
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
543 ></DD
544 ><DT
545 >Returns</DT
546 ><DD
547 ><P
548 >The length of the new string.</P
549 ></DD
550 ></DL
551 ></DIV
552 ></DIV
553 ><DIV
554 CLASS="SECTION"
555 ><H2
556 CLASS="SECTION"
557 ><A
558 NAME="DBD-CONN-QUOTE-STRING"
559 >3.3.8. dbd_conn_quote_string</A
560 ></H2
561 ><DIV
562 CLASS="FUNCSYNOPSIS"
563 ><P
564 ></P
565 ><A
566 NAME="AEN519"
567 ></A
568 ><P
569 ><CODE
570 ><CODE
571 CLASS="FUNCDEF"
572 >size_t <B
573 CLASS="FSFUNC"
574 >dbd_conn_quote_string</B
575 ></CODE
576 >(dbi_conn_t *<VAR
577 CLASS="PDPARAM"
578 >conn</VAR
579 >, const char *<VAR
580 CLASS="PDPARAM"
581 >orig</VAR
582 >, char *<VAR
583 CLASS="PDPARAM"
584 >dest</VAR
585 >);</CODE
586 ></P
587 ><P
588 ></P
589 ></DIV
590 ><P
591 >Given a string, wrap quotes around that string and escape any characters that the database server needs escaped.</P
592 ><DIV
593 CLASS="NOTE"
594 ><BLOCKQUOTE
595 CLASS="NOTE"
596 ><P
597 ><B
598 >Note: </B
599 >The use of this function in user programs is preferred over <A
600 HREF="driverfuncs-publicdbquery.html#DBD-QUOTE-STRING"
601 >dbd_quote_string</A
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"
604 >dbd_quote_string</A
605 >. libdbi makes sure that both <CODE
606 CLASS="PARAMETER"
607 >orig</CODE
608 > and <CODE
609 CLASS="PARAMETER"
610 >dest</CODE
611 > are non-NULL before calling this function.</P
612 ></BLOCKQUOTE
613 ></DIV
614 ><P
615 ></P
616 ><DIV
617 CLASS="VARIABLELIST"
618 ><DL
619 ><DT
620 >Arguments</DT
621 ><DD
622 ><P
623 ><TT
624 CLASS="LITERAL"
625 >conn</TT
626 >: A pointer to the current connection.</P
627 ><P
628 ><TT
629 CLASS="LITERAL"
630 >orig</TT
631 >: The string to quote and escape.</P
632 ><P
633 ><TT
634 CLASS="LITERAL"
635 >dest</TT
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
637 ></DD
638 ><DT
639 >Returns</DT
640 ><DD
641 ><P
642 >The length of the new string.</P
643 ></DD
644 ></DL
645 ></DIV
646 ></DIV
647 ><DIV
648 CLASS="SECTION"
649 ><H2
650 CLASS="SECTION"
651 ><A
652 NAME="DBD-QUOTE-BINARY"
653 >3.3.9. dbd_quote_binary</A
654 ></H2
655 ><DIV
656 CLASS="FUNCSYNOPSIS"
657 ><P
658 ></P
659 ><A
660 NAME="AEN552"
661 ></A
662 ><P
663 ><CODE
664 ><CODE
665 CLASS="FUNCDEF"
666 >size_t <B
667 CLASS="FSFUNC"
668 >dbd_quote_binary</B
669 ></CODE
670 >(dbi_conn_t *<VAR
671 CLASS="PDPARAM"
672 >conn</VAR
673 >, const char *<VAR
674 CLASS="PDPARAM"
675 >orig</VAR
676 >, size_t <VAR
677 CLASS="PDPARAM"
678 >from_length</VAR
679 >, char **<VAR
680 CLASS="PDPARAM"
681 >dest</VAR
682 >);</CODE
683 ></P
684 ><P
685 ></P
686 ></DIV
687 ><P
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
689 CLASS="PARAMETER"
690 >dest</CODE
691 > is not a valid pointer to a string.</P
692 ><P
693 ></P
694 ><DIV
695 CLASS="VARIABLELIST"
696 ><DL
697 ><DT
698 >Arguments</DT
699 ><DD
700 ><P
701 ><TT
702 CLASS="LITERAL"
703 >conn</TT
704 >: A pointer to the current connection.</P
705 ><P
706 ><TT
707 CLASS="LITERAL"
708 >orig</TT
709 >: The string to quote and escape.</P
710 ><P
711 ><TT
712 CLASS="LITERAL"
713 >from_length</TT
714 >: The length, in bytes, of the binary string.</P
715 ><P
716 ><TT
717 CLASS="LITERAL"
718 >dest</TT
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
720 CLASS="PARAMETER"
721 >dest</CODE
722 > points to accordingly.</P
723 ></DD
724 ><DT
725 >Returns</DT
726 ><DD
727 ><P
728 >The length of the new string, or DBI_LENGTH_ERROR in case of an error.</P
729 ></DD
730 ></DL
731 ></DIV
732 ></DIV
733 ><DIV
734 CLASS="SECTION"
735 ><H2
736 CLASS="SECTION"
737 ><A
738 NAME="DBD-QUERY"
739 >3.3.10. dbd_query</A
740 ></H2
741 ><DIV
742 CLASS="FUNCSYNOPSIS"
743 ><P
744 ></P
745 ><A
746 NAME="AEN585"
747 ></A
748 ><P
749 ><CODE
750 ><CODE
751 CLASS="FUNCDEF"
752 >dbi_result_t *<B
753 CLASS="FSFUNC"
754 >dbd_query</B
755 ></CODE
756 >(dbi_conn_t *<VAR
757 CLASS="PDPARAM"
758 >conn</VAR
759 >, const char *<VAR
760 CLASS="PDPARAM"
761 >statement</VAR
762 >);</CODE
763 ></P
764 ><P
765 ></P
766 ></DIV
767 ><P
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
772 ><P
773 ></P
774 ><DIV
775 CLASS="VARIABLELIST"
776 ><DL
777 ><DT
778 >Arguments</DT
779 ><DD
780 ><P
781 ><TT
782 CLASS="LITERAL"
783 >conn</TT
784 >: The target connection.</P
785 ><P
786 ><TT
787 CLASS="LITERAL"
788 >statement</TT
789 >: The zero-terminated query string to execute.</P
790 ></DD
791 ><DT
792 >Returns</DT
793 ><DD
794 ><P
795 >A DBI result object, or NULL on error.</P
796 ></DD
797 ></DL
798 ></DIV
799 ></DIV
800 ><DIV
801 CLASS="SECTION"
802 ><H2
803 CLASS="SECTION"
804 ><A
805 NAME="DBD-QUERY-NULL"
806 >3.3.11. dbd_query_null</A
807 ></H2
808 ><DIV
809 CLASS="FUNCSYNOPSIS"
810 ><P
811 ></P
812 ><A
813 NAME="AEN609"
814 ></A
815 ><P
816 ><CODE
817 ><CODE
818 CLASS="FUNCDEF"
819 >dbi_result_t *<B
820 CLASS="FSFUNC"
821 >dbd_query_null</B
822 ></CODE
823 >(dbi_conn_t *<VAR
824 CLASS="PDPARAM"
825 >conn</VAR
826 >, const unsigned char *<VAR
827 CLASS="PDPARAM"
828 >statement</VAR
829 >, size_t <VAR
830 CLASS="PDPARAM"
831 >st_length</VAR
832 >);</CODE
833 ></P
834 ><P
835 ></P
836 ></DIV
837 ><P
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
842 ><P
843 ></P
844 ><DIV
845 CLASS="VARIABLELIST"
846 ><DL
847 ><DT
848 >Arguments</DT
849 ><DD
850 ><P
851 ><TT
852 CLASS="LITERAL"
853 >conn</TT
854 >: The target connection.</P
855 ><P
856 ><TT
857 CLASS="LITERAL"
858 >statement</TT
859 >: The query string to execute, which may contain NULL bytes and other non-printable characters.</P
860 ><P
861 ><TT
862 CLASS="LITERAL"
863 >st_length</TT
864 >: The length of the binary query string.</P
865 ></DD
866 ><DT
867 >Returns</DT
868 ><DD
869 ><P
870 >A DBI result object, or NULL on error.</P
871 ></DD
872 ></DL
873 ></DIV
874 ></DIV
875 ><DIV
876 CLASS="SECTION"
877 ><H2
878 CLASS="SECTION"
879 ><A
880 NAME="DBD-SELECT-DB"
881 >3.3.12. dbd_select_db</A
882 ></H2
883 ><DIV
884 CLASS="FUNCSYNOPSIS"
885 ><P
886 ></P
887 ><A
888 NAME="AEN637"
889 ></A
890 ><P
891 ><CODE
892 ><CODE
893 CLASS="FUNCDEF"
894 >const char *<B
895 CLASS="FSFUNC"
896 >dbd_select_db</B
897 ></CODE
898 >(dbi_conn_t *<VAR
899 CLASS="PDPARAM"
900 >conn</VAR
901 >, const char* <VAR
902 CLASS="PDPARAM"
903 >db</VAR
904 >);</CODE
905 ></P
906 ><P
907 ></P
908 ></DIV
909 ><P
910 >Selects a new database on the server.</P
911 ><P
912 ></P
913 ><DIV
914 CLASS="VARIABLELIST"
915 ><DL
916 ><DT
917 >Arguments</DT
918 ><DD
919 ><P
920 ><TT
921 CLASS="LITERAL"
922 >conn</TT
923 >: The target connection.</P
924 ><P
925 ><TT
926 CLASS="LITERAL"
927 >db</TT
928 >: The name of the database to switch to.</P
929 ></DD
930 ><DT
931 >Returns</DT
932 ><DD
933 ><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
935 ></DD
936 ></DL
937 ></DIV
938 ></DIV
939 ><DIV
940 CLASS="SECTION"
941 ><H2
942 CLASS="SECTION"
943 ><A
944 NAME="DBD-GET-SEQ-LAST"
945 >3.3.13. dbd_get_seq_last</A
946 ></H2
947 ><DIV
948 CLASS="FUNCSYNOPSIS"
949 ><P
950 ></P
951 ><A
952 NAME="AEN660"
953 ></A
954 ><P
955 ><CODE
956 ><CODE
957 CLASS="FUNCDEF"
958 >unsigned long long <B
959 CLASS="FSFUNC"
960 >dbd_get_seq_last</B
961 ></CODE
962 >(dbi_conn_t *<VAR
963 CLASS="PDPARAM"
964 >conn</VAR
965 >, const char *<VAR
966 CLASS="PDPARAM"
967 >sequence</VAR
968 >);</CODE
969 ></P
970 ><P
971 ></P
972 ></DIV
973 ><P
974 >Returns the row ID generated by the last <B
975 CLASS="COMMAND"
976 >INSERT</B
977 > command.</P
978 ><P
979 ></P
980 ><DIV
981 CLASS="VARIABLELIST"
982 ><DL
983 ><DT
984 >Arguments</DT
985 ><DD
986 ><P
987 ><TT
988 CLASS="LITERAL"
989 >conn</TT
990 >: The target connection.</P
991 ><P
992 ><TT
993 CLASS="LITERAL"
994 >sequence</TT
995 >: The name of the sequence if the database engine requires this, or NULL if it is not required.</P
996 ></DD
997 ><DT
998 >Returns</DT
999 ><DD
1000 ><P
1001 >The row ID if successful, otherwise 0.</P
1002 ></DD
1003 ></DL
1004 ></DIV
1005 ></DIV
1006 ><DIV
1007 CLASS="SECTION"
1008 ><H2
1009 CLASS="SECTION"
1010 ><A
1011 NAME="DBD-GET-SEQ-NEXT"
1012 >3.3.14. dbd_get_seq_next</A
1013 ></H2
1014 ><DIV
1015 CLASS="FUNCSYNOPSIS"
1016 ><P
1017 ></P
1018 ><A
1019 NAME="AEN684"
1020 ></A
1021 ><P
1022 ><CODE
1023 ><CODE
1024 CLASS="FUNCDEF"
1025 >unsigned long long <B
1026 CLASS="FSFUNC"
1027 >dbd_get_seq_next</B
1028 ></CODE
1029 >(dbi_conn_t *<VAR
1030 CLASS="PDPARAM"
1031 >conn</VAR
1032 >, const char *<VAR
1033 CLASS="PDPARAM"
1034 >sequence</VAR
1035 >);</CODE
1036 ></P
1037 ><P
1038 ></P
1039 ></DIV
1040 ><P
1041 >Increments the sequence counter by the preset increment, and returns the resulting row ID.</P
1042 ><P
1043 ></P
1044 ><DIV
1045 CLASS="VARIABLELIST"
1046 ><DL
1047 ><DT
1048 >Arguments</DT
1049 ><DD
1050 ><P
1051 ><TT
1052 CLASS="LITERAL"
1053 >conn</TT
1054 >: The target connection.</P
1055 ><P
1056 ><TT
1057 CLASS="LITERAL"
1058 >sequence</TT
1059 >: The name of the sequence if the database engine requires this, or NULL if it is not required.</P
1060 ></DD
1061 ><DT
1062 >Returns</DT
1063 ><DD
1064 ><P
1065 >The row ID if successful, otherwise 0. Also return 0 if the database engine does not implement this feature.</P
1066 ></DD
1067 ></DL
1068 ></DIV
1069 ></DIV
1070 ><DIV
1071 CLASS="SECTION"
1072 ><H2
1073 CLASS="SECTION"
1074 ><A
1075 NAME="DBD-PING"
1076 >3.3.15. dbd_ping</A
1077 ></H2
1078 ><DIV
1079 CLASS="FUNCSYNOPSIS"
1080 ><P
1081 ></P
1082 ><A
1083 NAME="AEN707"
1084 ></A
1085 ><P
1086 ><CODE
1087 ><CODE
1088 CLASS="FUNCDEF"
1089 >int <B
1090 CLASS="FSFUNC"
1091 >dbd_ping</B
1092 ></CODE
1093 >(dbi_conn_t *<VAR
1094 CLASS="PDPARAM"
1095 >conn</VAR
1096 >);</CODE
1097 ></P
1098 ><P
1099 ></P
1100 ></DIV
1101 ><P
1102 >Checks whether the database connection is still alive.</P
1103 ><P
1104 ></P
1105 ><DIV
1106 CLASS="VARIABLELIST"
1107 ><DL
1108 ><DT
1109 >Arguments</DT
1110 ><DD
1111 ><P
1112 ><TT
1113 CLASS="LITERAL"
1114 >conn</TT
1115 >: The target connection.</P
1116 ></DD
1117 ><DT
1118 >Returns</DT
1119 ><DD
1120 ><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
1122 ></DD
1123 ></DL
1124 ></DIV
1125 ></DIV
1126 ></DIV
1127 ><DIV
1128 CLASS="NAVFOOTER"
1129 ><HR
1130 ALIGN="LEFT"
1131 WIDTH="100%"><TABLE
1132 SUMMARY="Footer navigation table"
1133 WIDTH="100%"
1134 BORDER="0"
1135 CELLPADDING="0"
1136 CELLSPACING="0"
1137 ><TR
1138 ><TD
1139 WIDTH="33%"
1140 ALIGN="left"
1141 VALIGN="top"
1142 ><A
1143 HREF="driverfuncs-dbquery.html"
1144 ACCESSKEY="P"
1145 >Prev</A
1146 ></TD
1147 ><TD
1148 WIDTH="34%"
1149 ALIGN="center"
1150 VALIGN="top"
1151 ><A
1152 HREF="index.html"
1153 ACCESSKEY="H"
1154 >Home</A
1155 ></TD
1156 ><TD
1157 WIDTH="33%"
1158 ALIGN="right"
1159 VALIGN="top"
1160 ><A
1161 HREF="helperfuncs.html"
1162 ACCESSKEY="N"
1163 >Next</A
1164 ></TD
1165 ></TR
1166 ><TR
1167 ><TD
1168 WIDTH="33%"
1169 ALIGN="left"
1170 VALIGN="top"
1171 >Internal Database Query Functions</TD
1172 ><TD
1173 WIDTH="34%"
1174 ALIGN="center"
1175 VALIGN="top"
1176 ><A
1177 HREF="driverfuncs.html"
1178 ACCESSKEY="U"
1179 >Up</A
1180 ></TD
1181 ><TD
1182 WIDTH="33%"
1183 ALIGN="right"
1184 VALIGN="top"
1185 >DBD Helper Functions</TD
1186 ></TR
1187 ></TABLE
1188 ></DIV
1189 ></BODY
1190 ></HTML
1191 >