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
|
<html>
<head>
<title>~/src/firstworks/sqlrelay-0.37/src/api/c++/include/sqlrelay/sqlrclient.h.html</title>
<meta name="Generator" content="Vim/6.3">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
<font color="#0000ff">// Copyright (c) 1999-2001 David Muse</font>
<font color="#0000ff">// See the file COPYING for more information.</font>
<font color="#a020f0">#ifndef SQLRCLIENT_H</font>
<font color="#a020f0">#define SQLRCLIENT_H</font>
<font color="#a020f0">#include </font><font color="#ff00ff"><sqlrelay/private/sqlrincludes.h></font>
<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
<font color="#a52a2a"><b>using</b></font> <font color="#2e8b57"><b>namespace</b></font> rudiments;
<font color="#a020f0">#endif</font>
<font color="#2e8b57"><b>class</b></font> sqlrconnection {
<font color="#a52a2a"><b>public</b></font>:
sqlrconnection(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *server, <font color="#2e8b57"><b>uint16_t</b></font> port,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *socket,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *user, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *password,
<font color="#2e8b57"><b>int32_t</b></font> retrytime, <font color="#2e8b57"><b>int32_t</b></font> tries);
<font color="#0000ff">// Initiates a connection to "server" on "port"</font>
<font color="#0000ff">// or to the unix "socket" on the local machine</font>
<font color="#0000ff">// and authenticates with "user" and "password".</font>
<font color="#0000ff">// Failed connections will be retried for </font>
<font color="#0000ff">// "tries" times on interval "retrytime".</font>
<font color="#0000ff">// If "tries" is 0 then retries will continue</font>
<font color="#0000ff">// forever. If "retrytime" is 0 then retries</font>
<font color="#0000ff">// will be attempted on a default interval.</font>
<font color="#0000ff">// If the "socket" parameter is neither </font>
<font color="#0000ff">// NULL nor "" then an attempt will be made to </font>
<font color="#0000ff">// connect through it before attempting to </font>
<font color="#0000ff">// connect to "server" on "port". If it is </font>
<font color="#0000ff">// NULL or "" then no attempt will be made to </font>
<font color="#0000ff">// connect through the socket.</font>
~sqlrconnection();
<font color="#0000ff">// Disconnects and ends the session if</font>
<font color="#0000ff">// it hasn't been ended already.</font>
<font color="#2e8b57"><b>void</b></font> endSession();
<font color="#0000ff">// Ends the session.</font>
<font color="#2e8b57"><b>bool</b></font> suspendSession();
<font color="#0000ff">// Disconnects this connection from the current</font>
<font color="#0000ff">// session but leaves the session open so </font>
<font color="#0000ff">// that another connection can connect to it </font>
<font color="#0000ff">// using resumeSession().</font>
<font color="#2e8b57"><b>uint16_t</b></font> getConnectionPort();
<font color="#0000ff">// Returns the inet port that the connection is </font>
<font color="#0000ff">// communicating over. This parameter may be </font>
<font color="#0000ff">// passed to another connection for use in</font>
<font color="#0000ff">// the resumeSession() method.</font>
<font color="#0000ff">// Note: The value this method returns is only</font>
<font color="#0000ff">// valid after a call to suspendSession().</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getConnectionSocket();
<font color="#0000ff">// Returns the unix socket that the connection </font>
<font color="#0000ff">// is communicating over. This parameter may be </font>
<font color="#0000ff">// passed to another connection for use in</font>
<font color="#0000ff">// the resumeSession() method.</font>
<font color="#0000ff">// Note: The value this method returns is only</font>
<font color="#0000ff">// valid after a call to suspendSession().</font>
<font color="#2e8b57"><b>bool</b></font> resumeSession(<font color="#2e8b57"><b>uint16_t</b></font> port, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *socket);
<font color="#0000ff">// Resumes a session previously left open </font>
<font color="#0000ff">// using suspendSession().</font>
<font color="#0000ff">// Returns true on success and false on failure.</font>
<font color="#2e8b57"><b>bool</b></font> ping();
<font color="#0000ff">// Returns true if the database is up and false</font>
<font color="#0000ff">// if it's down.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *identify();
<font color="#0000ff">// Returns the type of database: </font>
<font color="#0000ff">// oracle7, oracle8, postgresql, mysql, etc.</font>
<font color="#2e8b57"><b>bool</b></font> autoCommitOn();
<font color="#0000ff">// Instructs the database to perform a commit</font>
<font color="#0000ff">// after every successful query.</font>
<font color="#2e8b57"><b>bool</b></font> autoCommitOff();
<font color="#0000ff">// Instructs the database to wait for the </font>
<font color="#0000ff">// client to tell it when to commit.</font>
<font color="#2e8b57"><b>bool</b></font> commit();
<font color="#0000ff">// Issues a commit. Returns 1 if the commit</font>
<font color="#0000ff">// succeeded, 0 if it failed.</font>
<font color="#2e8b57"><b>bool</b></font> rollback();
<font color="#0000ff">// Issues a rollback. Returns 1 if the rollback</font>
<font color="#0000ff">// succeeded, 0 if it failed.</font>
<font color="#2e8b57"><b>void</b></font> debugOn();
<font color="#0000ff">// Causes verbose debugging information to be </font>
<font color="#0000ff">// sent to standard output. Another way to do</font>
<font color="#0000ff">// this is to start a query with "-- debug\n".</font>
<font color="#2e8b57"><b>void</b></font> debugOff();
<font color="#0000ff">// Turns debugging off.</font>
<font color="#2e8b57"><b>bool</b></font> getDebug();
<font color="#0000ff">// Returns false if debugging is off and true</font>
<font color="#0000ff">// if debugging is on.</font>
<font color="#2e8b57"><b>void</b></font> debugPrintFunction(<font color="#2e8b57"><b>int</b></font> (*printfunction)
(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *,...));
<font color="#0000ff">// Allows you to replace the function used</font>
<font color="#0000ff">// to print debug messages with your own</font>
<font color="#0000ff">// function. The function is expected to take</font>
<font color="#0000ff">// arguments like printf().</font>
<font color="#a020f0"> #include </font><font color="#ff00ff"><sqlrelay/private/sqlrconnection.h></font>
};
<font color="#2e8b57"><b>class</b></font> sqlrcursor {
<font color="#a52a2a"><b>public</b></font>:
sqlrcursor(sqlrconnection *sqlrc);
~sqlrcursor();
<font color="#2e8b57"><b>void</b></font> setResultSetBufferSize(<font color="#2e8b57"><b>uint64_t</b></font> rows);
<font color="#0000ff">// Sets the number of rows of the result set</font>
<font color="#0000ff">// to buffer at a time. 0 (the default)</font>
<font color="#0000ff">// means buffer the entire result set.</font>
<font color="#2e8b57"><b>uint64_t</b></font> getResultSetBufferSize();
<font color="#0000ff">// Returns the number of result set rows that </font>
<font color="#0000ff">// will be buffered at a time or 0 for the</font>
<font color="#0000ff">// entire result set.</font>
<font color="#2e8b57"><b>void</b></font> dontGetColumnInfo();
<font color="#0000ff">// Tells the server not to send any column</font>
<font color="#0000ff">// info (names, types, sizes). If you don't</font>
<font color="#0000ff">// need that info, you should call this</font>
<font color="#0000ff">// method to improve performance.</font>
<font color="#2e8b57"><b>void</b></font> getColumnInfo();
<font color="#0000ff">// Tells the server to send column info.</font>
<font color="#2e8b57"><b>void</b></font> mixedCaseColumnNames();
<font color="#0000ff">// Columns names are returned in the same</font>
<font color="#0000ff">// case as they are defined in the database.</font>
<font color="#0000ff">// This is the default.</font>
<font color="#2e8b57"><b>void</b></font> upperCaseColumnNames();
<font color="#0000ff">// Columns names are converted to upper case.</font>
<font color="#2e8b57"><b>void</b></font> lowerCaseColumnNames();
<font color="#0000ff">// Columns names are converted to lower case.</font>
<font color="#2e8b57"><b>void</b></font> cacheToFile(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *filename);
<font color="#0000ff">// Sets query caching on. Future queries</font>
<font color="#0000ff">// will be cached to the file "filename".</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// A default time-to-live of 10 minutes is</font>
<font color="#0000ff">// also set.</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Note that once cacheToFile() is called,</font>
<font color="#0000ff">// the result sets of all future queries will</font>
<font color="#0000ff">// be cached to that file until another call </font>
<font color="#0000ff">// to cacheToFile() changes which file to</font>
<font color="#0000ff">// cache to or a call to cacheOff() turns off</font>
<font color="#0000ff">// caching.</font>
<font color="#2e8b57"><b>void</b></font> setCacheTtl(<font color="#2e8b57"><b>uint32_t</b></font> ttl);
<font color="#0000ff">// Sets the time-to-live for cached result</font>
<font color="#0000ff">// sets. The sqlr-cachemanger will remove each </font>
<font color="#0000ff">// cached result set "ttl" seconds after it's </font>
<font color="#0000ff">// created, provided it's scanning the directory</font>
<font color="#0000ff">// containing the cache files.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getCacheFileName();
<font color="#0000ff">// Returns the name of the file containing the</font>
<font color="#0000ff">// cached result set.</font>
<font color="#2e8b57"><b>void</b></font> cacheOff();
<font color="#0000ff">// Sets query caching off.</font>
<font color="#0000ff">// If you don't need to use substitution or bind variables</font>
<font color="#0000ff">// in your queries, use these two methods.</font>
<font color="#2e8b57"><b>bool</b></font> sendQuery(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *query);
<font color="#0000ff">// Sends "query" and gets a result set.</font>
<font color="#2e8b57"><b>bool</b></font> sendQuery(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *query, <font color="#2e8b57"><b>uint32_t</b></font> length);
<font color="#0000ff">// Sends "query" with length "length" and gets</font>
<font color="#0000ff">// a result set. This method must be used if</font>
<font color="#0000ff">// the query contains binary data.</font>
<font color="#2e8b57"><b>bool</b></font> sendFileQuery(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *path, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *filename);
<font color="#0000ff">// Sends the query in file "path"/"filename" </font>
<font color="#0000ff">// and gets a result set.</font>
<font color="#0000ff">// If you need to use substitution or bind variables, in your</font>
<font color="#0000ff">// queries use the following methods. See the API </font>
<font color="#0000ff">// documentation for more information about substitution and </font>
<font color="#0000ff">// bind variables.</font>
<font color="#2e8b57"><b>void</b></font> prepareQuery(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *query);
<font color="#0000ff">// Prepare to execute "query".</font>
<font color="#2e8b57"><b>void</b></font> prepareQuery(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *query, <font color="#2e8b57"><b>uint32_t</b></font> length);
<font color="#0000ff">// Prepare to execute "query" with length </font>
<font color="#0000ff">// "length". This method must be used if the</font>
<font color="#0000ff">// query contains binary data.</font>
<font color="#2e8b57"><b>bool</b></font> prepareFileQuery(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *path,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *filename);
<font color="#0000ff">// Prepare to execute the contents </font>
<font color="#0000ff">// of "path"/"filename". Returns false if the</font>
<font color="#0000ff">// file couldn't be opened.</font>
<font color="#2e8b57"><b>void</b></font> clearBinds();
<font color="#0000ff">// Clear all bind variables.</font>
<font color="#2e8b57"><b>uint16_t</b></font> countBindVariables() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Parses the previously prepared query,</font>
<font color="#0000ff">// counts the number of bind variables defined</font>
<font color="#0000ff">// in it and returns that number.</font>
<font color="#2e8b57"><b>void</b></font> substitution(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value);
<font color="#2e8b57"><b>void</b></font> substitution(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable, <font color="#2e8b57"><b>int64_t</b></font> value);
<font color="#2e8b57"><b>void</b></font> substitution(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable, <font color="#2e8b57"><b>double</b></font> value,
<font color="#2e8b57"><b>uint32_t</b></font> precision,
<font color="#2e8b57"><b>uint32_t</b></font> scale);
<font color="#0000ff">// Define a substitution variable.</font>
<font color="#2e8b57"><b>void</b></font> inputBind(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value);
<font color="#2e8b57"><b>void</b></font> inputBind(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable, <font color="#2e8b57"><b>int64_t</b></font> value);
<font color="#2e8b57"><b>void</b></font> inputBind(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable, <font color="#2e8b57"><b>double</b></font> value,
<font color="#2e8b57"><b>uint32_t</b></font> precision,
<font color="#2e8b57"><b>uint32_t</b></font> scale);
<font color="#2e8b57"><b>void</b></font> inputBindBlob(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value,
<font color="#2e8b57"><b>uint32_t</b></font> size);
<font color="#2e8b57"><b>void</b></font> inputBindClob(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value,
<font color="#2e8b57"><b>uint32_t</b></font> size);
<font color="#0000ff">// Define an input bind variable.</font>
<font color="#2e8b57"><b>void</b></font> defineOutputBind(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable,
<font color="#2e8b57"><b>uint32_t</b></font> bufferlength);
<font color="#0000ff">// Define an output bind variable.</font>
<font color="#0000ff">// "bufferlength" bytes will be reserved</font>
<font color="#0000ff">// to store the value.</font>
<font color="#2e8b57"><b>void</b></font> defineOutputBindBlob(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable);
<font color="#0000ff">// Define a BLOB output bind variable.</font>
<font color="#2e8b57"><b>void</b></font> defineOutputBindClob(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable);
<font color="#0000ff">// Define a CLOB output bind variable.</font>
<font color="#2e8b57"><b>void</b></font> defineOutputBindCursor(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable);
<font color="#0000ff">// Define a cursor output bind variable.</font>
<font color="#2e8b57"><b>void</b></font> substitutions(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **variables,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **values);
<font color="#2e8b57"><b>void</b></font> substitutions(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **variables,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>int64_t</b></font> *values);
<font color="#2e8b57"><b>void</b></font> substitutions(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **variables,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>double</b></font> *values,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>uint32_t</b></font> *precisions,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>uint32_t</b></font> *scales);
<font color="#0000ff">// Define an array of substitution variables.</font>
<font color="#2e8b57"><b>void</b></font> inputBinds(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **variables, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **values);
<font color="#2e8b57"><b>void</b></font> inputBinds(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **variables,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>int64_t</b></font> *values);
<font color="#2e8b57"><b>void</b></font> inputBinds(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **variables,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>double</b></font> *values,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>uint32_t</b></font> *precisions,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>uint32_t</b></font> *scales);
<font color="#0000ff">// Define an array of input bind variables.</font>
<font color="#2e8b57"><b>void</b></font> validateBinds();
<font color="#0000ff">// If you are binding to any variables that </font>
<font color="#0000ff">// might not actually be in your query, call </font>
<font color="#0000ff">// this to ensure that the database won't try </font>
<font color="#0000ff">// to bind them unless they really are in the </font>
<font color="#0000ff">// query. There is a performance penalty for</font>
<font color="#0000ff">// calling this method.</font>
<font color="#2e8b57"><b>bool</b></font> executeQuery();
<font color="#0000ff">// Execute the query that was previously </font>
<font color="#0000ff">// prepared and bound.</font>
<font color="#2e8b57"><b>bool</b></font> fetchFromBindCursor();
<font color="#0000ff">// Fetch from a cursor that was returned as</font>
<font color="#0000ff">// an output bind variable.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getOutputBind(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable);
<font color="#0000ff">// Get the value stored in a previously</font>
<font color="#0000ff">// defined output bind variable.</font>
<font color="#2e8b57"><b>int64_t</b></font> getOutputBindAsInteger(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable);
<font color="#0000ff">// Get the value stored in a previously</font>
<font color="#0000ff">// defined output bind variable as a long</font>
<font color="#0000ff">// integer.</font>
<font color="#2e8b57"><b>double</b></font> getOutputBindAsDouble(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable);
<font color="#0000ff">// Get the value stored in a previously</font>
<font color="#0000ff">// defined output bind variable as a double</font>
<font color="#0000ff">// precision floating point number.</font>
<font color="#2e8b57"><b>uint32_t</b></font> getOutputBindLength(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable);
<font color="#0000ff">// Get the length of the value stored in a</font>
<font color="#0000ff">// previously defined output bind variable.</font>
sqlrcursor *getOutputBindCursor(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *variable);
<font color="#0000ff">// Get the cursor associated with a previously</font>
<font color="#0000ff">// defined output bind variable.</font>
<font color="#2e8b57"><b>bool</b></font> openCachedResultSet(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *filename);
<font color="#0000ff">// Opens a cached result set.</font>
<font color="#0000ff">// Returns true on success and false on failure.</font>
<font color="#2e8b57"><b>uint32_t</b></font> colCount();
<font color="#0000ff">// Returns the number of columns in the current</font>
<font color="#0000ff">// result set.</font>
<font color="#2e8b57"><b>uint64_t</b></font> rowCount();
<font color="#0000ff">// Returns the number of rows in the current </font>
<font color="#0000ff">// result set (if the result set is being</font>
<font color="#0000ff">// stepped through, this returns the number</font>
<font color="#0000ff">// of rows processed so far).</font>
<font color="#2e8b57"><b>uint64_t</b></font> totalRows();
<font color="#0000ff">// Returns the total number of rows that will </font>
<font color="#0000ff">// be returned in the result set. Not all </font>
<font color="#0000ff">// databases support this call. Don't use it </font>
<font color="#0000ff">// for applications which are designed to be </font>
<font color="#0000ff">// portable across databases. 0 is returned</font>
<font color="#0000ff">// by databases which don't support this option.</font>
<font color="#2e8b57"><b>uint64_t</b></font> affectedRows();
<font color="#0000ff">// Returns the number of rows that were </font>
<font color="#0000ff">// updated, inserted or deleted by the query.</font>
<font color="#0000ff">// Not all databases support this call. Don't </font>
<font color="#0000ff">// use it for applications which are designed </font>
<font color="#0000ff">// to be portable across databases. 0 is </font>
<font color="#0000ff">// returned by databases which don't support </font>
<font color="#0000ff">// this option.</font>
<font color="#2e8b57"><b>uint64_t</b></font> firstRowIndex();
<font color="#0000ff">// Returns the index of the first buffered row.</font>
<font color="#0000ff">// This is useful when buffering only part of</font>
<font color="#0000ff">// the result set at a time.</font>
<font color="#2e8b57"><b>bool</b></font> endOfResultSet();
<font color="#0000ff">// Returns false if part of the result set is</font>
<font color="#0000ff">// still pending on the server and true if not.</font>
<font color="#0000ff">// This method can only return false if </font>
<font color="#0000ff">// setResultSetBufferSize() has been called</font>
<font color="#0000ff">// with a parameter other than 0.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *errorMessage();
<font color="#0000ff">// If a query failed and generated an error, </font>
<font color="#0000ff">// the error message is available here. If </font>
<font color="#0000ff">// the query succeeded then this method </font>
<font color="#0000ff">// returns a NULL.</font>
<font color="#2e8b57"><b>void</b></font> getNullsAsEmptyStrings();
<font color="#0000ff">// Tells the connection to return NULL fields</font>
<font color="#0000ff">// and output bind variables as empty strings. </font>
<font color="#0000ff">// This is the default.</font>
<font color="#2e8b57"><b>void</b></font> getNullsAsNulls();
<font color="#0000ff">// Tells the connection to return NULL fields</font>
<font color="#0000ff">// and output bind variables as NULL's rather</font>
<font color="#0000ff">// than as empty strings.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getField(<font color="#2e8b57"><b>uint64_t</b></font> row, <font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getField(<font color="#2e8b57"><b>uint64_t</b></font> row, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns a pointer to the value of the </font>
<font color="#0000ff">// specified row and column.</font>
<font color="#2e8b57"><b>int64_t</b></font> getFieldAsInteger(<font color="#2e8b57"><b>uint64_t</b></font> row, <font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>int64_t</b></font> getFieldAsInteger(<font color="#2e8b57"><b>uint64_t</b></font> row, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns the specified field as a long</font>
<font color="#0000ff">// integer.</font>
<font color="#2e8b57"><b>double</b></font> getFieldAsDouble(<font color="#2e8b57"><b>uint64_t</b></font> row, <font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>double</b></font> getFieldAsDouble(<font color="#2e8b57"><b>uint64_t</b></font> row, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns the specified field as a double</font>
<font color="#0000ff">// precision floating point number.</font>
<font color="#2e8b57"><b>uint32_t</b></font> getFieldLength(<font color="#2e8b57"><b>uint64_t</b></font> row, <font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>uint32_t</b></font> getFieldLength(<font color="#2e8b57"><b>uint64_t</b></font> row, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns the length of the </font>
<font color="#0000ff">// specified row and column.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> * <font color="#2e8b57"><b>const</b></font> *getRow(<font color="#2e8b57"><b>uint64_t</b></font> row);
<font color="#0000ff">// Returns a null terminated array of the </font>
<font color="#0000ff">// values of the fields in the specified row.</font>
<font color="#2e8b57"><b>uint32_t</b></font> *getRowLengths(<font color="#2e8b57"><b>uint64_t</b></font> row);
<font color="#0000ff">// Returns a null terminated array of the </font>
<font color="#0000ff">// lengths of the fields in the specified row.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> * <font color="#2e8b57"><b>const</b></font> *getColumnNames();
<font color="#0000ff">// Returns a null terminated array of the </font>
<font color="#0000ff">// column names of the current result set.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getColumnName(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#0000ff">// Returns the name of the specified column.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getColumnType(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getColumnType(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns the type of the specified column.</font>
<font color="#2e8b57"><b>uint32_t</b></font> getColumnLength(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>uint32_t</b></font> getColumnLength(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns the number of bytes required on</font>
<font color="#0000ff">// the server to store the data.</font>
<font color="#2e8b57"><b>uint32_t</b></font> getColumnPrecision(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>uint32_t</b></font> getColumnPrecision(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns the precision of the specified</font>
<font color="#0000ff">// column.</font>
<font color="#0000ff">// Precision is the total number of digits in</font>
<font color="#0000ff">// a number. eg: 123.45 has a precision of 5.</font>
<font color="#0000ff">// For non-numeric types, it's the number of</font>
<font color="#0000ff">// characters in the string.</font>
<font color="#2e8b57"><b>uint32_t</b></font> getColumnScale(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>uint32_t</b></font> getColumnScale(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns the scale of the specified column.</font>
<font color="#0000ff">// Scale is the total number of digits to the</font>
<font color="#0000ff">// right of the decimal point in a number.</font>
<font color="#0000ff">// eg: 123.45 has a scale of 2.</font>
<font color="#2e8b57"><b>bool</b></font> getColumnIsNullable(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>bool</b></font> getColumnIsNullable(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns 1 if the specified column can</font>
<font color="#0000ff">// contain nulls and 0 otherwise.</font>
<font color="#2e8b57"><b>bool</b></font> getColumnIsPrimaryKey(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>bool</b></font> getColumnIsPrimaryKey(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns 1 if the specified column is a</font>
<font color="#0000ff">// primary key and 0 otherwise.</font>
<font color="#2e8b57"><b>bool</b></font> getColumnIsUnique(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>bool</b></font> getColumnIsUnique(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns 1 if the specified column is</font>
<font color="#0000ff">// unique and 0 otherwise.</font>
<font color="#2e8b57"><b>bool</b></font> getColumnIsPartOfKey(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>bool</b></font> getColumnIsPartOfKey(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns 1 if the specified column is</font>
<font color="#0000ff">// part of a composite key and 0 otherwise.</font>
<font color="#2e8b57"><b>bool</b></font> getColumnIsUnsigned(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>bool</b></font> getColumnIsUnsigned(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns 1 if the specified column is</font>
<font color="#0000ff">// an unsigned number and 0 otherwise.</font>
<font color="#2e8b57"><b>bool</b></font> getColumnIsZeroFilled(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>bool</b></font> getColumnIsZeroFilled(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns 1 if the specified column was</font>
<font color="#0000ff">// created with the zero-fill flag and 0</font>
<font color="#0000ff">// otherwise.</font>
<font color="#2e8b57"><b>bool</b></font> getColumnIsBinary(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>bool</b></font> getColumnIsBinary(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns 1 if the specified column</font>
<font color="#0000ff">// contains binary data and 0</font>
<font color="#0000ff">// otherwise.</font>
<font color="#2e8b57"><b>bool</b></font> getColumnIsAutoIncrement(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>bool</b></font> getColumnIsAutoIncrement(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns 1 if the specified column</font>
<font color="#0000ff">// auto-increments and 0 otherwise.</font>
<font color="#2e8b57"><b>uint32_t</b></font> getLongest(<font color="#2e8b57"><b>uint32_t</b></font> col);
<font color="#2e8b57"><b>uint32_t</b></font> getLongest(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *col);
<font color="#0000ff">// Returns the length of the longest field</font>
<font color="#0000ff">// in the specified column.</font>
<font color="#2e8b57"><b>void</b></font> suspendResultSet();
<font color="#0000ff">// Tells the server to leave this result</font>
<font color="#0000ff">// set open when the connection calls </font>
<font color="#0000ff">// suspendSession() so that another connection </font>
<font color="#0000ff">// can connect to it using resumeResultSet() </font>
<font color="#0000ff">// after it calls resumeSession().</font>
<font color="#2e8b57"><b>uint16_t</b></font> getResultSetId();
<font color="#0000ff">// Returns the internal ID of this result set.</font>
<font color="#0000ff">// This parameter may be passed to another </font>
<font color="#0000ff">// cursor for use in the resumeResultSet() </font>
<font color="#0000ff">// method.</font>
<font color="#0000ff">// Note: The value this method returns is only</font>
<font color="#0000ff">// valid after a call to suspendResultSet().</font>
<font color="#2e8b57"><b>bool</b></font> resumeResultSet(<font color="#2e8b57"><b>uint16_t</b></font> id);
<font color="#0000ff">// Resumes a result set previously left open </font>
<font color="#0000ff">// using suspendSession().</font>
<font color="#0000ff">// Returns true on success and false on failure.</font>
<font color="#2e8b57"><b>bool</b></font> resumeCachedResultSet(<font color="#2e8b57"><b>uint16_t</b></font> id,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *filename);
<font color="#0000ff">// Resumes a result set previously left open</font>
<font color="#0000ff">// using suspendSession() and continues caching</font>
<font color="#0000ff">// the result set to "filename".</font>
<font color="#0000ff">// Returns true on success and false on failure.</font>
<font color="#a020f0"> #include </font><font color="#ff00ff"><sqlrelay/private/sqlrcursor.h></font>
};
<font color="#a020f0">#endif</font>
</pre>
</body>
</html>
|