gda.connection

Module for [Connection] class

Types 4

Methods
GType _gType() @property
Connection self()Returns `this`, for use in `with` statements.
ConnectionGidBuilder builder()Get builder for [gda.connection.Connection] Returns: New builder object
string authString() @property
void authString(string propval) @property
string cncString() @property
void cncString(string propval) @property
string dsn() @property
void dsn(string propval) @property
int eventsHistorySize() @propertyGet `eventsHistorySize` property. Returns: Defines the number of #GdaConnectionEvent objects kept in memory which can be fetched using [gda.connection.Connection.getEvents].
void eventsHistorySize(int propval) @propertySet `eventsHistorySize` property. Params: propval = Defines the number of #GdaConnectionEvent objects kept in memory which can be fetched using [gda.connection.Connection.getEvents].
uint executionSlowdown() @propertyGet `executionSlowdown` property. Returns: Artificially slows down the execution of queries. This property can be used to debug some problems. If non zero, this value is the number of microseconds ...
void executionSlowdown(uint propval) @propertySet `executionSlowdown` property. Params: propval = Artificially slows down the execution of queries. This property can be used to debug some problems. If non zero, this value is the number of micr...
bool executionTimer() @propertyGet `executionTimer` property. Returns: Computes execution times for each statement executed.
void executionTimer(bool propval) @propertySet `executionTimer` property. Params: propval = Computes execution times for each statement executed.
bool isWrapper() @propertyGet `isWrapper` property. Returns: This property, if set to true, specifies that the connection is not a real connection, but rather a #GdaConnection object which "proxies" all the calls to another...
void isWrapper(bool propval) @propertySet `isWrapper` property. Params: propval = This property, if set to true, specifies that the connection is not a real connection, but rather a #GdaConnection object which "proxies" all the calls t...
void metaStore(gda.meta_store.MetaStore propval) @property
bool monitorWrappedInMainloop() @propertyGet `monitorWrappedInMainloop` property. Returns: Useful only when there is a mainloop and when the connection acts as a thread wrapper around another connection, it sets up a timeout to handle sig...
void monitorWrappedInMainloop(bool propval) @propertySet `monitorWrappedInMainloop` property. Params: propval = Useful only when there is a mainloop and when the connection acts as a thread wrapper around another connection, it sets up a timeout to h...
void * threadOwner() @property
void threadOwner(void * propval) @property
gda.connection.Connection newFromDsn(string dsn, string authString, gda.types.ConnectionOptions options)This function is similar to [gda.connection.Connection.openFromDsn], except it does not actually open the connection, you have to open it using [gda.connection.Connection.open].
gda.connection.Connection newFromString(string providerName, string cncString, string authString, gda.types.ConnectionOptions options)This function is similar to [gda.connection.Connection.openFromString], except it does not actually open the connection, you have to open it using [gda.connection.Connection.open].
gda.connection.Connection openFromDsn(string dsn, string authString, gda.types.ConnectionOptions options)This function is the way of opening database connections with libgda, using a pre-defined data source (DSN), see [gda.config.Config.defineDsn] for more information about how to define a DSN. If you...
gda.connection.Connection openFromString(string providerName, string cncString, string authString, gda.types.ConnectionOptions options)Opens a connection given a provider ID and a connection string. This allows applications to open connections without having to create a data source (DSN) in the configuration. The format of cnc_str...
gda.connection.Connection openSqlite(string directory, string filename, bool autoUnlink)Opens an SQLite connection even if the SQLite provider is not installed, to be used by database providers which need a temporary database to store some information.
void stringSplit(string string_, out string outCncParams, out string outProvider, out string outUsername, out string outPassword)Extract the provider, connection parameters, username and password from string. in string, the various parts are strings which are expected to be encoded using an RFC 1738 compliant encoding. If th...
void addEvent(gda.connection_event.ConnectionEvent event)Adds an event to the given connection. This function is usually called by providers, to inform clients of events that happened during some operation.
void addPreparedStatement(gda.statement.Statement gdaStmt, gda.pstmt.PStmt preparedStmt)Declares that preparedstmt is a prepared statement object associated to gdastmt within the connection (meaning the connection increments the reference counter of prepared_stmt).
bool addSavepoint(string name = null)Adds a SAVEPOINT named name.
bool asyncCancel(uint taskId)Requests that a task be cancelled. This operation may of may not have any effect depending on the task's status, even if it returns true. If it returns false, then the task has not been cancelled.
gobject.object.ObjectWrap asyncFetchResult(uint taskId, out gda.set.Set lastInsertRow)Use this method to obtain the result of the execution of a statement which has been executed asynchronously by calling [gda.connection.Connection.asyncStatementExecute]. This function is non lockin...
gobject.object.ObjectWrap[] batchExecute(gda.batch.Batch batch, gda.set.Set params, gda.types.StatementModelUsage modelUsage)Executes all the statements contained in batch (in the order in which they were added to batch), and returns a list of #GObject objects, at most one #GObject for each statement; see [gda.connection...
bool beginTransaction(string name, gda.types.TransactionIsolation level)Starts a transaction on the data source, identified by the name parameter.
void clearEventsList()This function lets you clear the list of #GdaConnectionEvent's of the given connection.
void close()Closes the connection to the underlying data source, but first emits the "conn-to-close" signal.
void closeNoWarning()Closes the connection to the underlying data source, without emiting any warning signal.
bool commitTransaction(string name = null)Commits the given transaction to the backend database. You need to call [gda.connection.Connection.beginTransaction] first.
gda.server_operation.ServerOperation createOperation(gda.types.ServerOperationType type, gda.set.Set options = null)Creates a new #GdaServerOperation object which can be modified in order to perform the type type of action. It is a wrapper around the [gda.server_provider.ServerProvider.createOperation] method.
gda.sql_parser.SqlParser createParser()Creates a new parser object able to parse the SQL dialect understood by cnc. If the #GdaServerProvider object internally used by cnc does not have its own parser, then null is returned, and a gener...
void delPreparedStatement(gda.statement.Statement gdaStmt)Removes any prepared statement associated to gda_stmt in cnc: this undoes what [gda.connection.Connection.addPreparedStatement] does.
bool deleteRowFromTable(string table, string conditionColumnName, gobject.value.Value conditionValue)This is a convenience function, which creates a DELETE statement and executes it using the values provided. It internally relies on variables which makes it immune to SQL injection problems.
bool deleteSavepoint(string name = null)Delete the SAVEPOINT named name when not used anymore.
int executeNonSelectCommand(string sql)This is a convenience function to execute a SQL command over the opened connection. For the returned value, see [gda.connection.Connection.statementExecuteNonSelect]'s documentation.
gda.data_model.DataModel executeSelectCommand(string sql)Execute a SQL SELECT command over an opened connection.
string getAuthentication()Gets the user name used to open this connection. Returns: the user name.
string getCncString()Gets the connection string used to open this connection.
bool getDateFormat(out glib.types.DateDMY outFirst, out glib.types.DateDMY outSecond, out glib.types.DateDMY outThird, out char outSep)This function allows you to determine the actual format for the date values.
string getDsn()
gda.connection_event.ConnectionEvent[] getEvents()Retrieves a list of the last errors occurred during the connection. The returned list is chronologically ordered such as that the most recent event is the #GdaConnectionEvent of the first node.
gda.meta_store.MetaStore getMetaStore()Get or initializes the #GdaMetaStore associated to cnc Returns: a #GdaMetaStore object
gda.data_model.DataModel getMetaStoreDataV(gda.types.ConnectionMetaType metaType, gda.holder.Holder[] filters)see #gdaconnectiongetmetastore_data
gda.types.ConnectionOptions getOptions()Gets the #GdaConnectionOptions used to open this connection. Returns: the connection options.
gda.pstmt.PStmt getPreparedStatement(gda.statement.Statement gdaStmt)Retrieves a pointer to an object representing a prepared statement for gda_stmt within cnc. The association must have been done using [gda.connection.Connection.addPreparedStatement].
gda.server_provider.ServerProvider getProvider()Gets a pointer to the #GdaServerProvider object used to access the database Returns: the #GdaServerProvider (NEVER NULL)
string getProviderName()Gets the name (identifier) of the database provider used by cnc Returns: a non modifiable string
gda.transaction_status.TransactionStatus getTransactionStatus()Get the status of cnc regarding transactions. The returned object should not be modified or destroyed; however it may be modified or destroyed by the connection itself.
bool insertRowIntoTableV(string table, string[] colNames, gobject.value.Value[] values)col_names and values must have length (>= 1).
bool isOpened()Checks whether a connection is open or not. Returns: true if the connection is open, false if it's not.
bool open()Tries to open the connection. Returns: TRUE if the connection is opened, and FALSE otherwise. Throws: [ConnectionException]
gda.statement.Statement parseSqlString(string sql, out gda.set.Set params)This function helps to parse a SQL string which uses parameters and store them at params.
bool performOperation(gda.server_operation.ServerOperation op)Performs the operation described by op (which should have been created using [gda.connection.Connection.createOperation]). It is a wrapper around the [gda.server_provider.ServerProvider.performOper...
gda.connection_event.ConnectionEvent pointAvailableEvent(gda.types.ConnectionEventType type)Use this method to get a pointer to the next available connection event which can then be customized and taken into account using [gda.connection.Connection.addEvent].
string quoteSqlIdentifier(string id)Use this method to get a correctly quoted (if necessary) SQL identifier which can be used in SQL statements, from id. If id is already correctly quoted for cnc, then a copy of id may be returned.
bool rollbackSavepoint(string name = null)Rollback all the modifications made after the SAVEPOINT named name.
bool rollbackTransaction(string name = null)Rollbacks the given transaction. This means that all changes made to the underlying data source since the last call to #[gda.connection.Connection.beginTransaction] or #[gda.connection.Connection.c...
int statementExecuteNonSelect(gda.statement.Statement stmt, gda.set.Set params, out gda.set.Set lastInsertRow)Executes a non-selection statement on the given connection.
gda.data_model.DataModel statementExecuteSelect(gda.statement.Statement stmt, gda.set.Set params = null)Executes a selection command on the given connection.
bool statementPrepare(gda.statement.Statement stmt)Ask the database accessed through the cnc connection to prepare the usage of stmt. This is only useful if stmt will be used more than once (however some database providers may always prepare statem...
string statementToSql(gda.statement.Statement stmt, gda.set.Set params, gda.types.StatementSqlFlag flags, out gda.holder.Holder[] paramsUsed)Renders stmt as an SQL statement, adapted to the SQL dialect used by cnc
bool supportsFeature(gda.types.ConnectionFeature feature)Asks the underlying provider for if a specific feature is supported.
bool updateMetaStore(gda.meta_context.MetaContext context = null)Updates cnc's associated #GdaMetaStore. If context is not null, then only the parts described by context will be updated, and if it is null, then the complete meta store will be updated. Detailed e...
bool updateRowInTableV(string table, string conditionColumnName, gobject.value.Value conditionValue, string[] colNames, gobject.value.Value[] values)col_names and values must have length (>= 1).
string valueToSqlString(gobject.value.Value from)Produces a fully quoted and escaped string from a GValue
gulong connectConnClosed(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gda.connection.Connection))) && Parameters!T.length < 2)Connect to `ConnClosed` signal.
gulong connectConnOpened(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gda.connection.Connection))) && Parameters!T.length < 2)Connect to `ConnOpened` signal.
gulong connectConnToClose(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gda.connection.Connection))) && Parameters!T.length < 2)Connect to `ConnToClose` signal.
gulong connectDsnChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gda.connection.Connection))) && Parameters!T.length < 2)Connect to `DsnChanged` signal.
gulong connectError(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gda.connection_event.ConnectionEvent))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gda.connection.Connection))) && Parameters!T.length < 3)Connect to `Error` signal.
gulong connectTransactionStatusChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gda.connection.Connection))) && Parameters!T.length < 2)Connect to `TransactionStatusChanged` signal.
Constructors
this(void * ptr, Flag!"Take" take)
Methods
T authString(string propval)
T cncString(string propval)
T dsn(string propval)
T eventsHistorySize(int propval)Set `eventsHistorySize` property. Params: propval = Defines the number of #GdaConnectionEvent objects kept in memory which can be fetched using [gda.connection.Connection.getEvents]. Returns: Build...
T executionSlowdown(uint propval)Set `executionSlowdown` property. Params: propval = Artificially slows down the execution of queries. This property can be used to debug some problems. If non zero, this value is the number of micr...
T executionTimer(bool propval)Set `executionTimer` property. Params: propval = Computes execution times for each statement executed. Returns: Builder instance for fluent chaining
T isWrapper(bool propval)Set `isWrapper` property. Params: propval = This property, if set to true, specifies that the connection is not a real connection, but rather a #GdaConnection object which "proxies" all the calls t...
T monitorWrappedInMainloop(bool propval)Set `monitorWrappedInMainloop` property. Params: propval = Useful only when there is a mainloop and when the connection acts as a thread wrapper around another connection, it sets up a timeout to h...
T threadOwner(void * propval)

Fluent builder for [gda.connection.Connection]

Methods
Constructors
this(GError * err)
this(Code code, string msg)