Qore Programming Language Reference Manual  0.9.3
QC_Datasource.dox.h
1 namespace Qore::SQL {
4 
104 
105 public:
107 
121 nothing beginTransaction();
122 
123 public:
125 
127 nothing clearEventQueue();
128 
129 public:
131 
140 nothing close();
141 
142 public:
144 
153 nothing commit();
154 
155 public:
157 
177  constructor(string driver, *string user, *string pass, *string db, *string encoding, *string host, *softint port, *hash<auto> options, *Qore::Thread::Queue queue, auto arg);
178 
179 public:
181 
196  constructor(string desc, *Qore::Thread::Queue queue, auto arg);
197 
198 public:
200 
221  constructor(hash<auto> opts, *Qore::Thread::Queue queue, auto arg);
222 
223 public:
225 
230  copy();
231 
232 public:
234 
249 
250 public:
252 
277 *hash<auto> describe(string sql, ...);
278 
279 public:
281 
288  destructor();
289 
290 public:
292 
308 auto exec(string sql, ...);
309 
310 public:
312 
330 auto execRaw(string sql);
331 
332 public:
334 
344 bool getAutoCommit();
345 
346 public:
348 
360 int getCapabilities();
361 
362 public:
364 
376 list<auto> getCapabilityList();
377 
378 public:
380 
389 auto getClientVersion();
390 
391 public:
393 
408 hash<auto> getConfigHash();
409 
410 public:
412 
427 string getConfigString();
428 
429 public:
431 
443 string getDBCharset();
444 
445 public:
447 
459 string getDBEncoding();
460 
461 public:
463 
473 *string getDBName();
474 
475 public:
477 
487 string getDriverName();
488 
489 public:
491 
501 *string getHostName();
502 
503 public:
505 
517 string getOSCharset();
518 
519 public:
521 
531 *string getOSEncoding();
532 
533 public:
535 
547 auto getOption(string opt);
548 
549 public:
551 
565 hash<auto> getOptionHash();
566 
567 public:
569 
579 *string getPassword();
580 
581 public:
583 
593 *int getPort();
594 
595 public:
597 
607 
608 public:
610 
621 auto getServerVersion();
622 
623 public:
625 
636 
637 public:
639 
649 *string getUserName();
650 
651 public:
653 
663 bool inTransaction();
664 
665 public:
667 
678 nothing open();
679 
680 public:
682 
691 nothing reset();
692 
693 public:
695 
704 nothing rollback();
705 
706 public:
708 
741 auto select(string sql, ...);
742 
743 public:
745 
766 *hash<auto> selectRow(string sql, ...);
767 
768 public:
770 
796 auto selectRows(string sql, ...);
797 
798 public:
800 
806 nothing setAutoCommit(bool ac = True);
807 
808 public:
810 
821 nothing setDBCharset(string encoding);
822 
823 public:
825 
834 nothing setDBEncoding(string encoding);
835 
836 public:
838 
847 nothing setDBName(string db);
848 
849 public:
851 
858 nothing setEventQueue(Qore::Thread::Queue queue, auto arg);
859 
860 public:
862 
871 nothing setHostName(string host);
872 
873 public:
875 
885  setOption(string opt, auto val);
886 
887 public:
889 
898 nothing setPassword(string pass);
899 
900 public:
902 
911 nothing setPort(softint port = 0);
912 
913 public:
915 
922 nothing setTransactionLockTimeout(timeout timeout_ms = 0);
923 
924 public:
926 
935 nothing setUserName(string user);
936 
937 public:
939 
956 int transactionTid();
957 
958 public:
960 
978 auto vexec(string sql, *softlist<auto> vargs);
979 
980 public:
982 
1012 auto vselect(string sql, *softlist<auto> vargs);
1013 
1014 public:
1016 
1038 *hash<auto> vselectRow(string sql, *softlist<auto> vargs);
1039 
1040 public:
1042 
1070 auto vselectRows(string sql, *softlist<auto> vargs);
1071 };
1076 
1078  const DSDB2 = "db2";
1080  const DSFreeTDS = "freetds";
1082  const DSMSSQL = "freetds";
1084  const DSMySQL = "mysql";
1086  const DSOracle = "oracle";
1088  const DSPGSQL = "pgsql";
1090  const DSSQLite3 = "sqlite3";
1092  const DSSybase = "sybase";
1094 
1098 
1120 
1138 };
This class defines an abstract interface for the SQLStatement class.
Definition: QC_AbstractSQLStatement.dox.h:9
string getConfigString()
Returns a string giving the configuration of the current object in a format that can be parsed by par...
auto select(string sql,...)
Executes an SQL select statement on the server and returns the result as a hash (column names) of lis...
constructor()
The constructor does not perform any action; this class is just used to mark a class as serializable ...
auto selectRows(string sql,...)
Executes an SQL select statement on the server and returns the result as a list (rows) of hashes (the...
const DBI_CAP_HAS_NUMBER_SUPPORT
Indicates that the DBI driver supports arbitrary-precision numeric support for binding and retrieving...
Definition: QC_Datasource.dox.h:1116
nothing setPort(softint port=0)
Sets the port number to use for the connection.
const DSFreeTDS
for the "freetds" driver
Definition: QC_Datasource.dox.h:1080
int transactionTid()
Returns the TID of the thread holding the transaction lock or -1 if it's not currently held.
nothing setDBCharset(string encoding)
Sets the database-specific character encoding name for the next connection to the server.
const DBI_CAP_AUTORECONNECT
Indicates that the DBI driver supports automatically/transparently reconnecting to the server if the ...
Definition: QC_Datasource.dox.h:1100
const DBI_CAP_HAS_EXECRAW
Indicates that the DBI driver supports the Datasource::execRaw() and DatasourcePool::execRaw() method...
Definition: QC_Datasource.dox.h:1114
*string getPassword()
Returns the password parameter as a string or NOTHING if none is set.
const DBI_CAP_HAS_STATEMENT
Indicates that the DBI driver supports the prepared statement interface (the SQLStatement class)
Definition: QC_Datasource.dox.h:1126
const DSMSSQL
another constant for the "freetds" driver
Definition: QC_Datasource.dox.h:1082
*string getOSEncoding()
Returns the Qore character encoding name for the current connection as a string or NOTHING if none is...
auto execRaw(string sql)
Grabs the transaction lock (if autocommit is disabled) and executes an SQL command on the server and ...
const DBI_CAP_LOB_SUPPORT
Indicates that the DBI driver supports LOB columns (BLOBs and CLOBs, for example)
Definition: QC_Datasource.dox.h:1128
nothing rollback()
Rolls the current transaction back and releases the transaction lock.
const True
logical True
Definition: qc_qore.dox.h:94
nothing setHostName(string host)
Sets the hostname to use for the next connection to the server.
int getCapabilities()
Returns an integer bitfield of DBI driver capabilities.
const DSPGSQL
for the "pgsql" driver
Definition: QC_Datasource.dox.h:1088
bool getAutoCommit()
Returns the autocommit status for the object.
const DBI_CAP_HAS_DESCRIBE
Indicates that the DBI driver supports the describe method.
Definition: QC_Datasource.dox.h:1112
string getDBCharset()
Retrieves the database-specific charset set encoding for the current connection.
AbstractSQLStatement getSQLStatement()
Returns an AbstractSQLStatement object based on the current database connection object.
The Serializable class can be used to mark a class as being serializable.
Definition: QC_Serializable.dox.h:90
*hash< auto > vselectRow(string sql, *softlist< auto > vargs)
Executes a select statement on the server and returns the first row as a hash (column names and value...
This class defines an abstract interface for database access, inherited by both the Datasource and Da...
Definition: QC_AbstractDatasource.dox.h:8
*int getPort()
Gets the port number that will be used for the next connection to the server.
const DSSQLite3
for the "sqlite3" driver
Definition: QC_Datasource.dox.h:1090
const DBI_CAP_HAS_OPTION_SUPPORT
Indicates that the DBI driver supports the new driver option API.
Definition: QC_Datasource.dox.h:1118
*string getHostName()
Returns the hostname parameter as a string or NOTHING if none is set.
auto vselect(string sql, *softlist< auto > vargs)
Executes a select statement on the server and returns the results in a hash (column names) of lists (...
nothing beginTransaction()
Manually grabs the transaction lock.
auto exec(string sql,...)
Grabs the transaction lock (if autocommit is disabled) and executes an SQL command on the server and ...
nothing clearEventQueue()
Clears the queue object for DBI events on the datasource.
const DBI_CAP_BIND_BY_VALUE
Indicates that the DBI driver supports directly binding qore values into queries using the %v placeho...
Definition: QC_Datasource.dox.h:1104
*hash< auto > describe(string sql,...)
Executes an SQL select statement on the server and returns a description of the result set as a hash.
const DBI_CAP_TIME_ZONE_SUPPORT
Indicates that the DBI driver supports time zones in times.
Definition: QC_Datasource.dox.h:1134
const DSSybase
for the "sybase" driver
Definition: QC_Datasource.dox.h:1092
hash< auto > getOptionHash()
returns the valid options for the driver associated with the Datasource with descriptions and current...
const DBI_CAP_HAS_RESULTSET_OUTPUT
Indicates that the DBI driver supports result set output binding with a SQLStatement output variable.
Definition: QC_Datasource.dox.h:1122
auto vselectRows(string sql, *softlist< auto > vargs)
Executes a select statement on the server and returns the results in a list (rows) of hashes (column ...
nothing setPassword(string pass)
Sets the password parameter for the time a connection to the server is established.
setOption(string opt, auto val)
sets an option for the datasource
bool currentThreadInTransaction()
Returns True if the current thread is in a transaction (i.e. holds the transaction lock),...
auto vexec(string sql, *softlist< auto > vargs)
Grabs the transaction lock (if autocommit is disabled) and executes SQL code on the DB connection,...
nothing open()
Opens a connection to the datasouce, using the connection parameters already set; an exception is thr...
nothing setEventQueue(Qore::Thread::Queue queue, auto arg)
Sets a queue object for DBI events on the datasource.
const DBI_CAP_BIND_BY_PLACEHOLDER
Indicates that the DBI driver supports binding placeholder buffers when executing SQL to retrieve dat...
Definition: QC_Datasource.dox.h:1102
nothing reset()
Closes and reopens the Datasource.
nothing setDBEncoding(string encoding)
Sets the database-specific character encoding name for the next connection to the server.
nothing close()
Closes the connection to the database; if any actions are in progress on the database,...
list< auto > getCapabilityList()
Returns a list of strings giving the capabilities of the current DBI driver.
const DBI_CAP_STORED_PROCEDURES
Indicates that the DBI driver supports stored procedure execution.
Definition: QC_Datasource.dox.h:1132
auto getClientVersion()
Retrieves the driver-specific client library version information; this method may not be implemented ...
*hash< auto > selectRow(string sql,...)
Executes an SQL select statement on the server and returns the first row as a hash (the column values...
string getOSCharset()
Returns the Qore character encoding name for the current connection as a string or "(unknown)" if non...
nothing setAutoCommit(bool ac=True)
Turns autocommit on or off for this object.
nothing commit()
Commits the current transaction and releases the transaction lock.
const DSDB2
for the "db2" driver
Definition: QC_Datasource.dox.h:1078
Queue objects provide a blocking, thread-safe message-passing object to Qore programs
Definition: QC_Queue.dox.h:15
auto getServerVersion()
Returns the driver-specific server version data for the current connection.
const DBI_CAP_TRANSACTION_MANAGEMENT
Indicates that the DBI driver supports transaction management.
Definition: QC_Datasource.dox.h:1136
destructor()
Closes the datasource if it's open (if any operations are in progress, will block until the operation...
const DBI_CAP_HAS_ARRAY_BIND
Indicates that the DBI driver supports binding arrays by value for bulk DML operations.
Definition: QC_Datasource.dox.h:1110
bool inTransaction()
Returns True if a transaction is currently in progress, False if not.
const DBI_CAP_SERVER_TIME_ZONE
Indicates that the DBI driver supports automatically converting date/time values to the server's pres...
Definition: QC_Datasource.dox.h:1130
nothing setTransactionLockTimeout(timeout timeout_ms=0)
Sets the transaction lock timeout value in milliseconds; set to 0 for no timeout.
*string getDBName()
Returns the database name parameter as a string or NOTHING if none is set.
nothing setDBName(string db)
Sets the database name parameter for the time a connection to the server is established.
int getTransactionLockTimeout()
Retrieves the transaction lock timeout value as an integer in milliseconds.
*string getUserName()
Returns the username parameter as a string or NOTHING if none is set.
hash< auto > getConfigHash()
Returns a datasource hash describing the configuration of the current object.
nothing setUserName(string user)
Sets the username parameter for the time a connection to the server is established.
const DSMySQL
for the "mysql" driver
Definition: QC_Datasource.dox.h:1084
const DBI_CAP_HAS_SELECT_ROW
Indicates that the DBI driver supports a native selectRow() method implementation.
Definition: QC_Datasource.dox.h:1124
const DBI_CAP_CHARSET_SUPPORT
Indicates that the DBI driver supports proper character encoding conversions.
Definition: QC_Datasource.dox.h:1106
This class provides the Qore interface to databases.
Definition: QC_Datasource.dox.h:103
string getDBEncoding()
Retrieves the database-specific charset set encoding for the current connection.
const DBI_CAP_EVENTS
Indicates that the DBI driver supports the event API.
Definition: QC_Datasource.dox.h:1108
copy()
Creates a new Datasource object with the same driver as the original and copies of all the connection...
const DSOracle
for the "oracle" driver
Definition: QC_Datasource.dox.h:1086
string getDriverName()
Returns the name of the driver used for the object.
auto getOption(string opt)
Returns the current value for the given option.