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
None
if 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.Connection
orNone
) – aGda.Connection
object which will be used to perform an action, orNone
type (
Gda.ServerOperationType
) – the type of operation requested
- Raises:
- Returns:
a new
Gda.ServerOperation
object, orNone
in the provider does not support the type type of operation or if an error occurred- Return type:
Creates a new
Gda.ServerOperation
object 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.ServerOperation
object, 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.Connection
orNone
) – aGda.Connection
, orNone
- Returns:
a new
Gda.SqlParser
object, orNone
.- Return type:
Creates a new
Gda.SqlParser
object which is adapted to self (and possibly depending on cnc for the actual database version).If prov does not have its own parser, then
None
is returned, and a general SQL parser can be obtained usingGda.SqlParser.new
().
- escape_string(cnc, str)¶
- Parameters:
cnc (
Gda.Connection
orNone
) – aGda.Connection
object, orNone
str (
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
None
if 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.Connection
orNone
) – aGda.Connection
object, orNone
for_type (
str
) – a DBMS type definition
- Returns:
a
Gda.DataHandler
, orNone
if the provider does not know about the for_type type- Return type:
Find a
Gda.DataHandler
object 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.Connection
orNone
) – aGda.Connection
object, orNone
type (
GObject.GType
) – aGObject.GType
dbms_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.Connection
orNone
) – aGda.Connection
object, orNone
for_type (
GObject.GType
) – aGObject.GType
- Returns:
a
Gda.DataHandler
, orNone
if the provider does not support the requested for_type data type- Return type:
Find a
Gda.DataHandler
object to manipulate data of type for_type. The returned object must not be modified.
- get_default_dbms_type(cnc, type)¶
- Parameters:
cnc (
Gda.Connection
orNone
) – aGda.Connection
object orNone
type (
GObject.GType
) – aGObject.GType
value 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
None
either 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 exampleNone
may be returned if a DBMS has integers only up to 4 bytes and aGObject.TYPE_INT64
is 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.Connection
object- Returns:
a (read only) string, or
None
if 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.Connection
orNone
) – aGda.Connection
g_type (
GObject.GType
) – aGObject.GType
- Returns:
the requested
Gda.DataHandler
, orNone
if none found- Return type:
Reserved to database provider’s implementations: get the
Gda.DataHandler
associated 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.SqlParser
object for eachGda.ServerProvider
object Don’t unref it.
- perform_operation(cnc, op)¶
- Parameters:
cnc (
Gda.Connection
orNone
) – aGda.Connection
object which will be used to perform the action, orNone
op (
Gda.ServerOperation
) – aGda.ServerOperation
object
- Raises:
- Returns:
True
if 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.Connection
orNone
) – aGda.Connection
object which will be used to perform an action, orNone
op (
Gda.ServerOperation
) – aGda.ServerOperation
object
- Raises:
- Returns:
True
if 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.Connection
orNone
) – aGda.Connection
object which will be used to render the action, orNone
op (
Gda.ServerOperation
) – aGda.ServerOperation
object
- Raises:
- Returns:
a new string, or
None
if 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.Connection
orNone
) – aGda.Connection
object, orNone
string (
str
) – the SQL string to convert to a valuepreferred_type (
GObject.GType
) – aGObject.GType
, orGObject.TYPE_INVALID
dbms_type (
str
orNone
) – 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.Value
from a single string representation.The preferred_type can optionally ask self to return a
GObject.Value
of the requested type (but if such a value can’t be created from string, thenNone
is returned); passGObject.TYPE_INVALID
if any returned type is acceptable.The returned value is either a new
GObject.Value
orNone
in 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.Value
from 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, orNone
otherwise.
- supports_feature(cnc, feature)¶
- Parameters:
cnc (
Gda.Connection
orNone
) – aGda.Connection
object, orNone
feature (
Gda.ConnectionFeature
) –Gda.ConnectionFeature
feature to test
- Returns:
True
if feature is supported- Return type:
Tests if a feature is supported
- supports_operation(cnc, type, options)¶
- Parameters:
cnc (
Gda.Connection
orNone
) – aGda.Connection
object which would be used to perform an action, orNone
type (
Gda.ServerOperationType
) – the type of operation requestedoptions (
Gda.Set
orNone
) – a list of named parameters, orNone
- Returns:
True
if 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.Connection
orNone
) – aGda.Connection
object, orNone
str (
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.Connection
orNone
) – aGda.Connection
object, orNone
from (
GObject.Value
) –GObject.Value
to convert from
- Returns:
escaped and quoted value or
None
if 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.Connection
orNone
) – aGda.Connection
object which will be used to perform an action, orNone
type (
Gda.ServerOperationType
) – the type of operation requested
- Returns:
a new
Gda.ServerOperation
object, orNone
in the provider does not support the type type of operation or if an error occurred- Return type:
Creates a new
Gda.ServerOperation
object 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.ServerOperation
object, 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.Connection
orNone
) – aGda.Connection
, orNone
- Returns:
a new
Gda.SqlParser
object, orNone
.- Return type:
Creates a new
Gda.SqlParser
object which is adapted to provider (and possibly depending on cnc for the actual database version).If prov does not have its own parser, then
None
is 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.Connection
orNone
) – aGda.Connection
object, orNone
str (
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.Connection
object- Returns:
a (read only) string, or
None
if 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.Connection
orNone
) – aGda.Connection
object which will be used to render the action, orNone
op (
Gda.ServerOperation
) – aGda.ServerOperation
object
- Returns:
a new string, or
None
if 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.Connection
orNone
) – aGda.Connection
object, orNone
feature (
Gda.ConnectionFeature
) –Gda.ConnectionFeature
feature to test
- Returns:
True
if feature is supported- Return type:
Tests if a feature is supported
- do_supports_operation(cnc, type, options) virtual¶
- Parameters:
cnc (
Gda.Connection
orNone
) – aGda.Connection
object which would be used to perform an action, orNone
type (
Gda.ServerOperationType
) – the type of operation requestedoptions (
Gda.Set
orNone
) – a list of named parameters, orNone
- Returns:
True
if 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.Connection
orNone
) – aGda.Connection
object, orNone
str (
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
().