1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ResultSet</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&dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&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_1ResultSet.html">ResultSet</a></li> </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
<div class="headertitle"><div class="title">ResultSet</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 database result set. </p>
<p>A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> is created by executing a SQL SELECT statement using <a class="el" href="classzdb_1_1Connection.html#af68e46ae0740c0b7db284465656a6b45" title="Executes a SQL query and returns a ResultSet.">Connection::executeQuery()</a>.</p>
<p>A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> maintains a cursor pointing to its current row of data. Initially, the cursor is positioned before the first row. <a class="el" href="#a80870c233d0237e3588a2d6f8d176916" title="Moves the cursor to the next row.">ResultSet::next()</a> moves the cursor to the next row, and because it returns false when there are no more rows, it can be used in a while loop to iterate through the result set. A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> is not updatable and has a cursor that moves forward only. Thus, you can iterate through it only once and only from the first row to the last row.</p>
<p>The <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> class provides getter methods for retrieving column values from the current row. Values can be retrieved using either the index number of the column or the name of the column. In general, using the column index will be more efficient. <em>Columns are numbered from 1.</em></p>
<p>Column names used as input to getter methods are case sensitive. When a getter method is called with a column name and several columns have the same name, the value of the first matching column will be returned. The column name option is designed to be used when column names are used in the SQL query that generated the result set. For columns that are NOT explicitly named in the query, it is best to use column indices.</p>
<h2><a class="anchor" id="autotoc_md39"></a>
Examples</h2>
<p>The following examples demonstrate how to obtain a <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> and how to retrieve values from it.</p>
<h3><a class="anchor" id="autotoc_md40"></a>
Example: Using column names</h3>
<p>In this example, columns are named in the SELECT statement, and we retrieve values using the column names (we could of course also use indices if we want):</p>
<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="classzdb_1_1Connection.html#af68e46ae0740c0b7db284465656a6b45">executeQuery</a>(<span class="stringliteral">"SELECT ssn, name, photo FROM employees"</span>);</div>
<div class="line"><span class="keywordflow">while</span> (result.<a class="code hl_function" href="#a80870c233d0237e3588a2d6f8d176916">next</a>()) {</div>
<div class="line"> <span class="keywordtype">int</span> ssn = result.<a class="code hl_function" href="#a2e7dde031277c762bd5112487b2fad52">getInt</a>(<span class="stringliteral">"ssn"</span>);</div>
<div class="line"> <span class="keyword">auto</span> name = result.<a class="code hl_function" href="#ac00f123b0b60a08479a813b7d569a15a">getString</a>(<span class="stringliteral">"name"</span>);</div>
<div class="line"> <span class="keyword">auto</span> photo = result.<a class="code hl_function" href="#ae213bd0278eb588c50988aaea9de8dc1">getBlob</a>(<span class="stringliteral">"photo"</span>);</div>
<div class="line"> <span class="keywordflow">if</span> (photo) {</div>
<div class="line"> <span class="comment">// Process photo data</span></div>
<div class="line"> }</div>
<div class="line"> <span class="comment">// Process other data...</span></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="classzdb_1_1Connection.html#af68e46ae0740c0b7db284465656a6b45">zdb::Connection::executeQuery</a></div><div class="ttdeci">ResultSet executeQuery(const std::string &sql, Args &&... 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="#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="#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="#ac00f123b0b60a08479a813b7d569a15a">zdb::ResultSet::getString</a></div><div class="ttdeci">std::optional< std::string_view > 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 class="ttc" id="aclasszdb_1_1ResultSet_html_ae213bd0278eb588c50988aaea9de8dc1"><div class="ttname"><a href="#ae213bd0278eb588c50988aaea9de8dc1">zdb::ResultSet::getBlob</a></div><div class="ttdeci">std::optional< std::span< const std::byte > > getBlob(int columnIndex)</div><div class="ttdoc">Gets the designated column's value as a byte span.</div><div class="ttdef"><b>Definition</b> zdbpp.h:793</div></div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md41"></a>
Example: Using column indices</h3>
<p>This example demonstrates selecting a generated result and printing it. When the SELECT statement doesn't name the column, we use the column index to retrieve the value:</p>
<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> r = con.<a class="code hl_function" href="classzdb_1_1Connection.html#af68e46ae0740c0b7db284465656a6b45">executeQuery</a>(<span class="stringliteral">"SELECT COUNT(*) FROM employees"</span>);</div>
<div class="line"><span class="keywordflow">if</span> (r.<a class="code hl_function" href="#a80870c233d0237e3588a2d6f8d176916">next</a>()) {</div>
<div class="line"> std::cout << <span class="stringliteral">"Number of employees: "</span></div>
<div class="line"> << r.<a class="code hl_function" href="#ac00f123b0b60a08479a813b7d569a15a">getString</a>(1).value_or(<span class="stringliteral">"none"</span>)</div>
<div class="line"> << std::endl;</div>
<div class="line">} <span class="keywordflow">else</span> {</div>
<div class="line"> std::cout << <span class="stringliteral">"No results returned"</span> << std::endl;</div>
<div class="line">}</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md42"></a>
Automatic type conversions</h2>
<p>A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> stores values internally as bytes and converts values on-the-fly to numeric types when requested, such as when <a class="el" href="#a2e7dde031277c762bd5112487b2fad52" title="Gets the designated column's value as an int.">getInt()</a> or one of the other numeric get-methods are called. In the above example, even if <em>count(*)</em> returns a numeric value, we can use <a class="el" href="#ac00f123b0b60a08479a813b7d569a15a" title="Gets the designated column's value as a string.">getString()</a> to get the number as a string or if we choose, we can use <a class="el" href="#a2e7dde031277c762bd5112487b2fad52" title="Gets the designated column's value as an int.">getInt()</a> to get the value as an integer. In the latter case, note that if the column value cannot be converted to a number, an <a class="el" href="classzdb_1_1sql__exception.html" title="Exception class for SQL related errors.">sql_exception</a> is thrown.</p>
<h2><a class="anchor" id="autotoc_md43"></a>
Date and Time</h2>
<p><a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> provides two principal methods for retrieving temporal column values as C types. <a class="el" href="#a6010915966181ccce6bcccb754a1bfa1" title="Gets the designated column's value as a Unix timestamp.">getTimestamp()</a> converts a SQL timestamp value to a <code>time_t</code> and <a class="el" href="#a62f1a1e4d7177fc24ff5fdee1fd71925" title="Gets the designated column's value as a Date, Time or DateTime.">getDateTime()</a> returns a <code>tm structure</code> representing a Date, Time, DateTime, or Timestamp column type. To get a temporal column value as a string, simply use <a class="el" href="#ac00f123b0b60a08479a813b7d569a15a" title="Gets the designated column's value as a string.">getString()</a></p>
<p><em>A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</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>Remember that column indices in <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> are 1-based, not 0-based.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd><a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects are internally managed by the <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> that created them and are not copyable or movable. Always ensure that the originating <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> object remains valid for the entire duration of the <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a>'s use. Basically, keep the <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> and <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects in the same scope. Do not attempt to use <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> objects (including through references or pointers) after their <a class="el" href="classzdb_1_1Connection.html" title="Represents a connection to a SQL database system.">Connection</a> has been closed and returned to the pool. </dd></dl>
</div>
<p>Represents a database result set.
<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:af1d230abc0cc6608de02a4f84e266d31" id="r_af1d230abc0cc6608de02a4f84e266d31"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#af1d230abc0cc6608de02a4f84e266d31">columnCount</a> () const noexcept</td></tr>
<tr class="memdesc:af1d230abc0cc6608de02a4f84e266d31"><td class="mdescLeft"> </td><td class="mdescRight">Gets the number of columns in this <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a>. <br /></td></tr>
<tr class="separator:af1d230abc0cc6608de02a4f84e266d31"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af3924dd33495031700971912062d9da8" id="r_af3924dd33495031700971912062d9da8"><td class="memItemLeft" align="right" valign="top">std::optional< std::string_view > </td><td class="memItemRight" valign="bottom"><a class="el" href="#af3924dd33495031700971912062d9da8">columnName</a> (int columnIndex) const noexcept</td></tr>
<tr class="memdesc:af3924dd33495031700971912062d9da8"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's name. <br /></td></tr>
<tr class="separator:af3924dd33495031700971912062d9da8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a058710758357e65269c0cd08224657e7" id="r_a058710758357e65269c0cd08224657e7"><td class="memItemLeft" align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="#a058710758357e65269c0cd08224657e7">columnSize</a> (int columnIndex)</td></tr>
<tr class="memdesc:a058710758357e65269c0cd08224657e7"><td class="mdescLeft"> </td><td class="mdescRight">Gets the size of a column in bytes. <br /></td></tr>
<tr class="separator:a058710758357e65269c0cd08224657e7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abbf636ade7858de8e9b91b7b87667df5" id="r_abbf636ade7858de8e9b91b7b87667df5"><td class="memItemLeft" align="right" valign="top">void </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"> </td><td class="mdescRight">Sets the number of rows to fetch from the database. <br /></td></tr>
<tr class="separator:abbf636ade7858de8e9b91b7b87667df5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae007f7db7c78d86b64661de71c5aaf5f" id="r_ae007f7db7c78d86b64661de71c5aaf5f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae007f7db7c78d86b64661de71c5aaf5f">getFetchSize</a> () const noexcept</td></tr>
<tr class="memdesc:ae007f7db7c78d86b64661de71c5aaf5f"><td class="mdescLeft"> </td><td class="mdescRight">Gets the number of rows to fetch from the database. <br /></td></tr>
<tr class="separator:ae007f7db7c78d86b64661de71c5aaf5f"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader">Functions</div></td></tr>
<tr class="memitem:a80870c233d0237e3588a2d6f8d176916" id="r_a80870c233d0237e3588a2d6f8d176916"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a80870c233d0237e3588a2d6f8d176916">next</a> ()</td></tr>
<tr class="memdesc:a80870c233d0237e3588a2d6f8d176916"><td class="mdescLeft"> </td><td class="mdescRight">Moves the cursor to the next row. <br /></td></tr>
<tr class="separator:a80870c233d0237e3588a2d6f8d176916"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader">Columns</div></td></tr>
<tr class="memitem:a096eb10a6f137add4dcc02be3ba853c3" id="r_a096eb10a6f137add4dcc02be3ba853c3"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a096eb10a6f137add4dcc02be3ba853c3">isNull</a> (int columnIndex)</td></tr>
<tr class="memdesc:a096eb10a6f137add4dcc02be3ba853c3"><td class="mdescLeft"> </td><td class="mdescRight">Checks if the designated column's value is SQL NULL. <br /></td></tr>
<tr class="separator:a096eb10a6f137add4dcc02be3ba853c3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac00f123b0b60a08479a813b7d569a15a" id="r_ac00f123b0b60a08479a813b7d569a15a"><td class="memItemLeft" align="right" valign="top">std::optional< std::string_view > </td><td class="memItemRight" valign="bottom"><a class="el" href="#ac00f123b0b60a08479a813b7d569a15a">getString</a> (int columnIndex)</td></tr>
<tr class="memdesc:ac00f123b0b60a08479a813b7d569a15a"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a string. <br /></td></tr>
<tr class="separator:ac00f123b0b60a08479a813b7d569a15a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a995f6c93cb8c4cba8222c797371b2408" id="r_a995f6c93cb8c4cba8222c797371b2408"><td class="memItemLeft" align="right" valign="top">std::optional< std::string_view > </td><td class="memItemRight" valign="bottom"><a class="el" href="#a995f6c93cb8c4cba8222c797371b2408">getString</a> (const std::string &<a class="el" href="#af3924dd33495031700971912062d9da8">columnName</a>)</td></tr>
<tr class="memdesc:a995f6c93cb8c4cba8222c797371b2408"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a string. <br /></td></tr>
<tr class="separator:a995f6c93cb8c4cba8222c797371b2408"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2e7dde031277c762bd5112487b2fad52" id="r_a2e7dde031277c762bd5112487b2fad52"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#a2e7dde031277c762bd5112487b2fad52">getInt</a> (int columnIndex)</td></tr>
<tr class="memdesc:a2e7dde031277c762bd5112487b2fad52"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as an int. <br /></td></tr>
<tr class="separator:a2e7dde031277c762bd5112487b2fad52"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0e9a4693eb2f6c45ec8e09ea0179bc69" id="r_a0e9a4693eb2f6c45ec8e09ea0179bc69"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#a0e9a4693eb2f6c45ec8e09ea0179bc69">getInt</a> (const std::string &<a class="el" href="#af3924dd33495031700971912062d9da8">columnName</a>)</td></tr>
<tr class="memdesc:a0e9a4693eb2f6c45ec8e09ea0179bc69"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as an int. <br /></td></tr>
<tr class="separator:a0e9a4693eb2f6c45ec8e09ea0179bc69"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af81be46a299e4f68dbd8bb92bb679550" id="r_af81be46a299e4f68dbd8bb92bb679550"><td class="memItemLeft" align="right" valign="top">long long </td><td class="memItemRight" valign="bottom"><a class="el" href="#af81be46a299e4f68dbd8bb92bb679550">getLLong</a> (int columnIndex)</td></tr>
<tr class="memdesc:af81be46a299e4f68dbd8bb92bb679550"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a long long. <br /></td></tr>
<tr class="separator:af81be46a299e4f68dbd8bb92bb679550"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0f1c6e8ec0fc05cf3a3fc317a0464ec9" id="r_a0f1c6e8ec0fc05cf3a3fc317a0464ec9"><td class="memItemLeft" align="right" valign="top">long long </td><td class="memItemRight" valign="bottom"><a class="el" href="#a0f1c6e8ec0fc05cf3a3fc317a0464ec9">getLLong</a> (const std::string &<a class="el" href="#af3924dd33495031700971912062d9da8">columnName</a>)</td></tr>
<tr class="memdesc:a0f1c6e8ec0fc05cf3a3fc317a0464ec9"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a long long. <br /></td></tr>
<tr class="separator:a0f1c6e8ec0fc05cf3a3fc317a0464ec9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a130266e855e3a9deac87f07fed9ec642" id="r_a130266e855e3a9deac87f07fed9ec642"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="#a130266e855e3a9deac87f07fed9ec642">getDouble</a> (int columnIndex)</td></tr>
<tr class="memdesc:a130266e855e3a9deac87f07fed9ec642"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a double. <br /></td></tr>
<tr class="separator:a130266e855e3a9deac87f07fed9ec642"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4ce892f31b6aae7404c91b2356945928" id="r_a4ce892f31b6aae7404c91b2356945928"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="#a4ce892f31b6aae7404c91b2356945928">getDouble</a> (const std::string &<a class="el" href="#af3924dd33495031700971912062d9da8">columnName</a>)</td></tr>
<tr class="memdesc:a4ce892f31b6aae7404c91b2356945928"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a double. <br /></td></tr>
<tr class="separator:a4ce892f31b6aae7404c91b2356945928"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae213bd0278eb588c50988aaea9de8dc1" id="r_ae213bd0278eb588c50988aaea9de8dc1"><td class="memItemLeft" align="right" valign="top">std::optional< std::span< const std::byte > > </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae213bd0278eb588c50988aaea9de8dc1">getBlob</a> (int columnIndex)</td></tr>
<tr class="memdesc:ae213bd0278eb588c50988aaea9de8dc1"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a byte span. <br /></td></tr>
<tr class="separator:ae213bd0278eb588c50988aaea9de8dc1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4f2c222f1f3eade4c9ebd7cc09a09e45" id="r_a4f2c222f1f3eade4c9ebd7cc09a09e45"><td class="memItemLeft" align="right" valign="top">std::optional< std::span< const std::byte > > </td><td class="memItemRight" valign="bottom"><a class="el" href="#a4f2c222f1f3eade4c9ebd7cc09a09e45">getBlob</a> (const std::string &<a class="el" href="#af3924dd33495031700971912062d9da8">columnName</a>)</td></tr>
<tr class="memdesc:a4f2c222f1f3eade4c9ebd7cc09a09e45"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a byte span. <br /></td></tr>
<tr class="separator:a4f2c222f1f3eade4c9ebd7cc09a09e45"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader">Date and Time</div></td></tr>
<tr class="memitem:a6010915966181ccce6bcccb754a1bfa1" id="r_a6010915966181ccce6bcccb754a1bfa1"><td class="memItemLeft" align="right" valign="top">time_t </td><td class="memItemRight" valign="bottom"><a class="el" href="#a6010915966181ccce6bcccb754a1bfa1">getTimestamp</a> (int columnIndex)</td></tr>
<tr class="memdesc:a6010915966181ccce6bcccb754a1bfa1"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a Unix timestamp. <br /></td></tr>
<tr class="separator:a6010915966181ccce6bcccb754a1bfa1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac1bdd93d342ed93d97ca2fdc4320edb7" id="r_ac1bdd93d342ed93d97ca2fdc4320edb7"><td class="memItemLeft" align="right" valign="top">time_t </td><td class="memItemRight" valign="bottom"><a class="el" href="#ac1bdd93d342ed93d97ca2fdc4320edb7">getTimestamp</a> (const std::string &<a class="el" href="#af3924dd33495031700971912062d9da8">columnName</a>)</td></tr>
<tr class="memdesc:ac1bdd93d342ed93d97ca2fdc4320edb7"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a Unix timestamp. <br /></td></tr>
<tr class="separator:ac1bdd93d342ed93d97ca2fdc4320edb7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a62f1a1e4d7177fc24ff5fdee1fd71925" id="r_a62f1a1e4d7177fc24ff5fdee1fd71925"><td class="memItemLeft" align="right" valign="top">tm </td><td class="memItemRight" valign="bottom"><a class="el" href="#a62f1a1e4d7177fc24ff5fdee1fd71925">getDateTime</a> (int columnIndex)</td></tr>
<tr class="memdesc:a62f1a1e4d7177fc24ff5fdee1fd71925"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a Date, Time or DateTime. <br /></td></tr>
<tr class="separator:a62f1a1e4d7177fc24ff5fdee1fd71925"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7069f9ef3a802166bc1e7191d0610552" id="r_a7069f9ef3a802166bc1e7191d0610552"><td class="memItemLeft" align="right" valign="top">tm </td><td class="memItemRight" valign="bottom"><a class="el" href="#a7069f9ef3a802166bc1e7191d0610552">getDateTime</a> (const std::string &<a class="el" href="#af3924dd33495031700971912062d9da8">columnName</a>)</td></tr>
<tr class="memdesc:a7069f9ef3a802166bc1e7191d0610552"><td class="mdescLeft"> </td><td class="mdescRight">Gets the designated column's value as a Date, Time or DateTime. <br /></td></tr>
<tr class="separator:a7069f9ef3a802166bc1e7191d0610552"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="af1d230abc0cc6608de02a4f84e266d31" name="af1d230abc0cc6608de02a4f84e266d31"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af1d230abc0cc6608de02a4f84e266d31">◆ </a></span>columnCount()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int columnCount </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 number of columns in this <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>The number of columns. </dd></dl>
</div>
</div>
<a id="af3924dd33495031700971912062d9da8" name="af3924dd33495031700971912062d9da8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af3924dd33495031700971912062d9da8">◆ </a></span>columnName()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::optional< std::string_view > columnName </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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 designated column's name. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An optional containing the Column name, or std::nullopt if not found. </dd></dl>
</div>
</div>
<a id="a058710758357e65269c0cd08224657e7" name="a058710758357e65269c0cd08224657e7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a058710758357e65269c0cd08224657e7">◆ </a></span>columnSize()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">long columnSize </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Gets the size of a column in bytes. </p>
<p>If the column is a blob then this method returns the number of bytes in that blob. No type conversions occur. If the result is a string (or a number since a number can be converted into a string) then return the number of bytes in the resulting string.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Column data size. </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 columnIndex is outside the valid range. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="abbf636ade7858de8e9b91b7b87667df5" name="abbf636ade7858de8e9b91b7b87667df5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abbf636ade7858de8e9b91b7b87667df5">◆ </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 from the database. </p>
<p><a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> will prefetch rows in batches of number of <code>rows</code> when <a class="el" href="#a80870c233d0237e3588a2d6f8d176916" title="Moves the cursor to the next row.">next()</a> is called to reduce the network roundtrip to the database. This method is only applicable to MySQL and Oracle.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">rows</td><td>The number of rows to fetch (1..INT_MAX). </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ae007f7db7c78d86b64661de71c5aaf5f" name="ae007f7db7c78d86b64661de71c5aaf5f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae007f7db7c78d86b64661de71c5aaf5f">◆ </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> 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 number of rows to fetch from the database. </p>
<p>Unless previously set with <a class="el" href="#abbf636ade7858de8e9b91b7b87667df5" title="Sets the number of rows to fetch from the database.">setFetchSize()</a>, the returned value is the same as returned by <a class="el" href="classzdb_1_1Connection.html#a7948c7ccabbf0fab6c126628c904b94f" title="Gets the number of rows to fetch for ResultSet objects.">Connection::getFetchSize()</a></p>
<dl class="section return"><dt>Returns</dt><dd>The number of rows to fetch or 0 if N/A. </dd></dl>
</div>
</div>
<a id="a80870c233d0237e3588a2d6f8d176916" name="a80870c233d0237e3588a2d6f8d176916"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a80870c233d0237e3588a2d6f8d176916">◆ </a></span>next()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool next </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Moves the cursor to the next row. </p>
<p>A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> cursor is initially positioned before the first row; the first call to this method makes the first row the current row; the second call makes the second row the current row, and so on. When there are no more available rows false is returned. An empty <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> will return false on the first call to <a class="el" href="#a80870c233d0237e3588a2d6f8d176916" title="Moves the cursor to the next row.">ResultSet::next()</a>.</p>
<dl class="section return"><dt>Returns</dt><dd>true if the new current row is valid; false if there are no more rows. </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. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a096eb10a6f137add4dcc02be3ba853c3" name="a096eb10a6f137add4dcc02be3ba853c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a096eb10a6f137add4dcc02be3ba853c3">◆ </a></span>isNull()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool isNull </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Checks if the designated column's value is SQL NULL. </p>
<p>A <a class="el" href="classzdb_1_1ResultSet.html" title="Represents a database result set.">ResultSet</a> returns an optional for reference types and 0 for value types. Use this method if you need to differentiate between SQL NULL and std::nullopt/0.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if column value is SQL NULL, false otherwise. </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 columnIndex is invalid. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ac00f123b0b60a08479a813b7d569a15a" name="ac00f123b0b60a08479a813b7d569a15a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac00f123b0b60a08479a813b7d569a15a">◆ </a></span>getString() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::optional< std::string_view > getString </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Gets the designated column's value as a string. </p>
<p><em>The returned string may only be valid until the next call to <a class="el" href="#a80870c233d0237e3588a2d6f8d176916" title="Moves the cursor to the next row.">next()</a> and if you plan to use the returned value longer, you must make a copy.</em></p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An optional containing the column value, or std::nullopt if NULL. </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 columnIndex is invalid. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a995f6c93cb8c4cba8222c797371b2408" name="a995f6c93cb8c4cba8222c797371b2408"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a995f6c93cb8c4cba8222c797371b2408">◆ </a></span>getString() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::optional< std::string_view > getString </td>
<td>(</td>
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>columnName</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>Gets the designated column's value as a string. </p>
<p><em>The returned string may only be valid until the next call to <a class="el" href="#a80870c233d0237e3588a2d6f8d176916" title="Moves the cursor to the next row.">next()</a> and if you plan to use the returned value longer, you must make a copy.</em></p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnName</td><td>The SQL name of the column. case-sensitive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An optional containing the column value, or std::nullopt if NULL. </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 columnName does not exist. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a2e7dde031277c762bd5112487b2fad52" name="a2e7dde031277c762bd5112487b2fad52"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2e7dde031277c762bd5112487b2fad52">◆ </a></span>getInt() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int getInt </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Gets the designated column's value as an int. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The column value; if the value is SQL NULL, the value returned is 0. </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, columnIndex is invalid or value is NaN. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a0e9a4693eb2f6c45ec8e09ea0179bc69" name="a0e9a4693eb2f6c45ec8e09ea0179bc69"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0e9a4693eb2f6c45ec8e09ea0179bc69">◆ </a></span>getInt() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int getInt </td>
<td>(</td>
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>columnName</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>Gets the designated column's value as an int. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnName</td><td>The SQL name of the column. case-sensitive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The column value; if the value is SQL NULL, the value returned is 0. </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, columnName is invalid or value is NaN. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="af81be46a299e4f68dbd8bb92bb679550" name="af81be46a299e4f68dbd8bb92bb679550"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af81be46a299e4f68dbd8bb92bb679550">◆ </a></span>getLLong() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">long long getLLong </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Gets the designated column's value as a long long. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The column value; if the value is SQL NULL, the value returned is 0. </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, columnIndex is invalid or value is NaN. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a0f1c6e8ec0fc05cf3a3fc317a0464ec9" name="a0f1c6e8ec0fc05cf3a3fc317a0464ec9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0f1c6e8ec0fc05cf3a3fc317a0464ec9">◆ </a></span>getLLong() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">long long getLLong </td>
<td>(</td>
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>columnName</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>Gets the designated column's value as a long long. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnName</td><td>The SQL name of the column. case-sensitive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The column value; if the value is SQL NULL, the value returned is 0. </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, columnName is invalid or value is NaN. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a130266e855e3a9deac87f07fed9ec642" name="a130266e855e3a9deac87f07fed9ec642"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a130266e855e3a9deac87f07fed9ec642">◆ </a></span>getDouble() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">double getDouble </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Gets the designated column's value as a double. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The column value; if the value is SQL NULL, the value returned is 0.0. </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, columnIndex is invalid or value is NaN. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a4ce892f31b6aae7404c91b2356945928" name="a4ce892f31b6aae7404c91b2356945928"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4ce892f31b6aae7404c91b2356945928">◆ </a></span>getDouble() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">double getDouble </td>
<td>(</td>
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>columnName</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>Gets the designated column's value as a double. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnName</td><td>The SQL name of the column. case-sensitive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The column value; if the value is SQL NULL, the value returned is 0.0. </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, columnName is invalid or value is NaN. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ae213bd0278eb588c50988aaea9de8dc1" name="ae213bd0278eb588c50988aaea9de8dc1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae213bd0278eb588c50988aaea9de8dc1">◆ </a></span>getBlob() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::optional< std::span< const std::byte > > getBlob </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Gets the designated column's value as a byte span. </p>
<p><em>The returned blob may only be valid until the next call to <a class="el" href="#a80870c233d0237e3588a2d6f8d176916" title="Moves the cursor to the next row.">next()</a> and if you plan to use the returned value longer, you must make a copy.</em></p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An optional span of bytes containing the blob data, or std::nullopt if NULL. </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 columnIndex is invalid. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a4f2c222f1f3eade4c9ebd7cc09a09e45" name="a4f2c222f1f3eade4c9ebd7cc09a09e45"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4f2c222f1f3eade4c9ebd7cc09a09e45">◆ </a></span>getBlob() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::optional< std::span< const std::byte > > getBlob </td>
<td>(</td>
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>columnName</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>Gets the designated column's value as a byte span. </p>
<p><em>The returned blob may only be valid until the next call to <a class="el" href="#a80870c233d0237e3588a2d6f8d176916" title="Moves the cursor to the next row.">next()</a> and if you plan to use the returned value longer, you must make a copy.</em></p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnName</td><td>The SQL name of the column. case-sensitive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An optional span of bytes containing the blob data, or std::nullopt if NULL. </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 columnName is invalid. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a6010915966181ccce6bcccb754a1bfa1" name="a6010915966181ccce6bcccb754a1bfa1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6010915966181ccce6bcccb754a1bfa1">◆ </a></span>getTimestamp() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">time_t getTimestamp </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Gets the designated column's value as a Unix timestamp. </p>
<p>The returned value is in Coordinated Universal Time (UTC) and represents seconds since the <b>epoch</b> (January 1, 1970, 00:00:00 GMT).</p>
<p>Even though the underlying database might support timestamp ranges before the epoch and after '2038-01-19 03:14:07 UTC' it is safest not to assume or use values outside this range. Especially on a 32-bit system.</p>
<p><em>SQLite</em> does not have temporal SQL data types per se and using this method with SQLite assumes the column value in the Result Set to be either a numerical value representing a Unix Time in UTC which is returned as-is or an <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> time string which is converted to a <code>time_t</code> value.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The column value as seconds since the epoch in the GMT timezone. If the value is SQL NULL, the value returned is 0. </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, columnIndex is outside the valid range or if the column value cannot be converted to a valid timestamp. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ac1bdd93d342ed93d97ca2fdc4320edb7" name="ac1bdd93d342ed93d97ca2fdc4320edb7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac1bdd93d342ed93d97ca2fdc4320edb7">◆ </a></span>getTimestamp() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">time_t getTimestamp </td>
<td>(</td>
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>columnName</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>Gets the designated column's value as a Unix timestamp. </p>
<p>The returned value is in Coordinated Universal Time (UTC) and represents seconds since the <b>epoch</b> (January 1, 1970, 00:00:00 GMT).</p>
<p>Even though the underlying database might support timestamp ranges before the epoch and after '2038-01-19 03:14:07 UTC' it is safest not to assume or use values outside this range. Especially on a 32-bit system.</p>
<p><em>SQLite</em> does not have temporal SQL data types per se and using this method with SQLite assumes the column value in the Result Set to be either a numerical value representing a Unix Time in UTC which is returned as-is or an <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> time string which is converted to a <code>time_t</code> value.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnName</td><td>The SQL name of the column. case-sensitive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The column value as seconds since the epoch in the GMT timezone. If the value is SQL NULL, the value returned is 0. </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, columnName is not found or if the column value cannot be converted to a valid timestamp. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a62f1a1e4d7177fc24ff5fdee1fd71925" name="a62f1a1e4d7177fc24ff5fdee1fd71925"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a62f1a1e4d7177fc24ff5fdee1fd71925">◆ </a></span>getDateTime() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">tm getDateTime </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>columnIndex</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>Gets the designated column's value as a Date, Time or DateTime. </p>
<p>This method can be used to retrieve the value of columns with the SQL data type, Date, Time, DateTime or Timestamp. The returned <code>tm</code> structure follows the convention for usage with mktime(3) where:</p>
<ul>
<li>tm_hour = hours since midnight [0-23]</li>
<li>tm_min = minutes after the hour [0-59]</li>
<li>tm_sec = seconds after the minute [0-60]</li>
<li>tm_mday = day of the month [1-31]</li>
<li>tm_mon = months since January <b>[0-11]</b></li>
</ul>
<p>If the column value contains timezone information, tm_gmtoff is set to the offset from UTC in seconds, otherwise tm_gmtoff is set to 0. <em>On systems without tm_gmtoff, (Solaris), the member, tm_wday is set to gmt offset instead as this property is ignored by mktime on input.</em> The exception to the above is <b>tm_year</b> which contains the year literal and <em>not years since 1900</em> which is the convention. All other fields in the structure are set to zero. If the column type is DateTime or Timestamp all the fields mentioned above are set, if it is a Date or a Time, only the relevant fields are set.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnIndex</td><td>The first column is 1, the second is 2, ... </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A tm structure with fields for date and time. If the value is SQL NULL, a zeroed tm structure is returned. Use <a class="el" href="#a096eb10a6f137add4dcc02be3ba853c3" title="Checks if the designated column's value is SQL NULL.">isNull()</a> if in doubt. </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, columnIndex is outside the valid range or if the column value cannot be converted to a valid SQL Date, Time or DateTime type. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a7069f9ef3a802166bc1e7191d0610552" name="a7069f9ef3a802166bc1e7191d0610552"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7069f9ef3a802166bc1e7191d0610552">◆ </a></span>getDateTime() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">tm getDateTime </td>
<td>(</td>
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>columnName</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>Gets the designated column's value as a Date, Time or DateTime. </p>
<p>This method can be used to retrieve the value of columns with the SQL data type, Date, Time, DateTime or Timestamp. The returned <code>tm</code> structure follows the convention for usage with mktime(3) where:</p>
<ul>
<li>tm_hour = hours since midnight [0-23]</li>
<li>tm_min = minutes after the hour [0-59]</li>
<li>tm_sec = seconds after the minute [0-60]</li>
<li>tm_mday = day of the month [1-31]</li>
<li>tm_mon = months since January <b>[0-11]</b></li>
</ul>
<p>If the column value contains timezone information, tm_gmtoff is set to the offset from UTC in seconds, otherwise tm_gmtoff is set to 0. <em>On systems without tm_gmtoff, (Solaris), the member, tm_wday is set to gmt offset instead as this property is ignored by mktime on input.</em> The exception to the above is <b>tm_year</b> which contains the year literal and <em>not years since 1900</em> which is the convention. All other fields in the structure are set to zero. If the column type is DateTime or Timestamp all the fields mentioned above are set, if it is a Date or a Time, only the relevant fields are set.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">columnName</td><td>The SQL name of the column. case-sensitive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A tm structure with fields for date and time. If the value is SQL NULL, a zeroed tm structure is returned. Use <a class="el" href="#a096eb10a6f137add4dcc02be3ba853c3" title="Checks if the designated column's value is SQL NULL.">isNull()</a> if in doubt. </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, columnName is not found or if the column value cannot be converted to a valid Date, Time or DateTime type. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</div><!-- contents -->
<p style="text-align:center;color:#808080;font-size:90%;margin:40px 0 20px 0;">
Copyright © <a href="https://tildeslash.com/">Tildeslash Ltd</a>. All
rights reserved.</p>
</body></html>
|