SQL Relay C++ API: /home/dmuse/src/sqlrelay/src/api/c++/sqlrelay/sqlrclient.h Source File

SQL Relay C++ API

- Main Page
- Classes

sqlrclient.h
1 // Copyright (c) 1999-2001 David Muse
2 // See the file COPYING for more information.
3
4 #ifndef SQLRCLIENT_H
5 #define SQLRCLIENT_H
6
7 #include <sqlrelay/private/sqlrclientincludes.h>
8
9 class SQLRCLIENT_DLLSPEC sqlrconnection {
10 public:
26 sqlrconnection(const char *server, uint16_t port,
27 const char *socket,
28 const char *user, const char *password,
29 int32_t retrytime, int32_t tries);
30
31
34 ~sqlrconnection();
35
36
37
42 void setConnectTimeout(int32_t timeoutsec,
43 int32_t timeoutusec);
44
49 void setAuthenticationTimeout(int32_t timeoutsec,
50 int32_t timeoutusec);
51
57 void setResponseTimeout(int32_t timeoutsec,
58 int32_t timeoutusec);
59
60
61
97 void enableKerberos(const char *service,
98 const char *mech,
99 const char *flags);
100
170 void enableTls(const char *version,
171 const char *cert,
172 const char *password,
173 const char *ciphers,
174 const char *validate,
175 const char *ca,
176 uint16_t depth);
177
179 void disableEncryption();
180
181
182
184 void endSession();
185
190 bool suspendSession();
191
198 uint16_t getConnectionPort();
199
206 const char *getConnectionSocket();
207
211 bool resumeSession(uint16_t port, const char *socket);
212
213
214
217 bool ping();
218
221 const char *identify();
222
224 const char *dbVersion();
225
227 const char *dbHostName();
228
230 const char *dbIpAddress();
231
233 const char *serverVersion();
234
236 const char *clientVersion();
237
240 const char *bindFormat();
241
242
243
245 bool selectDatabase(const char *database);
246
248 const char *getCurrentDatabase();
249
250
251
254 uint64_t getLastInsertId();
255
256
257
260 bool autoCommitOn();
261
264 bool autoCommitOff();
265
266
273 bool begin();
274
277 bool commit();
278
281 bool rollback();
282
283
284
289 const char *errorMessage();
290
295 int64_t errorNumber();
296
297
298
304 void debugOn();
305
307 void debugOff();
308
311 bool getDebug();
312
313
314
319 void debugPrintFunction(int (*printfunction)
320 (const char *,...));
321
325 void setDebugFile(const char *filename);
326
327
332 void setClientInfo(const char *clientinfo);
333
335 const char *getClientInfo() const;
336
337 #include <sqlrelay/private/sqlrconnection.h>
338 };
339
340
341 class SQLRCLIENT_DLLSPEC sqlrcursor {
342 public:
345 sqlrcursor(sqlrconnection *sqlrc);
346
349 ~sqlrcursor();
350
351
352
356 void setResultSetBufferSize(uint64_t rows);
357
361 uint64_t getResultSetBufferSize();
362
363
364
369 void dontGetColumnInfo();
370
372 void getColumnInfo();
373
374
378 void mixedCaseColumnNames();
379
381 void upperCaseColumnNames();
382
384 void lowerCaseColumnNames();
385
386
387
400 void cacheToFile(const char *filename);
401
407 void setCacheTtl(uint32_t ttl);
408
411 const char *getCacheFileName();
412
414 void cacheOff();
415
416
417
422 bool getDatabaseList(const char *wild);
423
427 bool getTableList(const char *wild);
428
433 bool getColumnList(const char *table, const char *wild);
434
435
436
438 bool sendQuery(const char *query);
439
443 bool sendQuery(const char *query, uint32_t length);
444
447 bool sendFileQuery(const char *path, const char *filename);
448
449
450
452 void prepareQuery(const char *query);
453
457 void prepareQuery(const char *query, uint32_t length);
458
462 bool prepareFileQuery(const char *path,
463 const char *filename);
464
465
466
468 void substitution(const char *variable, const char *value);
469
471 void substitution(const char *variable, int64_t value);
472
474 void substitution(const char *variable, double value,
475 uint32_t precision,
476 uint32_t scale);
477
479 void substitutions(const char **variables,
480 const char **values);
481
483 void substitutions(const char **variables,
484 const int64_t *values);
485
487 void substitutions(const char **variables,
488 const double *values,
489 const uint32_t *precisions,
490 const uint32_t *scales);
491
492
493
495 void inputBind(const char *variable, const char *value);
496
498 void inputBind(const char *variable, const char *value,
499 uint32_t valuelength);
500
502 void inputBind(const char *variable, int64_t value);
503
509 void inputBind(const char *variable, double value,
510 uint32_t precision,
511 uint32_t scale);
512
516 void inputBind(const char *variable,
517 int16_t year, int16_t month, int16_t day,
518 int16_t hour, int16_t minute, int16_t second,
519 int32_t microsecond, const char *tz);
520
522 void inputBindBlob(const char *variable,
523 const char *value,
524 uint32_t size);
525
527 void inputBindClob(const char *variable,
528 const char *value,
529 uint32_t size);
530
532 void inputBinds(const char **variables, const char **values);
533
535 void inputBinds(const char **variables,
536 const int64_t *values);
537
539 void inputBinds(const char **variables,
540 const double *values,
541 const uint32_t *precisions,
542 const uint32_t *scales);
543
544
545
549 void defineOutputBindString(const char *variable,
550 uint32_t bufferlength);
551
553 void defineOutputBindInteger(const char *variable);
554
556 void defineOutputBindDouble(const char *variable);
557
559 void defineOutputBindDate(const char *variable);
560
562 void defineOutputBindBlob(const char *variable);
563
565 void defineOutputBindClob(const char *variable);
566
568 void defineOutputBindCursor(const char *variable);
569
570
571
573 void clearBinds();
574
578 uint16_t countBindVariables() const;
579
586 void validateBinds();
587
590 bool validBind(const char *variable);
591
592
593
596 bool executeQuery();
597
600 bool fetchFromBindCursor();
601
602
603
606 const char *getOutputBindString(const char *variable);
607
610 int64_t getOutputBindInteger(const char *variable);
611
614 double getOutputBindDouble(const char *variable);
615
618 bool getOutputBindDate(const char *variable,
619 int16_t *year,
620 int16_t *month,
621 int16_t *day,
622 int16_t *hour,
623 int16_t *minute,
624 int16_t *second,
625 int32_t *microsecond,
626 const char **tz);
627
630 const char *getOutputBindBlob(const char *variable);
631
634 const char *getOutputBindClob(const char *variable);
635
638 uint32_t getOutputBindLength(const char *variable);
639
642 sqlrcursor *getOutputBindCursor(const char *variable);
643
644
645
648 bool openCachedResultSet(const char *filename);
649
650
651
654 uint32_t colCount();
655
660 uint64_t rowCount();
661
668 uint64_t totalRows();
669
677 uint64_t affectedRows();
678
682 uint64_t firstRowIndex();
683
689 bool endOfResultSet();
690
691
692
697 const char *errorMessage();
698
703 int64_t errorNumber();
704
705
706
710 void getNullsAsEmptyStrings();
711
715 void getNullsAsNulls();
716
717
718
720 const char *getField(uint64_t row, uint32_t col);
721
723 const char *getField(uint64_t row, const char *col);
724
726 int64_t getFieldAsInteger(uint64_t row, uint32_t col);
727
729 int64_t getFieldAsInteger(uint64_t row, const char *col);
730
732 double getFieldAsDouble(uint64_t row, uint32_t col);
733
735 double getFieldAsDouble(uint64_t row, const char *col);
736
737
738
740 uint32_t getFieldLength(uint64_t row, uint32_t col);
741
743 uint32_t getFieldLength(uint64_t row, const char *col);
744
745
746
749 const char * const *getRow(uint64_t row);
750
753 uint32_t *getRowLengths(uint64_t row);
754
757 const char * const *getColumnNames();
758
760 const char *getColumnName(uint32_t col);
761
763 const char *getColumnType(uint32_t col);
764
766 const char *getColumnType(const char *col);
767
770 uint32_t getColumnLength(uint32_t col);
771
774 uint32_t getColumnLength(const char *col);
775
782 uint32_t getColumnPrecision(uint32_t col);
783
790 uint32_t getColumnPrecision(const char *col);
791
796 uint32_t getColumnScale(uint32_t col);
797
802 uint32_t getColumnScale(const char *col);
803
806 bool getColumnIsNullable(uint32_t col);
807
810 bool getColumnIsNullable(const char *col);
811
814 bool getColumnIsPrimaryKey(uint32_t col);
815
818 bool getColumnIsPrimaryKey(const char *col);
819
822 bool getColumnIsUnique(uint32_t col);
823
826 bool getColumnIsUnique(const char *col);
827
830 bool getColumnIsPartOfKey(uint32_t col);
831
834 bool getColumnIsPartOfKey(const char *col);
835
838 bool getColumnIsUnsigned(uint32_t col);
839
842 bool getColumnIsUnsigned(const char *col);
843
847 bool getColumnIsZeroFilled(uint32_t col);
848
852 bool getColumnIsZeroFilled(const char *col);
853
857 bool getColumnIsBinary(uint32_t col);
858
862 bool getColumnIsBinary(const char *col);
863
866 bool getColumnIsAutoIncrement(uint32_t col);
867
870 bool getColumnIsAutoIncrement(const char *col);
871
874 uint32_t getLongest(uint32_t col);
875
878 uint32_t getLongest(const char *col);
879
880
881
887 void suspendResultSet();
888
895 uint16_t getResultSetId();
896
900 bool resumeResultSet(uint16_t id);
901
906 bool resumeCachedResultSet(uint16_t id,
907 const char *filename);
908
913 void closeResultSet();
914
915 #include <sqlrelay/private/sqlrcursor.h>
916 };
917
918 #endif
sqlrconnection
Definition: sqlrclient.h:9
sqlrcursor
Definition: sqlrclient.h:341