## GdaSqlStatement

GdaSqlStatement — SQL statement

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #include <libgda/sql-parser/gda-sql-statement.h>

                        GdaSqlStatement;
    enum                GdaSqlStatementType;
    GdaSqlStatement *   gda_sql_statement_new               (GdaSqlStatementType type);
    GdaSqlStatement *   gda_sql_statement_copy              (GdaSqlStatement *stmt);
    void                gda_sql_statement_free              (GdaSqlStatement *stmt);
    gchar *             gda_sql_statement_serialize         (GdaSqlStatement *stmt);
    const gchar *       gda_sql_statement_type_to_string    (GdaSqlStatementType type);
    GdaSqlStatementType gda_sql_statement_string_to_type    (const gchar *type);
    gboolean            gda_sql_statement_check_structure   (GdaSqlStatement *stmt,
                                                             GError **error);
    gboolean            gda_sql_statement_check_validity    (GdaSqlStatement *stmt,
                                                             GdaConnection *cnc,
                                                             GError **error);
    gboolean            gda_sql_statement_check_validity_m  (GdaSqlStatement *stmt,
                                                             GdaMetaStruct *mstruct,
                                                             GError **error);
    void                gda_sql_statement_check_clean       (GdaSqlStatement *stmt);
    gboolean            gda_sql_statement_normalize         (GdaSqlStatement *stmt,
                                                             GdaConnection *cnc,
                                                             GError **error);

    struct              GdaSqlAnyPart;
    enum                GdaSqlAnyPartType;
    #define             GDA_SQL_ANY_PART                    (x)
    gboolean            (*GdaSqlForeachFunc)                (GdaSqlAnyPart *part,
                                                             gpointer data,
                                                             GError **error);
    gboolean            gda_sql_any_part_foreach            (GdaSqlAnyPart *node,
                                                             GdaSqlForeachFunc func,
                                                             gpointer data,
                                                             GError **error);

                        GdaSqlStatementUnknown;
    void                gda_sql_statement_unknown_take_expressions
                                                            (GdaSqlStatement *stmt,
                                                             GSList *expressions);

                        GdaSqlStatementTransaction;
    void                gda_sql_statement_trans_take_mode   (GdaSqlStatement *stmt,
                                                             GValue *value);
    void                gda_sql_statement_trans_take_name   (GdaSqlStatement *stmt,
                                                             GValue *value);
    void                gda_sql_statement_trans_set_isol_level
                                                            (GdaSqlStatement *stmt,
                                                             GdaTransactionIsolation level);

                        GdaSqlStatementSelect;
    void                gda_sql_statement_select_take_distinct
                                                            (GdaSqlStatement *stmt,
                                                             gboolean distinct,
                                                             GdaSqlExpr *distinct_expr);
    void                gda_sql_statement_select_take_expr_list
                                                            (GdaSqlStatement *stmt,
                                                             GSList *expr_list);
    void                gda_sql_statement_select_take_from  (GdaSqlStatement *stmt,
                                                             GdaSqlSelectFrom *from);
    void                gda_sql_statement_select_take_where_cond
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *expr);
    void                gda_sql_statement_select_take_group_by
                                                            (GdaSqlStatement *stmt,
                                                             GSList *group_by);
    void                gda_sql_statement_select_take_having_cond
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *expr);
    void                gda_sql_statement_select_take_order_by
                                                            (GdaSqlStatement *stmt,
                                                             GSList *order_by);
    void                gda_sql_statement_select_take_limits
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *count,
                                                             GdaSqlExpr *offset);

                        GdaSqlStatementInsert;
    void                gda_sql_statement_insert_take_table_name
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);
    void                gda_sql_statement_insert_take_on_conflict
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);
    void                gda_sql_statement_insert_take_fields_list
                                                            (GdaSqlStatement *stmt,
                                                             GSList *list);
    void                gda_sql_statement_insert_take_1_values_list
                                                            (GdaSqlStatement *stmt,
                                                             GSList *list);
    void                gda_sql_statement_insert_take_extra_values_list
                                                            (GdaSqlStatement *stmt,
                                                             GSList *list);
    void                gda_sql_statement_insert_take_select
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlStatement *select);

                        GdaSqlStatementDelete;
    void                gda_sql_statement_delete_take_table_name
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);
    void                gda_sql_statement_delete_take_condition
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *cond);

                        GdaSqlStatementUpdate;
    void                gda_sql_statement_update_take_table_name
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);
    void                gda_sql_statement_update_take_on_conflict
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);
    void                gda_sql_statement_update_take_condition
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *cond);
    void                gda_sql_statement_update_take_set_value
                                                            (GdaSqlStatement *stmt,
                                                             GValue *fname,
                                                             GdaSqlExpr *expr);

                        GdaSqlStatementCompound;
    enum                GdaSqlStatementCompoundType;
    void                gda_sql_statement_compound_set_type (GdaSqlStatement *stmt,
                                                             GdaSqlStatementCompoundType type);
    void                gda_sql_statement_compound_take_stmt
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlStatement *s);

    struct              GdaSqlExpr;
    GdaSqlExpr *        gda_sql_expr_new                    (GdaSqlAnyPart *parent);
    void                gda_sql_expr_free                   (GdaSqlExpr *expr);
    GdaSqlExpr *        gda_sql_expr_copy                   (GdaSqlExpr *expr);
    gchar *             gda_sql_expr_serialize              (GdaSqlExpr *expr);
    void                gda_sql_expr_take_select            (GdaSqlExpr *expr,
                                                             GdaSqlStatement *stmt);

    struct              GdaSqlParamSpec;
    GdaSqlParamSpec *   gda_sql_param_spec_new              (GValue *simple_spec);
    GdaSqlParamSpec *   gda_sql_param_spec_copy             (GdaSqlParamSpec *pspec);
    void                gda_sql_param_spec_take_name        (GdaSqlParamSpec *pspec,
                                                             GValue *value);
    void                gda_sql_param_spec_take_type        (GdaSqlParamSpec *pspec,
                                                             GValue *value);
    void                gda_sql_param_spec_take_descr       (GdaSqlParamSpec *pspec,
                                                             GValue *value);
    void                gda_sql_param_spec_take_nullok      (GdaSqlParamSpec *pspec,
                                                             GValue *value);
    void                gda_sql_param_spec_free             (GdaSqlParamSpec *pspec);
    gchar *             gda_sql_param_spec_serialize        (GdaSqlParamSpec *pspec);

    struct              GdaSqlField;
    GdaSqlField *       gda_sql_field_new                   (GdaSqlAnyPart *parent);
    void                gda_sql_field_free                  (GdaSqlField *field);
    GdaSqlField *       gda_sql_field_copy                  (GdaSqlField *field);
    gchar *             gda_sql_field_serialize             (GdaSqlField *field);
    void                gda_sql_field_take_name             (GdaSqlField *field,
                                                             GValue *value);

    struct              GdaSqlTable;
    GdaSqlTable *       gda_sql_table_new                   (GdaSqlAnyPart *parent);
    void                gda_sql_table_free                  (GdaSqlTable *table);
    GdaSqlTable *       gda_sql_table_copy                  (GdaSqlTable *table);
    gchar *             gda_sql_table_serialize             (GdaSqlTable *table);
    void                gda_sql_table_take_name             (GdaSqlTable *table,
                                                             GValue *value);

    struct              GdaSqlFunction;
    GdaSqlFunction *    gda_sql_function_new                (GdaSqlAnyPart *parent);
    void                gda_sql_function_free               (GdaSqlFunction *function);
    GdaSqlFunction *    gda_sql_function_copy               (GdaSqlFunction *function);
    gchar *             gda_sql_function_serialize          (GdaSqlFunction *function);
    void                gda_sql_function_take_name          (GdaSqlFunction *function,
                                                             GValue *value);
    void                gda_sql_function_take_args_list     (GdaSqlFunction *function,
                                                             GSList *args);

    struct              GdaSqlOperation;
    enum                GdaSqlOperatorType;
    GdaSqlOperation *   gda_sql_operation_new               (GdaSqlAnyPart *parent);
    void                gda_sql_operation_free              (GdaSqlOperation *operation);
    GdaSqlOperation *   gda_sql_operation_copy              (GdaSqlOperation *operation);
    gchar *             gda_sql_operation_serialize         (GdaSqlOperation *operation);
    const gchar *       gda_sql_operation_operator_to_string
                                                            (GdaSqlOperatorType op);
    GdaSqlOperatorType  gda_sql_operation_operator_from_string
                                                            (const gchar *op);

    struct              GdaSqlCase;
    GdaSqlCase *        gda_sql_case_new                    (GdaSqlAnyPart *parent);
    void                gda_sql_case_free                   (GdaSqlCase *sc);
    GdaSqlCase *        gda_sql_case_copy                   (GdaSqlCase *sc);
    gchar *             gda_sql_case_serialize              (GdaSqlCase *sc);

    struct              GdaSqlSelectField;
    GdaSqlSelectField * gda_sql_select_field_new            (GdaSqlAnyPart *parent);
    void                gda_sql_select_field_free           (GdaSqlSelectField *field);
    GdaSqlSelectField * gda_sql_select_field_copy           (GdaSqlSelectField *field);
    gchar *             gda_sql_select_field_serialize      (GdaSqlSelectField *field);
    void                gda_sql_select_field_take_star_value
                                                            (GdaSqlSelectField *field,
                                                             GValue *value);
    void                gda_sql_select_field_take_expr      (GdaSqlSelectField *field,
                                                             GdaSqlExpr *expr);
    void                gda_sql_select_field_take_alias     (GdaSqlSelectField *field,
                                                             GValue *alias);

    struct              GdaSqlSelectTarget;
    GdaSqlSelectTarget * gda_sql_select_target_new          (GdaSqlAnyPart *parent);
    void                gda_sql_select_target_free          (GdaSqlSelectTarget *target);
    GdaSqlSelectTarget * gda_sql_select_target_copy         (GdaSqlSelectTarget *target);
    gchar *             gda_sql_select_target_serialize     (GdaSqlSelectTarget *target);
    void                gda_sql_select_target_take_table_name
                                                            (GdaSqlSelectTarget *target,
                                                             GValue *value);
    void                gda_sql_select_target_take_select   (GdaSqlSelectTarget *target,
                                                             GdaSqlStatement *stmt);
    void                gda_sql_select_target_take_alias    (GdaSqlSelectTarget *target,
                                                             GValue *alias);

    struct              GdaSqlSelectJoin;
    enum                GdaSqlSelectJoinType;
    GdaSqlSelectJoin *  gda_sql_select_join_new             (GdaSqlAnyPart *parent);
    void                gda_sql_select_join_free            (GdaSqlSelectJoin *join);
    GdaSqlSelectJoin *  gda_sql_select_join_copy            (GdaSqlSelectJoin *join);
    gchar *             gda_sql_select_join_serialize       (GdaSqlSelectJoin *join);
    const gchar *       gda_sql_select_join_type_to_string  (GdaSqlSelectJoinType type);

    struct              GdaSqlSelectFrom;
    GdaSqlSelectFrom *  gda_sql_select_from_new             (GdaSqlAnyPart *parent);
    void                gda_sql_select_from_free            (GdaSqlSelectFrom *from);
    GdaSqlSelectFrom *  gda_sql_select_from_copy            (GdaSqlSelectFrom *from);
    gchar *             gda_sql_select_from_serialize       (GdaSqlSelectFrom *from);
    void                gda_sql_select_from_take_new_target (GdaSqlSelectFrom *from,
                                                             GdaSqlSelectTarget *target);
    void                gda_sql_select_from_take_new_join   (GdaSqlSelectFrom *from,
                                                             GdaSqlSelectJoin *join);

    struct              GdaSqlSelectOrder;
    GdaSqlSelectOrder * gda_sql_select_order_new            (GdaSqlAnyPart *parent);
    void                gda_sql_select_order_free           (GdaSqlSelectOrder *order);
    GdaSqlSelectOrder * gda_sql_select_order_copy           (GdaSqlSelectOrder *order);
    gchar *             gda_sql_select_order_serialize      (GdaSqlSelectOrder *order);

    gchar *             gda_sql_value_stringify             (const GValue *value);

## Description

Use the GdaSqlBuilder object to build GdaSqlStatement structures.

Every SQL statement can be decomposed in a GdaSqlStatement structure. This is not a GObject, but rather just a C structure which can be manipulated directly. The structure is a tree composed of several key structures which are show in the following diagram (even though it does not show, all structures "inherit" the GdaSqlAnyPart structure which holds some basic information).

Main parts of the GdaSqlStatement structure.

The samples/SqlParserConsole directory of Libgda's sources contains a small utility to display statements' structures as a graph (using the GraphViz language). It has been used to provide the examples in this section of the documentation.

## Details

### GdaSqlStatement

    typedef struct {
    	gchar               *sql;
    	GdaSqlStatementType  stmt_type;
    	gpointer             contents; /* depends on stmt_type */
    	GdaMetaStruct       *validity_meta_struct; /* set when gda_sql_statement_check_validity() was last called */
    } GdaSqlStatement;

This structure is the top level structure encapsulating several type of statements.

gchar *`sql`; |
GdaSqlStatementType `stmt_type`; | type of statement
gpointer `contents`; | contents, cast it depending on `stmt_type` (for example to a GdaSqlStatementSelect).
GdaMetaStruct *`validity_meta_struct`; |

### enum GdaSqlStatementType

    typedef enum {
    	GDA_SQL_STATEMENT_SELECT,
    	GDA_SQL_STATEMENT_INSERT,
    	GDA_SQL_STATEMENT_UPDATE,
    	GDA_SQL_STATEMENT_DELETE,
    	GDA_SQL_STATEMENT_COMPOUND,

    	GDA_SQL_STATEMENT_BEGIN,
    	GDA_SQL_STATEMENT_ROLLBACK,
    	GDA_SQL_STATEMENT_COMMIT,

    	GDA_SQL_STATEMENT_SAVEPOINT,
    	GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT,
    	GDA_SQL_STATEMENT_DELETE_SAVEPOINT,

    	GDA_SQL_STATEMENT_UNKNOWN,
    	GDA_SQL_STATEMENT_NONE
    } GdaSqlStatementType;

Known types of statements

`GDA_SQL_STATEMENT_SELECT` | a SELECT statement
`GDA_SQL_STATEMENT_INSERT` | an INSERT statement
`GDA_SQL_STATEMENT_UPDATE` | an UPDATE statement
`GDA_SQL_STATEMENT_DELETE` | a DELETE statement
`GDA_SQL_STATEMENT_COMPOUND` | a compound statement: multiple SELECT statements grouped together using an operator
`GDA_SQL_STATEMENT_BEGIN` | start of transaction statement
`GDA_SQL_STATEMENT_ROLLBACK` | transaction abort statement
`GDA_SQL_STATEMENT_COMMIT` | transaction commit statement
`GDA_SQL_STATEMENT_SAVEPOINT` | new savepoint definition statement
`GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT` | return to savepoint statement
`GDA_SQL_STATEMENT_DELETE_SAVEPOINT` | savepoint deletion statement
`GDA_SQL_STATEMENT_UNKNOWN` | unknown statement, only identifies variables
`GDA_SQL_STATEMENT_NONE` | not used

### gda_sql_statement_new ()

    GdaSqlStatement *   gda_sql_statement_new               (GdaSqlStatementType type);

Use this function to create a GdaSqlStatement of the specified `type` type.

`type` : | type of statement to create
Returns : | a new GdaSqlStatement

### gda_sql_statement_copy ()

    GdaSqlStatement *   gda_sql_statement_copy              (GdaSqlStatement *stmt);

Creates a copy of `stmt`.

`stmt` : | a GdaSqlStatement pointer
Returns : | a new GdaSqlStatement

### gda_sql_statement_free ()

    void                gda_sql_statement_free              (GdaSqlStatement *stmt);

Releases any memory associated to `stmt`.

`stmt` : | a GdaSqlStatement pointer

### gda_sql_statement_serialize ()

    gchar *             gda_sql_statement_serialize         (GdaSqlStatement *stmt);

Creates a string representation of `stmt`.

`stmt` : | a GdaSqlStatement pointer
Returns : | a new string

### gda_sql_statement_type_to_string ()

    const gchar *       gda_sql_statement_type_to_string    (GdaSqlStatementType type);

Converts a GdaSqlStatementType to a string, see also `gda_sql_statement_string_to_type()`

`type` : | a GdaSqlStatementType value
Returns : | a constant string

### gda_sql_statement_string_to_type ()

    GdaSqlStatementType gda_sql_statement_string_to_type    (const gchar *type);

Converts a string to a GdaSqlStatementType value, see also `gda_sql_statement_type_to_string()`

`type` : | a string representing a GdaSqlStatementType type
Returns : | a GdaSqlStatementType value

### gda_sql_statement_check_structure ()

    gboolean            gda_sql_statement_check_structure   (GdaSqlStatement *stmt,
                                                             GError **error);

Checks for any error in `stmt`'s structure to make sure the statement is valid (for example a SELECT statement must at least return a column, a DELETE statement must specify which table is targeted).

`stmt` : | a GdaSqlStatement pointer
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occurred

### gda_sql_statement_check_validity ()

    gboolean            gda_sql_statement_check_validity    (GdaSqlStatement *stmt,
                                                             GdaConnection *cnc,
                                                             GError **error);

If `cnc` is not `NULL`, then checks that all the database objects referenced in the statement actually exist in the connection's database (for example the table being updated in a UPDATE statement must exist in the connection's database for the check to succeed). This method fills the `stmt`->validity_meta_struct attribute.

If `cnc` is `NULL`, then remove any information from a previous call to this method stored in `stmt`. In this case, the `stmt`->validity_meta_struct attribute is cleared.

Also note that some parts of `stmt` may be modified: for example leading and trailing spaces in aliases or objects names will be removed.

`stmt` : | a GdaSqlStatement pointer
`cnc` : | a GdaConnection object, or `NULL`. [allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occurred

### gda_sql_statement_check_validity_m ()

    gboolean            gda_sql_statement_check_validity_m  (GdaSqlStatement *stmt,
                                                             GdaMetaStruct *mstruct,
                                                             GError **error);

If `mstruct` is not `NULL`, then checks that all the database objects referenced in the statement i actually referenced in `mstruct` (for example the table being updated in a UPDATE statement must exist in the connection's database for the check to succeed). This method sets the `stmt`->validity_meta_struct attribute to `mstruct`.

If `mstruct` is `NULL`, then remove any information from a previous call to this method stored in `stmt`. In this case, the `stmt`->validity_meta_struct attribute is cleared.

Also note that some parts of `stmt` may be modified: for example leading and trailing spaces in aliases or objects names will be removed.

`stmt` : | a GdaSqlStatement pointer
`mstruct` : | a GdaMetaStruct object, or `NULL`. [allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occurred

Since 4.2

### gda_sql_statement_check_clean ()

    void                gda_sql_statement_check_clean       (GdaSqlStatement *stmt);

Cleans any data set by a previous call to `gda_sql_statement_check_validity()`.

`stmt` : | a pinter to a GdaSqlStatement structure

### gda_sql_statement_normalize ()

    gboolean            gda_sql_statement_normalize         (GdaSqlStatement *stmt,
                                                             GdaConnection *cnc,
                                                             GError **error);

"Normalizes" (in place) some parts of `stmt`, which means `stmt` may be modified. At the moment any "*" field in a SELECT statement will be replaced by one GdaSqlSelectField structure for each field in the referenced table.

`stmt` : | a pointer to a GdaSqlStatement structure
`cnc` : | a GdaConnection object, or `NULL`. [allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occurred

### struct GdaSqlAnyPart

    struct GdaSqlAnyPart {
    	GdaSqlAnyPartType  type;
    	GdaSqlAnyPart     *parent;
    };

Base structure of which all structures (except GdaSqlStatement) "inherit". It identifies, for each structure, its type and its parent in the structure hierarchy.

GdaSqlAnyPartType `type`; | type of structure, as a GdaSqlAnyPartType enum.
GdaSqlAnyPart *`parent`; | pointer to the parent GdaSqlAnyPart structure

### enum GdaSqlAnyPartType

    typedef enum {
    	/* complete statements */
    	GDA_SQL_ANY_STMT_SELECT = GDA_SQL_STATEMENT_SELECT,
    	GDA_SQL_ANY_STMT_INSERT = GDA_SQL_STATEMENT_INSERT,
    	GDA_SQL_ANY_STMT_UPDATE = GDA_SQL_STATEMENT_UPDATE,
    	GDA_SQL_ANY_STMT_DELETE = GDA_SQL_STATEMENT_DELETE,
    	GDA_SQL_ANY_STMT_COMPOUND = GDA_SQL_STATEMENT_COMPOUND,
    	GDA_SQL_ANY_STMT_BEGIN = GDA_SQL_STATEMENT_BEGIN,
    	GDA_SQL_ANY_STMT_ROLLBACK = GDA_SQL_STATEMENT_ROLLBACK,
    	GDA_SQL_ANY_STMT_COMMIT = GDA_SQL_STATEMENT_COMMIT,
    	GDA_SQL_ANY_STMT_SAVEPOINT = GDA_SQL_STATEMENT_SAVEPOINT,
    	GDA_SQL_ANY_STMT_ROLLBACK_SAVEPOINT = GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT,
    	GDA_SQL_ANY_STMT_DELETE_SAVEPOINT = GDA_SQL_STATEMENT_DELETE_SAVEPOINT,
    	GDA_SQL_ANY_STMT_UNKNOWN = GDA_SQL_STATEMENT_UNKNOWN,

    	/* individual parts */
    	GDA_SQL_ANY_EXPR = 500,
    	GDA_SQL_ANY_SQL_FIELD,
    	GDA_SQL_ANY_SQL_TABLE,
    	GDA_SQL_ANY_SQL_FUNCTION,
    	GDA_SQL_ANY_SQL_OPERATION,
    	GDA_SQL_ANY_SQL_CASE,
    	GDA_SQL_ANY_SQL_SELECT_FIELD,
    	GDA_SQL_ANY_SQL_SELECT_TARGET,
    	GDA_SQL_ANY_SQL_SELECT_JOIN,
    	GDA_SQL_ANY_SQL_SELECT_FROM,
    	GDA_SQL_ANY_SQL_SELECT_ORDER
    } GdaSqlAnyPartType;

Type of part.

`GDA_SQL_ANY_STMT_SELECT` | structure is a GdaSqlStatementSelect
`GDA_SQL_ANY_STMT_INSERT` | structure is a GdaSqlStatementInsert
`GDA_SQL_ANY_STMT_UPDATE` | structure is a GdaSqlStatementUpdate
`GDA_SQL_ANY_STMT_DELETE` | structure is a GdaSqlStatementDelete
`GDA_SQL_ANY_STMT_COMPOUND` | structure is a GdaSqlStatementCompound
`GDA_SQL_ANY_STMT_BEGIN` | structure is a GdaSqlStatementTransaction
`GDA_SQL_ANY_STMT_ROLLBACK` | structure is a GdaSqlStatementTransaction
`GDA_SQL_ANY_STMT_COMMIT` | structure is a GdaSqlStatementTransaction
`GDA_SQL_ANY_STMT_SAVEPOINT` | structure is a GdaSqlStatementTransaction
`GDA_SQL_ANY_STMT_ROLLBACK_SAVEPOINT` | structure is a GdaSqlStatementTransaction
`GDA_SQL_ANY_STMT_DELETE_SAVEPOINT` | structure is a GdaSqlStatementTransaction
`GDA_SQL_ANY_STMT_UNKNOWN` | structure is a GdaSqlStatementUnknown
`GDA_SQL_ANY_EXPR` | structure is a GdaSqlExpr
`GDA_SQL_ANY_SQL_FIELD` | structure is a GdaSqlField
`GDA_SQL_ANY_SQL_TABLE` | structure is a GdaSqlTable
`GDA_SQL_ANY_SQL_FUNCTION` | structure is a GdaSqlFunction
`GDA_SQL_ANY_SQL_OPERATION` | structure is a GdaSqlOperation
`GDA_SQL_ANY_SQL_CASE` | structure is a GdaSqlCase
`GDA_SQL_ANY_SQL_SELECT_FIELD` | structure is a GdaSqlSelectField
`GDA_SQL_ANY_SQL_SELECT_TARGET` | structure is a GdaSqlSelectTarget
`GDA_SQL_ANY_SQL_SELECT_JOIN` | structure is a GdaSqlSelectJoin
`GDA_SQL_ANY_SQL_SELECT_FROM` | structure is a GdaSqlSelectFrom
`GDA_SQL_ANY_SQL_SELECT_ORDER` | structure is a GdaSqlSelectOrder

### GDA_SQL_ANY_PART()

    #define GDA_SQL_ANY_PART(x) ((GdaSqlAnyPart*)(x))

### GdaSqlForeachFunc ()

    gboolean            (*GdaSqlForeachFunc)                (GdaSqlAnyPart *part,
                                                             gpointer data,
                                                             GError **error);

Specifies the type of functions passed to `gda_sql_any_part_foreach()`.

`part` : | the current GdaSqlAnyPart node
`data` : | user data passed to `gda_sql_any_part_foreach()`.
`error` : | pointer to a place to store errors
Returns : | FALSE if the `gda_sql_any_part_foreach()` should stop at this point and fail

### gda_sql_any_part_foreach ()

    gboolean            gda_sql_any_part_foreach            (GdaSqlAnyPart *node,
                                                             GdaSqlForeachFunc func,
                                                             gpointer data,
                                                             GError **error);

Calls a function for each element of a GdaSqlAnyPart node

`node` : | the stat node
`func` : | function to call for each sub node. [scope call]
`data` : | data to pass to `func` each time it is called. [closure]
`error` : | a place to store errors, or `NULL` (is also passed to `func`)
Returns : | TRUE if `func` has been called for any sub node of `node` and always returned TRUE, or FALSE otherwise.

### GdaSqlStatementUnknown

    typedef struct {
    	GdaSqlAnyPart  any;
    	GSList        *expressions;
    } GdaSqlStatementUnknown;

Represents any statement which type is not identified (any DDL statement or database specific dialect)

GdaSqlAnyPart `any`; |
GSList *`expressions`; | a list of GdaSqlExpr pointers

### gda_sql_statement_unknown_take_expressions ()

    void                gda_sql_statement_unknown_take_expressions
                                                            (GdaSqlStatement *stmt,
                                                             GSList *expressions);

Sets `stmt`'s list of expressions

`expressions`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`expressions` : | a list of GdaSqlExpr pointers

### GdaSqlStatementTransaction

    typedef struct {
    	GdaSqlAnyPart           any;
    	GdaTransactionIsolation isolation_level;
    	gchar                  *trans_mode; /* DEFERRED, IMMEDIATE, EXCLUSIVE, READ_WRITE, READ_ONLY */
    	gchar                  *trans_name;
    } GdaSqlStatementTransaction;

The statement is a transaction management related statement (BEGIN, ROLLBACK, etc). The GdaSqlStatementTransaction structure does not hold enough information to reconstruct the complete SQL statement (some information may be missing) - the aim of this structure is to identify a minimum set of information in the transaction statement. Note that the complete SQL which created the statement should be available in the GdaSqlStatement structure which encapsulates this structure.

GdaSqlAnyPart `any`; | inheritance structure
GdaTransactionIsolation `isolation_level`; | isolation level as a GdaTransactionIsolation
gchar *`trans_mode`; | transaction mode (DEFERRED, IMMEDIATE, EXCLUSIVE, READ_WRITE, READ_ONLY)
gchar *`trans_name`; | transaction name

### gda_sql_statement_trans_take_mode ()

    void                gda_sql_statement_trans_take_mode   (GdaSqlStatement *stmt,
                                                             GValue *value);

Sets the model of the transaction

`value`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`value` : | a G_TYPE_STRING value. [transfer full]

### gda_sql_statement_trans_take_name ()

    void                gda_sql_statement_trans_take_name   (GdaSqlStatement *stmt,
                                                             GValue *value);

Sets the name of the transaction

`value`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`value` : | a G_TYPE_STRING value. [transfer full]

### gda_sql_statement_trans_set_isol_level ()

    void                gda_sql_statement_trans_set_isol_level
                                                            (GdaSqlStatement *stmt,
                                                             GdaTransactionIsolation level);

### GdaSqlStatementSelect

    typedef struct {
    	GdaSqlAnyPart     any;
    	gboolean          distinct;
    	GdaSqlExpr       *distinct_expr;

    	GSList           *expr_list;  /* list of GdaSqlSelectField pointers */
    	GdaSqlSelectFrom *from;

    	GdaSqlExpr       *where_cond; /* WHERE... */
    	GSList           *group_by; /* list of GdaSqlExpr pointers */
    	GdaSqlExpr       *having_cond; /* HAVING... */
    	GSList           *order_by;   /* list of GdaSqlSelectOrder pointers */

    	GdaSqlExpr       *limit_count;
    	GdaSqlExpr       *limit_offset;
    } GdaSqlStatementSelect;

### gda_sql_statement_select_take_distinct ()

    void                gda_sql_statement_select_take_distinct
                                                            (GdaSqlStatement *stmt,
                                                             gboolean distinct,
                                                             GdaSqlExpr *distinct_expr);

Sets the DISTINCT clause of `stmt`.

`distinct_expr`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`distinct` : | a TRUE/FALSE value
`distinct_expr` : | a GdaSqlExpr pointer representing what the DISTINCT is on, or `NULL`. [allow-none]

### gda_sql_statement_select_take_expr_list ()

    void                gda_sql_statement_select_take_expr_list
                                                            (GdaSqlStatement *stmt,
                                                             GSList *expr_list);

Sets list of expressions selected by `stmt`

`expr_list`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`expr_list` : | a list of GdaSqlSelectField pointers

### gda_sql_statement_select_take_from ()

    void                gda_sql_statement_select_take_from  (GdaSqlStatement *stmt,
                                                             GdaSqlSelectFrom *from);

Sets the FROM clause of `stmt`

`from`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`from` : | a GdaSqlSelectFrom pointer

### gda_sql_statement_select_take_where_cond ()

    void                gda_sql_statement_select_take_where_cond
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *expr);

Sets the WHERE clause of `stmt`

`expr`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`expr` : | a GdaSqlExpr pointer

### gda_sql_statement_select_take_group_by ()

    void                gda_sql_statement_select_take_group_by
                                                            (GdaSqlStatement *stmt,
                                                             GSList *group_by);

Sets the GROUP BY clause of `stmt`

`group_by`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`group_by` : | a list of GdaSqlExpr pointer

### gda_sql_statement_select_take_having_cond ()

    void                gda_sql_statement_select_take_having_cond
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *expr);

Sets the HAVING clause of `stmt`

`expr`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`expr` : | a GdaSqlExpr pointer

### gda_sql_statement_select_take_order_by ()

    void                gda_sql_statement_select_take_order_by
                                                            (GdaSqlStatement *stmt,
                                                             GSList *order_by);

Sets the ORDER BY clause of `stmt`

`order_by`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`order_by` : | a list of GdaSqlSelectOrder pointer

### gda_sql_statement_select_take_limits ()

    void                gda_sql_statement_select_take_limits
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *count,
                                                             GdaSqlExpr *offset);

Sets the LIMIT clause of `stmt`

`count` and `offset`'s responsibility are transferred to `stmt` (which means `stmt` is then responsible for freeing them when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`count` : | a GdaSqlExpr pointer
`offset` : | a GdaSqlExpr pointer

### GdaSqlStatementInsert

    typedef struct {
    	GdaSqlAnyPart           any;
    	gchar                  *on_conflict; /* conflict resolution clause */
    	GdaSqlTable            *table;
    	GSList                 *fields_list; /* list of GdaSqlField structures */
    	GSList                 *values_list; /* list of list of GdaSqlExpr */
    	GdaSqlAnyPart          *select; /* SELECT OR COMPOUND statements: GdaSqlStatementSelect or GdaSqlStatementCompound */
    } GdaSqlStatementInsert;

The statement is an INSERT statement, any kind of INSERT statement can be represented using this structure (if this is not the case then report a bug).

Example of a GdaSqlStatement having a GdaSqlStatementInsert as its contents with 2 lists of values to insert.

Another example of a GdaSqlStatement having a GdaSqlStatementInsert as its contents, using a SELECT to express the values to insert.

GdaSqlAnyPart `any`; | inheritance structure
gchar *`on_conflict`; | conflict resolution clause if there is one (such as "OR REPLACE")
GdaSqlTable *`table`; | name of the table to which data is inserted
GSList *`fields_list`; | list of GdaSqlField fields which are valued for insertion
GSList *`values_list`; | list of list of GdaSqlExpr expressions (this is a list of list, not a simple list)
GdaSqlAnyPart *`select`; | a GdaSqlStatementSelect or GdaSqlStatementCompound structure representing the values to insert

### gda_sql_statement_insert_take_table_name ()

    void                gda_sql_statement_insert_take_table_name
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);

Sets the name of the table to insert into in `stmt`. `value`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`value` : | name of the table to insert into, as a G_TYPE_STRING GValue

### gda_sql_statement_insert_take_on_conflict ()

    void                gda_sql_statement_insert_take_on_conflict
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);

Sets the name of the resolution conflict algorithm used by `stmt`. `value`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`value` : | name of the resolution conflict algorithm, as a G_TYPE_STRING GValue

### gda_sql_statement_insert_take_fields_list ()

    void                gda_sql_statement_insert_take_fields_list
                                                            (GdaSqlStatement *stmt,
                                                             GSList *list);

Sets the list of fields for which values will be specified in `stmt`. `list`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`list` : | a list of GdaSqlField pointers

### gda_sql_statement_insert_take_1_values_list ()

    void                gda_sql_statement_insert_take_1_values_list
                                                            (GdaSqlStatement *stmt,
                                                             GSList *list);

Sets a list of list of values to be inserted by `stmt`. `list`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`list` : | a list of GSList of GdaSqlExpr pointers

### gda_sql_statement_insert_take_extra_values_list ()

    void                gda_sql_statement_insert_take_extra_values_list
                                                            (GdaSqlStatement *stmt,
                                                             GSList *list);

### gda_sql_statement_insert_take_select ()

    void                gda_sql_statement_insert_take_select
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlStatement *select);

Specifies a SELECT statement, the values inserted will be the result set of `select`. `select`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`select` : | a SELECT or COMPOUND GdaSqlStatement pointer

### GdaSqlStatementDelete

    typedef struct {
    	GdaSqlAnyPart any;
    	GdaSqlTable  *table;
    	GdaSqlExpr   *cond;
    } GdaSqlStatementDelete;

### gda_sql_statement_delete_take_table_name ()

    void                gda_sql_statement_delete_take_table_name
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);

Sets the name of the table to delete from in `stmt`. `value`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`value` : | a table name as a G_TYPE_STRING GValue

### gda_sql_statement_delete_take_condition ()

    void                gda_sql_statement_delete_take_condition
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *cond);

Sets the WHERE condition of `stmt`. `cond`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`cond` : | the WHERE condition of the DELETE statement, as a GdaSqlExpr

### GdaSqlStatementUpdate

    typedef struct {
    	GdaSqlAnyPart     any;
    	gchar            *on_conflict; /* conflict resolution clause */
    	GdaSqlTable      *table;
    	GSList           *fields_list; /* list of GdaSqlField pointers */
    	GSList           *expr_list;   /* list of GdaSqlExpr pointers */
    	GdaSqlExpr       *cond;
    } GdaSqlStatementUpdate;

### gda_sql_statement_update_take_table_name ()

    void                gda_sql_statement_update_take_table_name
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);

Sets the name of the table to delete from in `stmt`.

`value`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`value` : | a table name, as a G_TYPE_STRING GValue

### gda_sql_statement_update_take_on_conflict ()

    void                gda_sql_statement_update_take_on_conflict
                                                            (GdaSqlStatement *stmt,
                                                             GValue *value);

Sets the name of the resolution conflict algorithm used by `stmt`. `value`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`value` : | name of the resolution conflict algorithm, as a G_TYPE_STRING GValue

### gda_sql_statement_update_take_condition ()

    void                gda_sql_statement_update_take_condition
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlExpr *cond);

Sets the WHERE clause of `stmt`

`expr`'s ownership is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`cond` : | a GdaSqlExpr pointer

### gda_sql_statement_update_take_set_value ()

    void                gda_sql_statement_update_take_set_value
                                                            (GdaSqlStatement *stmt,
                                                             GValue *fname,
                                                             GdaSqlExpr *expr);

Specifies that the field named `fname` will be updated with the expression `expr`.

`fname` and `expr`'s responsibility are transferred to `stmt` (which means `stmt` is then responsible for freeing them when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`fname` : | a field name, as a G_TYPE_STRING GValue
`expr` : | a GdaSqlExpr pointer

### GdaSqlStatementCompound

    typedef struct {
    	GdaSqlAnyPart                any;
    	GdaSqlStatementCompoundType  compound_type;
    	GSList                      *stmt_list; /* list of SELECT or COMPOUND statements */
    } GdaSqlStatementCompound;

### enum GdaSqlStatementCompoundType

    typedef enum {
    	GDA_SQL_STATEMENT_COMPOUND_UNION,
    	GDA_SQL_STATEMENT_COMPOUND_UNION_ALL,
    	GDA_SQL_STATEMENT_COMPOUND_INTERSECT,
    	GDA_SQL_STATEMENT_COMPOUND_INTERSECT_ALL,
    	GDA_SQL_STATEMENT_COMPOUND_EXCEPT,
    	GDA_SQL_STATEMENT_COMPOUND_EXCEPT_ALL
    } GdaSqlStatementCompoundType;

`GDA_SQL_STATEMENT_COMPOUND_UNION` |
`GDA_SQL_STATEMENT_COMPOUND_UNION_ALL` |
`GDA_SQL_STATEMENT_COMPOUND_INTERSECT` |
`GDA_SQL_STATEMENT_COMPOUND_INTERSECT_ALL` |
`GDA_SQL_STATEMENT_COMPOUND_EXCEPT` |
`GDA_SQL_STATEMENT_COMPOUND_EXCEPT_ALL` |

### gda_sql_statement_compound_set_type ()

    void                gda_sql_statement_compound_set_type (GdaSqlStatement *stmt,
                                                             GdaSqlStatementCompoundType type);

Specifies `stmt`'s type of compound

`stmt` : | a GdaSqlStatement pointer
`type` : | a GdaSqlStatementCompoundType value

### gda_sql_statement_compound_take_stmt ()

    void                gda_sql_statement_compound_take_stmt
                                                            (GdaSqlStatement *stmt,
                                                             GdaSqlStatement *s);

Adds the `s` sub-statement to the `stmt` compound statement. `s`'s reference is transferred to `stmt` (which means `stmt` is then responsible for freeing it when no longer needed).

`stmt` : | a GdaSqlStatement pointer
`s` : | a GdaSqlStatement pointer

### struct GdaSqlExpr

    struct GdaSqlExpr {
    	GdaSqlAnyPart    any;
    	GValue          *value;
    	GdaSqlParamSpec *param_spec;
    	GdaSqlFunction  *func;
    	GdaSqlOperation *cond;
    	GdaSqlAnyPart   *select; /* SELECT OR COMPOUND statements: GdaSqlStatementSelect or GdaSqlStatementCompound */
    	GdaSqlCase      *case_s;

    	gchar           *cast_as;

    	gboolean         value_is_ident;
    };

This structure contains any expression, either as a value (the `value` part is set), a variable (the `param_spec` is set), or as other types of expressions.

Note 1 about the `value` field: if the expression represents a string value in the SQL statement, the string itself must be represented as it would be in the actual SQL, ie. it should be escaped (accordingly to the escaping rules of the database which will use the SQL). For example a string representing the `'joe'` value should be `"'joe'"` and not `"joe"`.

Note 2 about the `value` field: if the expression represents an SQL identifier (such as a table or field name), then the `value_is_ident` should be set to `TRUE`, and `value` should be a string which may contain double quotes around SQL identifiers which also are reserved keywords or which are case sensitive.

GdaSqlAnyPart `any`; | inheritance structure
GValue *`value`; | a GValue, or `NULL`. Please see specific note about this field. [allow-none]
GdaSqlParamSpec *`param_spec`; | a GdaSqlParamSpec, or `NULL` if this is not a variable. [allow-none]
GdaSqlFunction *`func`; | not `NULL` if expression is a function or aggregate. [allow-none]
GdaSqlOperation *`cond`; | not `NULL` if expression is a condition or an operation. [allow-none]
GdaSqlAnyPart *`select`; | not `NULL` if expression is a sub select statement (GdaSqlStatementSelect or GdaSqlStatementCompound). [allow-none]
GdaSqlCase *`case_s`; | not `NULL` if expression is a CASE WHEN ... expression. [allow-none]
gchar *`cast_as`; | not `NULL` if expression must be cast to another data type. [allow-none]
gboolean `value_is_ident`; | Please see specific note about the `value` field

### gda_sql_expr_new ()

    GdaSqlExpr *        gda_sql_expr_new                    (GdaSqlAnyPart *parent);

Creates a new GdaSqlField structure, using `parent` as its parent part.

`parent` : | a GdaSqlStatementInsert, GdaSqlStatementUpdate, GdaSqlSelectField, GdaSqlSelectTarget, GdaSqlOperation
Returns : | a new GdaSqlField structure.

### gda_sql_expr_free ()

    void                gda_sql_expr_free                   (GdaSqlExpr *expr);

Frees a GdaSqlExpr structure and its members.

`expr` : | a GdaSqlExpr to be freed.

### gda_sql_expr_copy ()

    GdaSqlExpr *        gda_sql_expr_copy                   (GdaSqlExpr *expr);

Creates a new GdaSqlExpr structure initiated with the values stored in `expr`.

`expr` : | a GdaSqlExpr
Returns : | a new GdaSqlExpr structure.

### gda_sql_expr_serialize ()

    gchar *             gda_sql_expr_serialize              (GdaSqlExpr *expr);

Creates a new string representation of the SQL expression. You need to free the returned string using `g_free()`;

`expr` : | a GdaSqlExpr structure
Returns : | a new string with the SQL expression or "null" in case `expr` is invalid.

### gda_sql_expr_take_select ()

    void                gda_sql_expr_take_select            (GdaSqlExpr *expr,
                                                             GdaSqlStatement *stmt);

Sets the expression's parent to the GdaSqlStatementSelect held by `stmt`. After calling this function `stmt` is freed.

`expr` : | a GdaSqlExpr structure
`stmt` : | a GdaSqlStatement holding the GdaSqlStatementSelect to take from

### struct GdaSqlParamSpec

    struct GdaSqlParamSpec {
    	gchar    *name;
    	gchar    *descr;
    	gboolean  is_param;
    	gboolean  nullok;

    	GType     g_type;
    	gpointer  validity_meta_dict; /* to be replaced with a pointer to a structure representing a DBMS data type in GdaMetaStruct */

    	/* Padding for future expansion */
    	gpointer         _gda_reserved1;
    	gpointer         _gda_reserved2;
    };

### gda_sql_param_spec_new ()

    GdaSqlParamSpec *   gda_sql_param_spec_new              (GValue *simple_spec);

`value` must contain a string representing a variable, see the documentation associated to the GdaSqlParser object.

`value` is destroyed by this function.

`value` : | a G_TYPE_STRING GValue. [transfer full]
Returns : | a new GdaSqlParamSpec

### gda_sql_param_spec_copy ()

    GdaSqlParamSpec *   gda_sql_param_spec_copy             (GdaSqlParamSpec *pspec);

Creates a copy of `pspec`.

`pspec` : | GdaSqlParamSpec pointer
Returns : | a new GdaSqlParamSpec

### gda_sql_param_spec_take_name ()

    void                gda_sql_param_spec_take_name        (GdaSqlParamSpec *pspec,
                                                             GValue *value);

Sets `pspec`'s name. `value`'s ownership is transferred to `pspec` (which means `pspec` is then responsible for freeing it when no longer needed).

`pspec` : | a GdaSqlParamSpec pointer
`value` : | a G_TYPE_STRING GValue. [transfer full]

### gda_sql_param_spec_take_type ()

    void                gda_sql_param_spec_take_type        (GdaSqlParamSpec *pspec,
                                                             GValue *value);

Sets `pspec`'s data type. `value`'s ownership is transferred to `pspec` (which means `pspec` is then responsible for freeing it when no longer needed).

`value` must represent a data type, as understood by `gda_g_type_from_string()`.

`pspec` : | a GdaSqlParamSpec pointer
`value` : | a G_TYPE_STRING GValue. [transfer full]

### gda_sql_param_spec_take_descr ()

    void                gda_sql_param_spec_take_descr       (GdaSqlParamSpec *pspec,
                                                             GValue *value);

Sets `pspec`'s description. `value`'s ownership is transferred to `pspec` (which means `pspec` is then responsible for freeing it when no longer needed).

`pspec` : | a GdaSqlParamSpec pointer
`value` : | a G_TYPE_STRING GValue. [transfer full]

### gda_sql_param_spec_take_nullok ()

    void                gda_sql_param_spec_take_nullok      (GdaSqlParamSpec *pspec,
                                                             GValue *value);

Sets `pspec`'s ability of being NULL. `value`'s ownership is transferred to `pspec` (which means `pspec` is then responsible for freeing it when no longer needed).

If `value`'s string starts by 't' or 'T' then `pspec` will be allowed to be `NULL`

`pspec` : | a GdaSqlParamSpec pointer
`value` : | a G_TYPE_STRING GValue. [transfer full]

### gda_sql_param_spec_free ()

    void                gda_sql_param_spec_free             (GdaSqlParamSpec *pspec);

Destroys `pspec`.

`pspec` : | GdaSqlParamSpec pointer

### gda_sql_param_spec_serialize ()

    gchar *             gda_sql_param_spec_serialize        (GdaSqlParamSpec *pspec);

Creates a new string representing `pspec`.

`pspec` : | a GdaSqlParamSpec pointer
Returns : | a new string.

### struct GdaSqlField

    struct GdaSqlField {
    	GdaSqlAnyPart       any;
    	gchar              *field_name;

    	/* validity check with a connection */
    	GdaMetaTableColumn *validity_meta_table_column;
    };

This structure represents the name of a table's field.

### gda_sql_field_new ()

    GdaSqlField *       gda_sql_field_new                   (GdaSqlAnyPart *parent);

Creates a new GdaSqlField structure, using `parent` as its parent part.

`parent` : | a GdaSqlStatementSelect, GdaSqlStatementInsert, GdaSqlStatementDelete, GdaSqlStatementUpdate
Returns : | a new GdaSqlField structure.

### gda_sql_field_free ()

    void                gda_sql_field_free                  (GdaSqlField *field);

Frees a GdaSqlField structure and its members.

`field` : | a GdaSqlField to be freed.

### gda_sql_field_copy ()

    GdaSqlField *       gda_sql_field_copy                  (GdaSqlField *field);

Creates a new GdaSqlField structure initiated with the values stored in `field`.

`field` : | a GdaSqlAnyPart
Returns : | a new GdaSqlField structure.

### gda_sql_field_serialize ()

    gchar *             gda_sql_field_serialize             (GdaSqlField *field);

Creates a new string representing a field. You need to free the returned string using `g_free()`;

`field` : | a GdaSqlField structure
Returns : | a new string with the name of the field or "null" in case `field` is invalid.

### gda_sql_field_take_name ()

    void                gda_sql_field_take_name             (GdaSqlField *field,
                                                             GValue *value);

Sets the field's name using the string held by `value`. When call, `value` is freed using #`gda_value_free()`.

`field` : | a GdaSqlField structure
`value` : | a GValue holding a string to take from

### struct GdaSqlTable

    struct GdaSqlTable {
    	GdaSqlAnyPart       any;
    	gchar              *table_name;

    	/* validity check with a connection */
    	GdaMetaDbObject    *validity_meta_object;
    };

This structure represents the name of a table.

### gda_sql_table_new ()

    GdaSqlTable *       gda_sql_table_new                   (GdaSqlAnyPart *parent);

Creates a new GdaSqlTable structure, using `parent` as its parent part.

`parent` : | a GdaSqlStatementSelect, GdaSqlStatementInsert, GdaSqlStatementDelete, GdaSqlStatementUpdate
Returns : | a new GdaSqlTable structure.

### gda_sql_table_free ()

    void                gda_sql_table_free                  (GdaSqlTable *table);

Frees a GdaSqlTable structure and its members.

`table` : | a GdaSqlTable structure to be freed

### gda_sql_table_copy ()

    GdaSqlTable *       gda_sql_table_copy                  (GdaSqlTable *table);

Creates a new GdaSqlTable structure initiated with the values stored in `table`.

`table` : | a GdaSqlTable structure to be copied
Returns : | a new GdaSqlTable structure.

### gda_sql_table_serialize ()

    gchar *             gda_sql_table_serialize             (GdaSqlTable *table);

Creates a new string representing a table. You need to free the returned string using `g_free()`;

`field` : | a GdaSqlTable structure
Returns : | a new string with the name of the field or "null" in case `table` is invalid.

### gda_sql_table_take_name ()

    void                gda_sql_table_take_name             (GdaSqlTable *table,
                                                             GValue *value);

Sets the table's name using the string held by `value`. When call, `value` is freed using `gda_value_free()`.

`field` : | a GdaSqlTable structure
`value` : | a GValue holding a string to take from

### struct GdaSqlFunction

    struct GdaSqlFunction {
    	GdaSqlAnyPart       any;
    	gchar              *function_name;
    	GSList             *args_list;
    };

This structure represents a function or an aggregate with zero or more arguments.

GdaSqlAnyPart `any`; | inheritance structure
gchar *`function_name`; | name of the function , in the form [[catalog.]schema.]function_name
GSList *`args_list`; | list of GdaSqlExpr expressions, one for each argument

### gda_sql_function_new ()

    GdaSqlFunction *    gda_sql_function_new                (GdaSqlAnyPart *parent);

Creates a new GdaSqlFunction structure initiated.

`parent` : | a GdaSqlAnyPart structure
Returns : | a new GdaSqlFunction structure.

### gda_sql_function_free ()

    void                gda_sql_function_free               (GdaSqlFunction *function);

Frees a GdaSqlFunction structure and its members.

`function` : | a GdaSqlFunction structure to be freed

### gda_sql_function_copy ()

    GdaSqlFunction *    gda_sql_function_copy               (GdaSqlFunction *function);

Creates a new GdaSqlFunction structure initiated with the values stored in `function`.

`function` : | a GdaSqlFunction structure to be copied
Returns : | a new GdaSqlFunction structure.

### gda_sql_function_serialize ()

    gchar *             gda_sql_function_serialize          (GdaSqlFunction *function);

Creates a new string representing a function. You need to free the returned string using `g_free()`;

`function` : | a GdaSqlFunction structure
Returns : | a new string with the description of the function or "null" in case `function` is invalid.

### gda_sql_function_take_name ()

    void                gda_sql_function_take_name          (GdaSqlFunction *function,
                                                             GValue *value);

Sets the function's name using the string held by `value`. When call, `value` is freed using #`gda_value_free()`.

`function` : | a GdaSqlFunction structure
`value` : | a GValue holding a string to take from

### gda_sql_function_take_args_list ()

    void                gda_sql_function_take_args_list     (GdaSqlFunction *function,
                                                             GSList *args);

Sets the function's arguments to point to `args`, then sets the list's data elements' parent to `function`.

`function` : | a GdaSqlFunction structure
`args` : | a GSList to take from

### struct GdaSqlOperation

    struct GdaSqlOperation {
    	GdaSqlAnyPart       any;
    	GdaSqlOperatorType  operator_type;
    	GSList             *operands;
    };

This structure represents an operation between one or more operands.

GdaSqlAnyPart `any`; | inheritance structure
GdaSqlOperatorType `operator_type`; |
GSList *`operands`; | list of GdaSqlExpr operands

### enum GdaSqlOperatorType

    typedef enum {
    	GDA_SQL_OPERATOR_TYPE_AND,
    	GDA_SQL_OPERATOR_TYPE_OR,

    	GDA_SQL_OPERATOR_TYPE_EQ,
    	GDA_SQL_OPERATOR_TYPE_IS,
    	GDA_SQL_OPERATOR_TYPE_LIKE,
    	GDA_SQL_OPERATOR_TYPE_BETWEEN,
    	GDA_SQL_OPERATOR_TYPE_GT,
    	GDA_SQL_OPERATOR_TYPE_LT,
    	GDA_SQL_OPERATOR_TYPE_GEQ,
    	GDA_SQL_OPERATOR_TYPE_LEQ,
    	GDA_SQL_OPERATOR_TYPE_DIFF,
    	GDA_SQL_OPERATOR_TYPE_REGEXP,
    	GDA_SQL_OPERATOR_TYPE_REGEXP_CI,
    	GDA_SQL_OPERATOR_TYPE_NOT_REGEXP,
    	GDA_SQL_OPERATOR_TYPE_NOT_REGEXP_CI,
    	GDA_SQL_OPERATOR_TYPE_SIMILAR,
    	GDA_SQL_OPERATOR_TYPE_ISNULL,
    	GDA_SQL_OPERATOR_TYPE_ISNOTNULL,
    	GDA_SQL_OPERATOR_TYPE_NOT,
    	GDA_SQL_OPERATOR_TYPE_IN,
    	GDA_SQL_OPERATOR_TYPE_NOTIN,

    	GDA_SQL_OPERATOR_TYPE_CONCAT,
    	GDA_SQL_OPERATOR_TYPE_PLUS,
    	GDA_SQL_OPERATOR_TYPE_MINUS,
    	GDA_SQL_OPERATOR_TYPE_STAR,
    	GDA_SQL_OPERATOR_TYPE_DIV,
    	GDA_SQL_OPERATOR_TYPE_REM,
    	GDA_SQL_OPERATOR_TYPE_BITAND,
    	GDA_SQL_OPERATOR_TYPE_BITOR,
    	GDA_SQL_OPERATOR_TYPE_BITNOT,
    	GDA_SQL_OPERATOR_TYPE_ILIKE,

    	GDA_SQL_OPERATOR_TYPE_NOTLIKE,
    	GDA_SQL_OPERATOR_TYPE_NOTILIKE
    } GdaSqlOperatorType;

`GDA_SQL_OPERATOR_TYPE_AND` |
`GDA_SQL_OPERATOR_TYPE_OR` |
`GDA_SQL_OPERATOR_TYPE_EQ` |
`GDA_SQL_OPERATOR_TYPE_IS` |
`GDA_SQL_OPERATOR_TYPE_LIKE` |
`GDA_SQL_OPERATOR_TYPE_BETWEEN` |
`GDA_SQL_OPERATOR_TYPE_GT` |
`GDA_SQL_OPERATOR_TYPE_LT` |
`GDA_SQL_OPERATOR_TYPE_GEQ` |
`GDA_SQL_OPERATOR_TYPE_LEQ` |
`GDA_SQL_OPERATOR_TYPE_DIFF` |
`GDA_SQL_OPERATOR_TYPE_REGEXP` |
`GDA_SQL_OPERATOR_TYPE_REGEXP_CI` |
`GDA_SQL_OPERATOR_TYPE_NOT_REGEXP` |
`GDA_SQL_OPERATOR_TYPE_NOT_REGEXP_CI` |
`GDA_SQL_OPERATOR_TYPE_SIMILAR` |
`GDA_SQL_OPERATOR_TYPE_ISNULL` |
`GDA_SQL_OPERATOR_TYPE_ISNOTNULL` |
`GDA_SQL_OPERATOR_TYPE_NOT` |
`GDA_SQL_OPERATOR_TYPE_IN` |
`GDA_SQL_OPERATOR_TYPE_NOTIN` |
`GDA_SQL_OPERATOR_TYPE_CONCAT` |
`GDA_SQL_OPERATOR_TYPE_PLUS` |
`GDA_SQL_OPERATOR_TYPE_MINUS` |
`GDA_SQL_OPERATOR_TYPE_STAR` |
`GDA_SQL_OPERATOR_TYPE_DIV` |
`GDA_SQL_OPERATOR_TYPE_REM` |
`GDA_SQL_OPERATOR_TYPE_BITAND` |
`GDA_SQL_OPERATOR_TYPE_BITOR` |
`GDA_SQL_OPERATOR_TYPE_BITNOT` |
`GDA_SQL_OPERATOR_TYPE_ILIKE` |
`GDA_SQL_OPERATOR_TYPE_NOTLIKE` |
`GDA_SQL_OPERATOR_TYPE_NOTILIKE` |

### gda_sql_operation_new ()

    GdaSqlOperation *   gda_sql_operation_new               (GdaSqlAnyPart *parent);

Creates a new GdaSqlOperation structure and sets its parent to `parent`.

`parent` : | a GdaSqlAnyPart structure
Returns : | a new GdaSqlOperation structure.

### gda_sql_operation_free ()

    void                gda_sql_operation_free              (GdaSqlOperation *operation);

Frees a GdaSqlOperation structure and its members.

`operation` : | a GdaSqlOperation structure to be freed

### gda_sql_operation_copy ()

    GdaSqlOperation *   gda_sql_operation_copy              (GdaSqlOperation *operation);

Creates a new GdaSqlOperation structure initiated with the values stored in `operation`.

`operation` : | a GdaSqlOperation structure to be copied
Returns : | a new GdaSqlOperation structure.

### gda_sql_operation_serialize ()

    gchar *             gda_sql_operation_serialize         (GdaSqlOperation *operation);

Creates a new string representing an operator. You need to free the returned string using `g_free()`;

`operation` : | a GdaSqlOperation structure
Returns : | a new string with the description of the operator or "null" in case `operation` is invalid.

### gda_sql_operation_operator_to_string ()

    const gchar *       gda_sql_operation_operator_to_string
                                                            (GdaSqlOperatorType op);

Returns a constant string representing a operator name. You don't need to free the returned string.

`op` : | a GdaSqlOperation structure
Returns : | a string with the operator's name or NULL in case `op` is invalid.

### gda_sql_operation_operator_from_string ()

    GdaSqlOperatorType  gda_sql_operation_operator_from_string
                                                            (const gchar *op);

Returns GdaSqlOperatorType that correspond with the string `op`.

`op` : | a GdaSqlOperation structure
Returns : | GdaSqlOperatorType

### struct GdaSqlCase

    struct GdaSqlCase {
    	GdaSqlAnyPart    any;
    	GdaSqlExpr      *base_expr;
    	GSList          *when_expr_list;
    	GSList          *then_expr_list;
    	GdaSqlExpr      *else_expr;
    };

This structure represents a CASE WHEN... construct

GdaSqlAnyPart `any`; | inheritance structure
GdaSqlExpr *`base_expr`; | expression to test
GSList *`when_expr_list`; | list of GdaSqlExpr, one for each WHEN clause
GSList *`then_expr_list`; | list of GdaSqlExpr, one for each THEN clause
GdaSqlExpr *`else_expr`; | default expression for the CASE

### gda_sql_case_new ()

    GdaSqlCase *        gda_sql_case_new                    (GdaSqlAnyPart *parent);

Creates a new GdaSqlCase structure and sets its parent to `parent`.

`parent` : | a GdaSqlAnyPart structure
Returns : | a new GdaSqlCase structure.

### gda_sql_case_free ()

    void                gda_sql_case_free                   (GdaSqlCase *sc);

Frees a GdaSqlCase structure and its members.

`sc` : | a GdaSqlCase structure to be freed

### gda_sql_case_copy ()

    GdaSqlCase *        gda_sql_case_copy                   (GdaSqlCase *sc);

Creates a new GdaSqlCase structure initiated with the values stored in `sc`.

`sc` : | a GdaSqlCase structure to be copied
Returns : | a new GdaSqlCase structure.

### gda_sql_case_serialize ()

    gchar *             gda_sql_case_serialize              (GdaSqlCase *sc);

Creates a new string representing a CASE clause. You need to free the returned string using `g_free()`;

`sc` : | a GdaSqlCase structure
Returns : | a new string with the description of the CASE clause or "null" in case `sc` is invalid.

### struct GdaSqlSelectField

    struct GdaSqlSelectField {
    	GdaSqlAnyPart       any;
    	GdaSqlExpr         *expr;
    	gchar              *field_name; /* may be NULL if expr does not refer to a table.field, can also be "*" */
    	gchar              *table_name; /* may be NULL if expr does not refer to a table.field */
    	gchar              *as;

    	/* validity check with a connection */
    	GdaMetaDbObject    *validity_meta_object;
    	GdaMetaTableColumn *validity_meta_table_column;
    };

This structure represents a selected item in a SELECT statement (when executed, the returned data set will have one column per selected item). Note that the `table_name` and `field_name` field parts will be overwritten by Libgda, set the value of `expr->value` instead.

GdaSqlAnyPart `any`; | inheritance structure
GdaSqlExpr *`expr`; | expression
gchar *`field_name`; | field name part of `expr` if `expr` represents a field
gchar *`table_name`; | table name part of `expr` if `expr` represents a field
gchar *`as`; | alias
GdaMetaDbObject *`validity_meta_object`; |
GdaMetaTableColumn *`validity_meta_table_column`; |

### gda_sql_select_field_new ()

    GdaSqlSelectField * gda_sql_select_field_new            (GdaSqlAnyPart *parent);

Creates a new GdaSqlSelectField structure and sets its parent to `parent`. A GdaSqlSelectField is any expression in SELECT statements before the FROM clause.

`parent` : | a GdaSqlStatementSelect structure
Returns : | a new GdaSqlSelectField structure.

### gda_sql_select_field_free ()

    void                gda_sql_select_field_free           (GdaSqlSelectField *field);

Frees a GdaSqlSelectField structure and its members.

`field` : | a GdaSqlSelectField structure to be freed

### gda_sql_select_field_copy ()

    GdaSqlSelectField * gda_sql_select_field_copy           (GdaSqlSelectField *field);

Creates a new GdaSqlSelectField structure initiated with the values stored in `field`.

`field` : | a GdaSqlSelectField structure to be copied
Returns : | a new GdaSqlSelectField structure.

### gda_sql_select_field_serialize ()

    gchar *             gda_sql_select_field_serialize      (GdaSqlSelectField *field);

Creates a new string representing an expression used as field in a SELECT statement before the FROM clause.

`field` : | a GdaSqlSelectField structure
Returns : | a new string with the description of the expression or "null" in case `field` is invalid.

### gda_sql_select_field_take_star_value ()

    void                gda_sql_select_field_take_star_value
                                                            (GdaSqlSelectField *field,
                                                             GValue *value);

Sets the expression field's value in the GdaSqlSelectField structure to point to `value`; after this `field` is the owner of `value`.

`field` : | a GdaSqlSelectField structure
`value` : | a GValue to take from

### gda_sql_select_field_take_expr ()

    void                gda_sql_select_field_take_expr      (GdaSqlSelectField *field,
                                                             GdaSqlExpr *expr);

Sets the expression field in the GdaSqlSelectField structure to point to `expr` and modify it to sets its parent to `field`.

`field` : | a GdaSqlSelectField structure
`expr` : | a GdaSqlExpr to take from

### gda_sql_select_field_take_alias ()

    void                gda_sql_select_field_take_alias     (GdaSqlSelectField *field,
                                                             GValue *alias);

Sets the 'as' field's string in the GdaSqlSelectField structure. `alias` is freed after call this function.

`field` : | a GdaSqlSelectField structure
`alias` : | a GValue to take from

### struct GdaSqlSelectTarget

    struct GdaSqlSelectTarget {
    	GdaSqlAnyPart       any;
    	GdaSqlExpr         *expr;
    	gchar              *table_name; /* may be NULL if expr does not refer to a table */
    	gchar              *as;

    	/* validity check with a connection */
    	GdaMetaDbObject    *validity_meta_object;
    };

This structure represents a target used to fetch data from in a SELECT statement; it can represent a table or a sub select. Note that the `table_name` part will be overwritten by Libgda, set the value of `expr->value` instead.

GdaSqlAnyPart `any`; | inheritance structure
GdaSqlExpr *`expr`; | expression
gchar *`table_name`; | table name part of `expr` if `expr` represents a table
gchar *`as`; | alias
GdaMetaDbObject *`validity_meta_object`; |

### gda_sql_select_target_new ()

    GdaSqlSelectTarget * gda_sql_select_target_new          (GdaSqlAnyPart *parent);

Creates a new GdaSqlSelectTarget structure and sets its parent to `parent`. A GdaSqlSelectTarget is the table in a SELECT statement.

`parent` : | a GdaSqlSelectFrom
Returns : | a new GdaSqlSelectTarget structure.

### gda_sql_select_target_free ()

    void                gda_sql_select_target_free          (GdaSqlSelectTarget *target);

Frees a GdaSqlSelectTarget structure and its members.

`target` : | a GdaSqlSelectTarget structure to be freed

### gda_sql_select_target_copy ()

    GdaSqlSelectTarget * gda_sql_select_target_copy         (GdaSqlSelectTarget *target);

Creates a new GdaSqlSelectTarget structure initiated with the values stored in `target`.

`target` : | a GdaSqlSelectTarget structure to be copied
Returns : | a new GdaSqlSelectTarget structure.

### gda_sql_select_target_serialize ()

    gchar *             gda_sql_select_target_serialize     (GdaSqlSelectTarget *target);

Creates a new string representing a target used in a SELECT statement after the FROM clause.

`target` : | a GdaSqlSelectTarget structure
Returns : | a new string with the description of the expression or "null" in case `field` is invalid.

### gda_sql_select_target_take_table_name ()

    void                gda_sql_select_target_take_table_name
                                                            (GdaSqlSelectTarget *target,
                                                             GValue *value);

Sets the target to be a SELECT subquery setting target's expression to use `stmt`; after call this function the target owns `stmt`, then you must not free it.

`target` : | a GdaSqlSelectTarget structure
`stmt` : | a GValue to take from

### gda_sql_select_target_take_select ()

    void                gda_sql_select_target_take_select   (GdaSqlSelectTarget *target,
                                                             GdaSqlStatement *stmt);

### gda_sql_select_target_take_alias ()

    void                gda_sql_select_target_take_alias    (GdaSqlSelectTarget *target,
                                                             GValue *alias);

### struct GdaSqlSelectJoin

    struct GdaSqlSelectJoin {
    	GdaSqlAnyPart         any;
    	GdaSqlSelectJoinType  type;
    	gint                  position; /* between a target at (pos < @position) and the one @position */
    	GdaSqlExpr           *expr;
    	GSList               *use; /* list of GdaSqlField pointers */
    };

This structure represents a join between two targets in a SELECT statement.

GdaSqlAnyPart `any`; | inheritance structure
GdaSqlSelectJoinType `type`; | type of join
gint `position`; | represents a join between a target at (pos < `position`) and the one at `position`
GdaSqlExpr *`expr`; | joining expression, or `NULL`. [allow-none]
GSList *`use`; | list of GdaSqlField pointers to use when joining, or `NULL`. [allow-none]

### enum GdaSqlSelectJoinType

    typedef enum {
    	GDA_SQL_SELECT_JOIN_CROSS,
    	GDA_SQL_SELECT_JOIN_NATURAL,
    	GDA_SQL_SELECT_JOIN_INNER,
    	GDA_SQL_SELECT_JOIN_LEFT,
    	GDA_SQL_SELECT_JOIN_RIGHT,
    	GDA_SQL_SELECT_JOIN_FULL
    } GdaSqlSelectJoinType;

`GDA_SQL_SELECT_JOIN_CROSS` |
`GDA_SQL_SELECT_JOIN_NATURAL` |
`GDA_SQL_SELECT_JOIN_INNER` |
`GDA_SQL_SELECT_JOIN_LEFT` |
`GDA_SQL_SELECT_JOIN_RIGHT` |
`GDA_SQL_SELECT_JOIN_FULL` |

### gda_sql_select_join_new ()

    GdaSqlSelectJoin *  gda_sql_select_join_new             (GdaSqlAnyPart *parent);

Creates a new GdaSqlSelectJoin structure and sets its parent to `parent`.

`parent` : | a GdaSqlSelectFrom
Returns : | a new GdaSqlSelectJoin structure

### gda_sql_select_join_free ()

    void                gda_sql_select_join_free            (GdaSqlSelectJoin *join);

Frees a GdaSqlSelectJoin structure and its members.

`join` : | a GdaSqlSelectJoin structure to be freed

### gda_sql_select_join_copy ()

    GdaSqlSelectJoin *  gda_sql_select_join_copy            (GdaSqlSelectJoin *join);

Creates a new GdaSqlSelectJoin structure initiated with the values stored in `join`.

`join` : | a GdaSqlSelectJoin structure to be copied
Returns : | a new GdaSqlSelectJoin structure.

### gda_sql_select_join_serialize ()

    gchar *             gda_sql_select_join_serialize       (GdaSqlSelectJoin *join);

Creates a new string description of the join used in a SELECT statement.

`join` : | a GdaSqlSelectJoin structure
Returns : | a new string with the description of the join or "null" in case `join` is invalid.

### gda_sql_select_join_type_to_string ()

    const gchar *       gda_sql_select_join_type_to_string  (GdaSqlSelectJoinType type);

Creates a new string representing the join type.

`type` : | a GdaSqlSelectJoinType structure to be copied
Returns : | a string representing the Join type.

### struct GdaSqlSelectFrom

    struct GdaSqlSelectFrom {
    	GdaSqlAnyPart    any;
    	GSList          *targets;
    	GSList          *joins;
    };

This structure represents the FROM clause of a SELECT statement, it lists targets and joins

GdaSqlAnyPart `any`; | inheritance structure
GSList *`targets`; | list of GdaSqlSelectTarget. [element-type Gda.SqlSelectTarget]
GSList *`joins`; | list of GdaSqlSelectJoin. [element-type Gda.SqlSelectJoin]

### gda_sql_select_from_new ()

    GdaSqlSelectFrom *  gda_sql_select_from_new             (GdaSqlAnyPart *parent);

Creates a new GdaSqlSelectFrom structure and sets its parent to `parent`.

`parent` : | a GdaSqlStatementSelect
Returns : | a new GdaSqlSelectFrom structure

### gda_sql_select_from_free ()

    void                gda_sql_select_from_free            (GdaSqlSelectFrom *from);

Frees a GdaSqlSelectFrom structure and its members.

`from` : | a GdaSqlSelectFrom structure to be freed

### gda_sql_select_from_copy ()

    GdaSqlSelectFrom *  gda_sql_select_from_copy            (GdaSqlSelectFrom *from);

Creates a new GdaSqlSelectFrom structure initiated with the values stored in `from`.

`from` : | a GdaSqlSelectFrom structure to be copied
Returns : | a new GdaSqlSelectFrom structure.

### gda_sql_select_from_serialize ()

    gchar *             gda_sql_select_from_serialize       (GdaSqlSelectFrom *from);

Creates a new string description of the FROM clause used in a SELECT statement.

`from` : | a GdaSqlSelectFrom structure
Returns : | a new string with the description of the FROM or "null" in case `from` is invalid.

### gda_sql_select_from_take_new_target ()

    void                gda_sql_select_from_take_new_target (GdaSqlSelectFrom *from,
                                                             GdaSqlSelectTarget *target);

Append `target` to the targets in the FROM clause and set `target`'s parent to `from`; after call this function `from` owns `target` then you must not free it.

`from` : | a GdaSqlSelectFrom structure
`target` : | a GdaSqlSelectTarget to take from

### gda_sql_select_from_take_new_join ()

    void                gda_sql_select_from_take_new_join   (GdaSqlSelectFrom *from,
                                                             GdaSqlSelectJoin *join);

Append `join` to the joins in the FROM clause and set `join`'s parent to `from`; after call this function `from` owns `join` then you must not free it.

`from` : | a GdaSqlSelectFrom structure
`join` : | a GdaSqlSelectJoin to take from

### struct GdaSqlSelectOrder

    struct GdaSqlSelectOrder {
    	GdaSqlAnyPart    any;
    	GdaSqlExpr      *expr;
    	gboolean         asc;
    	gchar           *collation_name;
    };

This structure represents the ordering of a SELECT statement.

GdaSqlAnyPart `any`; | inheritance structure
GdaSqlExpr *`expr`; | expression to order on
gboolean `asc`; | TRUE is ordering is ascending
gchar *`collation_name`; | name of the collation to use for ordering

### gda_sql_select_order_new ()

    GdaSqlSelectOrder * gda_sql_select_order_new            (GdaSqlAnyPart *parent);

Creates a new GdaSqlSelectOrder structure and sets its parent to `parent`.

`parent` : | a GdaSqlStatementSelect
Returns : | a new GdaSqlSelectOrder structure

### gda_sql_select_order_free ()

    void                gda_sql_select_order_free           (GdaSqlSelectOrder *order);

Frees a GdaSqlSelectOrder structure and its members.

`order` : | a GdaSqlSelectOrder structure to be freed

### gda_sql_select_order_copy ()

    GdaSqlSelectOrder * gda_sql_select_order_copy           (GdaSqlSelectOrder *order);

Creates a new GdaSqlSelectOrder structure initiated with the values stored in `order`.

`order` : | a GdaSqlSelectOrder structure to be copied
Returns : | a new GdaSqlSelectOrder structure.

### gda_sql_select_order_serialize ()

    gchar *             gda_sql_select_order_serialize      (GdaSqlSelectOrder *order);

Creates a new string description of the ORDER BY clause used in a SELECT statement.

`order` : | a GdaSqlSelectOrder structure
Returns : | a new string with the description of the ORDER BY or "null" in case `order` is invalid.

### gda_sql_value_stringify ()

    gchar *             gda_sql_value_stringify             (const GValue *value);

Simplified version of `gda_value_stringify()`.

`value` : | a GValue pointer
Returns : | a new string

## See Also

The GdaSqlBuilder object which features some easy to use API to build GdaSqlStatement structures or GdaStatement objects without having to worry about the details of GdaSqlStatement's contents.