File: classzdb_1_1Connection.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 (835 lines) | stat: -rw-r--r-- 62,858 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
<!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</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="namespacezdb.html">zdb</a></li><li class="navelem"><a class="el" href="classzdb_1_1Connection.html">Connection</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-static-methods">Static Public Member Functions</a>  </div>
  <div class="headertitle"><div class="title">Connection</div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Represents a connection to a SQL database system. </p>
<p>Use a <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> to execute SQL statements. There are three ways to execute statements: <a class="el" href="#aab458702e94c00b9df1734e5b725cd36" title="Executes a SQL statement, with or without parameters.">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="#af68e46ae0740c0b7db284465656a6b45" title="Executes a SQL query and returns a ResultSet.">executeQuery()</a> is used to execute a SQL SELECT statement and return a result set. These methods can handle various data types, including binary data, by automatically creating a <a class="el" href="classzdb_1_1PreparedStatement.html" title="Represents a pre-compiled SQL statement for later execution.">PreparedStatement</a> when arguments are provided. For more complex scenarios or when reusing statements, you can explicitly create a <a class="el" href="classzdb_1_1PreparedStatement.html" title="Represents a pre-compiled SQL statement for later execution.">PreparedStatement</a> object using the <a class="el" href="#af33971b5c1e0860dd86015bb9d9b01a9" title="Prepares a SQL statement for execution.">prepareStatement()</a> method.</p>
<p>The method <a class="el" href="#af68e46ae0740c0b7db284465656a6b45" title="Executes a SQL query and returns a ResultSet.">executeQuery()</a> will return an empty <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> (not null) if the SQL statement did not return any values. A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> is valid until the next call to <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> execute or until the <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> is returned to the <a class="el" href="classzdb_1_1ConnectionPool.html" title="Represents a database connection pool.">ConnectionPool</a>. If an error occurs during execution, an <a class="el" href="classzdb_1_1sql__exception.html" title="Exception class for SQL related errors.">sql_exception</a> 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="#af5edd522c28907ba30c4cb98d742d3ff" title="Begins a new transaction with optional isolation level.">beginTransaction()</a>. Such transactions usually persist until the next call to <a class="el" href="#ad55316f5135cdae6aa6c5a763f6c3473" title="Commits the current transaction.">commit()</a> or <a class="el" href="#a071de472f6ac976c658e4643f3fb3d0c" title="Rolls back the current transaction.">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_md51"></a>
Examples</h2>
<h3><a class="anchor" id="autotoc_md52"></a>
Basic Query Execution</h3>
<div class="fragment"><div class="line"><a class="code hl_class" href="classzdb_1_1Connection.html">Connection</a> con = pool.getConnection();</div>
<div class="line"><a class="code hl_class" href="classzdb_1_1ResultSet.html">ResultSet</a> result = con.<a class="code hl_function" href="#af68e46ae0740c0b7db284465656a6b45">executeQuery</a>(<span class="stringliteral">&quot;SELECT name, age FROM users WHERE id = ?&quot;</span>, 1);</div>
<div class="line"><span class="keywordflow">if</span> (result.<a class="code hl_function" href="classzdb_1_1ResultSet.html#a80870c233d0237e3588a2d6f8d176916">next</a>()) {</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;Name: &quot;</span> &lt;&lt; result.<a class="code hl_function" href="classzdb_1_1ResultSet.html#ac00f123b0b60a08479a813b7d569a15a">getString</a>(<span class="stringliteral">&quot;name&quot;</span>).value_or(<span class="stringliteral">&quot;N/A&quot;</span>)</div>
<div class="line">              &lt;&lt; <span class="stringliteral">&quot;, Age: &quot;</span> &lt;&lt; result.<a class="code hl_function" href="classzdb_1_1ResultSet.html#a2e7dde031277c762bd5112487b2fad52">getInt</a>(<span class="stringliteral">&quot;age&quot;</span>) &lt;&lt; std::endl;</div>
<div class="line">}</div>
<div class="ttc" id="aclasszdb_1_1Connection_html"><div class="ttname"><a href="classzdb_1_1Connection.html">zdb::Connection</a></div><div class="ttdoc">Represents a connection to a SQL database system.</div><div class="ttdef"><b>Definition</b> zdbpp.h:1331</div></div>
<div class="ttc" id="aclasszdb_1_1Connection_html_af68e46ae0740c0b7db284465656a6b45"><div class="ttname"><a href="#af68e46ae0740c0b7db284465656a6b45">zdb::Connection::executeQuery</a></div><div class="ttdeci">ResultSet executeQuery(const std::string &amp;sql, Args &amp;&amp;... args)</div><div class="ttdoc">Executes a SQL query and returns a ResultSet.</div><div class="ttdef"><b>Definition</b> zdbpp.h:1584</div></div>
<div class="ttc" id="aclasszdb_1_1ResultSet_html"><div class="ttname"><a href="classzdb_1_1ResultSet.html">zdb::ResultSet</a></div><div class="ttdoc">Represents a database result set.</div><div class="ttdef"><b>Definition</b> zdbpp.h:588</div></div>
<div class="ttc" id="aclasszdb_1_1ResultSet_html_a2e7dde031277c762bd5112487b2fad52"><div class="ttname"><a href="classzdb_1_1ResultSet.html#a2e7dde031277c762bd5112487b2fad52">zdb::ResultSet::getInt</a></div><div class="ttdeci">int getInt(int columnIndex)</div><div class="ttdoc">Gets the designated column's value as an int.</div><div class="ttdef"><b>Definition</b> zdbpp.h:729</div></div>
<div class="ttc" id="aclasszdb_1_1ResultSet_html_a80870c233d0237e3588a2d6f8d176916"><div class="ttname"><a href="classzdb_1_1ResultSet.html#a80870c233d0237e3588a2d6f8d176916">zdb::ResultSet::next</a></div><div class="ttdeci">bool next()</div><div class="ttdoc">Moves the cursor to the next row.</div><div class="ttdef"><b>Definition</b> zdbpp.h:675</div></div>
<div class="ttc" id="aclasszdb_1_1ResultSet_html_ac00f123b0b60a08479a813b7d569a15a"><div class="ttname"><a href="classzdb_1_1ResultSet.html#ac00f123b0b60a08479a813b7d569a15a">zdb::ResultSet::getString</a></div><div class="ttdeci">std::optional&lt; std::string_view &gt; getString(int columnIndex)</div><div class="ttdoc">Gets the designated column's value as a string.</div><div class="ttdef"><b>Definition</b> zdbpp.h:705</div></div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md53"></a>
Transaction Example</h3>
<div class="fragment"><div class="line"><span class="keywordflow">try</span> {</div>
<div class="line">    <a class="code hl_class" href="classzdb_1_1Connection.html">Connection</a> con = pool.getConnection();</div>
<div class="line">    con.<a class="code hl_function" href="#af5edd522c28907ba30c4cb98d742d3ff">beginTransaction</a>();</div>
<div class="line">    con.<a class="code hl_function" href="#aab458702e94c00b9df1734e5b725cd36">execute</a>(<span class="stringliteral">&quot;UPDATE accounts SET balance = balance - ? WHERE id = ?&quot;</span>, 100.0, 1);</div>
<div class="line">    con.<a class="code hl_function" href="#aab458702e94c00b9df1734e5b725cd36">execute</a>(<span class="stringliteral">&quot;UPDATE accounts SET balance = balance + ? WHERE id = ?&quot;</span>, 100.0, 2);</div>
<div class="line">    con.<a class="code hl_function" href="#ad55316f5135cdae6aa6c5a763f6c3473">commit</a>();</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;Transfer successful&quot;</span> &lt;&lt; std::endl;</div>
<div class="line">} <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="code hl_class" href="classzdb_1_1sql__exception.html">sql_exception</a>&amp; e) {</div>
<div class="line">    <span class="comment">// See note below why we don&#39;t have to explicit call rollback here</span></div>
<div class="line">    std::cerr &lt;&lt; <span class="stringliteral">&quot;Transfer failed: &quot;</span> &lt;&lt; e.what() &lt;&lt; std::endl;</div>
<div class="line">}</div>
<div class="ttc" id="aclasszdb_1_1Connection_html_aab458702e94c00b9df1734e5b725cd36"><div class="ttname"><a href="#aab458702e94c00b9df1734e5b725cd36">zdb::Connection::execute</a></div><div class="ttdeci">void execute(const std::string &amp;sql, Args &amp;&amp;... args)</div><div class="ttdoc">Executes a SQL statement, with or without parameters.</div><div class="ttdef"><b>Definition</b> zdbpp.h:1546</div></div>
<div class="ttc" id="aclasszdb_1_1Connection_html_ad55316f5135cdae6aa6c5a763f6c3473"><div class="ttname"><a href="#ad55316f5135cdae6aa6c5a763f6c3473">zdb::Connection::commit</a></div><div class="ttdeci">void commit()</div><div class="ttdoc">Commits the current transaction.</div><div class="ttdef"><b>Definition</b> zdbpp.h:1468</div></div>
<div class="ttc" id="aclasszdb_1_1Connection_html_af5edd522c28907ba30c4cb98d742d3ff"><div class="ttname"><a href="#af5edd522c28907ba30c4cb98d742d3ff">zdb::Connection::beginTransaction</a></div><div class="ttdeci">void beginTransaction(TRANSACTION_TYPE type=TRANSACTION_DEFAULT)</div><div class="ttdoc">Begins a new transaction with optional isolation level.</div><div class="ttdef"><b>Definition</b> zdbpp.h:1452</div></div>
<div class="ttc" id="aclasszdb_1_1sql__exception_html"><div class="ttname"><a href="classzdb_1_1sql__exception.html">zdb::sql_exception</a></div><div class="ttdoc">Exception class for SQL related errors.</div><div class="ttdef"><b>Definition</b> zdbpp.h:273</div></div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md54"></a>
Using PreparedStatement</h3>
<div class="fragment"><div class="line"><a class="code hl_class" href="classzdb_1_1Connection.html">Connection</a> con = pool.getConnection();</div>
<div class="line"><span class="keyword">auto</span> stmt = con.<a class="code hl_function" href="#af33971b5c1e0860dd86015bb9d9b01a9">prepareStatement</a>(<span class="stringliteral">&quot;INSERT INTO logs (message, timestamp) VALUES (?, ?)&quot;</span>);</div>
<div class="line">stmt.<a class="code hl_function" href="classzdb_1_1PreparedStatement.html#a8863f76c0f07aa5991fea801d4aef440">bindValues</a>(<span class="stringliteral">&quot;User logged in&quot;</span>, std::time(<span class="keyword">nullptr</span>));</div>
<div class="line">stmt.execute();</div>
<div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;Rows affected: &quot;</span> &lt;&lt; stmt.rowsChanged() &lt;&lt; std::endl;</div>
<div class="ttc" id="aclasszdb_1_1Connection_html_af33971b5c1e0860dd86015bb9d9b01a9"><div class="ttname"><a href="#af33971b5c1e0860dd86015bb9d9b01a9">zdb::Connection::prepareStatement</a></div><div class="ttdeci">PreparedStatement prepareStatement(const std::string &amp;sql)</div><div class="ttdoc">Prepares a SQL statement for execution.</div><div class="ttdef"><b>Definition</b> zdbpp.h:1617</div></div>
<div class="ttc" id="aclasszdb_1_1PreparedStatement_html_a8863f76c0f07aa5991fea801d4aef440"><div class="ttname"><a href="classzdb_1_1PreparedStatement.html#a8863f76c0f07aa5991fea801d4aef440">zdb::PreparedStatement::bindValues</a></div><div class="ttdeci">void bindValues(Args &amp;&amp;... args)</div><div class="ttdoc">Binds multiple values to the Prepared Statement at once.</div><div class="ttdef"><b>Definition</b> zdbpp.h:1159</div></div>
</div><!-- fragment --><p><em>A <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> 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 <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> object goes out of scope, 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, ensuring data integrity even in the face of exceptions.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd><a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> objects are internally managed by the <a class="el" href="classzdb_1_1ConnectionPool.html" title="Represents a database connection pool.">ConnectionPool</a> that created them and are not copyable or movable. Always ensure that the originating <a class="el" href="classzdb_1_1ConnectionPool.html" title="Represents a database connection pool.">ConnectionPool</a> object remains valid for the entire duration of the <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a>'s use. It is recommended to obtain a <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a>, use it for a specific task, and then close it (return it to the pool) as soon as possible, rather than holding onto it for extended periods. </dd></dl>
</div>
<p>Represents a connection to a SQL database system.  
 <a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Properties</div></td></tr>
<tr class="memitem:a8aaf0288c1c18b61dc1bd39c1bec09b0" id="r_a8aaf0288c1c18b61dc1bd39c1bec09b0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8aaf0288c1c18b61dc1bd39c1bec09b0">setQueryTimeout</a> (int ms) noexcept</td></tr>
<tr class="memdesc:a8aaf0288c1c18b61dc1bd39c1bec09b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the query timeout for this <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a>.  <br /></td></tr>
<tr class="separator:a8aaf0288c1c18b61dc1bd39c1bec09b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9bb95e06b67f0d6341a5580e96dfd6d5" id="r_a9bb95e06b67f0d6341a5580e96dfd6d5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9bb95e06b67f0d6341a5580e96dfd6d5">getQueryTimeout</a> () noexcept</td></tr>
<tr class="memdesc:a9bb95e06b67f0d6341a5580e96dfd6d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the query timeout for this <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a>.  <br /></td></tr>
<tr class="separator:a9bb95e06b67f0d6341a5580e96dfd6d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abc15e8f3546a76b4c71b8c753a86fdb8" id="r_abc15e8f3546a76b4c71b8c753a86fdb8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#abc15e8f3546a76b4c71b8c753a86fdb8">setMaxRows</a> (int max) noexcept</td></tr>
<tr class="memdesc:abc15e8f3546a76b4c71b8c753a86fdb8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the maximum number of rows for <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects.  <br /></td></tr>
<tr class="separator:abc15e8f3546a76b4c71b8c753a86fdb8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8daf5e064550991f0375acd5bce21f7e" id="r_a8daf5e064550991f0375acd5bce21f7e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8daf5e064550991f0375acd5bce21f7e">getMaxRows</a> () noexcept</td></tr>
<tr class="memdesc:a8daf5e064550991f0375acd5bce21f7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the maximum number of rows for <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects.  <br /></td></tr>
<tr class="separator:a8daf5e064550991f0375acd5bce21f7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abbf636ade7858de8e9b91b7b87667df5" id="r_abbf636ade7858de8e9b91b7b87667df5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#abbf636ade7858de8e9b91b7b87667df5">setFetchSize</a> (int rows) noexcept</td></tr>
<tr class="memdesc:abbf636ade7858de8e9b91b7b87667df5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the number of rows to fetch for <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects.  <br /></td></tr>
<tr class="separator:abbf636ade7858de8e9b91b7b87667df5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7948c7ccabbf0fab6c126628c904b94f" id="r_a7948c7ccabbf0fab6c126628c904b94f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a7948c7ccabbf0fab6c126628c904b94f">getFetchSize</a> () noexcept</td></tr>
<tr class="memdesc:a7948c7ccabbf0fab6c126628c904b94f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of rows to fetch for <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects.  <br /></td></tr>
<tr class="separator:a7948c7ccabbf0fab6c126628c904b94f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Functions</div></td></tr>
<tr class="memitem:a753b006e343f67046df5eff7b9c6eb78" id="r_a753b006e343f67046df5eff7b9c6eb78"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a753b006e343f67046df5eff7b9c6eb78">ping</a> () noexcept</td></tr>
<tr class="memdesc:a753b006e343f67046df5eff7b9c6eb78"><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:a753b006e343f67046df5eff7b9c6eb78"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a03bfacfaaba9195e4498375659f43531" id="r_a03bfacfaaba9195e4498375659f43531"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a03bfacfaaba9195e4498375659f43531">clear</a> () noexcept</td></tr>
<tr class="memdesc:a03bfacfaaba9195e4498375659f43531"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears any <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> and PreparedStatements in the <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a>.  <br /></td></tr>
<tr class="separator:a03bfacfaaba9195e4498375659f43531"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ead8fad3dd09d3a8b03e6c948f14e46" id="r_a2ead8fad3dd09d3a8b03e6c948f14e46"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a2ead8fad3dd09d3a8b03e6c948f14e46">close</a> () noexcept</td></tr>
<tr class="memdesc:a2ead8fad3dd09d3a8b03e6c948f14e46"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the connection to the connection pool.  <br /></td></tr>
<tr class="separator:a2ead8fad3dd09d3a8b03e6c948f14e46"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af5edd522c28907ba30c4cb98d742d3ff" id="r_af5edd522c28907ba30c4cb98d742d3ff"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af5edd522c28907ba30c4cb98d742d3ff">beginTransaction</a> (<a class="el" href="Connection_8h.html#a4cd1875ea5ecc896a0974c442afc2529">TRANSACTION_TYPE</a> type=<a class="el" href="Connection_8h.html#a4cd1875ea5ecc896a0974c442afc2529ad0bbcf3460953ea9db3ad9cc91b7fbe9">TRANSACTION_DEFAULT</a>)</td></tr>
<tr class="memdesc:af5edd522c28907ba30c4cb98d742d3ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Begins a new transaction with optional isolation level.  <br /></td></tr>
<tr class="separator:af5edd522c28907ba30c4cb98d742d3ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acb8eca15b5454a565f00a8e8a15627b4" id="r_acb8eca15b5454a565f00a8e8a15627b4"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#acb8eca15b5454a565f00a8e8a15627b4">inTransaction</a> () const noexcept</td></tr>
<tr class="memdesc:acb8eca15b5454a565f00a8e8a15627b4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if this <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> is in an uncommitted transaction.  <br /></td></tr>
<tr class="separator:acb8eca15b5454a565f00a8e8a15627b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad55316f5135cdae6aa6c5a763f6c3473" id="r_ad55316f5135cdae6aa6c5a763f6c3473"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad55316f5135cdae6aa6c5a763f6c3473">commit</a> ()</td></tr>
<tr class="memdesc:ad55316f5135cdae6aa6c5a763f6c3473"><td class="mdescLeft">&#160;</td><td class="mdescRight">Commits the current transaction.  <br /></td></tr>
<tr class="separator:ad55316f5135cdae6aa6c5a763f6c3473"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a071de472f6ac976c658e4643f3fb3d0c" id="r_a071de472f6ac976c658e4643f3fb3d0c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a071de472f6ac976c658e4643f3fb3d0c">rollback</a> ()</td></tr>
<tr class="memdesc:a071de472f6ac976c658e4643f3fb3d0c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rolls back the current transaction.  <br /></td></tr>
<tr class="separator:a071de472f6ac976c658e4643f3fb3d0c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a911fb38e45513e500a716f92ab8426ec" id="r_a911fb38e45513e500a716f92ab8426ec"><td class="memItemLeft" align="right" valign="top">long long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a911fb38e45513e500a716f92ab8426ec">lastRowId</a> () noexcept</td></tr>
<tr class="memdesc:a911fb38e45513e500a716f92ab8426ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the last inserted row ID for auto-increment columns.  <br /></td></tr>
<tr class="separator:a911fb38e45513e500a716f92ab8426ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f72484a003968e3ef14662256e118bd" id="r_a2f72484a003968e3ef14662256e118bd"><td class="memItemLeft" align="right" valign="top">long long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a2f72484a003968e3ef14662256e118bd">rowsChanged</a> () noexcept</td></tr>
<tr class="memdesc:a2f72484a003968e3ef14662256e118bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of rows affected by the last <a class="el" href="#aab458702e94c00b9df1734e5b725cd36" title="Executes a SQL statement, with or without parameters.">execute()</a> statement.  <br /></td></tr>
<tr class="separator:a2f72484a003968e3ef14662256e118bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aab458702e94c00b9df1734e5b725cd36" id="r_aab458702e94c00b9df1734e5b725cd36"><td class="memTemplParams" colspan="2">template&lt;typename... Args&gt; </td></tr>
<tr class="memitem:aab458702e94c00b9df1734e5b725cd36"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#aab458702e94c00b9df1734e5b725cd36">execute</a> (const std::string &amp;sql, Args &amp;&amp;... args)</td></tr>
<tr class="memdesc:aab458702e94c00b9df1734e5b725cd36"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes a SQL statement, with or without parameters.  <br /></td></tr>
<tr class="separator:aab458702e94c00b9df1734e5b725cd36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af68e46ae0740c0b7db284465656a6b45" id="r_af68e46ae0740c0b7db284465656a6b45"><td class="memTemplParams" colspan="2">template&lt;typename... Args&gt; </td></tr>
<tr class="memitem:af68e46ae0740c0b7db284465656a6b45"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classzdb_1_1ResultSet.html">ResultSet</a>&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#af68e46ae0740c0b7db284465656a6b45">executeQuery</a> (const std::string &amp;sql, Args &amp;&amp;... args)</td></tr>
<tr class="memdesc:af68e46ae0740c0b7db284465656a6b45"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes a SQL query and returns a <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a>.  <br /></td></tr>
<tr class="separator:af68e46ae0740c0b7db284465656a6b45"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af33971b5c1e0860dd86015bb9d9b01a9" id="r_af33971b5c1e0860dd86015bb9d9b01a9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classzdb_1_1PreparedStatement.html">PreparedStatement</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af33971b5c1e0860dd86015bb9d9b01a9">prepareStatement</a> (const std::string &amp;sql)</td></tr>
<tr class="memdesc:af33971b5c1e0860dd86015bb9d9b01a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prepares a SQL statement for execution.  <br /></td></tr>
<tr class="separator:af33971b5c1e0860dd86015bb9d9b01a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a624b0f65e1b5755b05010c02360ce927" id="r_a624b0f65e1b5755b05010c02360ce927"><td class="memItemLeft" align="right" valign="top">std::optional&lt; std::string_view &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a624b0f65e1b5755b05010c02360ce927">getLastError</a> () const noexcept</td></tr>
<tr class="memdesc:a624b0f65e1b5755b05010c02360ce927"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the last SQL error message.  <br /></td></tr>
<tr class="separator:a624b0f65e1b5755b05010c02360ce927"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:abeceaaf4177439057a9df54c4721a88c" id="r_abeceaaf4177439057a9df54c4721a88c"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#abeceaaf4177439057a9df54c4721a88c">isSupported</a> (const std::string &amp;url) noexcept</td></tr>
<tr class="memdesc:abeceaaf4177439057a9df54c4721a88c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if the specified database system is supported.  <br /></td></tr>
<tr class="separator:abeceaaf4177439057a9df54c4721a88c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a8aaf0288c1c18b61dc1bd39c1bec09b0" name="a8aaf0288c1c18b61dc1bd39c1bec09b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8aaf0288c1c18b61dc1bd39c1bec09b0">&#9670;&#160;</a></span>setQueryTimeout()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void setQueryTimeout </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>ms</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Sets the query timeout for this <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a>. </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 timeout. The default is no query timeout.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ms</td><td>Timeout in milliseconds. </td></tr>
  </table>
  </dd>
</dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int getQueryTimeout </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the query timeout for this <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>The query timeout in milliseconds. </dd></dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void setMaxRows </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>max</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Sets the maximum number of rows for <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> 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">max</td><td>Maximum number of rows. </td></tr>
  </table>
  </dd>
</dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int getMaxRows </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the maximum number of rows for <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects. </p>
<dl class="section return"><dt>Returns</dt><dd>The maximum number of rows. </dd></dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void setFetchSize </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>rows</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Sets the number of rows to fetch for <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects. </p>
<p>The default value is 100, meaning that a <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> will prefetch rows in batches of 100 rows to reduce the network roundtrip to the database. This value can also be set via the <a class="el" href="classzdb_1_1URL.html" title="Represents an immutable Uniform Resource Locator.">URL</a> 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">rows</td><td>Number of rows to fetch. </td></tr>
  </table>
  </dd>
</dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int getFetchSize </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the number of rows to fetch for <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects. </p>
<dl class="section return"><dt>Returns</dt><dd>The number of rows to fetch. </dd></dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool ping </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Pings the database server to check if the connection is alive. </p>
<dl class="section return"><dt>Returns</dt><dd>true if the connection is alive, false otherwise. </dd></dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void clear </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Clears any <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> and PreparedStatements in the <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a>. </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>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void close </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span>  </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="classzdb_1_1ConnectionPool.html#a1265c915e394316c05914d36138f552a" 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 <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> after this method was called </p>

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

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void beginTransaction </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a4cd1875ea5ecc896a0974c442afc2529">TRANSACTION_TYPE</a></td>          <td class="paramname"><span class="paramname"><em>type</em></span><span class="paramdefsep"> = </span><span class="paramdefval"><a class="el" href="Connection_8h.html#a4cd1875ea5ecc896a0974c442afc2529ad0bbcf3460953ea9db3ad9cc91b7fbe9">TRANSACTION_DEFAULT</a></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Begins a new transaction with optional isolation level. </p>
<p>Example usage: </p><div class="fragment"><div class="line"><span class="comment">// Use default isolation level</span></div>
<div class="line">connection.beginTransaction();</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Specify isolation level</span></div>
<div class="line">connection.beginTransaction(<a class="code hl_enumvalue" href="Connection_8h.html#a4cd1875ea5ecc896a0974c442afc2529a1d4194877393651107a4150e69a18178">TRANSACTION_SERIALIZABLE</a>);</div>
<div class="ttc" id="aConnection_8h_html_a4cd1875ea5ecc896a0974c442afc2529a1d4194877393651107a4150e69a18178"><div class="ttname"><a href="Connection_8h.html#a4cd1875ea5ecc896a0974c442afc2529a1d4194877393651107a4150e69a18178">TRANSACTION_SERIALIZABLE</a></div><div class="ttdeci">@ TRANSACTION_SERIALIZABLE</div><div class="ttdoc">Highest isolation level.</div><div class="ttdef"><b>Definition</b> Connection.h:181</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">type</td><td>The transaction isolation level (default: TRANSACTION_DEFAULT). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="Connection_8h.html#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"><a class="el" href="classzdb_1_1sql__exception.html" title="Exception class for SQL related errors.">sql_exception</a></td><td>If a database error occurs or if a transaction is already in progress. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>All transactions must be ended with either <a class="el" href="#ad55316f5135cdae6aa6c5a763f6c3473" title="Commits the current transaction.">commit()</a> or <a class="el" href="#a071de472f6ac976c658e4643f3fb3d0c" title="Rolls back the current transaction.">rollback()</a>. Nested transactions are not supported. </dd></dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool inTransaction </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Checks if this <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> is in an uncommitted transaction. </p>
<dl class="section return"><dt>Returns</dt><dd>true if in a transaction, false otherwise. </dd></dl>

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

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void commit </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Commits the current transaction. </p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classzdb_1_1sql__exception.html" title="Exception class for SQL related errors.">sql_exception</a></td><td>If a database error occurs. </td></tr>
  </table>
  </dd>
</dl>

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

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rollback </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Rolls back the current transaction. </p>
<p>This method will first call <a class="el" href="#a03bfacfaaba9195e4498375659f43531" title="Clears any ResultSet and PreparedStatements in the Connection.">clear()</a> before performing the rollback to clear any statements in progress such as selects.</p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classzdb_1_1sql__exception.html" title="Exception class for SQL related errors.">sql_exception</a></td><td>If a database error occurs. </td></tr>
  </table>
  </dd>
</dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long long lastRowId </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the last inserted row ID for auto-increment columns. </p>
<dl class="section return"><dt>Returns</dt><dd>The last inserted row ID.</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">con.execute(<span class="stringliteral">&quot;INSERT INTO users(name) VALUES(?)&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> = con.lastRowId();</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"><a class="code hl_class" href="classzdb_1_1ResultSet.html">ResultSet</a> r = con.executeQuery(<span class="stringliteral">&quot;INSERT INTO users(name) VALUES(?) 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> = r.<a class="code hl_function" href="classzdb_1_1ResultSet.html#a80870c233d0237e3588a2d6f8d176916">next</a>() ? r.<a class="code hl_function" href="classzdb_1_1ResultSet.html#af81be46a299e4f68dbd8bb92bb679550">getLLong</a>(1) : -1;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// For Oracle:</span></div>
<div class="line"><a class="code hl_class" href="classzdb_1_1ResultSet.html">ResultSet</a> r = con.executeQuery(<span class="stringliteral">&quot;INSERT INTO users(name) VALUES(?) 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> = r.<a class="code hl_function" href="classzdb_1_1ResultSet.html#a80870c233d0237e3588a2d6f8d176916">next</a>() ? r.<a class="code hl_function" href="classzdb_1_1ResultSet.html#af81be46a299e4f68dbd8bb92bb679550">getLLong</a>(1) : -1;</div>
<div class="ttc" id="aclasszdb_1_1ResultSet_html_af81be46a299e4f68dbd8bb92bb679550"><div class="ttname"><a href="classzdb_1_1ResultSet.html#af81be46a299e4f68dbd8bb92bb679550">zdb::ResultSet::getLLong</a></div><div class="ttdeci">long long getLLong(int columnIndex)</div><div class="ttdoc">Gets the designated column's value as a long long.</div><div class="ttdef"><b>Definition</b> zdbpp.h:749</div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> </dd></dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long long rowsChanged </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the number of rows affected by the last <a class="el" href="#aab458702e94c00b9df1734e5b725cd36" title="Executes a SQL statement, with or without parameters.">execute()</a> 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="section return"><dt>Returns</dt><dd>The number of rows changed. </dd></dl>

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

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename... Args&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void execute </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>sql</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Args &amp;&amp;...</td>          <td class="paramname"><span class="paramname"><em>args</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Executes a SQL statement, with or without parameters. </p>
<p>This method can be used in two ways:</p><ol type="1">
<li>With only a SQL string, which directly executes the statement(s).</li>
<li>With a SQL string and additional arguments, which creates a <a class="el" href="classzdb_1_1PreparedStatement.html" title="Represents a pre-compiled SQL statement for later execution.">PreparedStatement</a>, binds the provided parameters, and then executes it.</li>
</ol>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sql</td><td>The SQL statement to execute. </td></tr>
    <tr><td class="paramname">args</td><td>(Optional) Arguments to bind to the statement. These can be of various types, including string-like types, numeric types, blob-like types, time_t, and nullptr. </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classzdb_1_1sql__exception.html" title="Exception class for SQL related errors.">sql_exception</a></td><td>If a database access error occurs or if the types of the provided arguments don't match the expected types in the SQL statement. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>When used without arguments, this method is more efficient as it doesn't create a <a class="el" href="classzdb_1_1PreparedStatement.html" title="Represents a pre-compiled SQL statement for later execution.">PreparedStatement</a>. When used with arguments, it provides protection against SQL injection.</dd></dl>
<p>Example usage: </p><div class="fragment"><div class="line"><span class="comment">// Without parameters</span></div>
<div class="line">con.execute(<span class="stringliteral">&quot;DELETE FROM users WHERE inactive = true&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// With parameters</span></div>
<div class="line">con.execute(<span class="stringliteral">&quot;INSERT INTO users (name, age) VALUES (?, ?)&quot;</span>, <span class="stringliteral">&quot;John Doe&quot;</span>, 30);</div>
</div><!-- fragment --> 
</div>
</div>
<a id="af68e46ae0740c0b7db284465656a6b45" name="af68e46ae0740c0b7db284465656a6b45"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af68e46ae0740c0b7db284465656a6b45">&#9670;&#160;</a></span>executeQuery()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename... Args&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classzdb_1_1ResultSet.html">ResultSet</a> executeQuery </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>sql</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Args &amp;&amp;...</td>          <td class="paramname"><span class="paramname"><em>args</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Executes a SQL query and returns a <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a>. </p>
<p>This method can be used in two ways:</p><ol type="1">
<li>With only a SQL string, which directly executes the query.</li>
<li>With a SQL string and additional arguments, which creates a <a class="el" href="classzdb_1_1PreparedStatement.html" title="Represents a pre-compiled SQL statement for later execution.">PreparedStatement</a>, binds the provided parameters, and then executes it.</li>
</ol>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sql</td><td>The SQL query to execute. </td></tr>
    <tr><td class="paramname">args</td><td>(Optional) Arguments to bind to the query. These can be of various types, including string-like types, numeric types, blob-like types, time_t, and nullptr. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> containing the query results. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classzdb_1_1sql__exception.html" title="Exception class for SQL related errors.">sql_exception</a></td><td>If a database access error occurs or if the types of the provided arguments don't match the expected types in the SQL query. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>When used without arguments, this method is more efficient as it doesn't create a <a class="el" href="classzdb_1_1PreparedStatement.html" title="Represents a pre-compiled SQL statement for later execution.">PreparedStatement</a>. When used with arguments, it provides protection against SQL injection.</dd></dl>
<p>Example usage: </p><div class="fragment"><div class="line"><span class="comment">// Without parameters</span></div>
<div class="line"><span class="keyword">auto</span> result1 = con.executeQuery(<span class="stringliteral">&quot;SELECT * FROM users&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// With parameters</span></div>
<div class="line"><span class="keyword">auto</span> result2 = con.executeQuery(<span class="stringliteral">&quot;SELECT * FROM users WHERE age &gt; ? AND name LIKE ?&quot;</span>, 18, <span class="stringliteral">&quot;John%&quot;</span>);</div>
</div><!-- fragment --> 
</div>
</div>
<a id="af33971b5c1e0860dd86015bb9d9b01a9" name="af33971b5c1e0860dd86015bb9d9b01a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af33971b5c1e0860dd86015bb9d9b01a9">&#9670;&#160;</a></span>prepareStatement()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classzdb_1_1PreparedStatement.html">PreparedStatement</a> prepareStatement </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>sql</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Prepares a SQL statement for execution. </p>
<p>This method creates a <a class="el" href="classzdb_1_1PreparedStatement.html" title="Represents a pre-compiled SQL statement for later execution.">PreparedStatement</a> object that can be reused with different parameters. It's particularly useful for statements that will be executed multiple times with different values.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sql</td><td>The SQL statement to prepare. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="classzdb_1_1PreparedStatement.html" title="Represents a pre-compiled SQL statement for later execution.">PreparedStatement</a> object. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classzdb_1_1sql__exception.html" title="Exception class for SQL related errors.">sql_exception</a></td><td>If a database error occurs during preparation.</td></tr>
  </table>
  </dd>
</dl>
<p>Example usage: </p><div class="fragment"><div class="line"><span class="keyword">auto</span> stmt = con.prepareStatement(<span class="stringliteral">&quot;INSERT INTO users (name, age) VALUES (?, ?)&quot;</span>);</div>
<div class="line"><span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>&amp; user : users) {</div>
<div class="line">    stmt.bindValues(user.name, user.age);</div>
<div class="line">    stmt.execute();</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a id="a624b0f65e1b5755b05010c02360ce927" name="a624b0f65e1b5755b05010c02360ce927"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a624b0f65e1b5755b05010c02360ce927">&#9670;&#160;</a></span>getLastError()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::optional&lt; std::string_view &gt; getLastError </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the last SQL error message. </p>
<dl class="section return"><dt>Returns</dt><dd>The last error message as a string view. </dd></dl>

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

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool isSupported </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>url</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span><span class="mlabel">nodiscard</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Checks if the specified database system is supported. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">url</td><td>A database <a class="el" href="classzdb_1_1URL.html" title="Represents an immutable Uniform Resource Locator.">URL</a> string or protocol. </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>