GObject.Object
Gda.Connection
Import line: | Gda = imports.gi.Gda; |
GIR File: | Gda-4.0.gir |
C documentation: | GdaConnection |
Class : | Connection |
Implements: | Gda.Lockable |
Extends: | GObject.Object |
Show / Hide Inherited methods, properties and signals |
Properties | Defined By | |
---|---|---|
auth_string : String
|
Gda.Connection | |
cnc_string : String
|
Gda.Connection | |
dsn : String
|
Gda.Connection | |
is_wrapper : Boolean
|
Gda.Connection | |
meta_store : Gda.MetaStore
|
Gda.Connection | |
monitor_wrapped_in_mainloop : Boolean
|
Gda.Connection | |
object : GObject.Object
read only
|
Gda.Connection | |
options : Gda.ConnectionOptions
|
Gda.Connection | |
priv : Gda.ConnectionPrivate
read only
|
Gda.Connection | |
provider : Gda.ServerProvider
|
Gda.Connection | |
thread_owner : void*
|
Gda.Connection |
Method / Constructor | Defined By | |
---|---|---|
new Gda.Connection
(Object properties)
Create a new Gda.Connection
Create a new Gda.Connection
|
||
Gda.Connection.open_from_dsn
(String dsn, String auth_string, ConnectionOptions options)
:
Gda.Connection
This function is the way of opening database connections with libgda, using a pre-defined data source (DSN), see gda_config_define_dsn() for more information about how to define a DSN.
This function is the way of opening database connections with libgda, using a pre-defined data source (DSN), see gda_config_define_dsn() for more information about how to define a DSN. If you don't want to define a DSN, it is possible to use gda_connection_open_from_string() instead of this method. (if <username> and/or <password> are provided, and auth_string is NULL, then these username and passwords will be used). Note that if provided, <username> and <password> must be encoded as per RFC 1738, see gda_rfc1738_encode() for more information. The auth_string can contain the authentication information for the server to accept the connection. It is a string containing semi-colon seperated named value, usually like "USERNAME=...;PASSWORD=..." where the ... are replaced by actual values. Note that each name and value must be encoded as per RFC 1738, see gda_rfc1738_encode() for more information. The actual named parameters required depend on the provider being used, and that list is available as the
|
Gda.Connection | |
Gda.Connection.open_from_string
(String provider_name, String cnc_string, String auth_string, ConnectionOptions options)
:
Gda.Connection
Opens a connection given a provider ID and a connection string.
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_string is similar to PostgreSQL and MySQL connection strings. It is a semicolumn-separated series of <key>=<value> pairs, where each key and value are encoded as per RFC 1738, see gda_rfc1738_encode() for more information. The possible keys depend on the provider, the "gda-sql-4.0 -L" command can be used to list the actual keys for each installed database provider. For example the connection string to open an SQLite connection to a database file named "my_data.db" in the current directory would be
|
Gda.Connection | |
Gda.Connection.open_sqlite
(String directory, String filename, Boolean auto_unlink)
:
Gda.Connection
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.
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.
|
Gda.Connection | |
Gda.Connection | ||
add_event
(ConnectionEvent event)
:
none
Adds an event to the given connection.
Adds an event to the given connection. This function is usually called by providers, to inform clients of events that happened during some operation. As soon as a provider (or a client, it does not matter) calls this function with an event object which is an error, the connection object emits the "error" signal, to which clients can connect to be informed of events.
|
Gda.Connection | |
Declares that prepared_stmt is a prepared statement object associated to gda_stmt within the connection (meaning the connection increments the reference counter of prepared_stmt).
Declares that prepared_stmt is a prepared statement object associated to gda_stmt within the connection (meaning the connection increments the reference counter of prepared_stmt). If gda_stmt changes or is destroyed, the the association will be lost and the connection will lose the reference it has on prepared_stmt.
|
Gda.Connection | |
Gda.Connection | ||
Gda.Connection | ||
Use this method to obtain the result of the execution of a statement which has been executed asynchronously by calling gda_connection_async_statement_execute().
Use this method to obtain the result of the execution of a statement which has been executed asynchronously by calling gda_connection_async_statement_execute(). This function is non locking and will return NULL (and no error will be set) if the statement has not been executed yet. If the statement has been executed, this method returns the same value as gda_connection_statement_execute() would have if the statement had been executed synchronously.
|
Gda.Connection | |
async_statement_execute
(Statement stmt, Set params, StatementModelUsage model_usage, Array col_types, Boolean need_last_insert_row)
:
Number
This method is similar to gda_connection_statement_execute() but is asynchronous as it method returns immediately with a task ID.
This method is similar to gda_connection_statement_execute() but is asynchronous as it method returns immediately with a task ID. It's up to the caller to use gda_connection_async_fetch_result() regularly to check if the statement's execution is finished. It is possible to call the method several times to request several statements to be executed asynchronously, the statements will be executed in the order in which they were requested. The parameters, if present, are copied and can be discarded or modified before the statement is actually executed. The stmt object is not copied but simply referenced (for performance reasons), and if it is modified before it is actually executed, then its execution will not occur. It is however safe to call g_object_unref() on it if it's not needed anymore. The execution failure of any statement has no impact on the execution of other statements except for example if the connection has a transaction started and the failure invalidates the transaction (as decided by the database server). but any other error)
|
Gda.Connection | |
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_statement_execute() for details about the returned objects.
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_statement_execute() for details about the returned objects. If one of the statement fails, then none of the subsequent statement will be executed, and the method returns the list of GObject created by the correct execution of the previous statements. If a transaction is required, then it should be started before calling this method.
|
Gda.Connection | |
Starts a transaction on the data source, identified by the Before starting a transaction, you can check whether the underlying provider does support transactions or not by using the gda_connection_supports_feature() function.
Starts a transaction on the data source, identified by the Before starting a transaction, you can check whether the underlying provider does support transactions or not by using the gda_connection_supports_feature() function. otherwise.
|
Gda.Connection | |
clear_events_list
()
:
none
This function lets you clear the list of GdaConnectionEvent's of the given connection.
This function lets you clear the list of GdaConnectionEvent's of the given connection.
|
Gda.Connection | |
close
()
:
none
Closes the connection to the underlying data source, but first emits the "conn-to-close" signal.
Closes the connection to the underlying data source, but first emits the "conn-to-close" signal.
|
Gda.Connection | |
close_no_warning
()
:
none
Closes the connection to the underlying data source, without emiting any warning signal.
Closes the connection to the underlying data source, without emiting any warning signal.
|
Gda.Connection | |
Gda.Connection | ||
Creates a new GdaServerOperation object which can be modified in order to perform the type type of action.
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_create_operation() method. of operation or if an error occurred
|
Gda.Connection | |
create_parser
()
:
Gda.SqlParser
Creates a new parser object able to parse the SQL dialect understood by cnc.
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 general SQL parser can be obtained using gda_sql_parser_new().
|
Gda.Connection | |
del_prepared_statement
(Statement gda_stmt)
:
none
gda_connection_add_prepared_statement() does.
gda_connection_add_prepared_statement() does.
|
Gda.Connection | |
Gda.Connection | ||
get_authentication
()
:
String
Gets the user name used to open this connection.
Gets the user name used to open this connection.
|
Gda.Connection | |
get_cnc_string
()
:
String
Gets the connection string used to open this connection.
Gets the connection string used to open this connection. The connection string is the string sent over to the underlying database provider, which describes the parameters to be used to open a connection on the underlying data source.
|
Gda.Connection | |
get_dsn
()
:
String
to.
to.
|
Gda.Connection | |
get_events
()
:
Array
Retrieves a list of the last errors occurred during the connection.
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.Connection | |
get_meta_store
()
:
Gda.MetaStore
Get or initializes the GdaMetaStore associated to cnc
Get or initializes the GdaMetaStore associated to cnc
|
Gda.Connection | |
see gda_connection_get_meta_store_data for freeing the returned model using g_object_unref().
see gda_connection_get_meta_store_data for freeing the returned model using g_object_unref().
|
Gda.Connection | |
get_options
()
:
Gda.ConnectionOptions
Gets the GdaConnectionOptions used to open this connection.
Gets the GdaConnectionOptions used to open this connection.
|
Gda.Connection | |
Retrieves a pointer to an object representing a prepared statement for gda_stmt within cnc.
Retrieves a pointer to an object representing a prepared statement for gda_stmt within cnc. The association must have been done using gda_connection_add_prepared_statement().
|
Gda.Connection | |
get_provider
()
:
Gda.ServerProvider
Gets a pointer to the GdaServerProvider object used to access the database
Gets a pointer to the GdaServerProvider object used to access the database
|
Gda.Connection | |
get_provider_name
()
:
String
Gets the name (identifier) of the database provider used by cnc
Gets the name (identifier) of the database provider used by cnc
|
Gda.Connection | |
get_transaction_status
()
:
Gda.TransactionStatus
Get the status of cnc regarding transactions.
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. If NULL is returned, then no transaction has been associated with cnc
|
Gda.Connection | |
is_opened
()
:
Boolean
Checks whether a connection is open or not.
Checks whether a connection is open or not.
|
Gda.Connection | |
lock
()
:
none
|
Gda.Lockable | |
open
()
:
Boolean
Tries to open the connection.
Tries to open the connection.
|
Gda.Connection | |
perform_operation
(ServerOperation op)
:
Boolean
Performs the operation described by op (which should have been created using gda_connection_create_operation()).
Performs the operation described by op (which should have been created using gda_connection_create_operation()). It is a wrapper around the gda_server_provider_perform_operation() method.
|
Gda.Connection | |
Use this method to get a correctly quoted (if necessary) SQL identifier which can be used in SQL statements, from 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. This method may add double quotes (or other characters) around id:
|
Gda.Connection | |
repetitive_statement_execute
(RepetitiveStatement rstmt, StatementModelUsage model_usage, Array col_types, Boolean stop_on_error)
:
Array
Executes the statement upon which rstmt is built.
Executes the statement upon which rstmt is built. Note that as several statements can actually be executed by this method, it is recommended to be within a transaction. If error is not NULL and stop_on_error is FALSE, then it may contain the last error which occurred. represent), one for each actual execution of the statement upon which rstmt is built. If stop_on_error is FALSE, then the list may contain some NULL pointers which refer to statements which failed to execute.
|
Gda.Connection | |
Gda.Connection | ||
Rollbacks the given transaction.
|
Gda.Connection | |
statement_execute
(Statement stmt, Set params, StatementModelUsage model_usage, Object out_values)
:
GObject.Object
Executes stmt.
Executes stmt. As stmt can, by desing (and if not abused), contain only one SQL statement, the return object will either be:
|
Gda.Connection | |
Executes a non-selection statement on the given connection.
Executes a non-selection statement on the given connection. The gda_execute_non_select_command() method can be easier to use if one prefers to use some SQL directly. This function returns the number of rows affected by the execution of stmt, or -1 if an error occurred, or -2 if the connection's provider does not return the number of rows affected. This function is just a convenience function around the gda_connection_statement_execute() function. See the documentation of the gda_connection_statement_execute() for information about the params list of parameters. See gda_connection_statement_execute() form more information about last_insert_row.
|
Gda.Connection | |
Executes a selection command on the given connection.
Executes a selection command on the given connection. The gda_execute_select_command() method can be easier to use if one prefers to use some SQL directly. This function returns a GdaDataModel resulting from the SELECT statement, or NULL if an error occurred. This function is just a convenience function around the gda_connection_statement_execute() function. See the documentation of the gda_connection_statement_execute() for information about the params list of parameters. data source, or NULL if an error occurred
|
Gda.Connection | |
statement_execute_select_full
(Statement stmt, Set params, StatementModelUsage model_usage, Array col_types)
:
Gda.DataModel
value.
value. Any value left to 0 will make the database provider determine the real GType. col_types can also be NULL if no column type is specified. Executes a selection command on the given connection. This function returns a GdaDataModel resulting from the SELECT statement, or NULL if an error occurred. This function is just a convenience function around the gda_connection_statement_execute() function. See the documentation of the gda_connection_statement_execute() for information about the params list of parameters. data source, or NULL if an error occurred
|
Gda.Connection | |
Ask the database accessed through the cnc connection to prepare the usage of 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 statements before executing them). This function is also useful to make sure stmt is fully understood by the database before actually executing it. Note however that it is also possible that gda_connection_statement_prepare() fails when gda_connection_statement_execute() does not fail (this will usually be the case with statements such as tablename::string"]]> because database usually don't allow variables to be used in place of a table name).
|
Gda.Connection | |
Renders stmt as an SQL statement, adapted to the SQL dialect used by cnc
Renders stmt as an SQL statement, adapted to the SQL dialect used by cnc
|
Gda.Connection | |
supports_feature
(ConnectionFeature feature)
:
Boolean
Asks the underlying provider for if a specific feature is supported.
Asks the underlying provider for if a specific feature is supported.
|
Gda.Connection | |
trylock
()
:
Boolean
|
Gda.Lockable | |
unlock
()
:
none
|
Gda.Lockable | |
update_meta_store
(MetaContext context)
:
Boolean
Updates cnc's associated GdaMetaStore.
Updates cnc's associated GdaMetaStore. If context is not NULL, then only the parts described by explanations follow: In order to keep the meta store's contents in a consistent state, the update process involves updating the contents of all the tables related to one where the contents change. For example the "_columns" table (which lists all the columns of a table) depends on the "_tables" table (which lists all the tables in a schema), so if a row is added, removed or modified in the "_tables", then the "_columns" table's contents needs to be updated as well regarding that row. If context is NULL, then the update process will simply overwrite any data that was present in all the meta store's tables with new (up to date) data even if nothing has changed, without having to build the tables' dependency tree. This is the recommended way of proceeding when dealing with a meta store which might be outdated. On the other hand, if context is not NULL, then a tree of the dependencies has to be built (depending on context may be useful for example in the following situations:
|
Gda.Connection | |
|
Gda.Connection |
Event | Defined By | |
---|---|---|
conn_closed (Connection self)
:
none
|
Gda.Connection | |
conn_opened (Connection self)
:
none
|
Gda.Connection | |
conn_to_close (Connection self)
:
none
|
Gda.Connection | |
dsn_changed (Connection self)
:
none
|
Gda.Connection | |
error (Connection self, ConnectionEvent object)
:
none
|
Gda.Connection | |
transaction_status_changed (Connection self)
:
none
|
Gda.Connection |
Class / Namespace | Method / Signal / Properties |
---|---|
Gda
Method |
|
Gda
Method |
Gda.compute_dml_statements
(Connection cnc, Statement select_stmt, Boolean require_pk, Statement insert_stmt, Statement update_stmt, Statement delete_stmt)
:
Boolean
|
Gda
Method |
Gda.compute_unique_table_row_condition_with_cnc
(Connection cnc, SqlStatementSelect stsel, MetaTable mtable, Boolean require_pk)
:
Gda.SqlExpr
|
Gda
Method |
Gda.delete_row_from_table
(Connection cnc, String table, String condition_column_name, Value condition_value)
:
Boolean
|
Gda
Method |
|
Gda
Method |
|
Gda
Method |
|
Gda
Method |
|
Gda
Method |
Gda.sql_identifier_quote
(String id, Connection cnc, ServerProvider prov, Boolean meta_store_convention, Boolean force_quotes)
:
String
|
Gda
Method |
Gda.update_row_in_table_v
(Connection cnc, String table, String condition_column_name, Value condition_value, Array col_names, Array values)
:
Boolean
|
Gda.DataSelect
Property |
connection : Gda.Connection
|
Gda.DataSelect
Method |
get_connection
()
:
Gda.Connection
|
Gda.HandlerString
Method |
Create a new Gda.HandlerString
|
Gda.MetaStore
Property |
cnc : Gda.Connection
|
Gda.MetaStore
Method |
|
Gda.MetaStore
Method |
get_internal_connection
()
:
Gda.Connection
|
Gda.ServerOperation
Property |
connection : Gda.Connection
|
Gda.ServerProvider
Method |
get_server_version
(Connection cnc)
:
String
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
string_to_value
(Connection cnc, String string, Number preferred_type, Array dbms_type)
:
GObject.Value
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
create_parser
(Connection cnc)
:
Gda.SqlParser
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.ServerProvider
Method |
|
Gda.SqlStatement
Method |
check_validity
(Connection cnc)
:
Boolean
|
Gda.SqlStatement
Method |
normalize
(Connection cnc)
:
Boolean
|
Gda.Statement
Signal |
|
Gda.Statement
Method |
Renders stmt as an SQL statement, with some control on how it is rendered.
|
Gda.Statement
Method |
check_validity
(Connection cnc)
:
Boolean
If cnc is not NULL then checks that every object (table, field, function) used in stmt actually exists in cnc's database If cnc is NULL, then cleans anything related to cnc in stmt.
|
Gda.Statement
Method |
normalize
(Connection cnc)
:
Boolean
"Normalizes" some parts of stmt, see gda_sql_statement_normalize() for more information.
|
Gda.TreeMgrColumns
Property |
connection : Gda.Connection
|
Gda.TreeMgrColumns
Method |
new Gda.TreeMgrColumns.c_new
(Connection cnc, String schema, String table_name)
:
Gda.TreeMgrColumns
Create a new Gda.TreeMgrColumns
|
Gda.TreeMgrSchemas
Property |
connection : Gda.Connection
|
Gda.TreeMgrSchemas
Method |
Create a new Gda.TreeMgrSchemas
|
Gda.TreeMgrSelect
Property |
connection : Gda.Connection
|
Gda.TreeMgrSelect
Method |
Create a new Gda.TreeMgrSelect
|
Gda.TreeMgrTables
Property |
connection : Gda.Connection
|
Gda.TreeMgrTables
Method |
Create a new Gda.TreeMgrTables
|
Gda.XaTransaction
Method |
|
Gda.XaTransaction
Method |
unregister_connection
(Connection cnc)
:
none
|