GdaBatch

## GdaBatch GdaBatch — Multiple SQL statements grouped together. |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        GdaBatch;
    enum                GdaBatchError;
    GdaBatch *          gda_batch_new                       (void);
    GdaBatch *          gda_batch_copy                      (GdaBatch *orig);
    void                gda_batch_add_statement             (GdaBatch *batch,
                                                             GdaStatement *stmt);
    void                gda_batch_remove_statement          (GdaBatch *batch,
                                                             GdaStatement *stmt);
    gchar *             gda_batch_serialize                 (GdaBatch *batch);
    const GSList *      gda_batch_get_statements            (GdaBatch *batch);
    gboolean            gda_batch_get_parameters            (GdaBatch *batch,
                                                             GdaSet **out_params,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----GdaBatch

## Signals

      "changed"                                        : Run First

## Description

The GdaBatch object represents one or more SQL statements (as GdaStatement objects) in a single object.

A GdaBatch can either be built "manually" by assembling together several GdaStatement objects, or from an SQL string using a GdaSqlParser object.

## Details

### GdaBatch

    typedef struct _GdaBatch GdaBatch;

### enum GdaBatchError

    typedef enum {
    	GDA_BATCH_CONFLICTING_PARAMETER_ERROR
    } GdaBatchError;

`GDA_BATCH_CONFLICTING_PARAMETER_ERROR` |

### gda_batch_new ()

    GdaBatch *          gda_batch_new                       (void);

Creates a new GdaBatch object

Returns : | the new object

### gda_batch_copy ()

    GdaBatch *          gda_batch_copy                      (GdaBatch *orig);

Copy constructor

`orig` : | a GdaBatch to make a copy of
Returns : | a the new copy of `orig`. [transfer full]

### gda_batch_add_statement ()

    void                gda_batch_add_statement             (GdaBatch *batch,
                                                             GdaStatement *stmt);

Add `stmt` to the list of statements managed by `batch`. A GdaStatement object can be added multiple times to a GdaBatch object.

`batch` : | a GdaBatch object
`stmt` : | a statement to add to `batch`'s statements list

### gda_batch_remove_statement ()

    void                gda_batch_remove_statement          (GdaBatch *batch,
                                                             GdaStatement *stmt);

Removes `stmt` from the list of statements managed by `batch`. If `stmt` is present several times in `batch`'s statements' list, then only the first one is removed.

`batch` : | a GdaBatch object
`stmt` : | a statement to remove from `batch`'s statements list

### gda_batch_serialize ()

    gchar *             gda_batch_serialize                 (GdaBatch *batch);

Creates a string representing the contents of `batch`.

`batch` : | a GdaBatch object
Returns : | a string containing the serialized version of `batch`

### gda_batch_get_statements ()

    const GSList *      gda_batch_get_statements            (GdaBatch *batch);

Get a list of the GdaStatement objects contained in `batch`

`batch` : | a GdaBatch object
Returns : | a list of GdaStatement which should not be modified. [element-type GdaStatement][transfer none]

### gda_batch_get_parameters ()

    gboolean            gda_batch_get_parameters            (GdaBatch *batch,
                                                             GdaSet **out_params,
                                                             GError **error);

Get a new GdaSet object which groups all the execution parameters which `batch` needs for all the statements it includes. This new object is returned though `out_params`.

Note that if `batch` does not need any parameter, then `out_params` is set to `NULL`.

`batch` : | a GdaBatch object
`out_params` : | a place to store a new GdaSet object, or `NULL`. [out][transfer full][allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occurred.

## Signal Details

### The `"changed"` signal

    void                user_function                      (GdaBatch *batch,
                                                            GObject  *changed_stmt,
                                                            gpointer  user_data)         : Run First

Gets emitted whenever a GdaStatement in the `batch` object changes

`batch` : | the GdaBatch object
`changed_stmt` : | the statement which has been changed
`user_data` : | user data set when the signal handler was connected.

## See Also

GdaStatement