34 #ifndef _QORE_DATASOURCE_H    36 #define _QORE_DATASOURCE_H    38 #include <qore/QoreThreadLock.h>    39 #include <qore/QoreQueue.h>    44 class DatasourceStatementHelper;
    56     friend class QoreSQLStatement;
    57     friend hashdecl qore_ds_private;
    60     hashdecl qore_ds_private *priv; 
   101     DLLLOCAL 
Datasource(
const Datasource& old, DatasourceStatementHelper* dsh);
   202     template <
typename T>
   208     template <
typename T>
   210         return *getPrivateData<T>();
   276     DLLEXPORT 
void setAutoCommit(
bool ac);
   368     DLLEXPORT 
int close();
   441     DLLEXPORT 
bool isOpen() 
const;
   447     DLLEXPORT Datasource* 
copy() 
const;
   625 #endif // _QORE_DATASOURCE_H DLLEXPORT QoreStringNode * getPendingDBName() const
returns the pending database (or schema) name for the next connection 
 
DLLEXPORT void setPendingConnectionValues(const Datasource *other)
copies all pending connection values to another Datasource 
 
DLLEXPORT QoreHashNode * getCurrentOptionHash() const
returns the options currently set for this object 
 
DLLEXPORT QoreValue select(const QoreString *query_str, const QoreListNode *args, ExceptionSink *xsink)
executes SQL throught the "select" function of the DBI driver and returns the result, makes an implicit connection if necessary 
 
DLLEXPORT void setPendingPort(int port)
sets the port number to be used for the next connection 
 
DLLEXPORT const std::string & getDBNameStr() const
returns the database (or schema) name used for the last connection 
 
DLLEXPORT Datasource * copy() const
returns a copy of this object with the same DBIDriver and pending connection values ...
 
DLLEXPORT int getCapabilities() const
returns the capability mask of the current driver 
 
DLLEXPORT const char * getDriverName() const
returns the name of the current DBI driver 
 
defines string encoding functions in Qore 
Definition: QoreEncoding.h:83
 
DLLEXPORT QoreStringNode * getPendingHostName() const
returns the pending host name for the next connection 
 
DLLEXPORT QoreObject * getSQLStatementObjectForResultSet(void *stmt_private_data)
returns an SQLStatement object representing a result set 
 
DLLEXPORT int commit(ExceptionSink *xsink)
commits the current transaction to the database 
 
DLLEXPORT int getPendingPort() const
returns the pending port number for the next connection 
 
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
 
virtual DLLEXPORT ~Datasource()
the Datasource is closed if it's still open and the object is destroyed 
 
DLLEXPORT void setPendingUsername(const char *u)
sets the username to be used for the next connection 
 
DLLEXPORT int autoCommit(ExceptionSink *xsink)
called from subclasses when releasing the transaction lock 
 
DLLEXPORT const char * getOSEncoding() const
returns the OS (or Qore) character encoding name used for the last connection 
 
DLLEXPORT int getPort() const
returns the port number used for the last connection 
 
DLLEXPORT bool isOpen() const
returns true if the connection is currently open 
 
DLLEXPORT void freeConnectionValues()
frees all connection values 
 
DLLEXPORT QoreStringNode * getPendingUsername() const
returns the pending username for the next connection 
 
DLLEXPORT QoreValue selectRows(const QoreString *query_str, const QoreListNode *args, ExceptionSink *xsink)
executes SQL throught the "selectRows" function of the DBI driver and returns the result...
 
DLLEXPORT void setPendingHostName(const char *h)
sets the hostname to be used for the next connection 
 
DLLEXPORT QoreValue execRaw(const QoreString *query_str, const QoreListNode *args, ExceptionSink *xsink)
executes SQL throught the "execRaw" function of the DBI driver and returns the result, makes an implicit connection if necessary 
 
DLLEXPORT void reset(ExceptionSink *xsink)
closes and opens the connection 
 
DLLEXPORT void setEventQueue(Queue *q, QoreValue arg, ExceptionSink *xsink)
sets an event queue for datasource events 
 
this class provides the internal link to the database driver for Qore's DBI layer ...
Definition: DBI.h:350
 
DLLEXPORT QoreValue getClientVersion(ExceptionSink *xsink) const
executes the "get_client_version" function of the driver, if any, and returns the result ...
 
DLLEXPORT const QoreEncoding * getQoreEncoding() const
returns the QoreEncoding pointer used for this connection 
 
DLLEXPORT void connectionRecovered(ExceptionSink *xsink)
should be called be the DBI driver to signify that the connection to the server has been recovered ...
 
DLLEXPORT void setPendingDBName(const char *d)
sets the database (or schema) name to be used for the next connection 
 
DLLEXPORT const char * getDBEncoding() const
returns the database-specific character encoding name used for the last connection ...
 
DLLEXPORT QoreListNode * getCapabilityList() const
returns a QoreListNode object of all capability strings of the current driver, the caller owns the re...
 
DLLEXPORT const std::string & getHostNameStr() const
returns the host name used for the last connection 
 
DLLEXPORT const std::string & getDBEncodingStr() const
returns the database-specific character encoding name used for the last connection ...
 
Qore's string type supported by the QoreEncoding class. 
Definition: QoreString.h:81
 
Qore's string value type, reference counted, dynamically-allocated only. 
Definition: QoreStringNode.h:50
 
DLLEXPORT QoreValue exec(const QoreString *query_str, const QoreListNode *args, ExceptionSink *xsink)
executes SQL throught the "exec" function of the DBI driver and returns the result, makes an implicit connection if necessary 
 
DLLEXPORT int beginTransaction(ExceptionSink *xsink)
 
DLLEXPORT const char * getPassword() const
returns the password used for the last connection 
 
DLLEXPORT const std::string & getUsernameStr() const
returns the username used for the last connection 
 
DLLEXPORT QoreHashNode * getConfigHash() const
returns a hash representing the configuration of the current object 
 
This is the list container type in Qore, dynamically allocated only, reference counted. 
Definition: QoreListNode.h:52
 
DLLEXPORT QoreStringNode * getPendingDBEncoding() const
returns the pending database-specific character encoding name for the next connection ...
 
DLLEXPORT bool activeTransaction() const
returns true if a transaction is in progress and DB commands have been issued since the transaction w...
 
DLLEXPORT void setPendingPassword(const char *p)
sets the password to be used for the next connection 
 
DLLEXPORT void connectionAborted()
should be called by the DBIDriver if the connection to the server is lost 
 
DLLEXPORT const DBIDriver * getDriver() const
returns the DBIDriver pointer used for this object 
 
DLLEXPORT bool getAutoCommit() const
returns the autocommit status 
 
DLLEXPORT int rollback(ExceptionSink *xsink)
rolls back the current transaction to the database 
 
DLLEXPORT QoreHashNode * describe(const QoreString *query_str, const QoreListNode *args, ExceptionSink *xsink)
executes SQL that returns a result set and then returns a hash description of the result set ...
 
DLLEXPORT void setConnectionValues()
copies pending values to current values 
 
DLLEXPORT int setOption(const char *opt, const QoreValue val, ExceptionSink *xsink)
sets an option for the datasource 
 
DLLEXPORT void setQoreEncoding(const QoreEncoding *enc)
sets the QoreEncoding used for this connection 
 
DLLEXPORT QoreHashNode * getOptionHash() const
returns the valid options for this driver with descriptions and current values for the current dataso...
 
the base class for accessing databases in Qore through a Qore DBI driver 
Definition: Datasource.h:55
 
DLLEXPORT void * getPrivateData() const
returns the private DBI-specific data structure for this object 
 
DLLEXPORT const std::string & getPasswordStr() const
returns the password used for the last connection 
 
DLLEXPORT void connectionLost(ExceptionSink *xsink)
should be called be the DBI driver to signify that the connection to the server has been lost ...
 
The main value class in Qore, designed to be passed by value. 
Definition: QoreValue.h:262
 
the implementation of Qore's object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:61
 
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
 
DLLEXPORT int beginImplicitTransaction(ExceptionSink *xsink)
calls the "begin_implicit_transaction" DBI method if it exists 
 
DLLEXPORT bool wasConnectionAborted() const
returns the connection aborted status 
 
DLLEXPORT void setPendingDBEncoding(const char *c)
sets the database-specific name of the character-encoding to be used for the next connection ...
 
DLLEXPORT const QoreHashNode * getConnectOptions() const
returns the valid options for this driver with descriptions and current values for the current dataso...
 
DLLEXPORT QoreStringNode * getConfigString() const
returns a string representing the configuration of the current object 
 
DLLEXPORT const char * getUsername() const
returns the username used for the last connection 
 
DLLEXPORT QoreStringNode * getPendingPassword() const
returns the pending password for the next connection 
 
DLLLOCAL T & getPrivateDataRef() const
returns the private DBI-specific data structure for this object 
Definition: Datasource.h:209
 
DLLEXPORT QoreHashNode * selectRow(const QoreString *query_str, const QoreListNode *args, ExceptionSink *xsink)
executes SQL throught the "selectRow" function of the DBI driver and returns the result, makes an implicit connection if necessary 
 
DLLEXPORT void setTransactionStatus(bool)
sets the transaction status 
 
DLLEXPORT void setPrivateData(void *data)
sets the private DBI-specific data structure for this object 
 
DLLLOCAL Datasource(DBIDriver *driver, DatasourceStatementHelper *dsh)
creates the object; internal only 
 
DLLEXPORT int open(ExceptionSink *xsink)
opens a connection to the database 
 
DLLEXPORT QoreValue getServerVersion(ExceptionSink *xsink)
executes the "get_server_version" function of the driver, if any, and returns the result...
 
DLLEXPORT QoreHashNode * getEventQueueHash(Queue *&q, int event_code) const
returns an event hash with only default information in it or 0 if no event queue is set ...
 
DLLEXPORT void setDBEncoding(const char *name)
sets the database-specific character encoding name used for the current connection ...
 
DLLEXPORT const char * getDBName() const
returns the database (or schema) name used for the last connection 
 
DLLEXPORT const char * getHostName() const
returns the host name used for the last connection 
 
DLLEXPORT QoreValue getOption(const char *opt, ExceptionSink *xsink)
Returns the current value for the given option. 
 
DLLEXPORT int close()
closes the connection 
 
DLLEXPORT bool isInTransaction() const
returns the transaction status flag