File: Connection_8h.html

package info (click to toggle)
libzdb 3.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,600 kB
  • sloc: javascript: 7,158; ansic: 6,413; sh: 3,993; cpp: 582; makefile: 114; xml: 59; lex: 35
file content (1018 lines) | stat: -rw-r--r-- 80,306 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Connection.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="libzdb.css">
</head><body>
<a href="" class="back" onclick="history.back();return false;">⬅</a>
<!-- Generated by Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_bb61871b4c63e4e6685a8d6c52430594.html">zdb</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a>  </div>
  <div class="headertitle"><div class="title">Connection.h File Reference</div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A <b>Connection</b> represents a connection to a SQL database system. </p>
<p>Use a Connection to execute SQL statements. There are three ways to execute statements: <a class="el" href="#ad7029336959701d33bb921b89bc5b7ef" title="Executes a SQL statement, with or without parameters.">Connection_execute()</a> is used to execute SQL statements that do not return a result set. Such statements are INSERT, UPDATE or DELETE. <a class="el" href="#a3d1e39204654573ccac3d8ba3a2eae58" title="Executes a SQL query and returns a ResultSet.">Connection_executeQuery()</a> is used to execute a SQL SELECT statement and return a result set. These methods can only handle values which can be expressed as C-strings. If you need to handle binary data, such as inserting a blob value into the database, use a PreparedStatement object to execute the SQL statement. The factory method <a class="el" href="#a16dfbbe273d9a872462bed182dec3bb5" title="Prepares a SQL statement for execution.">Connection_prepareStatement()</a> is used to obtain a PreparedStatement object.</p>
<p>The method <a class="el" href="#a3d1e39204654573ccac3d8ba3a2eae58" title="Executes a SQL query and returns a ResultSet.">Connection_executeQuery()</a> will return an empty ResultSet (not null) if the SQL statement did not return any values. A ResultSet is valid until the next call to Connection execute or until the Connection is returned to the Connection Pool. If an error occurs during execution, an SQLException is thrown.</p>
<p>Any SQL statement that changes the database (basically, any SQL command other than SELECT) will automatically start a transaction if one is not already in effect. Automatically started transactions are committed at the conclusion of the command.</p>
<p>Transactions can also be started manually using <a class="el" href="#ac0ce66b1335330efc625c2b93ca7178a" title="Begins a new (default) transaction.">Connection_beginTransaction()</a>. Such transactions usually persist until the next call to <a class="el" href="#ac3672ae2a12da6901e53702decb10139" title="Commits the current transaction.">Connection_commit()</a> or <a class="el" href="#a4bdab7bb14c43834ba231aa511919a79" title="Rolls back the current transaction.">Connection_rollback()</a>. A transaction will also rollback if the database is closed or if an error occurs. Nested transactions are not allowed.</p>
<h2><a class="anchor" id="autotoc_md0"></a>
Examples</h2>
<h3><a class="anchor" id="autotoc_md1"></a>
Basic Query Execution</h3>
<div class="fragment"><div class="line">Connection_T con = <a class="code hl_function" href="ConnectionPool_8h.html#aeb9223e1addafed257e35e248c049097">ConnectionPool_getConnection</a>(pool);</div>
<div class="line"><span class="keywordflow">if</span> (con) {</div>
<div class="line">    ResultSet_T result = <a class="code hl_function" href="#a3d1e39204654573ccac3d8ba3a2eae58">Connection_executeQuery</a>(con, <span class="stringliteral">&quot;SELECT name, age FROM users WHERE id = %d&quot;</span>, 1);</div>
<div class="line">    <span class="keywordflow">if</span> (<a class="code hl_function" href="ResultSet_8h.html#a771894bb8c0ddfd90ed6ed9c9c3e46b3">ResultSet_next</a>(result)) {</div>
<div class="line">        <span class="keyword">const</span> <span class="keywordtype">char</span>* name = <a class="code hl_function" href="ResultSet_8h.html#ac65ad967dcaad62aa13d166c446e8f58">ResultSet_getString</a>(result, 1);</div>
<div class="line">        <span class="keywordtype">int</span> age = <a class="code hl_function" href="ResultSet_8h.html#aa73672053b34ee50c21eac0783b28719">ResultSet_getInt</a>(result, 2);</div>
<div class="line">        printf(<span class="stringliteral">&quot;Name: %s, Age: %d\n&quot;</span>, <a class="code hl_define" href="zdb_8h.html#a297ccf9a42e722258e3b51f9dabeab0a">valueOr</a>(name, <span class="stringliteral">&quot;N/A&quot;</span>), age);</div>
<div class="line">    }</div>
<div class="line">    <a class="code hl_function" href="#aac4c939875fb240528435d486b484a7f">Connection_close</a>(con);</div>
<div class="line">}</div>
<div class="ttc" id="aConnectionPool_8h_html_aeb9223e1addafed257e35e248c049097"><div class="ttname"><a href="ConnectionPool_8h.html#aeb9223e1addafed257e35e248c049097">ConnectionPool_getConnection</a></div><div class="ttdeci">Connection_T ConnectionPool_getConnection(T P)</div><div class="ttdoc">Get a connection from the pool.</div></div>
<div class="ttc" id="aConnection_8h_html_a3d1e39204654573ccac3d8ba3a2eae58"><div class="ttname"><a href="#a3d1e39204654573ccac3d8ba3a2eae58">Connection_executeQuery</a></div><div class="ttdeci">ResultSet_T Connection_executeQuery(T C, const char *sql,...)</div><div class="ttdoc">Executes a SQL query and returns a ResultSet.</div></div>
<div class="ttc" id="aConnection_8h_html_aac4c939875fb240528435d486b484a7f"><div class="ttname"><a href="#aac4c939875fb240528435d486b484a7f">Connection_close</a></div><div class="ttdeci">void Connection_close(T C)</div><div class="ttdoc">Returns the connection to the connection pool.</div></div>
<div class="ttc" id="aResultSet_8h_html_a771894bb8c0ddfd90ed6ed9c9c3e46b3"><div class="ttname"><a href="ResultSet_8h.html#a771894bb8c0ddfd90ed6ed9c9c3e46b3">ResultSet_next</a></div><div class="ttdeci">bool ResultSet_next(T R)</div><div class="ttdoc">Moves the cursor to the next row.</div></div>
<div class="ttc" id="aResultSet_8h_html_aa73672053b34ee50c21eac0783b28719"><div class="ttname"><a href="ResultSet_8h.html#aa73672053b34ee50c21eac0783b28719">ResultSet_getInt</a></div><div class="ttdeci">int ResultSet_getInt(T R, int columnIndex)</div><div class="ttdoc">Gets the designated column's value as an int.</div></div>
<div class="ttc" id="aResultSet_8h_html_ac65ad967dcaad62aa13d166c446e8f58"><div class="ttname"><a href="ResultSet_8h.html#ac65ad967dcaad62aa13d166c446e8f58">ResultSet_getString</a></div><div class="ttdeci">const char * ResultSet_getString(T R, int columnIndex)</div><div class="ttdoc">Gets the designated column's value as a C-string.</div></div>
<div class="ttc" id="azdb_8h_html_a297ccf9a42e722258e3b51f9dabeab0a"><div class="ttname"><a href="zdb_8h.html#a297ccf9a42e722258e3b51f9dabeab0a">valueOr</a></div><div class="ttdeci">#define valueOr(expr, default_value)</div><div class="ttdef"><b>Definition</b> zdb.h:107</div></div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md2"></a>
Transaction Example</h3>
<div class="fragment"><div class="line">Connection_T con = NULL;</div>
<div class="line"><a class="code hl_define" href="Exception_8h.html#ad2746371528bdf15c3910b7bf217dac0">TRY</a></div>
<div class="line">{</div>
<div class="line">    con = <a class="code hl_function" href="ConnectionPool_8h.html#aa9a93750f071e29530e66e5b4bcda865">ConnectionPool_getConnectionOrException</a>(pool);</div>
<div class="line">    <a class="code hl_function" href="#ac0ce66b1335330efc625c2b93ca7178a">Connection_beginTransaction</a>(con);</div>
<div class="line">    <a class="code hl_function" href="#ad7029336959701d33bb921b89bc5b7ef">Connection_execute</a>(con, <span class="stringliteral">&quot;UPDATE accounts SET balance = balance - %f WHERE id = %d&quot;</span>, 100.0, 1);</div>
<div class="line">    <a class="code hl_function" href="#ad7029336959701d33bb921b89bc5b7ef">Connection_execute</a>(con, <span class="stringliteral">&quot;UPDATE accounts SET balance = balance + %f WHERE id = %d&quot;</span>, 100.0, 2);</div>
<div class="line">    <a class="code hl_function" href="#ac3672ae2a12da6901e53702decb10139">Connection_commit</a>(con);</div>
<div class="line">    printf(<span class="stringliteral">&quot;Transfer successful\n&quot;</span>);</div>
<div class="line">}</div>
<div class="line"><a class="code hl_define" href="Exception_8h.html#a0a70ee0cbf5b1738be4c9463c529ce72">ELSE</a></div>
<div class="line">{</div>
<div class="line">    <span class="comment">// The error message in Exception_frame.message specify the error that occured</span></div>
<div class="line">    printf(<span class="stringliteral">&quot;Transfer failed: %s\n&quot;</span>, Exception_frame.message);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Connection_close() will automatically call Connection_rollback() if</span></div>
<div class="line">    <span class="comment">// the connection is in an uncommitted transaction</span></div>
<div class="line">}</div>
<div class="line"><a class="code hl_define" href="Exception_8h.html#a0e2a75478cd44f1666a6aca626c5c50b">FINALLY</a></div>
<div class="line">{</div>
<div class="line">   <span class="keywordflow">if</span> (con) <a class="code hl_function" href="#aac4c939875fb240528435d486b484a7f">Connection_close</a>(con);</div>
<div class="line">}</div>
<div class="line"><a class="code hl_define" href="Exception_8h.html#ae6628ac788ad213363b89dba9868420b">END_TRY</a>;</div>
<div class="ttc" id="aConnectionPool_8h_html_aa9a93750f071e29530e66e5b4bcda865"><div class="ttname"><a href="ConnectionPool_8h.html#aa9a93750f071e29530e66e5b4bcda865">ConnectionPool_getConnectionOrException</a></div><div class="ttdeci">Connection_T ConnectionPool_getConnectionOrException(T P)</div><div class="ttdoc">Get a connection from the pool.</div></div>
<div class="ttc" id="aConnection_8h_html_ac0ce66b1335330efc625c2b93ca7178a"><div class="ttname"><a href="#ac0ce66b1335330efc625c2b93ca7178a">Connection_beginTransaction</a></div><div class="ttdeci">void Connection_beginTransaction(T C)</div><div class="ttdoc">Begins a new (default) transaction.</div></div>
<div class="ttc" id="aConnection_8h_html_ac3672ae2a12da6901e53702decb10139"><div class="ttname"><a href="#ac3672ae2a12da6901e53702decb10139">Connection_commit</a></div><div class="ttdeci">void Connection_commit(T C)</div><div class="ttdoc">Commits the current transaction.</div></div>
<div class="ttc" id="aConnection_8h_html_ad7029336959701d33bb921b89bc5b7ef"><div class="ttname"><a href="#ad7029336959701d33bb921b89bc5b7ef">Connection_execute</a></div><div class="ttdeci">void Connection_execute(T C, const char *sql,...)</div><div class="ttdoc">Executes a SQL statement, with or without parameters.</div></div>
<div class="ttc" id="aException_8h_html_a0a70ee0cbf5b1738be4c9463c529ce72"><div class="ttname"><a href="Exception_8h.html#a0a70ee0cbf5b1738be4c9463c529ce72">ELSE</a></div><div class="ttdeci">#define ELSE</div><div class="ttdoc">Defines a block containing code for handling any exception thrown in the TRY block.</div><div class="ttdef"><b>Definition</b> Exception.h:286</div></div>
<div class="ttc" id="aException_8h_html_a0e2a75478cd44f1666a6aca626c5c50b"><div class="ttname"><a href="Exception_8h.html#a0e2a75478cd44f1666a6aca626c5c50b">FINALLY</a></div><div class="ttdeci">#define FINALLY</div><div class="ttdoc">Defines a block of code that is subsequently executed whether an exception is thrown or not.</div><div class="ttdef"><b>Definition</b> Exception.h:297</div></div>
<div class="ttc" id="aException_8h_html_ad2746371528bdf15c3910b7bf217dac0"><div class="ttname"><a href="Exception_8h.html#ad2746371528bdf15c3910b7bf217dac0">TRY</a></div><div class="ttdeci">#define TRY</div><div class="ttdoc">Defines a block of code that can potentially throw an exception.</div><div class="ttdef"><b>Definition</b> Exception.h:258</div></div>
<div class="ttc" id="aException_8h_html_ae6628ac788ad213363b89dba9868420b"><div class="ttname"><a href="Exception_8h.html#ae6628ac788ad213363b89dba9868420b">END_TRY</a></div><div class="ttdeci">#define END_TRY</div><div class="ttdoc">Ends a TRY-CATCH block.</div><div class="ttdef"><b>Definition</b> Exception.h:308</div></div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md3"></a>
Using PreparedStatement</h3>
<div class="fragment"><div class="line">Connection_T con = <a class="code hl_function" href="ConnectionPool_8h.html#aeb9223e1addafed257e35e248c049097">ConnectionPool_getConnection</a>(pool);</div>
<div class="line"><span class="keywordflow">if</span> (con) {</div>
<div class="line">    <span class="keyword">const</span> <span class="keywordtype">char</span> *sql = <span class="stringliteral">&quot;INSERT INTO logs (message, timestamp) VALUES (?, ?)&quot;</span>;</div>
<div class="line">    PreparedStatement_T stmt = <a class="code hl_function" href="#a16dfbbe273d9a872462bed182dec3bb5">Connection_prepareStatement</a>(con, sql);</div>
<div class="line">    <a class="code hl_function" href="PreparedStatement_8h.html#a618654d179459a9394828a4117f97d05">PreparedStatement_setString</a>(stmt, 1, <span class="stringliteral">&quot;User logged in&quot;</span>);</div>
<div class="line">    <a class="code hl_function" href="PreparedStatement_8h.html#a3cf4d848d41a7901727bccac2b58d31c">PreparedStatement_setTimestamp</a>(stmt, 2, time(NULL));</div>
<div class="line">    <a class="code hl_function" href="PreparedStatement_8h.html#a6f0eb01daec7f61bf92707b7de0a246f">PreparedStatement_execute</a>(stmt);</div>
<div class="line">    printf(<span class="stringliteral">&quot;Rows affected: %lld\n&quot;</span>, <a class="code hl_function" href="PreparedStatement_8h.html#aaaaec0e14c95b70b342dff0cf604cadd">PreparedStatement_rowsChanged</a>(stmt));</div>
<div class="line">    <a class="code hl_function" href="#aac4c939875fb240528435d486b484a7f">Connection_close</a>(con);</div>
<div class="line">}</div>
<div class="ttc" id="aConnection_8h_html_a16dfbbe273d9a872462bed182dec3bb5"><div class="ttname"><a href="#a16dfbbe273d9a872462bed182dec3bb5">Connection_prepareStatement</a></div><div class="ttdeci">PreparedStatement_T Connection_prepareStatement(T C, const char *sql,...)</div><div class="ttdoc">Prepares a SQL statement for execution.</div></div>
<div class="ttc" id="aPreparedStatement_8h_html_a3cf4d848d41a7901727bccac2b58d31c"><div class="ttname"><a href="PreparedStatement_8h.html#a3cf4d848d41a7901727bccac2b58d31c">PreparedStatement_setTimestamp</a></div><div class="ttdeci">void PreparedStatement_setTimestamp(T P, int parameterIndex, time_t x)</div><div class="ttdoc">Sets the in parameter at index parameterIndex to the given Unix timestamp value.</div></div>
<div class="ttc" id="aPreparedStatement_8h_html_a618654d179459a9394828a4117f97d05"><div class="ttname"><a href="PreparedStatement_8h.html#a618654d179459a9394828a4117f97d05">PreparedStatement_setString</a></div><div class="ttdeci">void PreparedStatement_setString(T P, int parameterIndex, const char *x)</div><div class="ttdoc">Sets the in parameter at index parameterIndex to the given string value.</div></div>
<div class="ttc" id="aPreparedStatement_8h_html_a6f0eb01daec7f61bf92707b7de0a246f"><div class="ttname"><a href="PreparedStatement_8h.html#a6f0eb01daec7f61bf92707b7de0a246f">PreparedStatement_execute</a></div><div class="ttdeci">void PreparedStatement_execute(T P)</div><div class="ttdoc">Executes the prepared SQL statement.</div></div>
<div class="ttc" id="aPreparedStatement_8h_html_aaaaec0e14c95b70b342dff0cf604cadd"><div class="ttname"><a href="PreparedStatement_8h.html#aaaaec0e14c95b70b342dff0cf604cadd">PreparedStatement_rowsChanged</a></div><div class="ttdeci">long long PreparedStatement_rowsChanged(T P)</div><div class="ttdoc">Gets the number of rows affected by the most recent SQL statement.</div></div>
</div><!-- fragment --><p><em>A Connection is reentrant, but not thread-safe and should only be used by one thread (at a time).</em></p>
<dl class="section note"><dt>Note</dt><dd>When <a class="el" href="#aac4c939875fb240528435d486b484a7f" title="Returns the connection to the connection pool.">Connection_close()</a> is called on a Connection object, it is automatically returned to the pool. If the connection is still in a transaction at this point, the transaction will be automatically rolled back. This ensures data integrity even when exceptions occur. It's recommended to always call <a class="el" href="#aac4c939875fb240528435d486b484a7f" title="Returns the connection to the connection pool.">Connection_close()</a> in a FINALLY block to guarantee proper resource management and transaction handling. See the Transaction Example above for a practical demonstration of this behavior.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="ResultSet_8h.html" title="A ResultSet represents a database result set.">ResultSet.h</a> <a class="el" href="PreparedStatement_8h.html" title="A PreparedStatement represents a single SQL statement pre-compiled into byte code for later execution...">PreparedStatement.h</a> <a class="el" href="SQLException_8h.html" title="Signals that an SQL specific exception has occurred.">SQLException.h</a> </dd></dl>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a0acb682b8260ab1c60b918599864e2e5" id="r_a0acb682b8260ab1c60b918599864e2e5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a0acb682b8260ab1c60b918599864e2e5">T</a>&#160;&#160;&#160;Connection_T</td></tr>
<tr class="separator:a0acb682b8260ab1c60b918599864e2e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a8dc1b239f8e305fbd1406ff041c89151" id="r_a8dc1b239f8e305fbd1406ff041c89151"><td class="memItemLeft" align="right" valign="top">typedef struct Connection_S *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td></tr>
<tr class="separator:a8dc1b239f8e305fbd1406ff041c89151"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:a4cd1875ea5ecc896a0974c442afc2529" id="r_a4cd1875ea5ecc896a0974c442afc2529"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529">TRANSACTION_TYPE</a> { <br />
&#160;&#160;<a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529ad0bbcf3460953ea9db3ad9cc91b7fbe9">TRANSACTION_DEFAULT</a> = 0
, <a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529ae8ac7cc540e8a2447386627ed56cf0b3">TRANSACTION_READ_UNCOMMITTED</a>
, <a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529a5ef84f58f96b618d8c7c777077b4c2b7">TRANSACTION_READ_COMMITTED</a>
, <a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529aa54800d3e5edaeb66d3a43ec439b9800">TRANSACTION_REPEATABLE_READ</a>
, <br />
&#160;&#160;<a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529a1d4194877393651107a4150e69a18178">TRANSACTION_SERIALIZABLE</a>
, <a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529a55a16d8fb0b5ab8e25989b21494e2462">TRANSACTION_IMMEDIATE</a>
, <a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529ad5c408148f09d09591bccd7727484e84">TRANSACTION_EXCLUSIVE</a>
<br />
 }</td></tr>
<tr class="memdesc:a4cd1875ea5ecc896a0974c442afc2529"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enum representing different transaction isolation levels and behaviors.  <a href="#a4cd1875ea5ecc896a0974c442afc2529">More...</a><br /></td></tr>
<tr class="separator:a4cd1875ea5ecc896a0974c442afc2529"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Properties</div></td></tr>
<tr class="memitem:a94361c8781129aaeb809a65b66f92608" id="r_a94361c8781129aaeb809a65b66f92608"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a94361c8781129aaeb809a65b66f92608">Connection_setQueryTimeout</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C, int ms)</td></tr>
<tr class="memdesc:a94361c8781129aaeb809a65b66f92608"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the query timeout for this Connection.  <br /></td></tr>
<tr class="separator:a94361c8781129aaeb809a65b66f92608"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c8570c9bd969efe7f91c516ce0d76f9" id="r_a3c8570c9bd969efe7f91c516ce0d76f9"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3c8570c9bd969efe7f91c516ce0d76f9">Connection_getQueryTimeout</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:a3c8570c9bd969efe7f91c516ce0d76f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the query timeout for this Connection.  <br /></td></tr>
<tr class="separator:a3c8570c9bd969efe7f91c516ce0d76f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1e4b15139c4cd0917ad028284c1b0bc2" id="r_a1e4b15139c4cd0917ad028284c1b0bc2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a1e4b15139c4cd0917ad028284c1b0bc2">Connection_setMaxRows</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C, int max)</td></tr>
<tr class="memdesc:a1e4b15139c4cd0917ad028284c1b0bc2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the maximum number of rows for ResultSet objects.  <br /></td></tr>
<tr class="separator:a1e4b15139c4cd0917ad028284c1b0bc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2686525f6d3374631f4385e03708088d" id="r_a2686525f6d3374631f4385e03708088d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a2686525f6d3374631f4385e03708088d">Connection_getMaxRows</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:a2686525f6d3374631f4385e03708088d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the maximum number of rows for ResultSet objects.  <br /></td></tr>
<tr class="separator:a2686525f6d3374631f4385e03708088d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a69aab12859ab87b931ffb418b7aca328" id="r_a69aab12859ab87b931ffb418b7aca328"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a69aab12859ab87b931ffb418b7aca328">Connection_setFetchSize</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C, int rows)</td></tr>
<tr class="memdesc:a69aab12859ab87b931ffb418b7aca328"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the number of rows to fetch for ResultSet objects.  <br /></td></tr>
<tr class="separator:a69aab12859ab87b931ffb418b7aca328"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac26356b1b7ea3b23edb4f26b327f0dbe" id="r_ac26356b1b7ea3b23edb4f26b327f0dbe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac26356b1b7ea3b23edb4f26b327f0dbe">Connection_getFetchSize</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:ac26356b1b7ea3b23edb4f26b327f0dbe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of rows to fetch for ResultSet objects.  <br /></td></tr>
<tr class="separator:ac26356b1b7ea3b23edb4f26b327f0dbe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad4823fe7dfe946573919138f6d708f9e" id="r_ad4823fe7dfe946573919138f6d708f9e"><td class="memItemLeft" align="right" valign="top">URL_T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad4823fe7dfe946573919138f6d708f9e">Connection_getURL</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:ad4823fe7dfe946573919138f6d708f9e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets this Connections URL.  <br /></td></tr>
<tr class="separator:ad4823fe7dfe946573919138f6d708f9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Functions</div></td></tr>
<tr class="memitem:ac9b36e40636c83f577630de22266d860" id="r_ac9b36e40636c83f577630de22266d860"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac9b36e40636c83f577630de22266d860">Connection_ping</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:ac9b36e40636c83f577630de22266d860"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pings the database server to check if the connection is alive.  <br /></td></tr>
<tr class="separator:ac9b36e40636c83f577630de22266d860"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae0cd7b68e0e3cfd6a1a458af31db25d3" id="r_ae0cd7b68e0e3cfd6a1a458af31db25d3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae0cd7b68e0e3cfd6a1a458af31db25d3">Connection_clear</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:ae0cd7b68e0e3cfd6a1a458af31db25d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears any ResultSet and PreparedStatements in the Connection.  <br /></td></tr>
<tr class="separator:ae0cd7b68e0e3cfd6a1a458af31db25d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac4c939875fb240528435d486b484a7f" id="r_aac4c939875fb240528435d486b484a7f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aac4c939875fb240528435d486b484a7f">Connection_close</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:aac4c939875fb240528435d486b484a7f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the connection to the connection pool.  <br /></td></tr>
<tr class="separator:aac4c939875fb240528435d486b484a7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac0ce66b1335330efc625c2b93ca7178a" id="r_ac0ce66b1335330efc625c2b93ca7178a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac0ce66b1335330efc625c2b93ca7178a">Connection_beginTransaction</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:ac0ce66b1335330efc625c2b93ca7178a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Begins a new (default) transaction.  <br /></td></tr>
<tr class="separator:ac0ce66b1335330efc625c2b93ca7178a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adc2caa32fa40601f41471f46755fc063" id="r_adc2caa32fa40601f41471f46755fc063"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#adc2caa32fa40601f41471f46755fc063">Connection_beginTransactionType</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C, <a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529">TRANSACTION_TYPE</a> type)</td></tr>
<tr class="memdesc:adc2caa32fa40601f41471f46755fc063"><td class="mdescLeft">&#160;</td><td class="mdescRight">Begins a new specific transaction.  <br /></td></tr>
<tr class="separator:adc2caa32fa40601f41471f46755fc063"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4dcb90c504e73583aaa7fb372973ad7f" id="r_a4dcb90c504e73583aaa7fb372973ad7f"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4dcb90c504e73583aaa7fb372973ad7f">Connection_inTransaction</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:a4dcb90c504e73583aaa7fb372973ad7f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if this Connection is in an uncommitted transaction.  <br /></td></tr>
<tr class="separator:a4dcb90c504e73583aaa7fb372973ad7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac3672ae2a12da6901e53702decb10139" id="r_ac3672ae2a12da6901e53702decb10139"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac3672ae2a12da6901e53702decb10139">Connection_commit</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:ac3672ae2a12da6901e53702decb10139"><td class="mdescLeft">&#160;</td><td class="mdescRight">Commits the current transaction.  <br /></td></tr>
<tr class="separator:ac3672ae2a12da6901e53702decb10139"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4bdab7bb14c43834ba231aa511919a79" id="r_a4bdab7bb14c43834ba231aa511919a79"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4bdab7bb14c43834ba231aa511919a79">Connection_rollback</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:a4bdab7bb14c43834ba231aa511919a79"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rolls back the current transaction.  <br /></td></tr>
<tr class="separator:a4bdab7bb14c43834ba231aa511919a79"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a784a1c368a3b88f93323ceaa2675346a" id="r_a784a1c368a3b88f93323ceaa2675346a"><td class="memItemLeft" align="right" valign="top">long long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a784a1c368a3b88f93323ceaa2675346a">Connection_lastRowId</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:a784a1c368a3b88f93323ceaa2675346a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the last inserted row ID for auto-increment columns.  <br /></td></tr>
<tr class="separator:a784a1c368a3b88f93323ceaa2675346a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7a1727da9b90633faacac82efd93e0cc" id="r_a7a1727da9b90633faacac82efd93e0cc"><td class="memItemLeft" align="right" valign="top">long long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a7a1727da9b90633faacac82efd93e0cc">Connection_rowsChanged</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:a7a1727da9b90633faacac82efd93e0cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of rows affected by the last execute() statement.  <br /></td></tr>
<tr class="separator:a7a1727da9b90633faacac82efd93e0cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad7029336959701d33bb921b89bc5b7ef" id="r_ad7029336959701d33bb921b89bc5b7ef"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad7029336959701d33bb921b89bc5b7ef">Connection_execute</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C, const char *sql,...)</td></tr>
<tr class="memdesc:ad7029336959701d33bb921b89bc5b7ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes a SQL statement, with or without parameters.  <br /></td></tr>
<tr class="separator:ad7029336959701d33bb921b89bc5b7ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d1e39204654573ccac3d8ba3a2eae58" id="r_a3d1e39204654573ccac3d8ba3a2eae58"><td class="memItemLeft" align="right" valign="top">ResultSet_T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3d1e39204654573ccac3d8ba3a2eae58">Connection_executeQuery</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C, const char *sql,...)</td></tr>
<tr class="memdesc:a3d1e39204654573ccac3d8ba3a2eae58"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes a SQL query and returns a ResultSet.  <br /></td></tr>
<tr class="separator:a3d1e39204654573ccac3d8ba3a2eae58"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a16dfbbe273d9a872462bed182dec3bb5" id="r_a16dfbbe273d9a872462bed182dec3bb5"><td class="memItemLeft" align="right" valign="top">PreparedStatement_T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a16dfbbe273d9a872462bed182dec3bb5">Connection_prepareStatement</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C, const char *sql,...)</td></tr>
<tr class="memdesc:a16dfbbe273d9a872462bed182dec3bb5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prepares a SQL statement for execution.  <br /></td></tr>
<tr class="separator:a16dfbbe273d9a872462bed182dec3bb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5202b3c879bd859705be9503eef00a92" id="r_a5202b3c879bd859705be9503eef00a92"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5202b3c879bd859705be9503eef00a92">Connection_getLastError</a> (<a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a> C)</td></tr>
<tr class="memdesc:a5202b3c879bd859705be9503eef00a92"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the last SQL error message.  <br /></td></tr>
<tr class="separator:a5202b3c879bd859705be9503eef00a92"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Class functions</div></td></tr>
<tr class="memitem:acb342bb922ef5ad26829605340134f0e" id="r_acb342bb922ef5ad26829605340134f0e"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#acb342bb922ef5ad26829605340134f0e">Connection_isSupported</a> (const char *url)</td></tr>
<tr class="memdesc:acb342bb922ef5ad26829605340134f0e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if the specified database system is supported.  <br /></td></tr>
<tr class="separator:acb342bb922ef5ad26829605340134f0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a0acb682b8260ab1c60b918599864e2e5" name="a0acb682b8260ab1c60b918599864e2e5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0acb682b8260ab1c60b918599864e2e5">&#9670;&#160;</a></span>T</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;&#160;&#160;Connection_T</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="a8dc1b239f8e305fbd1406ff041c89151" name="a8dc1b239f8e305fbd1406ff041c89151"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8dc1b239f8e305fbd1406ff041c89151">&#9670;&#160;</a></span>T</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct Connection_S* <a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="a4cd1875ea5ecc896a0974c442afc2529" name="a4cd1875ea5ecc896a0974c442afc2529"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4cd1875ea5ecc896a0974c442afc2529">&#9670;&#160;</a></span>TRANSACTION_TYPE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529">TRANSACTION_TYPE</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enum representing different transaction isolation levels and behaviors. </p>
<p>Support for specific types varies depending on the database system being used.</p>
<p>Note: All transactions must be explicitly ended with either a commit or a rollback operation, regardless of the isolation level or database system. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="a4cd1875ea5ecc896a0974c442afc2529ad0bbcf3460953ea9db3ad9cc91b7fbe9" name="a4cd1875ea5ecc896a0974c442afc2529ad0bbcf3460953ea9db3ad9cc91b7fbe9"></a>TRANSACTION_DEFAULT&#160;</td><td class="fielddoc"><p>Use the default transaction behavior of the underlying database system. </p>
<ul>
<li>MySQL: REPEATABLE READ</li>
<li>PostgreSQL: READ COMMITTED</li>
<li>Oracle: READ COMMITTED</li>
<li>SQLite: SERIALIZABLE </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a id="a4cd1875ea5ecc896a0974c442afc2529ae8ac7cc540e8a2447386627ed56cf0b3" name="a4cd1875ea5ecc896a0974c442afc2529ae8ac7cc540e8a2447386627ed56cf0b3"></a>TRANSACTION_READ_UNCOMMITTED&#160;</td><td class="fielddoc"><p>Lowest isolation level. </p>
<p>Transactions can read uncommitted data. Supported by: MySQL. Not supported by: PostgreSQL, Oracle, SQLite </p>
</td></tr>
<tr><td class="fieldname"><a id="a4cd1875ea5ecc896a0974c442afc2529a5ef84f58f96b618d8c7c777077b4c2b7" name="a4cd1875ea5ecc896a0974c442afc2529a5ef84f58f96b618d8c7c777077b4c2b7"></a>TRANSACTION_READ_COMMITTED&#160;</td><td class="fielddoc"><p>Prevents dirty reads. </p>
<p>A transaction only sees data committed before the transaction began. Supported by: MySQL, PostgreSQL, Oracle. Not applicable to SQLite (always SERIALIZABLE) </p>
</td></tr>
<tr><td class="fieldname"><a id="a4cd1875ea5ecc896a0974c442afc2529aa54800d3e5edaeb66d3a43ec439b9800" name="a4cd1875ea5ecc896a0974c442afc2529aa54800d3e5edaeb66d3a43ec439b9800"></a>TRANSACTION_REPEATABLE_READ&#160;</td><td class="fielddoc"><p>Prevents non-repeatable reads. </p>
<p>Supported by: MySQL, PostgreSQL. Not supported by: Oracle. Not applicable to SQLite (always SERIALIZABLE) </p>
</td></tr>
<tr><td class="fieldname"><a id="a4cd1875ea5ecc896a0974c442afc2529a1d4194877393651107a4150e69a18178" name="a4cd1875ea5ecc896a0974c442afc2529a1d4194877393651107a4150e69a18178"></a>TRANSACTION_SERIALIZABLE&#160;</td><td class="fielddoc"><p>Highest isolation level. </p>
<p>Prevents dirty reads, non-repeatable reads, and phantom reads. Supported by: MySQL, PostgreSQL, Oracle. Default and only level for SQLite </p>
</td></tr>
<tr><td class="fieldname"><a id="a4cd1875ea5ecc896a0974c442afc2529a55a16d8fb0b5ab8e25989b21494e2462" name="a4cd1875ea5ecc896a0974c442afc2529a55a16d8fb0b5ab8e25989b21494e2462"></a>TRANSACTION_IMMEDIATE&#160;</td><td class="fielddoc"><p>SQLite-specific. </p>
<p>Starts a transaction immediately, acquiring a RESERVED lock. Not applicable to other database systems. </p>
</td></tr>
<tr><td class="fieldname"><a id="a4cd1875ea5ecc896a0974c442afc2529ad5c408148f09d09591bccd7727484e84" name="a4cd1875ea5ecc896a0974c442afc2529ad5c408148f09d09591bccd7727484e84"></a>TRANSACTION_EXCLUSIVE&#160;</td><td class="fielddoc"><p>SQLite-specific. </p>
<p>Starts a transaction and acquires an EXCLUSIVE lock immediately. Not applicable to other database systems. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a94361c8781129aaeb809a65b66f92608" name="a94361c8781129aaeb809a65b66f92608"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a94361c8781129aaeb809a65b66f92608">&#9670;&#160;</a></span>Connection_setQueryTimeout()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_setQueryTimeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>ms</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the query timeout for this Connection. </p>
<p>If the limit is exceeded, the statement will return immediately with an error. The timeout is set per connection/session. Not all database systems support query (SELECT) timeout. The default is no query timeout.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
    <tr><td class="paramname">ms</td><td>The query timeout in milliseconds; zero (the default) means there is no timeout limit. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3c8570c9bd969efe7f91c516ce0d76f9" name="a3c8570c9bd969efe7f91c516ce0d76f9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c8570c9bd969efe7f91c516ce0d76f9">&#9670;&#160;</a></span>Connection_getQueryTimeout()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Connection_getQueryTimeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the query timeout for this Connection. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The query timeout limit in milliseconds; zero means there is no timeout limit </dd></dl>

</div>
</div>
<a id="a1e4b15139c4cd0917ad028284c1b0bc2" name="a1e4b15139c4cd0917ad028284c1b0bc2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1e4b15139c4cd0917ad028284c1b0bc2">&#9670;&#160;</a></span>Connection_setMaxRows()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_setMaxRows </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>max</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the maximum number of rows for ResultSet objects. </p>
<p>If the limit is exceeded, the excess rows are silently dropped.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
    <tr><td class="paramname">max</td><td>The new max rows limit; 0 (the default) means there is no limit </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a2686525f6d3374631f4385e03708088d" name="a2686525f6d3374631f4385e03708088d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2686525f6d3374631f4385e03708088d">&#9670;&#160;</a></span>Connection_getMaxRows()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Connection_getMaxRows </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the maximum number of rows for ResultSet objects. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The max rows limit; 0 means there is no limit </dd></dl>

</div>
</div>
<a id="a69aab12859ab87b931ffb418b7aca328" name="a69aab12859ab87b931ffb418b7aca328"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a69aab12859ab87b931ffb418b7aca328">&#9670;&#160;</a></span>Connection_setFetchSize()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_setFetchSize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>rows</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the number of rows to fetch for ResultSet objects. </p>
<p>The default value is 100, meaning that a ResultSet will prefetch rows in batches of 100 rows to reduce the network roundtrip to the database. This value can also be set via the URL parameter <code>fetch-size</code> to apply to all connections. This method and the concept of pre-fetching rows are only applicable to MySQL and Oracle.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
    <tr><td class="paramname">rows</td><td>The number of rows to fetch (1..INT_MAX) </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">AssertException</td><td>If `rows` is less than 1 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac26356b1b7ea3b23edb4f26b327f0dbe" name="ac26356b1b7ea3b23edb4f26b327f0dbe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac26356b1b7ea3b23edb4f26b327f0dbe">&#9670;&#160;</a></span>Connection_getFetchSize()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Connection_getFetchSize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the number of rows to fetch for ResultSet objects. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of rows to fetch </dd></dl>

</div>
</div>
<a id="ad4823fe7dfe946573919138f6d708f9e" name="ad4823fe7dfe946573919138f6d708f9e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad4823fe7dfe946573919138f6d708f9e">&#9670;&#160;</a></span>Connection_getURL()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">URL_T Connection_getURL </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets this Connections URL. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>This Connections URL </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="URL_8h.html" title="URL represents an immutable Uniform Resource Locator.">URL.h</a> </dd></dl>

</div>
</div>
<a id="ac9b36e40636c83f577630de22266d860" name="ac9b36e40636c83f577630de22266d860"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac9b36e40636c83f577630de22266d860">&#9670;&#160;</a></span>Connection_ping()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Connection_ping </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pings the database server to check if the connection is alive. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the connection is alive, false otherwise. </dd></dl>

</div>
</div>
<a id="ae0cd7b68e0e3cfd6a1a458af31db25d3" name="ae0cd7b68e0e3cfd6a1a458af31db25d3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae0cd7b68e0e3cfd6a1a458af31db25d3">&#9670;&#160;</a></span>Connection_clear()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_clear </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Clears any ResultSet and PreparedStatements in the Connection. </p>
<p>Normally it is not necessary to call this method, but for some implementations (SQLite) it <em>may, in some situations,</em> be necessary to call this method if an execution sequence error occurs.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aac4c939875fb240528435d486b484a7f" name="aac4c939875fb240528435d486b484a7f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aac4c939875fb240528435d486b484a7f">&#9670;&#160;</a></span>Connection_close()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_close </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the connection to the connection pool. </p>
<p>The same as calling <a class="el" href="ConnectionPool_8h.html#a5d1f04dc0ae5fc42707dfd934f681c4a" title="Returns a connection to the pool.">ConnectionPool_returnConnection()</a> on a connection. If the connection is in an uncommitted transaction, rollback is called. It is an unchecked error to attempt to use the Connection after this method is called</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac0ce66b1335330efc625c2b93ca7178a" name="ac0ce66b1335330efc625c2b93ca7178a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac0ce66b1335330efc625c2b93ca7178a">&#9670;&#160;</a></span>Connection_beginTransaction()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_beginTransaction </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Begins a new (default) transaction. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">SQLException</td><td>If a database error occurs </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="SQLException_8h.html" title="Signals that an SQL specific exception has occurred.">SQLException.h</a> </dd></dl>
<dl class="section note"><dt>Note</dt><dd>All transactions must be ended with either <a class="el" href="#ac3672ae2a12da6901e53702decb10139" title="Commits the current transaction.">Connection_commit()</a> or <a class="el" href="#a4bdab7bb14c43834ba231aa511919a79" title="Rolls back the current transaction.">Connection_rollback()</a>. Nested transactions are not supported. </dd></dl>

</div>
</div>
<a id="adc2caa32fa40601f41471f46755fc063" name="adc2caa32fa40601f41471f46755fc063"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adc2caa32fa40601f41471f46755fc063">&#9670;&#160;</a></span>Connection_beginTransactionType()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_beginTransactionType </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529">TRANSACTION_TYPE</a></td>          <td class="paramname"><span class="paramname"><em>type</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Begins a new specific transaction. </p>
<p>This method is similar to <a class="el" href="#ac0ce66b1335330efc625c2b93ca7178a" title="Begins a new (default) transaction.">Connection_beginTransaction()</a> except it allows you to specify the new transaction's isolation level explicitly. <a class="el" href="#ac0ce66b1335330efc625c2b93ca7178a" title="Begins a new (default) transaction.">Connection_beginTransaction()</a> uses the default isolation level for the database.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
    <tr><td class="paramname">type</td><td>The transaction type to start </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#a4cd1875ea5ecc896a0974c442afc2529" title="Enum representing different transaction isolation levels and behaviors.">TRANSACTION_TYPE</a> enum for available options. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">SQLException</td><td>If a database error occurs </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="SQLException_8h.html" title="Signals that an SQL specific exception has occurred.">SQLException.h</a> </dd></dl>
<dl class="section note"><dt>Note</dt><dd>All transactions must be ended with either <a class="el" href="#ac3672ae2a12da6901e53702decb10139" title="Commits the current transaction.">Connection_commit()</a> or <a class="el" href="#a4bdab7bb14c43834ba231aa511919a79" title="Rolls back the current transaction.">Connection_rollback()</a>. Nested transactions are not supported. </dd></dl>

</div>
</div>
<a id="a4dcb90c504e73583aaa7fb372973ad7f" name="a4dcb90c504e73583aaa7fb372973ad7f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4dcb90c504e73583aaa7fb372973ad7f">&#9670;&#160;</a></span>Connection_inTransaction()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Connection_inTransaction </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Checks if this Connection is in an uncommitted transaction. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if in a transaction, false otherwise. </dd></dl>

</div>
</div>
<a id="ac3672ae2a12da6901e53702decb10139" name="ac3672ae2a12da6901e53702decb10139"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac3672ae2a12da6901e53702decb10139">&#9670;&#160;</a></span>Connection_commit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_commit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Commits the current transaction. </p>
<p>Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by this Connection object.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">SQLException</td><td>If a database error occurs </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="SQLException_8h.html" title="Signals that an SQL specific exception has occurred.">SQLException.h</a> </dd></dl>

</div>
</div>
<a id="a4bdab7bb14c43834ba231aa511919a79" name="a4bdab7bb14c43834ba231aa511919a79"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4bdab7bb14c43834ba231aa511919a79">&#9670;&#160;</a></span>Connection_rollback()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_rollback </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Rolls back the current transaction. </p>
<p>Undoes all changes made in the current transaction and releases any database locks currently held by this Connection object. This method will first call <a class="el" href="#ae0cd7b68e0e3cfd6a1a458af31db25d3" title="Clears any ResultSet and PreparedStatements in the Connection.">Connection_clear()</a> before performing the rollback to clear any statements in progress such as selects.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">SQLException</td><td>If a database error occurs </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="SQLException_8h.html" title="Signals that an SQL specific exception has occurred.">SQLException.h</a> </dd></dl>

</div>
</div>
<a id="a784a1c368a3b88f93323ceaa2675346a" name="a784a1c368a3b88f93323ceaa2675346a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a784a1c368a3b88f93323ceaa2675346a">&#9670;&#160;</a></span>Connection_lastRowId()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">long long Connection_lastRowId </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the last inserted row ID for auto-increment columns. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The value of the rowid from the last insert statement</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function works as expected for MySQL and SQLite. For PostgreSQL and Oracle, this function may not return the expected value. For these databases, it's recommended to use the RETURNING clause in your INSERT statement instead.</dd></dl>
<p>Example usage for different database systems:</p>
<div class="fragment"><div class="line"><span class="comment">// For MySQL and SQLite:</span></div>
<div class="line"><a class="code hl_function" href="#ad7029336959701d33bb921b89bc5b7ef">Connection_execute</a>(con, <span class="stringliteral">&quot;INSERT INTO users(name) VALUES(%s)&quot;</span>, <span class="stringliteral">&quot;Min-seo&quot;</span>);</div>
<div class="line"><span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">id</span> = <a class="code hl_function" href="#a784a1c368a3b88f93323ceaa2675346a">Connection_lastRowId</a>(con);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// For PostgreSQL (assuming id is the auto increment column name):</span></div>
<div class="line">ResultSet_T r = <a class="code hl_function" href="#a3d1e39204654573ccac3d8ba3a2eae58">Connection_executeQuery</a>(con, <span class="stringliteral">&quot;INSERT INTO users(name) VALUES(%s) RETURNING id&quot;</span>, <span class="stringliteral">&quot;Min-seo&quot;</span>);</div>
<div class="line"><span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">id</span> = <a class="code hl_function" href="ResultSet_8h.html#a771894bb8c0ddfd90ed6ed9c9c3e46b3">ResultSet_next</a>(r) ? <a class="code hl_function" href="ResultSet_8h.html#a5d3ed80bc1b5816f27e135a8e392aca7">ResultSet_getLLong</a>(r, 1) : -1;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// For Oracle:</span></div>
<div class="line">ResultSet_T r = <a class="code hl_function" href="#a3d1e39204654573ccac3d8ba3a2eae58">Connection_executeQuery</a>(con, <span class="stringliteral">&quot;INSERT INTO users(name) VALUES(%s) RETURNING ROWID&quot;</span>, <span class="stringliteral">&quot;Min-seo&quot;</span>);</div>
<div class="line"><span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">id</span> = <a class="code hl_function" href="ResultSet_8h.html#a771894bb8c0ddfd90ed6ed9c9c3e46b3">ResultSet_next</a>(r) ? <a class="code hl_function" href="ResultSet_8h.html#a5d3ed80bc1b5816f27e135a8e392aca7">ResultSet_getLLong</a>(r, 1) : -1;</div>
<div class="ttc" id="aConnection_8h_html_a784a1c368a3b88f93323ceaa2675346a"><div class="ttname"><a href="#a784a1c368a3b88f93323ceaa2675346a">Connection_lastRowId</a></div><div class="ttdeci">long long Connection_lastRowId(T C)</div><div class="ttdoc">Gets the last inserted row ID for auto-increment columns.</div></div>
<div class="ttc" id="aResultSet_8h_html_a5d3ed80bc1b5816f27e135a8e392aca7"><div class="ttname"><a href="ResultSet_8h.html#a5d3ed80bc1b5816f27e135a8e392aca7">ResultSet_getLLong</a></div><div class="ttdeci">long long ResultSet_getLLong(T R, int columnIndex)</div><div class="ttdoc">Gets the designated column's value as a long long.</div></div>
</div><!-- fragment --><p>Using PreparedStatement:</p>
<div class="fragment"><div class="line"><span class="comment">// For MySQL and SQLite:</span></div>
<div class="line">PreparedStatement_T p = <a class="code hl_function" href="#a16dfbbe273d9a872462bed182dec3bb5">Connection_prepareStatement</a>(con, <span class="stringliteral">&quot;INSERT INTO users(name) VALUES(?)&quot;</span>);</div>
<div class="line"><a class="code hl_function" href="PreparedStatement_8h.html#a618654d179459a9394828a4117f97d05">PreparedStatement_setString</a>(p, 1, <span class="stringliteral">&quot;Ji-eun&quot;</span>);</div>
<div class="line"><a class="code hl_function" href="PreparedStatement_8h.html#a6f0eb01daec7f61bf92707b7de0a246f">PreparedStatement_execute</a>(p);</div>
<div class="line"><span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">id</span> = <a class="code hl_function" href="#a784a1c368a3b88f93323ceaa2675346a">Connection_lastRowId</a>(con);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// For PostgreSQL:</span></div>
<div class="line">PreparedStatement_T p = <a class="code hl_function" href="#a16dfbbe273d9a872462bed182dec3bb5">Connection_prepareStatement</a>(con, <span class="stringliteral">&quot;INSERT INTO users(name) VALUES(?) RETURNING id&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// For Oracle:</span></div>
<div class="line">PreparedStatement_T p = <a class="code hl_function" href="#a16dfbbe273d9a872462bed182dec3bb5">Connection_prepareStatement</a>(con, <span class="stringliteral">&quot;INSERT INTO users(name) VALUES(?) RETURNING ROWID&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// for both</span></div>
<div class="line"><a class="code hl_function" href="PreparedStatement_8h.html#a618654d179459a9394828a4117f97d05">PreparedStatement_setString</a>(p, 1, <span class="stringliteral">&quot;Ji-eun&quot;</span>);</div>
<div class="line">ResultSet_T r = <a class="code hl_function" href="PreparedStatement_8h.html#a3e33ed8289ac8b8b11438b009a169e63">PreparedStatement_executeQuery</a>(p);</div>
<div class="line"><span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">id</span> = <a class="code hl_function" href="ResultSet_8h.html#a771894bb8c0ddfd90ed6ed9c9c3e46b3">ResultSet_next</a>(r) ? <a class="code hl_function" href="ResultSet_8h.html#a5d3ed80bc1b5816f27e135a8e392aca7">ResultSet_getLLong</a>(r, 1) : -1;</div>
<div class="ttc" id="aPreparedStatement_8h_html_a3e33ed8289ac8b8b11438b009a169e63"><div class="ttname"><a href="PreparedStatement_8h.html#a3e33ed8289ac8b8b11438b009a169e63">PreparedStatement_executeQuery</a></div><div class="ttdeci">ResultSet_T PreparedStatement_executeQuery(T P)</div><div class="ttdoc">Executes the prepared SQL query.</div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="ResultSet_8h.html" title="A ResultSet represents a database result set.">ResultSet.h</a> </dd></dl>

</div>
</div>
<a id="a7a1727da9b90633faacac82efd93e0cc" name="a7a1727da9b90633faacac82efd93e0cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7a1727da9b90633faacac82efd93e0cc">&#9670;&#160;</a></span>Connection_rowsChanged()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">long long Connection_rowsChanged </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the number of rows affected by the last execute() statement. </p>
<p>If used with a transaction, this method should be called <em>before</em> commit is executed, otherwise 0 is returned.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of rows changed by the last (DIM) SQL statement </dd></dl>

</div>
</div>
<a id="ad7029336959701d33bb921b89bc5b7ef" name="ad7029336959701d33bb921b89bc5b7ef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad7029336959701d33bb921b89bc5b7ef">&#9670;&#160;</a></span>Connection_execute()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connection_execute </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *</td>          <td class="paramname"><span class="paramname"><em>sql</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"></td>          <td class="paramname"><span class="paramname"><em>...</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Executes a SQL statement, with or without parameters. </p>
<p>Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement. Several SQL statements can be used in the sql parameter string, each separated with the <code>;</code> SQL statement separator character. <b>Note</b>, calling this method clears any previous ResultSets associated with the Connection.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
    <tr><td class="paramname">sql</td><td>A SQL statement </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">SQLException</td><td>If a database error occurs. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="SQLException_8h.html" title="Signals that an SQL specific exception has occurred.">SQLException.h</a> </dd></dl>

</div>
</div>
<a id="a3d1e39204654573ccac3d8ba3a2eae58" name="a3d1e39204654573ccac3d8ba3a2eae58"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3d1e39204654573ccac3d8ba3a2eae58">&#9670;&#160;</a></span>Connection_executeQuery()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ResultSet_T Connection_executeQuery </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *</td>          <td class="paramname"><span class="paramname"><em>sql</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"></td>          <td class="paramname"><span class="paramname"><em>...</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Executes a SQL query and returns a ResultSet. </p>
<p>You may <b>only</b> use one SQL statement with this method. This is different from the behavior of <a class="el" href="#ad7029336959701d33bb921b89bc5b7ef" title="Executes a SQL statement, with or without parameters.">Connection_execute()</a> which executes all SQL statements in its input string. If the sql parameter string contains more than one SQL statement, only the first statement is executed, the others are silently ignored. A ResultSet a valid until the next call to <a class="el" href="#a3d1e39204654573ccac3d8ba3a2eae58" title="Executes a SQL query and returns a ResultSet.">Connection_executeQuery()</a>, <a class="el" href="#ad7029336959701d33bb921b89bc5b7ef" title="Executes a SQL statement, with or without parameters.">Connection_execute()</a> or until the Connection is returned to the Connection Pool. <em>This means that Result Sets cannot be saved between queries</em>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
    <tr><td class="paramname">sql</td><td>A SQL statement </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A ResultSet object that contains the data produced by the given query. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">SQLException</td><td>If a database error occurs. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="ResultSet_8h.html" title="A ResultSet represents a database result set.">ResultSet.h</a> </dd>
<dd>
<a class="el" href="SQLException_8h.html" title="Signals that an SQL specific exception has occurred.">SQLException.h</a> </dd></dl>

</div>
</div>
<a id="a16dfbbe273d9a872462bed182dec3bb5" name="a16dfbbe273d9a872462bed182dec3bb5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a16dfbbe273d9a872462bed182dec3bb5">&#9670;&#160;</a></span>Connection_prepareStatement()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">PreparedStatement_T Connection_prepareStatement </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *</td>          <td class="paramname"><span class="paramname"><em>sql</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"></td>          <td class="paramname"><span class="paramname"><em>...</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Prepares a SQL statement for execution. </p>
<p>The <code>sql</code> parameter may contain IN parameter placeholders. An IN placeholder is specified with a '?' character in the sql string. The placeholders are then replaced with actual values by using the PreparedStatement's setXXX methods. Only <em>one</em> SQL statement may be used in the sql parameter, this in difference to <a class="el" href="#ad7029336959701d33bb921b89bc5b7ef" title="Executes a SQL statement, with or without parameters.">Connection_execute()</a> which may take several statements. A PreparedStatement is valid until the Connection is returned to the Connection Pool.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
    <tr><td class="paramname">sql</td><td>A single SQL statement that may contain one or more '?' IN parameter placeholders </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new PreparedStatement object containing the pre-compiled SQL statement. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">SQLException</td><td>If a database error occurs. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="PreparedStatement_8h.html" title="A PreparedStatement represents a single SQL statement pre-compiled into byte code for later execution...">PreparedStatement.h</a> </dd>
<dd>
<a class="el" href="SQLException_8h.html" title="Signals that an SQL specific exception has occurred.">SQLException.h</a> </dd></dl>

</div>
</div>
<a id="a5202b3c879bd859705be9503eef00a92" name="a5202b3c879bd859705be9503eef00a92"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5202b3c879bd859705be9503eef00a92">&#9670;&#160;</a></span>Connection_getLastError()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char * Connection_getLastError </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>          <td class="paramname"><span class="paramname"><em>C</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the last SQL error message. </p>
<p>This method can be used to obtain a string describing the last error that occurred. Inside a CATCH-block you can also find the error message directly in the variable Exception_frame.message. It is recommended to use this variable instead since it contains both SQL errors and API errors such as parameter index out of range etc, while <a class="el" href="#a5202b3c879bd859705be9503eef00a92" title="Gets the last SQL error message.">Connection_getLastError()</a> might only show SQL errors</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">C</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A string explaining the last error </dd></dl>

</div>
</div>
<a id="acb342bb922ef5ad26829605340134f0e" name="acb342bb922ef5ad26829605340134f0e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acb342bb922ef5ad26829605340134f0e">&#9670;&#160;</a></span>Connection_isSupported()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Connection_isSupported </td>
          <td>(</td>
          <td class="paramtype">const char *</td>          <td class="paramname"><span class="paramname"><em>url</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Checks if the specified database system is supported. </p>
<p>Clients may pass a full Connection URL, for example using <a class="el" href="URL_8h.html#aa99b864d90166163f3e1c538d130a393" title="Returns a string representation of this URL object.">URL_toString()</a>, or for convenience only the protocol part of the URL. E.g. "mysql" or "sqlite".</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">url</td><td>A database url string or database name </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if supported, false otherwise. </dd></dl>

</div>
</div>
</div><!-- contents -->
<p style="text-align:center;color:#808080;font-size:90%;margin:40px 0 20px 0;">
Copyright &copy; <a href="https://tildeslash.com/">Tildeslash Ltd</a>. All
rights reserved.</p>
</body></html>