Gda.ServerOperation¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Connection to use |
||
r/w/co |
Type of operation to be done |
||
r/w/co |
Database provider which created the object |
||
w/co |
XML file which contains the object’s data structure |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Gets emitted whenever a new sequence item (from a sequence template) has been added |
|
Gets emitted whenever a sequence item is about to be removed |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
object |
r |
Class Details¶
- class Gda.ServerOperation(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(op_type, xml_file)¶
- Parameters:
op_type (
Gda.ServerOperationType
) – type of operationxml_file (
str
) – a file which has the specifications for theGda.ServerOperation
object to create
- Returns:
a new
Gda.ServerOperation
object- Return type:
IMPORTANT NOTE: Using this funtion is not the recommended way of creating a
Gda.ServerOperation
object, the correct way is to useGda.ServerProvider.create_operation
(); this method is reserved for the database provider’s implementation.Creates a new
Gda.ServerOperation
object from the xml_file specificationsThe xml_file must respect the DTD described in the “libgda-server-operation.dtd” file: its top node must be a <serv_op> tag.
- classmethod op_type_to_string(type)¶
- Parameters:
type (
Gda.ServerOperationType
) – aGda.ServerOperationType
value- Returns:
a non
None
string (do not free or modify)- Return type:
Get a string version of type
- classmethod prepare_create_database(provider, db_name)¶
- Parameters:
- Raises:
- Returns:
new
Gda.ServerOperation
object, orNone
if the provider does not support database creation- Return type:
Creates a new
Gda.ServerOperation
object which contains the specifications required to create a database. Once these specifications provided, useGda.ServerOperation.perform_create_database
() to perform the database creation.If db_name is left
None
, then the name of the database to create will have to be set in the returnedGda.ServerOperation
usingGda.ServerOperation.set_value_at
().New in version 4.2.3.
- classmethod prepare_drop_database(provider, db_name)¶
- Parameters:
- Raises:
- Returns:
new
Gda.ServerOperation
object, orNone
if the provider does not support database destruction- Return type:
Creates a new
Gda.ServerOperation
object which contains the specifications required to drop a database. Once these specifications provided, useGda.ServerOperation.perform_drop_database
() to perform the database creation.If db_name is left
None
, then the name of the database to drop will have to be set in the returnedGda.ServerOperation
usingGda.ServerOperation.set_value_at
().New in version 4.2.3.
- classmethod prepare_drop_table(cnc, table_name)¶
- Parameters:
cnc (
Gda.Connection
) – an opened connectiontable_name (
str
) – name of the table to drop
- Raises:
- Returns:
a new
Gda.ServerOperation
orNone
if couldn’t create the opereration.- Return type:
This is just a convenient function to create a
Gda.ServerOperation
to drop a table in an opened connection.New in version 4.2.3.
- classmethod string_to_op_type(str)¶
- Parameters:
str (
str
) – a string- Returns:
the
Gda.ServerOperationType
represented by str, orGObject.G_MAXINT
if str is not a valid representation of aGda.ServerOperationType
- Return type:
Performs the reverse of
Gda.ServerOperation.op_type_to_string
()New in version 4.2.
- add_item_to_sequence(seq_path)¶
- del_item_from_sequence(item_path)¶
- get_node_parent(path)¶
- Parameters:
path (
str
) – a complete path to a node (starting with “/”)- Returns:
a new string or
None
if the node does not have any parent or does not exist.- Return type:
Get the complete path to the parent of the node defined by path
- get_node_path_portion(path)¶
- Parameters:
path (
str
) – a complete path to a node (starting with “/”)- Returns:
a new string, or
None
if an error occurred- Return type:
Get the last part of path
- get_node_type(path, status)¶
- Parameters:
path (
str
) – a complete path to a node (starting with “/”)status (
Gda.ServerOperationNodeStatus
orNone
) – a place to store the status of the node, orNone
- Returns:
the type of node, or
Gda.ServerOperationNodeType.UNKNOWN
if the node was not found- Return type:
Convenience function to get the type of a node.
- get_op_type()¶
- Returns:
a
Gda.ServerOperationType
enum- Return type:
Get the type of operation self is for
- get_root_nodes()¶
- Returns:
a new array, which must be freed with
GLib.strfreev
().- Return type:
[
str
]
Get an array of strings containing the paths of nodes situated at the root of self.
- get_sequence_item_names(path)¶
- Parameters:
path (
str
) – a complete path to a sequence node (starting with “/”)- Returns:
a array of strings containing the complete paths of the nodes contained at path (free with
GLib.strfreev
())- Return type:
[
str
]
Fetch the contents of a sequence. path can describe either a sequence (for example “/SEQNAME”) or an item in a sequence (for example “/SEQNAME/3”)
- get_sequence_max_size(path)¶
- get_sequence_min_size(path)¶
- get_sequence_name(path)¶
- get_sequence_size(path)¶
- get_sql_identifier_at(cnc, prov, path)¶
- Parameters:
cnc (
Gda.Connection
orNone
) – aGda.Connection
, orNone
prov (
Gda.ServerProvider
orNone
) – aGda.ServerProvider
, orNone
path (
str
) – a complete path to a node (starting with “/”)
- Returns:
a new string, or
None
if the value is undefined or if the path is not defined or path does not hold any value, or if the value held is not a string (in that last case a warning is shown).- Return type:
This method is similar to
Gda.ServerOperation.get_value_at
(), but for SQL identifiers: a new string is returned instead of aGObject.Value
. Also the returned string is assumed to represents an SQL identifier and will correctly be quoted to be used with cnc, or prov if cnc isNone
(a generic quoting rule will be applied if both areNone
).New in version 4.2.6.
- get_value_at(path)¶
- Parameters:
path (
str
) – a complete path to a node (starting with “/”)- Returns:
a constant
GObject.Value
if a value has been defined, orNone
if the value is undefined or if the path is not defined or path does not hold any value.- Return type:
Get the value for the node at the path path
New in version 4.2.6.
- is_valid(xml_file)¶
- Parameters:
xml_file (
str
orNone
) – an XML specification file (seeGda.ServerOperation.new
()) orNone
- Raises:
- Returns:
True
if self is valid- Return type:
Tells if all the required values in self have been defined.
if xml_file is not
None
, the validity of self is tested against that specification, and not against the current self's specification.
- load_data_from_xml(node)¶
- Parameters:
node (
libxml2.NodePtr
) – alibxml2.NodePtr
- Raises:
- Returns:
True
if no error occurred- Return type:
Loads the contents of node into self. The XML tree passed through the node argument must correspond to an XML tree saved using gda_server_operation_save_data_to_xml().
- perform_create_database(provider)¶
- Parameters:
provider (
str
orNone
) – the database provider to use, orNone
if self has been created usingGda.ServerOperation.prepare_create_database
()- Raises:
- Returns:
True
if no error occurred and the database has been created,False
otherwise- Return type:
Creates a new database using the specifications in self. self can be obtained using
Gda.ServerProvider.create_operation
(), orGda.ServerOperation.prepare_create_database
().New in version 4.2.3.
- perform_create_table()¶
-
Performs a prepared
Gda.ServerOperation
to create a table. This could perform an operation created by #gda_server_operation_prepare_create_table or any other using the theGda.ServerOperation
API.New in version 4.2.3.
- perform_drop_database(provider)¶
- Parameters:
provider (
str
orNone
) – the database provider to use, orNone
if self has been created usingGda.ServerOperation.prepare_drop_database
()- Raises:
- Returns:
True
if no error occurred and the database has been destroyed- Return type:
Destroys an existing database using the specifications in self. self can be obtained using
Gda.ServerProvider.create_operation
(), orGda.ServerOperation.prepare_drop_database
().New in version 4.2.3.
- perform_drop_table()¶
- Raises:
- Returns:
True
if the table was dropped- Return type:
This is just a convenient function to perform a drop a table operation.
New in version 4.2.3.
- set_value_at(value, path)¶
- Parameters:
- Raises:
- Returns:
True
if no error occurred- Return type:
Set the value for the node at the path formed using path_format and the … ellipse (the rules are the same as for g_strdup_printf()).
Note that trying to set a value for a path which is not used by the current provider, such as “/TABLE_OPTIONS_P/TABLE_ENGINE” for a PostgreSQL connection (this option is only supported for MySQL), will not generate any error; this allows one to give values to a superset of the parameters and thus use the same code for several providers.
Here are the possible formats of path_format:
If the path corresponds to a
Gda.Holder
, then the parameter is set to <![CDATA[”value"]]>If the path corresponds to a sequence item like for example “/SEQUENCE_NAME/5/NAME” for the “NAME” value of the 6th item of the “SEQUENCE_NAME” sequence then:
if the sequence already has 6 or more items, then the value is just set to the corresponding value in the 6th item of the sequence
if the sequence has less then 6 items, then items are added up to the 6th one before setting the value to the corresponding in the 6th item of the sequence
If the path corresponds to a
Gda.DataModel
, like for example “/ARRAY/@COLUMN/5” for the value at the 6th row of the “COLUMN” column of the “ARRAY” data model, then:if the data model already contains 6 or more rows, then the value is just set
if the data model has less than 6 rows, then rows are added up to the 6th one before setting the value
New in version 4.2.6.
Signal Details¶
- Gda.ServerOperation.signals.sequence_item_added(server_operation, seq_path, item_index)¶
- Signal Name:
sequence-item-added
- Flags:
- Parameters:
server_operation (
Gda.ServerOperation
) – The object which received the signalseq_path (
str
) – the path to the new sequence itemitem_index (
int
) – the index (starting from 0) of the new sequence item in the sequence
Gets emitted whenever a new sequence item (from a sequence template) has been added
- Gda.ServerOperation.signals.sequence_item_remove(server_operation, seq_path, item_index)¶
- Signal Name:
sequence-item-remove
- Flags:
- Parameters:
server_operation (
Gda.ServerOperation
) – The object which received the signalseq_path (
str
) – the path to the sequence item to be removeditem_index (
int
) – the index (starting from 0) of the sequence item in the sequence
Gets emitted whenever a sequence item is about to be removed
Property Details¶
- Gda.ServerOperation.props.connection¶
- Name:
connection
- Type:
- Default Value:
- Flags:
Connection to use
- Gda.ServerOperation.props.op_type¶
- Name:
op-type
- Type:
- Default Value:
0
- Flags:
Type of operation to be done
- Gda.ServerOperation.props.provider¶
- Name:
provider
- Type:
- Default Value:
- Flags:
Database provider which created the object
- Gda.ServerOperation.props.spec_filename¶
- Name:
spec-filename
- Type:
- Default Value:
- Flags:
XML file which contains the object’s data structure