Gda.ServerProvider¶
- Subclasses:
 None
Methods¶
- Inherited:
 - Structs:
 
class  | 
  | 
class  | 
  | 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
- Inherited:
 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Properties¶
None
Signals¶
- Inherited:
 
Fields¶
- Inherited:
 
Name  | 
Type  | 
Access  | 
Description  | 
|---|---|---|---|
object  | 
r  | 
||
priv  | 
r  | 
Class Details¶
- class Gda.ServerProvider(**kwargs)¶
 - Bases:
 - Abstract:
 Yes
- Structure:
 
- classmethod load_file_contents(inst_dir, data_dir, filename)¶
 - Parameters:
 - Returns:
 a new string containing filename's contents, or
Noneif not found or if an error occurred- Return type:
 
Loads and returns the contents of filename, which is searched in several places This function should only be used by database provider’s implementations
- create_operation(cnc, type, options)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject which will be used to perform an action, orNonetype (
Gda.ServerOperationType) – the type of operation requested
- Raises:
 - Returns:
 a new
Gda.ServerOperationobject, orNonein the provider does not support the type type of operation or if an error occurred- Return type:
 
Creates a new
Gda.ServerOperationobject which can be modified in order to perform the type type of action. The options can contain:named values which ID is a path in the resulting
Gda.ServerOperationobject, to initialize some valuenamed values which may change the contents of the
Gda.ServerOperation, see ‘this section [gda-server-op-information-std]’ for more information
- create_parser(cnc)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connection, orNone- Returns:
 a new
Gda.SqlParserobject, orNone.- Return type:
 
Creates a new
Gda.SqlParserobject which is adapted to self (and possibly depending on cnc for the actual database version).If prov does not have its own parser, then
Noneis returned, and a general SQL parser can be obtained usingGda.SqlParser.new().
- escape_string(cnc, str)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonestr (
str) – a string to escape
- Returns:
 a new string suitable to use in SQL statements
- Return type:
 
Escapes str for use within an SQL command (to avoid SQL injection attacks). Note that the returned value still needs to be enclosed in single quotes before being used in an SQL statement.
- find_file(inst_dir, filename)¶
 - Parameters:
 - Returns:
 the complete path to filename, or
Noneif not found- Return type:
 
Finds the location of a filename. This function should only be used by database provider’s implementations
- get_data_handler_dbms(cnc, for_type)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonefor_type (
str) – a DBMS type definition
- Returns:
 a
Gda.DataHandler, orNoneif the provider does not know about the for_type type- Return type:
 
Find a
Gda.DataHandlerobject to manipulate data of type for_type.Note: this function is currently very poorly implemented by database providers.
- get_data_handler_default(cnc, type, dbms_type)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonetype (
GObject.GType) – aGObject.GTypedbms_type (
str) – a DBMS type definition
- Returns:
 a
Gda.DataHandler, orNone- Return type:
 
Provides the implementation when the default Libgda’s data handlers must be used
Deprecated since version 5.2: use gda_server_provider_handler_use_default() instead
- get_data_handler_g_type(cnc, for_type)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonefor_type (
GObject.GType) – aGObject.GType
- Returns:
 a
Gda.DataHandler, orNoneif the provider does not support the requested for_type data type- Return type:
 
Find a
Gda.DataHandlerobject to manipulate data of type for_type. The returned object must not be modified.
- get_default_dbms_type(cnc, type)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject orNonetype (
GObject.GType) – aGObject.GTypevalue type
- Returns:
 the name of the DBMS type, or
None- Return type:
 
Get the name of the most common data type which has type type.
The returned value may be
Noneeither if the provider does not implement that method, or if there is no DBMS data type which could contain data of the g_type type (for exampleNonemay be returned if a DBMS has integers only up to 4 bytes and aGObject.TYPE_INT64is requested).
- get_name()¶
 - Returns:
 a string containing the provider’s name
- Return type:
 
Get the name (identifier) of the provider
- get_server_version(cnc)¶
 - Parameters:
 cnc (
Gda.Connection) – aGda.Connectionobject- Returns:
 a (read only) string, or
Noneif an error occurred- Return type:
 
Get the version of the database to which the connection is opened.
- get_version()¶
 - Returns:
 a string containing the version identification.
- Return type:
 
Get the version of the provider.
- handler_declare(dh, cnc, g_type, dbms_type)¶
 - Parameters:
 dh (
Gda.DataHandler) –cnc (
Gda.Connection) –g_type (
GObject.GType) –dbms_type (
str) –
- handler_find(cnc, g_type, dbms_type)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectiong_type (
GObject.GType) – aGObject.GType
- Returns:
 the requested
Gda.DataHandler, orNoneif none found- Return type:
 
Reserved to database provider’s implementations: get the
Gda.DataHandlerassociated to self for connection cnc. You probably want to useGda.ServerProvider.get_data_handler_g_type().
- internal_get_parser()¶
 - Returns:
 - Return type:
 
This is a factory method to get a unique instance of a
Gda.SqlParserobject for eachGda.ServerProviderobject Don’t unref it.
- perform_operation(cnc, op)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject which will be used to perform the action, orNoneop (
Gda.ServerOperation) – aGda.ServerOperationobject
- Raises:
 - Returns:
 Trueif no error occurred- Return type:
 
Performs the operation described by op. Note that op is not destroyed by this method and can be reused.
- perform_operation_default(cnc, op)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject which will be used to perform an action, orNoneop (
Gda.ServerOperation) – aGda.ServerOperationobject
- Raises:
 - Returns:
 Trueif no error occurred- Return type:
 
Performs the operation described by op, using the SQL from the rendering of the operation
- render_operation(cnc, op)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject which will be used to render the action, orNoneop (
Gda.ServerOperation) – aGda.ServerOperationobject
- Raises:
 - Returns:
 a new string, or
Noneif an error occurred or operation cannot be rendered as SQL.- Return type:
 
Creates an SQL statement (possibly using some specific extensions of the DBMS) corresponding to the op operation. Note that the returned string may actually contain more than one SQL statement.
This function’s purpose is mainly informative to get the actual SQL code which would be executed to perform the operation; to actually perform the operation, use
Gda.ServerProvider.perform_operation().
- string_to_value(cnc, string, preferred_type, dbms_type)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonestring (
str) – the SQL string to convert to a valuepreferred_type (
GObject.GType) – aGObject.GType, orGObject.TYPE_INVALIDdbms_type (
strorNone) – place to get the actual database type used if the conversion succeeded, orNone
- Returns:
 a new
GObject.Value, orNone- Return type:
 
Use self to create a new
GObject.Valuefrom a single string representation.The preferred_type can optionally ask self to return a
GObject.Valueof the requested type (but if such a value can’t be created from string, thenNoneis returned); passGObject.TYPE_INVALIDif any returned type is acceptable.The returned value is either a new
GObject.ValueorNonein the following cases:string cannot be converted to preferred_type type
the provider does not handle preferred_type
the provider could not make a
GObject.Valuefrom string
If dbms_type is not
None, then if will contain a constant string representing the database type used for the conversion if the conversion was successfull, orNoneotherwise.
- supports_feature(cnc, feature)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonefeature (
Gda.ConnectionFeature) –Gda.ConnectionFeaturefeature to test
- Returns:
 Trueif feature is supported- Return type:
 
Tests if a feature is supported
- supports_operation(cnc, type, options)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject which would be used to perform an action, orNonetype (
Gda.ServerOperationType) – the type of operation requestedoptions (
Gda.SetorNone) – a list of named parameters, orNone
- Returns:
 Trueif the operation is supported- Return type:
 
Tells if self supports the type of operation on the cnc connection, using the (optional) options parameters.
- unescape_string(cnc, str)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonestr (
str) – a string to escape
- Returns:
 a new string
- Return type:
 
Unescapes str for use within an SQL command. This is the exact opposite of
Gda.ServerProvider.escape_string().
- value_to_sql_string(cnc, from_)¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonefrom (
GObject.Value) –GObject.Valueto convert from
- Returns:
 escaped and quoted value or
Noneif not supported.- Return type:
 
Produces a fully quoted and escaped string from a
GObject.Value
- do_add_savepoint(cnc, name) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –name (
str) –
- Return type:
 
- do_begin_transaction(cnc, name, level) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –name (
str) –level (
Gda.TransactionIsolation) –
- Return type:
 
- do_cancel(cnc, task_id) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –task_id (
int) –
- Return type:
 
- do_close_connection(cnc) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –- Return type:
 
- do_commit_transaction(cnc, name) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –name (
str) –
- Return type:
 
- do_create_operation(cnc, type, options) virtual¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject which will be used to perform an action, orNonetype (
Gda.ServerOperationType) – the type of operation requested
- Returns:
 a new
Gda.ServerOperationobject, orNonein the provider does not support the type type of operation or if an error occurred- Return type:
 
Creates a new
Gda.ServerOperationobject which can be modified in order to perform the type type of action. The options can contain:named values which ID is a path in the resulting
Gda.ServerOperationobject, to initialize some valuenamed values which may change the contents of the
Gda.ServerOperation, see ‘this section [gda-server-op-information-std]’ for more information
- do_create_parser(cnc) virtual¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connection, orNone- Returns:
 a new
Gda.SqlParserobject, orNone.- Return type:
 
Creates a new
Gda.SqlParserobject which is adapted to provider (and possibly depending on cnc for the actual database version).If prov does not have its own parser, then
Noneis returned, and a general SQL parser can be obtained usingGda.SqlParser.new().
- do_delete_savepoint(cnc, name) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –name (
str) –
- Return type:
 
- do_escape_string(cnc, str) virtual¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonestr (
str) – a string to escape
- Returns:
 a new string suitable to use in SQL statements
- Return type:
 
Escapes str for use within an SQL command (to avoid SQL injection attacks). Note that the returned value still needs to be enclosed in single quotes before being used in an SQL statement.
- do_get_database(cnc) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –- Return type:
 
- do_get_def_dbms_type(cnc, g_type) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –g_type (
GObject.GType) –
- Return type:
 
- do_get_name() virtual¶
 - Returns:
 a string containing the provider’s name
- Return type:
 
Get the name (identifier) of the provider
- do_get_server_version(cnc) virtual¶
 - Parameters:
 cnc (
Gda.Connection) – aGda.Connectionobject- Returns:
 a (read only) string, or
Noneif an error occurred- Return type:
 
Get the version of the database to which the connection is opened.
- do_get_version() virtual¶
 - Returns:
 a string containing the version identification.
- Return type:
 
Get the version of the provider.
- do_handle_async(cnc) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –- Return type:
 
- do_identifier_quote(cnc, id, for_meta_store, force_quotes) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –id (
str) –for_meta_store (
bool) –force_quotes (
bool) –
- Return type:
 
- do_is_busy(cnc) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –- Return type:
 
- do_render_operation(cnc, op) virtual¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject which will be used to render the action, orNoneop (
Gda.ServerOperation) – aGda.ServerOperationobject
- Returns:
 a new string, or
Noneif an error occurred or operation cannot be rendered as SQL.- Return type:
 
Creates an SQL statement (possibly using some specific extensions of the DBMS) corresponding to the op operation. Note that the returned string may actually contain more than one SQL statement.
This function’s purpose is mainly informative to get the actual SQL code which would be executed to perform the operation; to actually perform the operation, use
Gda.ServerProvider.perform_operation().
- do_rollback_savepoint(cnc, name) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –name (
str) –
- Return type:
 
- do_rollback_transaction(cnc, name) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –name (
str) –
- Return type:
 
- do_statement_prepare(cnc, stmt) virtual¶
 - Parameters:
 cnc (
Gda.Connection) –stmt (
Gda.Statement) –
- Return type:
 
- do_supports_feature(cnc, feature) virtual¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonefeature (
Gda.ConnectionFeature) –Gda.ConnectionFeaturefeature to test
- Returns:
 Trueif feature is supported- Return type:
 
Tests if a feature is supported
- do_supports_operation(cnc, type, options) virtual¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject which would be used to perform an action, orNonetype (
Gda.ServerOperationType) – the type of operation requestedoptions (
Gda.SetorNone) – a list of named parameters, orNone
- Returns:
 Trueif the operation is supported- Return type:
 
Tells if provider supports the type of operation on the cnc connection, using the (optional) options parameters.
- do_unescape_string(cnc, str) virtual¶
 - Parameters:
 cnc (
Gda.ConnectionorNone) – aGda.Connectionobject, orNonestr (
str) – a string to escape
- Returns:
 a new string
- Return type:
 
Unescapes str for use within an SQL command. This is the exact opposite of
Gda.ServerProvider.escape_string().