## GdaRepetitiveStatement GdaRepetitiveStatement — Execute the same statement several times with different values |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        GdaRepetitiveStatement;
    GdaRepetitiveStatement * gda_repetitive_statement_new   (GdaStatement *stmt);
    gboolean            gda_repetitive_statement_get_template_set
                                                            (GdaRepetitiveStatement *rstmt,
                                                             GdaSet **set,
                                                             GError **error);
    GSList *            gda_repetitive_statement_get_all_sets
                                                            (GdaRepetitiveStatement *rstmt);
    gboolean            gda_repetitive_statement_append_set (GdaRepetitiveStatement *rstmt,
                                                             GdaSet *values,
                                                             gboolean make_copy);

## Description

The GdaRepetitiveStatement object allows one to specify a statement to be executed several times using different variables' values sets for each execution. Using the object has almost no interrest at all if the statement to be executed several times has no parameter.

Use the `gda_connection_repetitive_statement_execute()` method to execute the repetitive statement.

## Details

### GdaRepetitiveStatement

    typedef struct _GdaRepetitiveStatement GdaRepetitiveStatement;

### gda_repetitive_statement_new ()

    GdaRepetitiveStatement * gda_repetitive_statement_new   (GdaStatement *stmt);

Creates a new GdaRepetitiveStatement object which, when executed, will execute `stmt` once for all the values set which will have been defined using `gda_repetitive_statement_append_set()`. Use `gda_connection_repetitive_statement_execute()` to actually execute it.

`stmt` : | a GdaStatement object
Returns : | a new GdaRepetitiveStatement object

Since 4.2

### gda_repetitive_statement_get_template_set ()

    gboolean            gda_repetitive_statement_get_template_set
                                                            (GdaRepetitiveStatement *rstmt,
                                                             GdaSet **set,
                                                             GError **error);

Gets a new GdaSet object with the parameters used by the template statement in the `rstmt` object.

Use this object with `gda_repetitive_statement_append_set()`.

`rstmt` : | a GdaRepetitiveStatement object
`set` : | a place to store the returned template set
`error` : | a place to store error, or `NULL`. [allow-none]
Returns : | `TRUE` on success, `FALSE` on error

Since 4.2

### gda_repetitive_statement_get_all_sets ()

    GSList *            gda_repetitive_statement_get_all_sets
                                                            (GdaRepetitiveStatement *rstmt);

Get all the values sets which will have been added using `gda_repetitive_statement_append_set()`.

`rstmt` : | a GdaRepetitiveStatement object
Returns : | a new GSList of GdaSet objects (free with `g_slist_free()`). [transfer container][element-type GdaSet]

Since 4.2

### gda_repetitive_statement_append_set ()

    gboolean            gda_repetitive_statement_append_set (GdaRepetitiveStatement *rstmt,
                                                             GdaSet *values,
                                                             gboolean make_copy);

Specifies that `rstmt` be executed one time with the values contained in `values`.

A new GdaSet to be used as the `values` argument can be obtained using `gda_repetitive_statement_get_template_set()`.

`rstmt` : | a GdaRepetitiveStatement object
`values` : | a GdaSet object with the values to be used
`make_copy` : | `TRUE` if `values` is copied, and `FALSE` if `values` is only ref'ed
Returns : | a new GdaRepetitiveStatement object

Since 4.2

## See Also

GdaStatement, GdaBatch and GdaConnection