File: ConnectionPool_8h.html

package info (click to toggle)
libzdb 3.1-0.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, stretch
  • size: 3,504 kB
  • ctags: 1,486
  • sloc: ansic: 6,072; sh: 3,600; makefile: 110; xml: 87; lex: 35
file content (827 lines) | stat: -rw-r--r-- 53,789 bytes parent folder | download | duplicates (2)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ConnectionPool.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<style type="text/css" media="screen">
    body {background-color:white;}
    body,div,p,dl,.memname, .params, .exception {font: normal normal normal 16px/22px "HelveticaNeue", Helvetica, "Arial Narrow", Arial, sans-serif;}
    #nav-path {display:none;}
    h2:first-of-type {margin-top:2px; border:none;}
    h2.groupheader {font-size:26px; line-height:28px;color:#286796;}
    div.groupheader { font-weight:600; font-size:18px;color: rgb(51, 51, 51);}
    h3 {font-size:20px;color: rgb(51, 51, 51);}
    div.header { background-image:none; background-color: #3b96d7; color:white;}
    div.title {text-align:center;font-size: 28px; font-weight:100;}
    .summary {display:none;}
    dl.section {border:none;}
    .memproto > *, .memitem > * {
            box-shadow: none!important;
            -moz-box-shadow: none!important;
            -webkit-box-shadow: none!important;
            background-image:none!important;
    }
    .memproto {
            border-bottom: 1px #b8c8e9 solid;
            background-color: #f7fcff;
    }
    pre {white-space: pre-wrap;}
    .textinfo {color: #428bca;}
    .textnote {color: #a94442;}
</style>
</head><body>
<!-- Generated by Doxygen 1.8.5 -->
<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 class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">ConnectionPool.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>ConnectionPool</b> represent a database connection pool. </p>
<p>A connection pool can be used to get a connection to a database and execute statements. This class opens a number of database connections and allow callers to obtain and use a database connection in a reentrant manner. Applications can instantiate as many ConnectionPool objects as needed and against as many different database systems as needed. The following diagram gives an overview of the library's components and their method-associations:</p>
<center><div class="image">
<img src="database.png" />
</div>
</center><p>The method <a class="el" href="ConnectionPool_8h.html#aeb9223e1addafed257e35e248c049097" title="Get a connection from the pool. ">ConnectionPool_getConnection()</a> is used to obtain a new connection from the pool. If there are no connections available a new connection is created and returned. If the pool has already handed out <em>maxConnections</em> Connections, the next call to <a class="el" href="ConnectionPool_8h.html#aeb9223e1addafed257e35e248c049097" title="Get a connection from the pool. ">ConnectionPool_getConnection()</a> will return NULL. Use <a class="el" href="Connection_8h.html#aac4c939875fb240528435d486b484a7f" title="Return connection to the connection pool. ">Connection_close()</a> to return a connection to the pool so it can be reused.</p>
<p>A connection pool is created default with 5 initial connections and with 20 maximum connections. These values can be changed by the property methods <a class="el" href="ConnectionPool_8h.html#a99b15436eda4986b28cc472ba39adefb" title="Set the number of initial connections to start the pool with. ">ConnectionPool_setInitialConnections()</a> and <a class="el" href="ConnectionPool_8h.html#a68ac953c1bc1915b3ac6ae0b7b4c64a4" title="Set the maximum number of connections this connection pool will create. ">ConnectionPool_setMaxConnections()</a>.</p>
<h2>Supported database systems:</h2>
<p>This library may be built with support for many different database systems. To test if a particular system is supported use the method <a class="el" href="Connection_8h.html#a518c866ed09a2520fd43d153bebc2e8d" title="Class method, test if the specified database system is supported by this library. ...">Connection_isSupported()</a>.</p>
<h2>Life-cycle methods:</h2>
<p>Clients should call <a class="el" href="ConnectionPool_8h.html#a8d7c529ccb99d0345e0c8524dba7281d" title="Prepare for the beginning of active use of this component. ">ConnectionPool_start()</a> to establish the connection pool against the database server before using the pool. To shutdown connections from the database server use <a class="el" href="ConnectionPool_8h.html#ac467a51ff4471989abbe07be1870072d" title="Gracefully terminate the active use of the public methods of this component. ">ConnectionPool_stop()</a>. Set preferred properties <em>before</em> calling <a class="el" href="ConnectionPool_8h.html#a8d7c529ccb99d0345e0c8524dba7281d" title="Prepare for the beginning of active use of this component. ">ConnectionPool_start()</a>. Some properties can also be changed dynamically after the pool was started such as changing the maximum number of connections or the number of initial connections. Changing and tuning these properties at runtime is most useful if the pool was started with a reaper-thread (see below) since the reaper dynamically change the size of the pool</p>
<h2>Connection URL:</h2>
<p>The URL given to a Connection Pool at creation time specify a database connection on the standard URL format. The format of the connection URL is defined as:</p>
 
<center><code>
database://[user:password@][host][:port]/database[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
</code></center>
<p>The property names <code>user</code> and <code>password</code> are always recognized and specify how to login to the database. Other properties depends on the database server in question. User name and password can alternatively be specified in the auth-part of the URL. If port number is omitted, the default port number for the database server is used.</p>
<h4>MySQL:</h4>
<p>Here is an example on how to connect to a <a href="http://www.mysql.org/">MySQL</a> database server:</p>
 
<dt><dd><code>
mysql://localhost:3306/test?user=root&password=swordfish<br/>
</code></dd></dt>
<p>In this case the username, <code>root</code> and password, <code>swordfish </code> are specified as properties to the URL. An alternative is to use the auth-part of the URL to specify authentication information:</p>
 
<dt><dd><code>
mysql://root:swordfish@localhost:3306/test
</code></dd></dt>
<p>See <a href="mysqloptions.html">mysql options</a> for all properties that can be set for a mysql connection URL.</p>
<h4>SQLite:</h4>
<p>For a <a href="http://www.sqlite.org/">SQLite</a> database the connection URL should simply specify a database file, since a SQLite database is just a file in the filesystem. SQLite uses <a href="http://sqlite.org/pragma.html">pragma commands</a> for performance tuning and other special purpose database commands. Pragma syntax on the form, <code>name=value</code> can be added as properties to the URL and will be set when the Connection is created. In addition to pragmas, the following properties are supported: </p>
<ul>
<li>
<code>heap_limit=value</code> - Make SQLite auto-release unused memory if memory usage goes above the specified value [KB]. </li>
</ul>
<p>An URL for connecting to a SQLite database might look like:</p>
 
<dt><dd><code>
sqlite:///var/sqlite/test.db?synchronous=normal&heap_limit=8000&foreign_keys=on
</code></dd></dt>
<h4>PostgreSQL:</h4>
<p>The URL for connecting to a <a href="http://www.postgresql.org/">PostgreSQL</a> database server might look like:</p>
 
<dt><dd><code>
postgresql://localhost:5432/test?user=root&password=swordfish<br/>
</code></dd></dt>
<p>As with the MySQL URL, the username and password are specified as properties to the URL. Likewise, the auth-part of the URL can be used instead to specify the username and the password:</p>
 
<dt><dd><code>
postgresql://root:swordfish@localhost/test?use-ssl=true
</code></dd></dt>
<p>In this example we have also omitted the port number to the server, in which case the default port number, <em>5432</em>, for PostgreSQL is used. In addition we have added an extra parameter to the URL, so connection to the server is done over a secure SSL connection.</p>
<p>See <a href="postgresoptions.html">postgresql options</a> for all properties that can be set for a postgresql connection URL.</p>
<h4>Oracle:</h4>
<p>The URL for connecting to an <a href="http://www.oracle.com/">Oracle</a> database server might look like:</p>
 
<dt><dd><code>
oracle://localhost:1521/test?user=scott&password=tiger<br/>
</code></dd></dt>
<p>The auth-part of the URL can be used instead to specify the username and the password. In addition, you may specify a service name in the URL instead if you have setup a <code>tnsnames.ora</code> configuration file.</p>
 
<dt><dd><code>
oracle:///servicename?user=scott&password=tiger
</code></dd></dt>
<h2>Example:</h2>
<p>To obtain a connection pool for a MySQL database, the code below can be used. The exact same code can be used for PostgreSQL, SQLite and Oracle, the only change needed is to modify the Connection URL. Here we connect to the database test on localhost and start the pool with the default 5 initial connections.</p>
 
<dt><dd><code>
<pre>
URL_T url = URL_new("mysql://localhost/test?user=root&password=swordfish");
ConnectionPool_T pool = ConnectionPool_new(url);
ConnectionPool_start(pool);
[..]
<b>Connection_T con = ConnectionPool_getConnection(pool);</b>
ResultSet_T result = Connection_executeQuery(con, "select id, name, image from employee where salary>%d", anumber);
while (ResultSet_next(result)) 
{
     int id = ResultSet_getInt(result, 1);
     const char *name = ResultSet_getString(result, 2);
     int blobSize;
     const void *image = ResultSet_getBlob(result, 3, &blobSize);
     [..]
}
<b>Connection_close(con);</b>
[..]
ConnectionPool_free(&pool);
URL_free(&url);
</pre>
</code></dd></dt>
<h2>Optimizing the pool size:</h2>
<p>The pool can be setup to dynamically change the number of active Connections in the pool depending on the load. A single <code>reaper</code> thread can be activated at startup to sweep through the pool at a regular interval and close Connections that have been inactive for a specified time or for some reasons no longer respond. Only inactive Connections will be closed and no more than the initial number of Connections the pool was started with are closed. The property method, <a class="el" href="ConnectionPool_8h.html#a756268df598fb93caeef570b775e6768" title="Specify that a reaper thread should be used by the pool. ">ConnectionPool_setReaper()</a>, is used to specify that a reaper thread should be started when the pool is started. This method <b>must</b> be called <em>before</em> <a class="el" href="ConnectionPool_8h.html#a8d7c529ccb99d0345e0c8524dba7281d" title="Prepare for the beginning of active use of this component. ">ConnectionPool_start()</a>, otherwise the pool will not start with a reaper thread.</p>
<p>Clients can also call the method, <a class="el" href="ConnectionPool_8h.html#a75e9b1e5c943a5bb76573a04268e496a" title="Close all inactive Connections in the pool, down to initial connections. ">ConnectionPool_reapConnections()</a>, to bonsai the pool directly if the reaper thread is not activated.</p>
<p>It is recommended to start the pool with a reaper-thread, especially if the pool maintains TCP/IP Connections.</p>
<h2>Realtime inspection:</h2>
<p>Two methods can be used to inspect the pool at runtime. The method <a class="el" href="ConnectionPool_8h.html#a76aacfe23b7708d436347107aedf0d15" title="Returns the current number of connections in the pool. ">ConnectionPool_size()</a> returns the number of connections in the pool, that is, both active and inactive connections. The method <a class="el" href="ConnectionPool_8h.html#a3c54f3a36f5dd94b2c622c01010df15f" title="Returns the number of active connections in the pool. ">ConnectionPool_active()</a> returns the number of active connections, i.e. those connections in current use by your application.</p>
<p><em>This ConnectionPool is thread-safe.</em></p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="Connection_8h.html" title="A Connection represent a connection to a SQL database system. ">Connection.h</a> <a class="el" href="ResultSet_8h.html" title="A ResultSet represents a database result set. ">ResultSet.h</a> <a class="el" href="URL_8h.html" title="URL represent an immutable Uniform Resource Locator. ">URL.h</a> <a class="el" href="PreparedStatement_8h.html" title="A PreparedStatement represent 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 name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a0acb682b8260ab1c60b918599864e2e5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a0acb682b8260ab1c60b918599864e2e5">T</a>&#160;&#160;&#160;ConnectionPool_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 name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ab61378ab62626de3ff80272e186394b3"><td class="memItemLeft" align="right" valign="top">typedef struct ConnectionPool_S *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#ab61378ab62626de3ff80272e186394b3">T</a></td></tr>
<tr class="separator:ab61378ab62626de3ff80272e186394b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aa808a931fc4e79ff34941ee5a46de8cb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#aa808a931fc4e79ff34941ee5a46de8cb">ConnectionPool_new</a> (URL_T url)</td></tr>
<tr class="memdesc:aa808a931fc4e79ff34941ee5a46de8cb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new ConnectionPool.  <a href="#aa808a931fc4e79ff34941ee5a46de8cb">More...</a><br/></td></tr>
<tr class="separator:aa808a931fc4e79ff34941ee5a46de8cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6ca3943e0f711030bf0bf3cf83e0abef"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a6ca3943e0f711030bf0bf3cf83e0abef">ConnectionPool_free</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> *P)</td></tr>
<tr class="memdesc:a6ca3943e0f711030bf0bf3cf83e0abef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disconnect and destroy the pool and release allocated resources.  <a href="#a6ca3943e0f711030bf0bf3cf83e0abef">More...</a><br/></td></tr>
<tr class="separator:a6ca3943e0f711030bf0bf3cf83e0abef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8d7c529ccb99d0345e0c8524dba7281d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a8d7c529ccb99d0345e0c8524dba7281d">ConnectionPool_start</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:a8d7c529ccb99d0345e0c8524dba7281d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prepare for the beginning of active use of this component.  <a href="#a8d7c529ccb99d0345e0c8524dba7281d">More...</a><br/></td></tr>
<tr class="separator:a8d7c529ccb99d0345e0c8524dba7281d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac467a51ff4471989abbe07be1870072d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#ac467a51ff4471989abbe07be1870072d">ConnectionPool_stop</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:ac467a51ff4471989abbe07be1870072d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gracefully terminate the active use of the public methods of this component.  <a href="#ac467a51ff4471989abbe07be1870072d">More...</a><br/></td></tr>
<tr class="separator:ac467a51ff4471989abbe07be1870072d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb9223e1addafed257e35e248c049097"><td class="memItemLeft" align="right" valign="top">Connection_T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#aeb9223e1addafed257e35e248c049097">ConnectionPool_getConnection</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:aeb9223e1addafed257e35e248c049097"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a connection from the pool.  <a href="#aeb9223e1addafed257e35e248c049097">More...</a><br/></td></tr>
<tr class="separator:aeb9223e1addafed257e35e248c049097"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5d1f04dc0ae5fc42707dfd934f681c4a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a5d1f04dc0ae5fc42707dfd934f681c4a">ConnectionPool_returnConnection</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P, Connection_T connection)</td></tr>
<tr class="memdesc:a5d1f04dc0ae5fc42707dfd934f681c4a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a connection to the pool.  <a href="#a5d1f04dc0ae5fc42707dfd934f681c4a">More...</a><br/></td></tr>
<tr class="separator:a5d1f04dc0ae5fc42707dfd934f681c4a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75e9b1e5c943a5bb76573a04268e496a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a75e9b1e5c943a5bb76573a04268e496a">ConnectionPool_reapConnections</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:a75e9b1e5c943a5bb76573a04268e496a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Close all inactive Connections in the pool, down to initial connections.  <a href="#a75e9b1e5c943a5bb76573a04268e496a">More...</a><br/></td></tr>
<tr class="separator:a75e9b1e5c943a5bb76573a04268e496a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Properties</div></td></tr>
<tr class="memitem:a58a3cd3c193bd0d51a987a15539e3b48"><td class="memItemLeft" align="right" valign="top">URL_T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a58a3cd3c193bd0d51a987a15539e3b48">ConnectionPool_getURL</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:a58a3cd3c193bd0d51a987a15539e3b48"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns this Connection Pool URL.  <a href="#a58a3cd3c193bd0d51a987a15539e3b48">More...</a><br/></td></tr>
<tr class="separator:a58a3cd3c193bd0d51a987a15539e3b48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a99b15436eda4986b28cc472ba39adefb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a99b15436eda4986b28cc472ba39adefb">ConnectionPool_setInitialConnections</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P, int connections)</td></tr>
<tr class="memdesc:a99b15436eda4986b28cc472ba39adefb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the number of initial connections to start the pool with.  <a href="#a99b15436eda4986b28cc472ba39adefb">More...</a><br/></td></tr>
<tr class="separator:a99b15436eda4986b28cc472ba39adefb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6a2130831722010e89924aec17fe561"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#aa6a2130831722010e89924aec17fe561">ConnectionPool_getInitialConnections</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:aa6a2130831722010e89924aec17fe561"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the number of initial connections to start the pool with.  <a href="#aa6a2130831722010e89924aec17fe561">More...</a><br/></td></tr>
<tr class="separator:aa6a2130831722010e89924aec17fe561"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a68ac953c1bc1915b3ac6ae0b7b4c64a4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a68ac953c1bc1915b3ac6ae0b7b4c64a4">ConnectionPool_setMaxConnections</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P, int maxConnections)</td></tr>
<tr class="memdesc:a68ac953c1bc1915b3ac6ae0b7b4c64a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the maximum number of connections this connection pool will create.  <a href="#a68ac953c1bc1915b3ac6ae0b7b4c64a4">More...</a><br/></td></tr>
<tr class="separator:a68ac953c1bc1915b3ac6ae0b7b4c64a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5edf7736ec825e4a1aafd4f7f85c24d5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a5edf7736ec825e4a1aafd4f7f85c24d5">ConnectionPool_getMaxConnections</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:a5edf7736ec825e4a1aafd4f7f85c24d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the maximum number of connections this Connection pool will create.  <a href="#a5edf7736ec825e4a1aafd4f7f85c24d5">More...</a><br/></td></tr>
<tr class="separator:a5edf7736ec825e4a1aafd4f7f85c24d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a143b4171cc03227b1bca5cd10e724bc5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a143b4171cc03227b1bca5cd10e724bc5">ConnectionPool_setConnectionTimeout</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P, int connectionTimeout)</td></tr>
<tr class="memdesc:a143b4171cc03227b1bca5cd10e724bc5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a Connection inactive timeout value in seconds.  <a href="#a143b4171cc03227b1bca5cd10e724bc5">More...</a><br/></td></tr>
<tr class="separator:a143b4171cc03227b1bca5cd10e724bc5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad2dabf50cf0b9710848eba40c58bf748"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#ad2dabf50cf0b9710848eba40c58bf748">ConnectionPool_getConnectionTimeout</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:ad2dabf50cf0b9710848eba40c58bf748"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the connection timeout value in seconds.  <a href="#ad2dabf50cf0b9710848eba40c58bf748">More...</a><br/></td></tr>
<tr class="separator:ad2dabf50cf0b9710848eba40c58bf748"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a23b8c11de2c910a5ce75b008291ee22a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a23b8c11de2c910a5ce75b008291ee22a">ConnectionPool_setAbortHandler</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P, void(*abortHandler)(const char *error))</td></tr>
<tr class="memdesc:a23b8c11de2c910a5ce75b008291ee22a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the function to call if a fatal error occurs in the library.  <a href="#a23b8c11de2c910a5ce75b008291ee22a">More...</a><br/></td></tr>
<tr class="separator:a23b8c11de2c910a5ce75b008291ee22a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a756268df598fb93caeef570b775e6768"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a756268df598fb93caeef570b775e6768">ConnectionPool_setReaper</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P, int sweepInterval)</td></tr>
<tr class="memdesc:a756268df598fb93caeef570b775e6768"><td class="mdescLeft">&#160;</td><td class="mdescRight">Specify that a reaper thread should be used by the pool.  <a href="#a756268df598fb93caeef570b775e6768">More...</a><br/></td></tr>
<tr class="separator:a756268df598fb93caeef570b775e6768"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a76aacfe23b7708d436347107aedf0d15"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a76aacfe23b7708d436347107aedf0d15">ConnectionPool_size</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:a76aacfe23b7708d436347107aedf0d15"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the current number of connections in the pool.  <a href="#a76aacfe23b7708d436347107aedf0d15">More...</a><br/></td></tr>
<tr class="separator:a76aacfe23b7708d436347107aedf0d15"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c54f3a36f5dd94b2c622c01010df15f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a3c54f3a36f5dd94b2c622c01010df15f">ConnectionPool_active</a> (<a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> P)</td></tr>
<tr class="memdesc:a3c54f3a36f5dd94b2c622c01010df15f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of active connections in the pool.  <a href="#a3c54f3a36f5dd94b2c622c01010df15f">More...</a><br/></td></tr>
<tr class="separator:a3c54f3a36f5dd94b2c622c01010df15f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Class methods</div></td></tr>
<tr class="memitem:ab7d96fe7a5feaefd73f411a092721868"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#ab7d96fe7a5feaefd73f411a092721868">ConnectionPool_version</a> (void)</td></tr>
<tr class="memdesc:ab7d96fe7a5feaefd73f411a092721868"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Class method</b>, returns this library version information  <a href="#ab7d96fe7a5feaefd73f411a092721868">More...</a><br/></td></tr>
<tr class="separator:ab7d96fe7a5feaefd73f411a092721868"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a7886fb40d7187a54bb9a5ef8899616ce"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ConnectionPool_8h.html#a7886fb40d7187a54bb9a5ef8899616ce">ZBDEBUG</a></td></tr>
<tr class="memdesc:a7886fb40d7187a54bb9a5ef8899616ce"><td class="mdescLeft">&#160;</td><td class="mdescRight">Library Debug flag.  <a href="#a7886fb40d7187a54bb9a5ef8899616ce">More...</a><br/></td></tr>
<tr class="separator:a7886fb40d7187a54bb9a5ef8899616ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="a0acb682b8260ab1c60b918599864e2e5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;&#160;&#160;ConnectionPool_T</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="ab61378ab62626de3ff80272e186394b3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct ConnectionPool_S* <a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="aa808a931fc4e79ff34941ee5a46de8cb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> ConnectionPool_new </td>
          <td>(</td>
          <td class="paramtype">URL_T&#160;</td>
          <td class="paramname"><em>url</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a new ConnectionPool. </p>
<p>The pool is created with default 5 initial connections. Maximum connections is set to 20. Property methods in this interface can be used to change the default values. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">url</td><td>The database connection url. It is a checked runtime error for the url parameter to be NULL. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new ConnectionPool object </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="URL_8h.html" title="URL represent an immutable Uniform Resource Locator. ">URL.h</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a6ca3943e0f711030bf0bf3cf83e0abef"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a> *&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disconnect and destroy the pool and release allocated resources. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object reference </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a58a3cd3c193bd0d51a987a15539e3b48"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">URL_T ConnectionPool_getURL </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

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

</div>
</div>
<a class="anchor" id="a99b15436eda4986b28cc472ba39adefb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_setInitialConnections </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>connections</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the number of initial connections to start the pool with. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
    <tr><td class="paramname">connections</td><td>The number of initial pool connections </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="Connection_8h.html" title="A Connection represent a connection to a SQL database system. ">Connection.h</a> </dd></dl>

</div>
</div>
<a class="anchor" id="aa6a2130831722010e89924aec17fe561"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ConnectionPool_getInitialConnections </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the number of initial connections to start the pool with. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of initial pool connections </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="Connection_8h.html" title="A Connection represent a connection to a SQL database system. ">Connection.h</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a68ac953c1bc1915b3ac6ae0b7b4c64a4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_setMaxConnections </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>maxConnections</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the maximum number of connections this connection pool will create. </p>
<p>If max connections has been served, <a class="el" href="ConnectionPool_8h.html#aeb9223e1addafed257e35e248c049097" title="Get a connection from the pool. ">ConnectionPool_getConnection()</a> will return NULL on the next call. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
    <tr><td class="paramname">maxConnections</td><td>The maximum number of connections this connection pool will create. It is a checked runtime error for maxConnections to be less than initialConnections. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="Connection_8h.html" title="A Connection represent a connection to a SQL database system. ">Connection.h</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a5edf7736ec825e4a1aafd4f7f85c24d5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ConnectionPool_getMaxConnections </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the maximum number of connections this Connection pool will create. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The maximum number of connections this connection pool will create. </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="Connection_8h.html" title="A Connection represent a connection to a SQL database system. ">Connection.h</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a143b4171cc03227b1bca5cd10e724bc5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_setConnectionTimeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>connectionTimeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set a Connection inactive timeout value in seconds. </p>
<p>The method, <a class="el" href="ConnectionPool_8h.html#a75e9b1e5c943a5bb76573a04268e496a" title="Close all inactive Connections in the pool, down to initial connections. ">ConnectionPool_reapConnections()</a>, if called will close inactive Connections in the pool which has not been in use since <code>connectionTimeout</code> seconds. Default connectionTimeout is 30 seconds. The reaper thread if in use, see <a class="el" href="ConnectionPool_8h.html#a756268df598fb93caeef570b775e6768" title="Specify that a reaper thread should be used by the pool. ">ConnectionPool_setReaper()</a>, also use this value when closing inactive Connections. It is a checked runtime error for <code>connectionTimeout</code> to be less than, or equal to zero. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
    <tr><td class="paramname">connectionTimeout</td><td>The number of <code>seconds</code> a Connection can be inactive, i.e. not in use, before the reaper close the Connection. (value &gt; 0) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ad2dabf50cf0b9710848eba40c58bf748"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ConnectionPool_getConnectionTimeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the connection timeout value in seconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The time an inactive Connection may live before it is closed </dd></dl>

</div>
</div>
<a class="anchor" id="a23b8c11de2c910a5ce75b008291ee22a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_setAbortHandler </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(const char *error)&#160;</td>
          <td class="paramname"><em>abortHandler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the function to call if a fatal error occurs in the library. </p>
<p>In practice this means Out-Of-Memory errors or uncatched exceptions. Clients may optionally provide this function. If not provided the library will call <code>abort(3)</code> upon encountering a fatal error if ZBDEBUG is set, otherwise exit(1) is called. This method provide clients with means to close down execution gracefully. It is an unchecked runtime error to continue using the library after the <code>abortHandler</code> was called. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
    <tr><td class="paramname">abortHandler</td><td>The handler function to call should a fatal error occur during processing. An explanatory error message is passed to the handler function in the string <code>error</code> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="Exception_8h.html" title="An Exception indicate an error condition from which recovery may be possible. ">Exception.h</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a756268df598fb93caeef570b775e6768"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_setReaper </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>sweepInterval</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Specify that a reaper thread should be used by the pool. </p>
<p>This thread will close all inactive Connections in the pool, down to initial connections. An inactive Connection is closed if and only if its <code>connectionTimeout</code> has expired <em>or</em> if the Connection failed the ping test. Active Connections, that is, connections in current use by your application are <em>never </em> closed by this thread. This method sets the reaper thread sweep property, but does not start the thread. This is done in <a class="el" href="ConnectionPool_8h.html#a8d7c529ccb99d0345e0c8524dba7281d" title="Prepare for the beginning of active use of this component. ">ConnectionPool_start()</a>. So, if the pool should use a reaper thread, remember to call this method <b>before</b> <a class="el" href="ConnectionPool_8h.html#a8d7c529ccb99d0345e0c8524dba7281d" title="Prepare for the beginning of active use of this component. ">ConnectionPool_start()</a>. It is a checked runtime error for <code>sweepInterval</code> to be less than, or equal to zero. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
    <tr><td class="paramname">sweepInterval</td><td>Number of <code>seconds</code> between sweeps of the reaper thread (value &gt; 0) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a76aacfe23b7708d436347107aedf0d15"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ConnectionPool_size </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the current number of connections in the pool. </p>
<p>The number of both active and inactive connections are returned. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of connections in the pool </dd></dl>

</div>
</div>
<a class="anchor" id="a3c54f3a36f5dd94b2c622c01010df15f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ConnectionPool_active </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the number of active connections in the pool. </p>
<p>I.e. connections in use by clients. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of active connections in the pool </dd></dl>

</div>
</div>
<a class="anchor" id="a8d7c529ccb99d0345e0c8524dba7281d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_start </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Prepare for the beginning of active use of this component. </p>
<p>This method must be called before the pool is used and will connect to the database server and create the initial connections for the pool. This method will also start the reaper thread if specified via <a class="el" href="ConnectionPool_8h.html#a756268df598fb93caeef570b775e6768" title="Specify that a reaper thread should be used by the pool. ">ConnectionPool_setReaper()</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool 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 class="anchor" id="ac467a51ff4471989abbe07be1870072d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_stop </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gracefully terminate the active use of the public methods of this component. </p>
<p>This method should be the last one called on a given instance of this component. Calling this method close down all connections in the pool, disconnect the pool from the database server and stop the reaper thread if it was started. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aeb9223e1addafed257e35e248c049097"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Connection_T ConnectionPool_getConnection </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get a connection from the pool. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A connection from the pool or NULL if maxConnection is reached </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="Connection_8h.html" title="A Connection represent a connection to a SQL database system. ">Connection.h</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a5d1f04dc0ae5fc42707dfd934f681c4a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionPool_returnConnection </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Connection_T&#160;</td>
          <td class="paramname"><em>connection</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns a connection to the pool. </p>
<p>The same as calling <a class="el" href="Connection_8h.html#aac4c939875fb240528435d486b484a7f" title="Return connection to the connection pool. ">Connection_close()</a> </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
    <tr><td class="paramname">connection</td><td>A Connection object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="Connection_8h.html" title="A Connection represent a connection to a SQL database system. ">Connection.h</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a75e9b1e5c943a5bb76573a04268e496a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ConnectionPool_reapConnections </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="Connection_8h.html#a8dc1b239f8e305fbd1406ff041c89151">T</a>&#160;</td>
          <td class="paramname"><em>P</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Close all inactive Connections in the pool, down to initial connections. </p>
<p>Inactive Connection are closed if and only if its <code>connectionTimeout</code> has expired <em>or</em> if the Connection failed the ping test against the database. Active Connections are <em>not</em> closed by this method. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>A ConnectionPool object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of Connections that was closed </dd></dl>

</div>
</div>
<a class="anchor" id="ab7d96fe7a5feaefd73f411a092721868"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* ConnectionPool_version </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Class method</b>, returns this library version information </p>
<dl class="section return"><dt>Returns</dt><dd>Library version information </dd></dl>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a7886fb40d7187a54bb9a5ef8899616ce"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ZBDEBUG</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Library Debug flag. </p>
<p>If set to true, emit debug output </p>

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