Debian Codegraph @

doc/programmers-guide/reference-query.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 >Managing Queries</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="libdbi API Reference"
14 HREF="reference.html"><LINK
15 REL="PREVIOUS"
16 TITLE="SQL and Database Infrastructure"
17 HREF="reference-database.html"><LINK
18 REL="NEXT"
19 TITLE="Managing Results"
20 HREF="reference-results.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 Programmer's Guide</TH
41 ></TR
42 ><TR
43 ><TD
44 WIDTH="10%"
45 ALIGN="left"
46 VALIGN="bottom"
47 ><A
48 HREF="reference-database.html"
49 ACCESSKEY="P"
50 >Prev</A
51 ></TD
52 ><TD
53 WIDTH="80%"
54 ALIGN="center"
55 VALIGN="bottom"
56 >Chapter 7. libdbi API Reference</TD
57 ><TD
58 WIDTH="10%"
59 ALIGN="right"
60 VALIGN="bottom"
61 ><A
62 HREF="reference-results.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="REFERENCE-QUERY"
77 >7.5. Managing Queries</A
78 ></H1
79 ><DIV
80 CLASS="SECTION"
81 ><H2
82 CLASS="SECTION"
83 ><A
84 NAME="DBI-CONN-QUERY"
85 >7.5.1. dbi_conn_query</A
86 ></H2
87 ><DIV
88 CLASS="FUNCSYNOPSIS"
89 ><P
90 ></P
91 ><A
92 NAME="AEN1890"
93 ></A
94 ><P
95 ><CODE
96 ><CODE
97 CLASS="FUNCDEF"
98 >dbi_result <B
99 CLASS="FSFUNC"
100 >dbi_conn_query</B
101 ></CODE
102 >(dbi_conn <VAR
103 CLASS="PDPARAM"
104 >Conn</VAR
105 >, const char *<VAR
106 CLASS="PDPARAM"
107 >statement</VAR
108 >);</CODE
109 ></P
110 ><P
111 ></P
112 ></DIV
113 ><P
114 >Execute the specified SQL query statement.</P
115 ><P
116 ></P
117 ><DIV
118 CLASS="VARIABLELIST"
119 ><DL
120 ><DT
121 >Arguments</DT
122 ><DD
123 ><P
124 ><TT
125 CLASS="LITERAL"
126 >Conn</TT
127 >: The target connection.</P
128 ><P
129 ><TT
130 CLASS="LITERAL"
131 >statement</TT
132 >: A string containing the SQL statement.</P
133 ></DD
134 ><DT
135 >Returns</DT
136 ><DD
137 ><P
138 >A query result object, or NULL if there was an error. In the latter case the <A
139 HREF="errornumbers.html"
140 >error number</A
141 > is a database engine-specific nonzero value.</P
142 ></DD
143 ></DL
144 ></DIV
145 ></DIV
146 ><DIV
147 CLASS="SECTION"
148 ><H2
149 CLASS="SECTION"
150 ><A
151 NAME="DBI-CONN-QUERYF"
152 >7.5.2. dbi_conn_queryf</A
153 ></H2
154 ><DIV
155 CLASS="FUNCSYNOPSIS"
156 ><P
157 ></P
158 ><A
159 NAME="AEN1914"
160 ></A
161 ><P
162 ><CODE
163 ><CODE
164 CLASS="FUNCDEF"
165 >dbi_result <B
166 CLASS="FSFUNC"
167 >dbi_conn_queryf</B
168 ></CODE
169 >(dbi_conn <VAR
170 CLASS="PDPARAM"
171 >Conn</VAR
172 >, const char *<VAR
173 CLASS="PDPARAM"
174 >formatstr</VAR
175 >, <VAR
176 CLASS="PDPARAM"
177 >...</VAR
178 >);</CODE
179 ></P
180 ><P
181 ></P
182 ></DIV
183 ><P
184 >Execute the specified SQL query statement.</P
185 ><P
186 ></P
187 ><DIV
188 CLASS="VARIABLELIST"
189 ><DL
190 ><DT
191 >Arguments</DT
192 ><DD
193 ><P
194 ><TT
195 CLASS="LITERAL"
196 >Conn</TT
197 >: The target connection.</P
198 ><P
199 ><TT
200 CLASS="LITERAL"
201 >formatstr</TT
202 >: The format string for the SQL statement. It uses the same format as printf().</P
203 ><P
204 ><TT
205 CLASS="LITERAL"
206 >ARG</TT
207 >: (...) Any variables that correspond to the printf-like format string.</P
208 ></DD
209 ><DT
210 >Returns</DT
211 ><DD
212 ><P
213 >A query result object, or NULL if there was an error. In the latter case the <A
214 HREF="errornumbers.html"
215 >error number</A
216 > is a database engine-specific nonzero value.</P
217 ></DD
218 ></DL
219 ></DIV
220 ></DIV
221 ><DIV
222 CLASS="SECTION"
223 ><H2
224 CLASS="SECTION"
225 ><A
226 NAME="DBI-CONN-QUERY-NULL"
227 >7.5.3. dbi_conn_query_null</A
228 ></H2
229 ><DIV
230 CLASS="FUNCSYNOPSIS"
231 ><P
232 ></P
233 ><A
234 NAME="AEN1942"
235 ></A
236 ><P
237 ><CODE
238 ><CODE
239 CLASS="FUNCDEF"
240 >dbi_result <B
241 CLASS="FSFUNC"
242 >dbi_conn_query_null</B
243 ></CODE
244 >(dbi_conn <VAR
245 CLASS="PDPARAM"
246 >Conn</VAR
247 >, const unsigned char *<VAR
248 CLASS="PDPARAM"
249 >statement</VAR
250 >, unsigned long <VAR
251 CLASS="PDPARAM"
252 >st_length</VAR
253 >);</CODE
254 ></P
255 ><P
256 ></P
257 ></DIV
258 ><P
259 >Execute the specified SQL query statement, which may contain valid NULL characters.</P
260 ><DIV
261 CLASS="NOTE"
262 ><BLOCKQUOTE
263 CLASS="NOTE"
264 ><P
265 ><B
266 >Note: </B
267 >This function is not implemented by all database drivers. For a portable way of including binary strings into SQL queries, see the function <A
268 HREF="reference-query.html#DBI-CONN-QUOTE-BINARY-COPY"
269 >dbi_conn_quote_binary_copy</A
270 >.</P
271 ></BLOCKQUOTE
272 ></DIV
273 ><P
274 ></P
275 ><DIV
276 CLASS="VARIABLELIST"
277 ><DL
278 ><DT
279 >Arguments</DT
280 ><DD
281 ><P
282 ><TT
283 CLASS="LITERAL"
284 >Conn</TT
285 >: The target connection.</P
286 ><P
287 ><TT
288 CLASS="LITERAL"
289 >statement</TT
290 >: The SQL statement, which may contain binary data.</P
291 ><P
292 ><TT
293 CLASS="LITERAL"
294 >st_length</TT
295 >: The number of characters in the non-null-terminated statement string.</P
296 ></DD
297 ><DT
298 >Returns</DT
299 ><DD
300 ><P
301 >A query result object, or NULL if there was an error. In the latter case the <A
302 HREF="errornumbers.html"
303 >error number</A
304 > is a database engine-specific nonzero value.</P
305 ></DD
306 ></DL
307 ></DIV
308 ></DIV
309 ><DIV
310 CLASS="SECTION"
311 ><H2
312 CLASS="SECTION"
313 ><A
314 NAME="DBI-CONN-SEQUENCE-LAST"
315 >7.5.4. dbi_conn_sequence_last</A
316 ></H2
317 ><DIV
318 CLASS="FUNCSYNOPSIS"
319 ><P
320 ></P
321 ><A
322 NAME="AEN1973"
323 ></A
324 ><P
325 ><CODE
326 ><CODE
327 CLASS="FUNCDEF"
328 >unsigned long long <B
329 CLASS="FSFUNC"
330 >dbi_conn_sequence_last</B
331 ></CODE
332 >(dbi_conn <VAR
333 CLASS="PDPARAM"
334 >Conn</VAR
335 >, const char *<VAR
336 CLASS="PDPARAM"
337 >name</VAR
338 >);</CODE
339 ></P
340 ><P
341 ></P
342 ></DIV
343 ><P
344 >Requests the row ID generated by the last <B
345 CLASS="COMMAND"
346 >INSERT</B
347 > command. The row ID is most commonly generated by an auto-incrementing column in the table. Use the return value to address the dataset that was last inserted.</P
348 ><P
349 ></P
350 ><DIV
351 CLASS="VARIABLELIST"
352 ><DL
353 ><DT
354 >Arguments</DT
355 ><DD
356 ><P
357 ><TT
358 CLASS="LITERAL"
359 >Conn</TT
360 >: The current database connection.</P
361 ><P
362 ><TT
363 CLASS="LITERAL"
364 >name</TT
365 >: The name of the sequence, or NULL if the database engine does not use explicit sequences.</P
366 ><DIV
367 CLASS="NOTE"
368 ><BLOCKQUOTE
369 CLASS="NOTE"
370 ><P
371 ><B
372 >Note: </B
373 >You may have noted that this function does not sufficiently encapsulate the peculiarities of the underlying database engines. You must keep track of sequence names yourself if your target database engine does use sequences.</P
374 ></BLOCKQUOTE
375 ></DIV
376 ></DD
377 ><DT
378 >Returns</DT
379 ><DD
380 ><P
381 >An integer value corresponding to the ID that was created by the last <B
382 CLASS="COMMAND"
383 >INSERT</B
384 > command. If the database engine does not support sequences, the function returns 0 (zero) and sets the <A
385 HREF="errornumbers.html"
386 >error number</A
387 > to DBI_ERROR_UNSUPPORTED.</P
388 ></DD
389 ></DL
390 ></DIV
391 ></DIV
392 ><DIV
393 CLASS="SECTION"
394 ><H2
395 CLASS="SECTION"
396 ><A
397 NAME="DBI-CONN-SEQUENCE-NEXT"
398 >7.5.5. dbi_conn_sequence_next</A
399 ></H2
400 ><DIV
401 CLASS="FUNCSYNOPSIS"
402 ><P
403 ></P
404 ><A
405 NAME="AEN2001"
406 ></A
407 ><P
408 ><CODE
409 ><CODE
410 CLASS="FUNCDEF"
411 >unsigned long long <B
412 CLASS="FSFUNC"
413 >dbi_conn_sequence_next</B
414 ></CODE
415 >(dbi_conn <VAR
416 CLASS="PDPARAM"
417 >Conn</VAR
418 >, const char *<VAR
419 CLASS="PDPARAM"
420 >name</VAR
421 >);</CODE
422 ></P
423 ><P
424 ></P
425 ></DIV
426 ><P
427 >Requests the row ID that would be generated by the next <B
428 CLASS="COMMAND"
429 >INSERT</B
430 > command. The row ID is most commonly generated by an auto-incrementing column in the table.</P
431 ><DIV
432 CLASS="NOTE"
433 ><BLOCKQUOTE
434 CLASS="NOTE"
435 ><P
436 ><B
437 >Note: </B
438 >Not all database engines support this feature. Portable code should use <A
439 HREF="reference-query.html#DBI-CONN-SEQUENCE-LAST"
440 >dbi_conn_sequence_last</A
441 > instead.</P
442 ></BLOCKQUOTE
443 ></DIV
444 ><P
445 ></P
446 ><DIV
447 CLASS="VARIABLELIST"
448 ><DL
449 ><DT
450 >Arguments</DT
451 ><DD
452 ><P
453 ><TT
454 CLASS="LITERAL"
455 >Conn</TT
456 >: The current database connection.</P
457 ><P
458 ><TT
459 CLASS="LITERAL"
460 >name</TT
461 >: The name of the sequence, or NULL if the database engine does not use explicit sequences.</P
462 ><DIV
463 CLASS="NOTE"
464 ><BLOCKQUOTE
465 CLASS="NOTE"
466 ><P
467 ><B
468 >Note: </B
469 >You may have noted that this function does not sufficiently encapsulate the peculiarities of the underlying database engines. You must keep track of sequence names yourself if your target database engine does use sequences.</P
470 ></BLOCKQUOTE
471 ></DIV
472 ></DD
473 ><DT
474 >Returns</DT
475 ><DD
476 ><P
477 >An integer value corresponding to the ID that was created by the last <B
478 CLASS="COMMAND"
479 >INSERT</B
480 > command, or 0 if the database engine does not support this feature. In the latter case, the <A
481 HREF="errornumbers.html"
482 >error number</A
483 > is DBI_ERROR_UNSUPPORTED</P
484 ></DD
485 ></DL
486 ></DIV
487 ></DIV
488 ><DIV
489 CLASS="SECTION"
490 ><H2
491 CLASS="SECTION"
492 ><A
493 NAME="DBI-CONN-PING"
494 >7.5.6. dbi_conn_ping</A
495 ></H2
496 ><DIV
497 CLASS="FUNCSYNOPSIS"
498 ><P
499 ></P
500 ><A
501 NAME="AEN2032"
502 ></A
503 ><P
504 ><CODE
505 ><CODE
506 CLASS="FUNCDEF"
507 >int <B
508 CLASS="FSFUNC"
509 >dbi_conn_ping</B
510 ></CODE
511 >(dbi_conn <VAR
512 CLASS="PDPARAM"
513 >Conn</VAR
514 >);</CODE
515 ></P
516 ><P
517 ></P
518 ></DIV
519 ><P
520 >Checks whether the current connection is still alive. Use this function to decide whether you must reconnect before running a query if your program is designed to keep connections open over prolonged periods of time.</P
521 ><P
522 ></P
523 ><DIV
524 CLASS="VARIABLELIST"
525 ><DL
526 ><DT
527 >Arguments</DT
528 ><DD
529 ><P
530 ><TT
531 CLASS="LITERAL"
532 >Conn</TT
533 >: The current database connection.</P
534 ></DD
535 ><DT
536 >Returns</DT
537 ><DD
538 ><P
539 >1 if the connection is alive. Otherwise the function returns 0.</P
540 ><DIV
541 CLASS="NOTE"
542 ><BLOCKQUOTE
543 CLASS="NOTE"
544 ><P
545 ><B
546 >Note: </B
547 >Database drivers may attempt to reconnect automatically if this function is called. If the reconnect is successful, this function will also return 1, as if the connection never had gone down.</P
548 ></BLOCKQUOTE
549 ></DIV
550 ></DD
551 ></DL
552 ></DIV
553 ></DIV
554 ><DIV
555 CLASS="SECTION"
556 ><H2
557 CLASS="SECTION"
558 ><A
559 NAME="DBI-CONN-QUOTE-STRING"
560 >7.5.7. dbi_conn_quote_string</A
561 ></H2
562 ><DIV
563 CLASS="FUNCSYNOPSIS"
564 ><P
565 ></P
566 ><A
567 NAME="AEN2053"
568 ></A
569 ><P
570 ><CODE
571 ><CODE
572 CLASS="FUNCDEF"
573 >size_t <B
574 CLASS="FSFUNC"
575 >dbi_conn_quote_string</B
576 ></CODE
577 >(dbi_conn <VAR
578 CLASS="PDPARAM"
579 >Conn</VAR
580 >, char **<VAR
581 CLASS="PDPARAM"
582 >orig</VAR
583 >);</CODE
584 ></P
585 ><P
586 ></P
587 ></DIV
588 ><P
589 >Escapes any special characters in a string and places the string itself in quotes so the string can be sent to the database engine as a query string, using either <A
590 HREF="reference-query.html#DBI-CONN-QUERY"
591 >dbi_conn_query</A
592 > or <A
593 HREF="reference-query.html#DBI-CONN-QUERYF"
594 >dbi_conn_queryf</A
595 >. The original string will be freed and <CODE
596 CLASS="PARAMETER"
597 >orig</CODE
598 > will point to a newly allocated one (which you still must free on your own). If an error occurs, the original string will be left alone. This function is preferred over <A
599 HREF="reference-driver.html#DBI-DRIVER-QUOTE-STRING"
600 >dbi_driver_quote_string</A
601 > because it takes the character encoding of the current connection into account when performing the escaping.</P
602 ><P
603 ></P
604 ><DIV
605 CLASS="VARIABLELIST"
606 ><DL
607 ><DT
608 >Arguments</DT
609 ><DD
610 ><P
611 ><TT
612 CLASS="LITERAL"
613 >Conn</TT
614 >: The current database connection.</P
615 ><P
616 ><TT
617 CLASS="LITERAL"
618 >orig</TT
619 >: A pointer to the string to quote and escape.</P
620 ></DD
621 ><DT
622 >Returns</DT
623 ><DD
624 ><P
625 >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. In case of an error the <A
626 HREF="errornumbers.html"
627 >error number</A
628 > is DBI_ERROR_BADPTR or DBI_ERROR_NOMEM.</P
629 ></DD
630 ><DT
631 >Availability</DT
632 ><DD
633 ><P
634 >0.8.0</P
635 ></DD
636 ></DL
637 ></DIV
638 ></DIV
639 ><DIV
640 CLASS="SECTION"
641 ><H2
642 CLASS="SECTION"
643 ><A
644 NAME="DBI-CONN-QUOTE-STRING-COPY"
645 >7.5.8. dbi_conn_quote_string_copy</A
646 ></H2
647 ><DIV
648 CLASS="FUNCSYNOPSIS"
649 ><P
650 ></P
651 ><A
652 NAME="AEN2085"
653 ></A
654 ><P
655 ><CODE
656 ><CODE
657 CLASS="FUNCDEF"
658 >size_t <B
659 CLASS="FSFUNC"
660 >dbi_conn_quote_string_copy</B
661 ></CODE
662 >(dbi_conn <VAR
663 CLASS="PDPARAM"
664 >Conn</VAR
665 >, char *<VAR
666 CLASS="PDPARAM"
667 >orig</VAR
668 >, char **<VAR
669 CLASS="PDPARAM"
670 >newstr</VAR
671 >);</CODE
672 ></P
673 ><P
674 ></P
675 ></DIV
676 ><P
677 >Escapes any special characters in a string and places the string itself in quotes so the string can be sent to the database engine as a query string, using either <A
678 HREF="reference-query.html#DBI-CONN-QUERY"
679 >dbi_conn_query</A
680 > or <A
681 HREF="reference-query.html#DBI-CONN-QUERYF"
682 >dbi_conn_queryf</A
683 >. The original string will be left alone, and <CODE
684 CLASS="PARAMETER"
685 >newstr</CODE
686 > will point to a newly allocated string containing the quoted string (which you still must free on your own). If the function fails, <CODE
687 CLASS="PARAMETER"
688 >newstr</CODE
689 > is an invalid pointer that must not be freed. This function is preferred over <A
690 HREF="reference-driver.html#DBI-DRIVER-QUOTE-STRING-COPY"
691 >dbi_driver_quote_string_copy</A
692 > because it takes the character encoding of the current connection into account when performing the escaping.</P
693 ><P
694 ></P
695 ><DIV
696 CLASS="VARIABLELIST"
697 ><DL
698 ><DT
699 >Arguments</DT
700 ><DD
701 ><P
702 ><TT
703 CLASS="LITERAL"
704 >Conn</TT
705 >: The current database connection.</P
706 ><P
707 ><TT
708 CLASS="LITERAL"
709 >orig</TT
710 >: A pointer to the string to quote and escape.</P
711 ><P
712 ><TT
713 CLASS="LITERAL"
714 >newstr</TT
715 >: After the function returns, this pointer will point to the quoted and escaped string.</P
716 ></DD
717 ><DT
718 >Returns</DT
719 ><DD
720 ><P
721 >The new string's length in bytes, excluding the terminating zero byte, or 0 in case of an error. Possible <A
722 HREF="errornumbers.html"
723 >error numbers</A
724 > are DBI_ERROR_BADPTR and DBI_ERROR_NOMEM.</P
725 ></DD
726 ><DT
727 >Availability</DT
728 ><DD
729 ><P
730 >0.8.0</P
731 ></DD
732 ></DL
733 ></DIV
734 ></DIV
735 ><DIV
736 CLASS="SECTION"
737 ><H2
738 CLASS="SECTION"
739 ><A
740 NAME="DBI-CONN-QUOTE-BINARY-COPY"
741 >7.5.9. dbi_conn_quote_binary_copy</A
742 ></H2
743 ><DIV
744 CLASS="FUNCSYNOPSIS"
745 ><P
746 ></P
747 ><A
748 NAME="AEN2122"
749 ></A
750 ><P
751 ><CODE
752 ><CODE
753 CLASS="FUNCDEF"
754 >size_t <B
755 CLASS="FSFUNC"
756 >dbi_conn_quote_binary_copy</B
757 ></CODE
758 >(dbi_conn <VAR
759 CLASS="PDPARAM"
760 >Conn</VAR
761 >, char *<VAR
762 CLASS="PDPARAM"
763 >orig</VAR
764 >, size_t <VAR
765 CLASS="PDPARAM"
766 >from_length</VAR
767 >, char **<VAR
768 CLASS="PDPARAM"
769 >newstr</VAR
770 >);</CODE
771 ></P
772 ><P
773 ></P
774 ></DIV
775 ><P
776 >Escapes any special characters, including null bytes, in a binary string and places the resulting string in quotes so it can be used in an SQL query. The original string will be left alone, and <CODE
777 CLASS="PARAMETER"
778 >newstr</CODE
779 > will point to a newly allocated string containing the quoted string (which you still must free on your own). If an error occurs, <CODE
780 CLASS="PARAMETER"
781 >newstr</CODE
782 > is an invalid pointer which must not be freed.</P
783 ><P
784 ></P
785 ><DIV
786 CLASS="VARIABLELIST"
787 ><DL
788 ><DT
789 >Arguments</DT
790 ><DD
791 ><P
792 ><TT
793 CLASS="LITERAL"
794 >Conn</TT
795 >: The current database connection.</P
796 ><P
797 ><TT
798 CLASS="LITERAL"
799 >orig</TT
800 >: A pointer to the string to quote and escape.</P
801 ><P
802 ><TT
803 CLASS="LITERAL"
804 >from_length</TT
805 >: The length of the binary string in bytes.</P
806 ><P
807 ><TT
808 CLASS="LITERAL"
809 >newstr</TT
810 >: After the function returns, this pointer will point to the quoted and escaped string.</P
811 ></DD
812 ><DT
813 >Returns</DT
814 ><DD
815 ><P
816 >The new string's length in bytes, excluding the terminating zero byte, or 0 in case of an error. Possible <A
817 HREF="errornumbers.html"
818 >error numbers</A
819 > are DBI_ERROR_BADPTR and DBI_ERROR_NOMEM.</P
820 ></DD
821 ><DT
822 >Availability</DT
823 ><DD
824 ><P
825 >0.8.0</P
826 ></DD
827 ></DL
828 ></DIV
829 ></DIV
830 ><DIV
831 CLASS="SECTION"
832 ><H2
833 CLASS="SECTION"
834 ><A
835 NAME="DBI-CONN-ESCAPE-STRING"
836 >7.5.10. dbi_conn_escape_string</A
837 ></H2
838 ><DIV
839 CLASS="FUNCSYNOPSIS"
840 ><P
841 ></P
842 ><A
843 NAME="AEN2160"
844 ></A
845 ><P
846 ><CODE
847 ><CODE
848 CLASS="FUNCDEF"
849 >size_t <B
850 CLASS="FSFUNC"
851 >dbi_conn_escape_string</B
852 ></CODE
853 >(dbi_conn <VAR
854 CLASS="PDPARAM"
855 >Conn</VAR
856 >, char **<VAR
857 CLASS="PDPARAM"
858 >orig</VAR
859 >);</CODE
860 ></P
861 ><P
862 ></P
863 ></DIV
864 ><P
865 >Works like <A
866 HREF="reference-query.html#DBI-CONN-QUOTE-STRING"
867 >dbi_conn_quote_string</A
868 > but does not surround the resulting string with quotes.</P
869 ><P
870 ></P
871 ><DIV
872 CLASS="VARIABLELIST"
873 ><DL
874 ><DT
875 >Arguments</DT
876 ><DD
877 ><P
878 ><TT
879 CLASS="LITERAL"
880 >Conn</TT
881 >: The current database connection.</P
882 ><P
883 ><TT
884 CLASS="LITERAL"
885 >orig</TT
886 >: A pointer to the string to quote and escape.</P
887 ></DD
888 ><DT
889 >Returns</DT
890 ><DD
891 ><P
892 >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. In case of an error the <A
893 HREF="errornumbers.html"
894 >error number</A
895 > is DBI_ERROR_BADPTR or DBI_ERROR_NOMEM.</P
896 ></DD
897 ><DT
898 >Availability</DT
899 ><DD
900 ><P
901 >0.8.3</P
902 ></DD
903 ></DL
904 ></DIV
905 ></DIV
906 ><DIV
907 CLASS="SECTION"
908 ><H2
909 CLASS="SECTION"
910 ><A
911 NAME="DBI-CONN-ESCAPE-STRING-COPY"
912 >7.5.11. dbi_conn_escape_string_copy</A
913 ></H2
914 ><DIV
915 CLASS="FUNCSYNOPSIS"
916 ><P
917 ></P
918 ><A
919 NAME="AEN2189"
920 ></A
921 ><P
922 ><CODE
923 ><CODE
924 CLASS="FUNCDEF"
925 >size_t <B
926 CLASS="FSFUNC"
927 >dbi_conn_escape_string_copy</B
928 ></CODE
929 >(dbi_conn <VAR
930 CLASS="PDPARAM"
931 >Conn</VAR
932 >, char *<VAR
933 CLASS="PDPARAM"
934 >orig</VAR
935 >, char **<VAR
936 CLASS="PDPARAM"
937 >newstr</VAR
938 >);</CODE
939 ></P
940 ><P
941 ></P
942 ></DIV
943 ><P
944 >Works like <A
945 HREF="reference-query.html#DBI-CONN-QUOTE-STRING-COPY"
946 >dbi_conn_quote_string_copy</A
947 > but does not surround the resulting string with quotes.</P
948 ><P
949 ></P
950 ><DIV
951 CLASS="VARIABLELIST"
952 ><DL
953 ><DT
954 >Arguments</DT
955 ><DD
956 ><P
957 ><TT
958 CLASS="LITERAL"
959 >Conn</TT
960 >: The current database connection.</P
961 ><P
962 ><TT
963 CLASS="LITERAL"
964 >orig</TT
965 >: A pointer to the string to quote and escape.</P
966 ><P
967 ><TT
968 CLASS="LITERAL"
969 >newstr</TT
970 >: After the function returns, this pointer will point to the quoted and escaped string.</P
971 ></DD
972 ><DT
973 >Returns</DT
974 ><DD
975 ><P
976 >The new string's length in bytes, excluding the terminating zero byte, or 0 in case of an error. Possible <A
977 HREF="errornumbers.html"
978 >error numbers</A
979 > are DBI_ERROR_BADPTR and DBI_ERROR_NOMEM.</P
980 ></DD
981 ><DT
982 >Availability</DT
983 ><DD
984 ><P
985 >0.8.3</P
986 ></DD
987 ></DL
988 ></DIV
989 ></DIV
990 ><DIV
991 CLASS="SECTION"
992 ><H2
993 CLASS="SECTION"
994 ><A
995 NAME="DBI-CONN-ESCAPE-BINARY-COPY"
996 >7.5.12. dbi_conn_escape_binary_copy</A
997 ></H2
998 ><DIV
999 CLASS="FUNCSYNOPSIS"
1000 ><P
1001 ></P
1002 ><A
1003 NAME="AEN2222"
1004 ></A
1005 ><P
1006 ><CODE
1007 ><CODE
1008 CLASS="FUNCDEF"
1009 >size_t <B
1010 CLASS="FSFUNC"
1011 >dbi_conn_escape_binary_copy</B
1012 ></CODE
1013 >(dbi_conn <VAR
1014 CLASS="PDPARAM"
1015 >Conn</VAR
1016 >, char *<VAR
1017 CLASS="PDPARAM"
1018 >orig</VAR
1019 >, size_t <VAR
1020 CLASS="PDPARAM"
1021 >from_length</VAR
1022 >, char **<VAR
1023 CLASS="PDPARAM"
1024 >newstr</VAR
1025 >);</CODE
1026 ></P
1027 ><P
1028 ></P
1029 ></DIV
1030 ><P
1031 >Works like <A
1032 HREF="reference-query.html#DBI-CONN-QUOTE-BINARY-COPY"
1033 >dbi_conn_quote_binary_copy</A
1034 > but does not surround the resulting string with quotes.</P
1035 ><P
1036 ></P
1037 ><DIV
1038 CLASS="VARIABLELIST"
1039 ><DL
1040 ><DT
1041 >Arguments</DT
1042 ><DD
1043 ><P
1044 ><TT
1045 CLASS="LITERAL"
1046 >Conn</TT
1047 >: The current database connection.</P
1048 ><P
1049 ><TT
1050 CLASS="LITERAL"
1051 >orig</TT
1052 >: A pointer to the string to quote and escape.</P
1053 ><P
1054 ><TT
1055 CLASS="LITERAL"
1056 >from_length</TT
1057 >: The length of the binary string in bytes.</P
1058 ><P
1059 ><TT
1060 CLASS="LITERAL"
1061 >newstr</TT
1062 >: After the function returns, this pointer will point to the quoted and escaped string.</P
1063 ></DD
1064 ><DT
1065 >Returns</DT
1066 ><DD
1067 ><P
1068 >The new string's length in bytes, excluding the terminating zero byte, or 0 in case of an error. Possible <A
1069 HREF="errornumbers.html"
1070 >error numbers</A
1071 > are DBI_ERROR_BADPTR and DBI_ERROR_NOMEM.</P
1072 ></DD
1073 ><DT
1074 >Availability</DT
1075 ><DD
1076 ><P
1077 >0.8.3</P
1078 ></DD
1079 ></DL
1080 ></DIV
1081 ></DIV
1082 ></DIV
1083 ><DIV
1084 CLASS="NAVFOOTER"
1085 ><HR
1086 ALIGN="LEFT"
1087 WIDTH="100%"><TABLE
1088 SUMMARY="Footer navigation table"
1089 WIDTH="100%"
1090 BORDER="0"
1091 CELLPADDING="0"
1092 CELLSPACING="0"
1093 ><TR
1094 ><TD
1095 WIDTH="33%"
1096 ALIGN="left"
1097 VALIGN="top"
1098 ><A
1099 HREF="reference-database.html"
1100 ACCESSKEY="P"
1101 >Prev</A
1102 ></TD
1103 ><TD
1104 WIDTH="34%"
1105 ALIGN="center"
1106 VALIGN="top"
1107 ><A
1108 HREF="index.html"
1109 ACCESSKEY="H"
1110 >Home</A
1111 ></TD
1112 ><TD
1113 WIDTH="33%"
1114 ALIGN="right"
1115 VALIGN="top"
1116 ><A
1117 HREF="reference-results.html"
1118 ACCESSKEY="N"
1119 >Next</A
1120 ></TD
1121 ></TR
1122 ><TR
1123 ><TD
1124 WIDTH="33%"
1125 ALIGN="left"
1126 VALIGN="top"
1127 >SQL and Database Infrastructure</TD
1128 ><TD
1129 WIDTH="34%"
1130 ALIGN="center"
1131 VALIGN="top"
1132 ><A
1133 HREF="reference.html"
1134 ACCESSKEY="U"
1135 >Up</A
1136 ></TD
1137 ><TD
1138 WIDTH="33%"
1139 ALIGN="right"
1140 VALIGN="top"
1141 >Managing Results</TD
1142 ></TR
1143 ></TABLE
1144 ></DIV
1145 ></BODY
1146 ></HTML
1147 >