SQL Relay C++ API
sqlrclient.h
1// Copyright (c) 1999-2018 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
9class SQLRCLIENT_DLLSPEC sqlrconnection : public object {
10 public:
28 sqlrconnection(const char *server, uint16_t port,
29 const char *socket,
30 const char *user, const char *password,
31 int32_t retrytime, int32_t tries);
32
33
37
38
39
44 void setConnectTimeout(int32_t timeoutsec,
45 int32_t timeoutusec);
46
52 void setResponseTimeout(int32_t timeoutsec,
53 int32_t timeoutusec);
54
57 void getConnectTimeout(int32_t *timeoutsec,
58 int32_t *timeoutusec);
59
62 void getResponseTimeout(int32_t *timeoutsec,
63 int32_t *timeoutusec);
64
65
66
70 void setBindVariableDelimiters(const char *delimiters);
71
75
79
83
87
88
89
125 void enableKerberos(const char *service,
126 const char *mech,
127 const char *flags);
128
198 void enableTls(const char *version,
199 const char *cert,
200 const char *password,
201 const char *ciphers,
202 const char *validate,
203 const char *ca,
204 uint16_t depth);
205
208
209
210
213
219
227
234 const char *getConnectionSocket();
235
239 bool resumeSession(uint16_t port, const char *socket);
240
241
242
245 bool ping();
246
249 const char *identify();
250
252 const char *dbVersion();
253
255 const char *dbHostName();
256
258 const char *dbIpAddress();
259
261 const char *serverVersion();
262
264 const char *clientVersion();
265
277 const char *bindFormat();
278
290 const char *nextvalFormat();
291
292
293
295 bool selectDatabase(const char *database);
296
298 const char *getCurrentDatabase();
299
300
301
304 uint64_t getLastInsertId();
305
306
307
311
315
316
323 bool begin();
324
327 bool commit();
328
331 bool rollback();
332
333
334
339 const char *errorMessage();
340
345 int64_t errorNumber();
346
347
348
354 void debugOn();
355
357 void debugOff();
358
361 bool getDebug();
362
363
364
369 void debugPrintFunction(int (*printfunction)
370 (const char *,...));
371
375 void setDebugFile(const char *filename);
376
377
382 void setClientInfo(const char *clientinfo);
383
385 const char *getClientInfo();
386
387 #include <sqlrelay/private/sqlrconnection.h>
388};
389
390
391class SQLRCLIENT_DLLSPEC sqlrcursor : public object {
392 public:
396
400
401
402
406 void setResultSetBufferSize(uint64_t rows);
407
412
413
414
420
423
424
429
432
435
436
437
450 void cacheToFile(const char *filename);
451
457 void setCacheTtl(uint32_t ttl);
458
461 const char *getCacheFileName();
462
464 void cacheOff();
465
466
467
472 bool getDatabaseList(const char *wild);
473
477 bool getTableList(const char *wild);
478
483 bool getColumnList(const char *table, const char *wild);
484
485
486
488 bool sendQuery(const char *query);
489
493 bool sendQuery(const char *query, uint32_t length);
494
497 bool sendFileQuery(const char *path, const char *filename);
498
499
500
502 void prepareQuery(const char *query);
503
507 void prepareQuery(const char *query, uint32_t length);
508
512 bool prepareFileQuery(const char *path,
513 const char *filename);
514
515
516
518 void substitution(const char *variable, const char *value);
519
521 void substitution(const char *variable, int64_t value);
522
524 void substitution(const char *variable, double value,
525 uint32_t precision,
526 uint32_t scale);
527
529 void substitutions(const char **variables,
530 const char **values);
531
533 void substitutions(const char **variables,
534 const int64_t *values);
535
537 void substitutions(const char **variables,
538 const double *values,
539 const uint32_t *precisions,
540 const uint32_t *scales);
541
542
543
545 void inputBind(const char *variable, const char *value);
546
548 void inputBind(const char *variable, const char *value,
549 uint32_t valuelength);
550
552 void inputBind(const char *variable, int64_t value);
553
559 void inputBind(const char *variable, double value,
560 uint32_t precision,
561 uint32_t scale);
562
585 void inputBind(const char *variable,
586 int16_t year, int16_t month, int16_t day,
587 int16_t hour, int16_t minute, int16_t second,
588 int32_t microsecond, const char *tz,
589 bool isnegative);
590
592 void inputBindBlob(const char *variable,
593 const char *value,
594 uint32_t size);
595
597 void inputBindClob(const char *variable,
598 const char *value,
599 uint32_t size);
600
602 void inputBinds(const char **variables, const char **values);
603
605 void inputBinds(const char **variables,
606 const int64_t *values);
607
609 void inputBinds(const char **variables,
610 const double *values,
611 const uint32_t *precisions,
612 const uint32_t *scales);
613
614
615
619 void defineOutputBindString(const char *variable,
620 uint32_t bufferlength);
621
623 void defineOutputBindInteger(const char *variable);
624
626 void defineOutputBindDouble(const char *variable);
627
629 void defineOutputBindDate(const char *variable);
630
632 void defineOutputBindBlob(const char *variable);
633
635 void defineOutputBindClob(const char *variable);
636
638 void defineOutputBindCursor(const char *variable);
639
640
641
644
649
657
660 bool validBind(const char *variable);
661
662
663
667
671
672
673
676 const char *getOutputBindString(const char *variable);
677
680 int64_t getOutputBindInteger(const char *variable);
681
684 double getOutputBindDouble(const char *variable);
685
688 bool getOutputBindDate(const char *variable,
689 int16_t *year,
690 int16_t *month,
691 int16_t *day,
692 int16_t *hour,
693 int16_t *minute,
694 int16_t *second,
695 int32_t *microsecond,
696 const char **tz,
697 bool *isnegative);
698
701 const char *getOutputBindBlob(const char *variable);
702
705 const char *getOutputBindClob(const char *variable);
706
709 uint32_t getOutputBindLength(const char *variable);
710
713 sqlrcursor *getOutputBindCursor(const char *variable);
714
715
716
719 bool openCachedResultSet(const char *filename);
720
721
722
725 uint32_t colCount();
726
731 uint64_t rowCount();
732
739 uint64_t totalRows();
740
748 uint64_t affectedRows();
749
753 uint64_t firstRowIndex();
754
761
762
763
768 const char *errorMessage();
769
774 int64_t errorNumber();
775
776
777
782
787
788
789
791 const char *getField(uint64_t row, uint32_t col);
792
794 const char *getField(uint64_t row, const char *col);
795
797 int64_t getFieldAsInteger(uint64_t row, uint32_t col);
798
800 int64_t getFieldAsInteger(uint64_t row, const char *col);
801
803 double getFieldAsDouble(uint64_t row, uint32_t col);
804
806 double getFieldAsDouble(uint64_t row, const char *col);
807
808
809
811 uint32_t getFieldLength(uint64_t row, uint32_t col);
812
814 uint32_t getFieldLength(uint64_t row, const char *col);
815
816
817
820 const char * const *getRow(uint64_t row);
821
824 uint32_t *getRowLengths(uint64_t row);
825
828 const char * const *getColumnNames();
829
831 const char *getColumnName(uint32_t col);
832
834 const char *getColumnType(uint32_t col);
835
837 const char *getColumnType(const char *col);
838
841 uint32_t getColumnLength(uint32_t col);
842
845 uint32_t getColumnLength(const char *col);
846
853 uint32_t getColumnPrecision(uint32_t col);
854
861 uint32_t getColumnPrecision(const char *col);
862
867 uint32_t getColumnScale(uint32_t col);
868
873 uint32_t getColumnScale(const char *col);
874
877 bool getColumnIsNullable(uint32_t col);
878
881 bool getColumnIsNullable(const char *col);
882
885 bool getColumnIsPrimaryKey(uint32_t col);
886
889 bool getColumnIsPrimaryKey(const char *col);
890
893 bool getColumnIsUnique(uint32_t col);
894
897 bool getColumnIsUnique(const char *col);
898
901 bool getColumnIsPartOfKey(uint32_t col);
902
905 bool getColumnIsPartOfKey(const char *col);
906
909 bool getColumnIsUnsigned(uint32_t col);
910
913 bool getColumnIsUnsigned(const char *col);
914
918 bool getColumnIsZeroFilled(uint32_t col);
919
923 bool getColumnIsZeroFilled(const char *col);
924
928 bool getColumnIsBinary(uint32_t col);
929
933 bool getColumnIsBinary(const char *col);
934
937 bool getColumnIsAutoIncrement(uint32_t col);
938
941 bool getColumnIsAutoIncrement(const char *col);
942
945 uint32_t getLongest(uint32_t col);
946
949 uint32_t getLongest(const char *col);
950
951
952
959
966 uint16_t getResultSetId();
967
971 bool resumeResultSet(uint16_t id);
972
977 bool resumeCachedResultSet(uint16_t id,
978 const char *filename);
979
980
985
986
992
993 #include <sqlrelay/private/sqlrcursor.h>
994};
995
996#endif
Definition sqlrclient.h:9
const char * dbIpAddress()
bool autoCommitOff()
void getConnectTimeout(int32_t *timeoutsec, int32_t *timeoutusec)
const char * identify()
bool getBindVariableDelimiterDollarSignSupported()
bool autoCommitOn()
const char * bindFormat()
bool getBindVariableDelimiterColonSupported()
bool suspendSession()
void enableKerberos(const char *service, const char *mech, const char *flags)
uint64_t getLastInsertId()
const char * getCurrentDatabase()
const char * serverVersion()
void debugPrintFunction(int(*printfunction)(const char *,...))
void setDebugFile(const char *filename)
const char * dbVersion()
const char * getClientInfo()
void disableEncryption()
bool selectDatabase(const char *database)
bool getBindVariableDelimiterQuestionMarkSupported()
void enableTls(const char *version, const char *cert, const char *password, const char *ciphers, const char *validate, const char *ca, uint16_t depth)
sqlrconnection(const char *server, uint16_t port, const char *socket, const char *user, const char *password, int32_t retrytime, int32_t tries)
void setResponseTimeout(int32_t timeoutsec, int32_t timeoutusec)
void getResponseTimeout(int32_t *timeoutsec, int32_t *timeoutusec)
void setClientInfo(const char *clientinfo)
const char * errorMessage()
int64_t errorNumber()
bool resumeSession(uint16_t port, const char *socket)
const char * nextvalFormat()
uint16_t getConnectionPort()
void setConnectTimeout(int32_t timeoutsec, int32_t timeoutusec)
const char * dbHostName()
bool getBindVariableDelimiterAtSignSupported()
const char * getConnectionSocket()
const char * clientVersion()
void setBindVariableDelimiters(const char *delimiters)
Definition sqlrclient.h:391
bool fetchFromBindCursor()
const char * getColumnName(uint32_t col)
double getOutputBindDouble(const char *variable)
void upperCaseColumnNames()
const char * getCacheFileName()
void defineOutputBindClob(const char *variable)
void inputBind(const char *variable, const char *value)
const char * getField(uint64_t row, const char *col)
uint32_t getColumnPrecision(const char *col)
void substitution(const char *variable, const char *value)
void validateBinds()
void defineOutputBindDouble(const char *variable)
uint16_t countBindVariables()
void lowerCaseColumnNames()
uint32_t getColumnLength(const char *col)
uint32_t getColumnScale(const char *col)
void defineOutputBindBlob(const char *variable)
const char * getOutputBindString(const char *variable)
void suspendResultSet()
void defineOutputBindDate(const char *variable)
double getFieldAsDouble(uint64_t row, const char *col)
const char * errorMessage()
void substitutions(const char **variables, const double *values, const uint32_t *precisions, const uint32_t *scales)
void defineOutputBindCursor(const char *variable)
const char * getField(uint64_t row, uint32_t col)
const char * getOutputBindClob(const char *variable)
int64_t getFieldAsInteger(uint64_t row, uint32_t col)
void defineOutputBindString(const char *variable, uint32_t bufferlength)
uint32_t getFieldLength(uint64_t row, const char *col)
uint32_t getColumnLength(uint32_t col)
void inputBind(const char *variable, int64_t value)
uint64_t rowCount()
const char *const * getRow(uint64_t row)
uint32_t getLongest(uint32_t col)
void cacheOff()
bool getColumnIsPartOfKey(const char *col)
bool endOfResultSet()
void inputBindBlob(const char *variable, const char *value, uint32_t size)
void setCacheTtl(uint32_t ttl)
bool getColumnIsUnique(const char *col)
sqlrcursor * getOutputBindCursor(const char *variable)
bool sendQuery(const char *query)
uint64_t getResultSetBufferSize()
bool getColumnList(const char *table, const char *wild)
bool getColumnIsPrimaryKey(uint32_t col)
uint64_t totalRows()
const char * getOutputBindBlob(const char *variable)
uint32_t colCount()
const char * getColumnType(uint32_t col)
double getFieldAsDouble(uint64_t row, uint32_t col)
bool getColumnIsZeroFilled(const char *col)
void getNullsAsNulls()
bool getTableList(const char *wild)
void inputBindClob(const char *variable, const char *value, uint32_t size)
bool getDatabaseList(const char *wild)
void substitution(const char *variable, double value, uint32_t precision, uint32_t scale)
bool resumeCachedResultSet(uint16_t id, const char *filename)
bool getColumnIsPrimaryKey(const char *col)
bool getColumnIsBinary(uint32_t col)
void clearBinds()
bool getColumnIsAutoIncrement(const char *col)
uint32_t getColumnPrecision(uint32_t col)
bool nextResultSet()
uint32_t getLongest(const char *col)
void substitution(const char *variable, int64_t value)
bool getColumnIsBinary(const char *col)
void prepareQuery(const char *query, uint32_t length)
void inputBinds(const char **variables, const char **values)
uint32_t * getRowLengths(uint64_t row)
void inputBind(const char *variable, int16_t year, int16_t month, int16_t day, int16_t hour, int16_t minute, int16_t second, int32_t microsecond, const char *tz, bool isnegative)
uint16_t getResultSetId()
const char *const * getColumnNames()
void getNullsAsEmptyStrings()
void dontGetColumnInfo()
bool executeQuery()
uint64_t affectedRows()
void mixedCaseColumnNames()
bool getColumnIsZeroFilled(uint32_t col)
void getColumnInfo()
void closeResultSet()
void defineOutputBindInteger(const char *variable)
bool openCachedResultSet(const char *filename)
bool sendQuery(const char *query, uint32_t length)
bool getColumnIsNullable(uint32_t col)
bool sendFileQuery(const char *path, const char *filename)
int64_t errorNumber()
void inputBind(const char *variable, double value, uint32_t precision, uint32_t scale)
void inputBind(const char *variable, const char *value, uint32_t valuelength)
void substitutions(const char **variables, const int64_t *values)
void setResultSetBufferSize(uint64_t rows)
void prepareQuery(const char *query)
const char * getColumnType(const char *col)
uint32_t getOutputBindLength(const char *variable)
bool getColumnIsNullable(const char *col)
bool getColumnIsPartOfKey(uint32_t col)
bool resumeResultSet(uint16_t id)
void inputBinds(const char **variables, const double *values, const uint32_t *precisions, const uint32_t *scales)
bool getColumnIsUnique(uint32_t col)
void inputBinds(const char **variables, const int64_t *values)
bool prepareFileQuery(const char *path, const char *filename)
void cacheToFile(const char *filename)
sqlrcursor(sqlrconnection *sqlrc)
bool getOutputBindDate(const char *variable, int16_t *year, int16_t *month, int16_t *day, int16_t *hour, int16_t *minute, int16_t *second, int32_t *microsecond, const char **tz, bool *isnegative)
bool getColumnIsUnsigned(uint32_t col)
int64_t getFieldAsInteger(uint64_t row, const char *col)
uint32_t getFieldLength(uint64_t row, uint32_t col)
void substitutions(const char **variables, const char **values)
int64_t getOutputBindInteger(const char *variable)
bool validBind(const char *variable)
uint32_t getColumnScale(uint32_t col)
uint64_t firstRowIndex()
bool getColumnIsAutoIncrement(uint32_t col)
bool getColumnIsUnsigned(const char *col)