1<?xml version="1.0" encoding="iso-8859-1"?> 2<!DOCTYPE html 3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 5 6<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 7<head> 8 <title>Class: SQLRConnection</title> 9 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 10 <meta http-equiv="Content-Script-Type" content="text/javascript" /> 11 <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> 12 <script type="text/javascript"> 13 // <![CDATA[ 14 15 function popupCode( url ) { 16 window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") 17 } 18 19 function toggleCode( id ) { 20 if ( document.getElementById ) 21 elem = document.getElementById( id ); 22 else if ( document.all ) 23 elem = eval( "document.all." + id ); 24 else 25 return false; 26 27 elemStyle = elem.style; 28 29 if ( elemStyle.display != "block" ) { 30 elemStyle.display = "block" 31 } else { 32 elemStyle.display = "none" 33 } 34 35 return true; 36 } 37 38 // Make codeblocks hidden by default 39 document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) 40 41 // ]]> 42 </script> 43 44</head> 45<body> 46 47 48 49 <div id="classHeader"> 50 <table class="header-table"> 51 <tr class="top-aligned-row"> 52 <td><strong>Class</strong></td> 53 <td class="class-name-in-header">SQLRConnection</td> 54 </tr> 55 <tr class="top-aligned-row"> 56 <td><strong>In:</strong></td> 57 <td> 58 <a href="../files/sqlrelay_cpp.html"> 59 sqlrelay.cpp 60 </a> 61 <br /> 62 </td> 63 </tr> 64 65 <tr class="top-aligned-row"> 66 <td><strong>Parent:</strong></td> 67 <td> 68 Object 69 </td> 70 </tr> 71 </table> 72 </div> 73 <!-- banner header --> 74 75 <div id="bodyContent"> 76 77 78 79 <div id="contextContent"> 80 81 82 83 </div> 84 85 <div id="method-list"> 86 <h3 class="section-bar">Methods</h3> 87 88 <div class="name-list"> 89 <a href="#M000105">autoCommitOff</a> 90 <a href="#M000104">autoCommitOn</a> 91 <a href="#M000106">begin</a> 92 <a href="#M000100">bindFormat</a> 93 <a href="#M000099">clientVersion</a> 94 <a href="#M000107">commit</a> 95 <a href="#M000096">dbHostName</a> 96 <a href="#M000097">dbIpAddress</a> 97 <a href="#M000095">dbVersion</a> 98 <a href="#M000112">debugOff</a> 99 <a href="#M000111">debugOn</a> 100 <a href="#M000088">endSession</a> 101 <a href="#M000109">errorMessage</a> 102 <a href="#M000110">errorNumber</a> 103 <a href="#M000115">getClientInfo</a> 104 <a href="#M000090">getConnectionPort</a> 105 <a href="#M000091">getConnectionSocket</a> 106 <a href="#M000102">getCurrentDatabase</a> 107 <a href="#M000113">getDebug</a> 108 <a href="#M000103">getLastInsertId</a> 109 <a href="#M000094">identify</a> 110 <a href="#M000086">new</a> 111 <a href="#M000093">ping</a> 112 <a href="#M000092">resumeSession</a> 113 <a href="#M000108">rollback</a> 114 <a href="#M000101">selectDatabase</a> 115 <a href="#M000098">serverVersion</a> 116 <a href="#M000114">setClientInfo</a> 117 <a href="#M000087">setConnectTimeout</a> 118 <a href="#M000089">suspendSession</a> 119 </div> 120 </div> 121 122 </div> 123 124 125 <!-- if includes --> 126 127 <div id="section"> 128 129 130 131 132 133 134 135 136 <!-- if method_list --> 137 <div id="methods"> 138 <h3 class="section-bar">Public Class methods</h3> 139 140 <div id="method-M000086" class="method-detail"> 141 <a name="M000086"></a> 142 143 <div class="method-heading"> 144 <a href="SQLRConnection.src/M000086.html" target="Code" class="method-signature" 145 onclick="popupCode('SQLRConnection.src/M000086.html');return false;"> 146 <span class="method-name">new(host, port, socket, user, password, retrytime, tries)<br /> 147</span> 148 </a> 149 </div> 150 151 <div class="method-description"> 152 <p> 153Initiates a connection to "host" on "port" or to the 154unix "socket" on the local machine and authenticates with 155"user" and "password". Failed connections will be 156retried for "tries" times on interval "retrytime". If 157"tries" is 0 then retries will continue forever. If 158"retrytime" is 0 then retries will be attempted on a default 159interval. If the "socket" parameter is nether nil nor 160"" then an attempt will be made to connect through it before 161attempting to connect to "host" on "port". If it is nil 162or "" then no attempt will be made to connect through the socket. 163</p> 164 </div> 165 </div> 166 167 <h3 class="section-bar">Public Instance methods</h3> 168 169 <div id="method-M000105" class="method-detail"> 170 <a name="M000105"></a> 171 172 <div class="method-heading"> 173 <a href="SQLRConnection.src/M000105.html" target="Code" class="method-signature" 174 onclick="popupCode('SQLRConnection.src/M000105.html');return false;"> 175 <span class="method-name">autoCommitOff</span><span class="method-args">()</span> 176 </a> 177 </div> 178 179 <div class="method-description"> 180 <p> 181Instructs the database to wait for the client to tell it when to <a 182href="SQLRConnection.html#M000107">commit</a>. 183</p> 184 </div> 185 </div> 186 187 <div id="method-M000104" class="method-detail"> 188 <a name="M000104"></a> 189 190 <div class="method-heading"> 191 <a href="SQLRConnection.src/M000104.html" target="Code" class="method-signature" 192 onclick="popupCode('SQLRConnection.src/M000104.html');return false;"> 193 <span class="method-name">autoCommitOn</span><span class="method-args">()</span> 194 </a> 195 </div> 196 197 <div class="method-description"> 198 <p> 199Instructs the database to perform a <a 200href="SQLRConnection.html#M000107">commit</a> after every successful query. 201</p> 202 </div> 203 </div> 204 205 <div id="method-M000106" class="method-detail"> 206 <a name="M000106"></a> 207 208 <div class="method-heading"> 209 <a href="SQLRConnection.src/M000106.html" target="Code" class="method-signature" 210 onclick="popupCode('SQLRConnection.src/M000106.html');return false;"> 211 <span class="method-name">begin</span><span class="method-args">()</span> 212 </a> 213 </div> 214 215 <div class="method-description"> 216 <p> 217Begins a transaction. Returns true if the <a 218href="SQLRConnection.html#M000106">begin</a> succeeded, false if it failed. 219If the database automatically begins a <a 220href="SQLRConnection.html#M000086">new</a> transaction when a <a 221href="SQLRConnection.html#M000107">commit</a> or <a 222href="SQLRConnection.html#M000108">rollback</a> is issued then this 223doesn‘t do anything unless SQL Relay is faking transaction blocks. 224</p> 225 </div> 226 </div> 227 228 <div id="method-M000100" class="method-detail"> 229 <a name="M000100"></a> 230 231 <div class="method-heading"> 232 <a href="SQLRConnection.src/M000100.html" target="Code" class="method-signature" 233 onclick="popupCode('SQLRConnection.src/M000100.html');return false;"> 234 <span class="method-name">bindFormat</span><span class="method-args">()</span> 235 </a> 236 </div> 237 238 <div class="method-description"> 239 <p> 240Returns a string representing the format of the bind variables used in the 241db. 242</p> 243 </div> 244 </div> 245 246 <div id="method-M000099" class="method-detail"> 247 <a name="M000099"></a> 248 249 <div class="method-heading"> 250 <a href="SQLRConnection.src/M000099.html" target="Code" class="method-signature" 251 onclick="popupCode('SQLRConnection.src/M000099.html');return false;"> 252 <span class="method-name">clientVersion</span><span class="method-args">()</span> 253 </a> 254 </div> 255 256 <div class="method-description"> 257 <p> 258Returns the version of the sqlrelay client software. 259</p> 260 </div> 261 </div> 262 263 <div id="method-M000107" class="method-detail"> 264 <a name="M000107"></a> 265 266 <div class="method-heading"> 267 <a href="SQLRConnection.src/M000107.html" target="Code" class="method-signature" 268 onclick="popupCode('SQLRConnection.src/M000107.html');return false;"> 269 <span class="method-name">commit</span><span class="method-args">()</span> 270 </a> 271 </div> 272 273 <div class="method-description"> 274 <p> 275Issues a <a href="SQLRConnection.html#M000107">commit</a>. Returns true if 276the <a href="SQLRConnection.html#M000107">commit</a> succeeded, false if it 277failed. 278</p> 279 </div> 280 </div> 281 282 <div id="method-M000096" class="method-detail"> 283 <a name="M000096"></a> 284 285 <div class="method-heading"> 286 <a href="SQLRConnection.src/M000096.html" target="Code" class="method-signature" 287 onclick="popupCode('SQLRConnection.src/M000096.html');return false;"> 288 <span class="method-name">dbHostName</span><span class="method-args">()</span> 289 </a> 290 </div> 291 292 <div class="method-description"> 293 <p> 294Returns the host name of the database 295</p> 296 </div> 297 </div> 298 299 <div id="method-M000097" class="method-detail"> 300 <a name="M000097"></a> 301 302 <div class="method-heading"> 303 <a href="SQLRConnection.src/M000097.html" target="Code" class="method-signature" 304 onclick="popupCode('SQLRConnection.src/M000097.html');return false;"> 305 <span class="method-name">dbIpAddress</span><span class="method-args">()</span> 306 </a> 307 </div> 308 309 <div class="method-description"> 310 <p> 311Returns the ip address of the database 312</p> 313 </div> 314 </div> 315 316 <div id="method-M000095" class="method-detail"> 317 <a name="M000095"></a> 318 319 <div class="method-heading"> 320 <a href="SQLRConnection.src/M000095.html" target="Code" class="method-signature" 321 onclick="popupCode('SQLRConnection.src/M000095.html');return false;"> 322 <span class="method-name">dbVersion</span><span class="method-args">()</span> 323 </a> 324 </div> 325 326 <div class="method-description"> 327 <p> 328Returns the version of the database 329</p> 330 </div> 331 </div> 332 333 <div id="method-M000112" class="method-detail"> 334 <a name="M000112"></a> 335 336 <div class="method-heading"> 337 <a href="SQLRConnection.src/M000112.html" target="Code" class="method-signature" 338 onclick="popupCode('SQLRConnection.src/M000112.html');return false;"> 339 <span class="method-name">debugOff</span><span class="method-args">()</span> 340 </a> 341 </div> 342 343 <div class="method-description"> 344 <p> 345Turns debugging off. 346</p> 347 </div> 348 </div> 349 350 <div id="method-M000111" class="method-detail"> 351 <a name="M000111"></a> 352 353 <div class="method-heading"> 354 <a href="SQLRConnection.src/M000111.html" target="Code" class="method-signature" 355 onclick="popupCode('SQLRConnection.src/M000111.html');return false;"> 356 <span class="method-name">debugOn</span><span class="method-args">()</span> 357 </a> 358 </div> 359 360 <div class="method-description"> 361 <p> 362Causes verbose debugging information to be sent to standard output. Another 363way to do this is to start a query with "— debug\n". Yet 364another way is to set the environment variable SQLR_CLIENT_DEBUG to 365"ON" 366</p> 367 </div> 368 </div> 369 370 <div id="method-M000088" class="method-detail"> 371 <a name="M000088"></a> 372 373 <div class="method-heading"> 374 <a href="SQLRConnection.src/M000088.html" target="Code" class="method-signature" 375 onclick="popupCode('SQLRConnection.src/M000088.html');return false;"> 376 <span class="method-name">endSession</span><span class="method-args">()</span> 377 </a> 378 </div> 379 380 <div class="method-description"> 381 <p> 382Ends the session. 383</p> 384 </div> 385 </div> 386 387 <div id="method-M000109" class="method-detail"> 388 <a name="M000109"></a> 389 390 <div class="method-heading"> 391 <a href="SQLRConnection.src/M000109.html" target="Code" class="method-signature" 392 onclick="popupCode('SQLRConnection.src/M000109.html');return false;"> 393 <span class="method-name">errorMessage</span><span class="method-args">()</span> 394 </a> 395 </div> 396 397 <div class="method-description"> 398 <p> 399If an operation failed and generated an error, the error message is 400available here. If there is no error then this method returns nil 401</p> 402 </div> 403 </div> 404 405 <div id="method-M000110" class="method-detail"> 406 <a name="M000110"></a> 407 408 <div class="method-heading"> 409 <a href="SQLRConnection.src/M000110.html" target="Code" class="method-signature" 410 onclick="popupCode('SQLRConnection.src/M000110.html');return false;"> 411 <span class="method-name">errorNumber</span><span class="method-args">()</span> 412 </a> 413 </div> 414 415 <div class="method-description"> 416 <p> 417If an operation failed and generated an error, the error number is 418available here. If there is no error then this method returns 0. 419</p> 420 </div> 421 </div> 422 423 <div id="method-M000115" class="method-detail"> 424 <a name="M000115"></a> 425 426 <div class="method-heading"> 427 <a href="SQLRConnection.src/M000115.html" target="Code" class="method-signature" 428 onclick="popupCode('SQLRConnection.src/M000115.html');return false;"> 429 <span class="method-name">getClientInfo</span><span class="method-args">()</span> 430 </a> 431 </div> 432 433 <div class="method-description"> 434 <p> 435Returns the string that was set by <a 436href="SQLRConnection.html#M000114">setClientInfo</a>(). 437</p> 438 </div> 439 </div> 440 441 <div id="method-M000090" class="method-detail"> 442 <a name="M000090"></a> 443 444 <div class="method-heading"> 445 <a href="SQLRConnection.src/M000090.html" target="Code" class="method-signature" 446 onclick="popupCode('SQLRConnection.src/M000090.html');return false;"> 447 <span class="method-name">getConnectionPort</span><span class="method-args">()</span> 448 </a> 449 </div> 450 451 <div class="method-description"> 452 <p> 453Returns the inet port that the connection is communicating over. This 454parameter may be passed to another connection for use in the 455sqlrcon_resumeSession() command. Note: The result this function returns is 456only valid after a call to <a 457href="SQLRConnection.html#M000089">suspendSession</a>(). 458</p> 459 </div> 460 </div> 461 462 <div id="method-M000091" class="method-detail"> 463 <a name="M000091"></a> 464 465 <div class="method-heading"> 466 <a href="SQLRConnection.src/M000091.html" target="Code" class="method-signature" 467 onclick="popupCode('SQLRConnection.src/M000091.html');return false;"> 468 <span class="method-name">getConnectionSocket</span><span class="method-args">()</span> 469 </a> 470 </div> 471 472 <div class="method-description"> 473 <p> 474Returns the unix socket that the connection is communicating over. This 475parameter may be passed to another connection for use in the 476sqlrcon_resumeSession() command. Note: The result this function returns is 477only valid after a call to <a 478href="SQLRConnection.html#M000089">suspendSession</a>(). 479</p> 480 </div> 481 </div> 482 483 <div id="method-M000102" class="method-detail"> 484 <a name="M000102"></a> 485 486 <div class="method-heading"> 487 <a href="SQLRConnection.src/M000102.html" target="Code" class="method-signature" 488 onclick="popupCode('SQLRConnection.src/M000102.html');return false;"> 489 <span class="method-name">getCurrentDatabase</span><span class="method-args">()</span> 490 </a> 491 </div> 492 493 <div class="method-description"> 494 <p> 495Returns the database/schema that is currently in use. 496</p> 497 </div> 498 </div> 499 500 <div id="method-M000113" class="method-detail"> 501 <a name="M000113"></a> 502 503 <div class="method-heading"> 504 <a href="SQLRConnection.src/M000113.html" target="Code" class="method-signature" 505 onclick="popupCode('SQLRConnection.src/M000113.html');return false;"> 506 <span class="method-name">getDebug</span><span class="method-args">()</span> 507 </a> 508 </div> 509 510 <div class="method-description"> 511 <p> 512Returns 0 if debugging is off and 1 if debugging is on. 513</p> 514 </div> 515 </div> 516 517 <div id="method-M000103" class="method-detail"> 518 <a name="M000103"></a> 519 520 <div class="method-heading"> 521 <a href="SQLRConnection.src/M000103.html" target="Code" class="method-signature" 522 onclick="popupCode('SQLRConnection.src/M000103.html');return false;"> 523 <span class="method-name">getLastInsertId</span><span class="method-args">()</span> 524 </a> 525 </div> 526 527 <div class="method-description"> 528 <p> 529Returns the value of the autoincrement column for the last insert 530</p> 531 </div> 532 </div> 533 534 <div id="method-M000094" class="method-detail"> 535 <a name="M000094"></a> 536 537 <div class="method-heading"> 538 <a href="SQLRConnection.src/M000094.html" target="Code" class="method-signature" 539 onclick="popupCode('SQLRConnection.src/M000094.html');return false;"> 540 <span class="method-name">identify</span><span class="method-args">()</span> 541 </a> 542 </div> 543 544 <div class="method-description"> 545 <p> 546Returns the type of database: oracle, postgresql, mysql, etc. 547</p> 548 </div> 549 </div> 550 551 <div id="method-M000093" class="method-detail"> 552 <a name="M000093"></a> 553 554 <div class="method-heading"> 555 <a href="SQLRConnection.src/M000093.html" target="Code" class="method-signature" 556 onclick="popupCode('SQLRConnection.src/M000093.html');return false;"> 557 <span class="method-name">ping</span><span class="method-args">()</span> 558 </a> 559 </div> 560 561 <div class="method-description"> 562 <p> 563Returns 1 if the database is up and 0 if it‘s down. 564</p> 565 </div> 566 </div> 567 568 <div id="method-M000092" class="method-detail"> 569 <a name="M000092"></a> 570 571 <div class="method-heading"> 572 <a href="SQLRConnection.src/M000092.html" target="Code" class="method-signature" 573 onclick="popupCode('SQLRConnection.src/M000092.html');return false;"> 574 <span class="method-name">resumeSession(port,socket)<br /> 575</span> 576 </a> 577 </div> 578 579 <div class="method-description"> 580 <p> 581Resumes a session previously left open using sqlrcon_suspendSession(). 582Returns 1 on success and 0 on failure. 583</p> 584 </div> 585 </div> 586 587 <div id="method-M000108" class="method-detail"> 588 <a name="M000108"></a> 589 590 <div class="method-heading"> 591 <a href="SQLRConnection.src/M000108.html" target="Code" class="method-signature" 592 onclick="popupCode('SQLRConnection.src/M000108.html');return false;"> 593 <span class="method-name">rollback</span><span class="method-args">()</span> 594 </a> 595 </div> 596 597 <div class="method-description"> 598 <p> 599Issues a <a href="SQLRConnection.html#M000108">rollback</a>. Returns true 600if the <a href="SQLRConnection.html#M000108">rollback</a> succeeded, false 601if it failed. 602</p> 603 </div> 604 </div> 605 606 <div id="method-M000101" class="method-detail"> 607 <a name="M000101"></a> 608 609 <div class="method-heading"> 610 <a href="SQLRConnection.src/M000101.html" target="Code" class="method-signature" 611 onclick="popupCode('SQLRConnection.src/M000101.html');return false;"> 612 <span class="method-name">selectDatabase(database)<br /> 613</span> 614 </a> 615 </div> 616 617 <div class="method-description"> 618 <p> 619Sets the current database/schema to "database" 620</p> 621 </div> 622 </div> 623 624 <div id="method-M000098" class="method-detail"> 625 <a name="M000098"></a> 626 627 <div class="method-heading"> 628 <a href="SQLRConnection.src/M000098.html" target="Code" class="method-signature" 629 onclick="popupCode('SQLRConnection.src/M000098.html');return false;"> 630 <span class="method-name">serverVersion</span><span class="method-args">()</span> 631 </a> 632 </div> 633 634 <div class="method-description"> 635 <p> 636Returns the version of the sqlrelay server software. 637</p> 638 </div> 639 </div> 640 641 <div id="method-M000114" class="method-detail"> 642 <a name="M000114"></a> 643 644 <div class="method-heading"> 645 <a href="SQLRConnection.src/M000114.html" target="Code" class="method-signature" 646 onclick="popupCode('SQLRConnection.src/M000114.html');return false;"> 647 <span class="method-name">setClientInfo(clientinfo)<br /> 648</span> 649 </a> 650 </div> 651 652 <div class="method-description"> 653 <p> 654Allows you to set a string that will be passed to the server and ultimately 655included in server-side logging along with queries that were run by this 656instance of the client. 657</p> 658 </div> 659 </div> 660 661 <div id="method-M000087" class="method-detail"> 662 <a name="M000087"></a> 663 664 <div class="method-heading"> 665 <a href="SQLRConnection.src/M000087.html" target="Code" class="method-signature" 666 onclick="popupCode('SQLRConnection.src/M000087.html');return false;"> 667 <span class="method-name">setConnectTimeout(timeoutsec,timeoutusec)<br /> 668</span> 669 </a> 670 </div> 671 672 <div class="method-description"> 673 <p> 674Sets the server connect timeout in seconds and milliseconds. Setting either 675parameter to -1 disables the timeout. You can also set this timeout using 676the SQLR_CLIENT_CONNECT_TIMEOUT environment variable. 677</p> 678 </div> 679 </div> 680 681 <div id="method-M000089" class="method-detail"> 682 <a name="M000089"></a> 683 684 <div class="method-heading"> 685 <a href="SQLRConnection.src/M000089.html" target="Code" class="method-signature" 686 onclick="popupCode('SQLRConnection.src/M000089.html');return false;"> 687 <span class="method-name">suspendSession</span><span class="method-args">()</span> 688 </a> 689 </div> 690 691 <div class="method-description"> 692 <p> 693Disconnects this connection from the current session but leaves the session 694open so that another connection can connect to it using 695sqlrcon_resumeSession(). 696</p> 697 </div> 698 </div> 699 700 701 </div> 702 703 704 </div> 705 706 707<div id="validator-badges"> 708 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> 709</div> 710 711</body> 712</html> 713