## GdaBatch

GdaBatch — Multiple SQL statements grouped together.

## Stability Level

Stable, unless otherwise indicated

## Functions

GdaBatch * | gda_batch_new ()
GdaBatch * | gda_batch_copy ()
void | gda_batch_add_statement ()
void | gda_batch_remove_statement ()
gchar * | gda_batch_serialize ()
const GSList * | gda_batch_get_statements ()
gboolean | gda_batch_get_parameters ()

## Signals

void | changed | Run First

## Types and Values

| GdaBatch
enum | GdaBatchError

## Object Hierarchy

        GObject
        ╰── GdaBatch

## 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.

## Functions

### 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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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` .

#### Parameters

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`

#### Parameters

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`.

#### Parameters

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.

## Types and Values

### GdaBatch

    typedef struct _GdaBatch GdaBatch;

### enum GdaBatchError

#### Members

GDA_BATCH_CONFLICTING_PARAMETER_ERROR |  |

## Signal Details

### The `“changed”` signal

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

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

#### Parameters

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

Flags: Run First

## See Also

GdaStatement