GdaBatch

Name

GdaBatch -- Batch command execution

Synopsis



GdaBatch*   gda_batch_new                   (void);
void        gda_batch_free                  (GdaBatch *job);
gboolean    gda_batch_load_file             (GdaBatch *job,
                                             const gchar *filename,
                                             gboolean clean);
void        gda_batch_add_command           (GdaBatch *job,
                                             const gchar *cmd);
void        gda_batch_clear                 (GdaBatch *job);
gboolean    gda_batch_start                 (GdaBatch *job);
void        gda_batch_stop                  (GdaBatch *job);
gboolean    gda_batch_is_running            (GdaBatch *job);
GdaConnection* gda_batch_get_connection     (GdaBatch *job);
void        gda_batch_set_connection        (GdaBatch *job,
                                             GdaConnection *cnc);
gboolean    gda_batch_get_transaction_mode  (GdaBatch *job);
void        gda_batch_set_transaction_mode  (GdaBatch *job,
                                             gboolean mode);

Description

The GdaBatch class provides a way to execute batch jobs on a given data source.

Details

gda_batch_new ()

GdaBatch*   gda_batch_new                   (void);

Creates a new GdaBatch object, which can be used in applications to simulate a transaction, that is, a series of commands which will be committed only if only all of them succeed. If any of the commands return an error when executed, all the changes are rolled back (by calling gda_connection_rollback_transaction).

Although, this behavior is configurable. You can also use it as a way of sending several commands to the underlying database, regardless of the errors found in the process.

Returns :

a pointer to the new object, or NULL on error


gda_batch_free ()

void        gda_batch_free                  (GdaBatch *job);

Destroy the given batch job object

job :

a GdaBatch object


gda_batch_load_file ()

gboolean    gda_batch_load_file             (GdaBatch *job,
                                             const gchar *filename,
                                             gboolean clean);

Load the given file as a set of commands into the given job object. The clean parameter specifies whether to clean up the list of commands before loading the given file or not.

job :

a GdaBatch object

filename :

file name

clean :

clean up

Returns :

TRUE if successful, or FALSE on error


gda_batch_add_command ()

void        gda_batch_add_command           (GdaBatch *job,
                                             const gchar *cmd);

Adds a command to the list of commands to be executed

job :

a GdaBatch object

cmd :

command string


gda_batch_clear ()

void        gda_batch_clear                 (GdaBatch *job);

Clears the given GdaBatch object. This means eliminating the list of commands

job :


gda_batch_start ()

gboolean    gda_batch_start                 (GdaBatch *job);

Start the batch job execution. This function will return when the series of commands is completed, or when an error is found

job :

a GdaBatch object

Returns :

TRUE if all goes well, or FALSE on error


gda_batch_stop ()

void        gda_batch_stop                  (GdaBatch *job);

Stop the execution of the given GdaBatch object. This cancels the the transaction (discarding all changes) if the GdaBatch object is in transaction mode

job :

a GdaBatch object


gda_batch_is_running ()

gboolean    gda_batch_is_running            (GdaBatch *job);

job :

a GdaBatch object

Returns :


gda_batch_get_connection ()

GdaConnection* gda_batch_get_connection     (GdaBatch *job);

Return the GdaConnection object associated with the given batch job

job :

a GdaBatch object

Returns :


gda_batch_set_connection ()

void        gda_batch_set_connection        (GdaBatch *job,
                                             GdaConnection *cnc);

Associate a GdaConnection object to the given batch job

job :

a GdaBatch object

cnc :

a GdaConnection object


gda_batch_get_transaction_mode ()

gboolean    gda_batch_get_transaction_mode  (GdaBatch *job);

job :

a GdaBatch object

Returns :

the transaction mode for the given GdaBatch object. This mode specifies how the series of commands are treated. If in transaction mode (TRUE), the execution is stopped whenever an error is found, discarding all changes, whereas all data is committed if no error is found. On the other hand, if transaction mode is disabled, the execution continues until the end regardless of any error found.


gda_batch_set_transaction_mode ()

void        gda_batch_set_transaction_mode  (GdaBatch *job,
                                             gboolean mode);

Enable/disable transaction mode for the given GdaBatch object. Transaction mode is enabled by default

job :

a GdaBatch object

mode :

transaction mode