Top |
Types and Values
Object Hierarchy
GBoxed ├── GdaSqlAnyPart ├── GdaSqlStatement ╰── GdaSqlStatementContentsInfo GEnum ├── GdaSqlAnyPartType ├── GdaSqlError ╰── GdaSqlStatementType
Functions
GdaSqlForeachFunc ()
gboolean (*GdaSqlForeachFunc) (GdaSqlAnyPart *part
,gpointer data
,GError **error
);
Specifies the type of functions passed to gda_sql_any_part_foreach()
.
Parameters
part |
the current GdaSqlAnyPart node |
|
data |
user data passed to |
|
error |
pointer to a place to store errors |
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
Parameters
node |
the stat node |
|
func |
function to call for each sub node. |
[scope call] |
data |
data to pass to |
[closure] |
error |
a place to store errors, or |
gda_sql_any_part_check_structure ()
gboolean gda_sql_any_part_check_structure (GdaSqlAnyPart *node
,GError **error
);
Checks for any error in node
's structure to make sure it is valid. This
is the same as gda_sql_statement_check_structure()
but for individual GdaSqlAnyPart
parts. This function is mainly for database provider's implementations
Types and Values
enum GdaSqlStatementType
Known types of statements
Members
a SELECT statement |
||
an INSERT statement |
||
an UPDATE statement |
||
a DELETE statement |
||
a compound statement: multiple SELECT statements grouped together using an operator |
||
start of transaction statement |
||
transaction abort statement |
||
transaction commit statement |
||
new savepoint definition statement |
||
return to savepoint statement |
||
savepoint deletion statement |
||
unknown statement, only identifies variables |
||
not used |
enum GdaSqlAnyPartType
Type of part.
Members
structure is a GdaSqlStatementSelect |
||
structure is a GdaSqlStatementInsert |
||
structure is a GdaSqlStatementUpdate |
||
structure is a GdaSqlStatementDelete |
||
structure is a GdaSqlStatementCompound |
||
structure is a GdaSqlStatementTransaction |
||
structure is a GdaSqlStatementTransaction |
||
structure is a GdaSqlStatementTransaction |
||
structure is a GdaSqlStatementTransaction |
||
structure is a GdaSqlStatementTransaction |
||
structure is a GdaSqlStatementTransaction |
||
structure is a GdaSqlStatementUnknown |
||
structure is a GdaSqlExpr |
||
structure is a GdaSqlField |
||
structure is a GdaSqlTable |
||
structure is a GdaSqlFunction |
||
structure is a GdaSqlOperation |
||
structure is a GdaSqlCase |
||
structure is a GdaSqlSelectField |
||
structure is a GdaSqlSelectTarget |
||
structure is a GdaSqlSelectJoin |
||
structure is a GdaSqlSelectFrom |
||
structure is a GdaSqlSelectOrder |
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.
Members
GdaSqlAnyPartType |
type of structure, as a GdaSqlAnyPartType enum. |
|
GdaSqlAnyPart * |
pointer to the parent GdaSqlAnyPart structure |
GdaSqlStatementContentsInfo
typedef struct { GdaSqlStatementType type; gchar *name; gpointer (*construct) (void); void (*free) (gpointer stm); gpointer (*copy) (gpointer stm); gchar *(*serialize) (gpointer stm); /* augmenting information precision using a dictionary */ GdaSqlForeachFunc check_structure_func; GdaSqlForeachFunc check_validity_func; } GdaSqlStatementContentsInfo;
Contents' infos
GdaSqlStatementCheckValidityData
typedef struct { GdaConnection *cnc; GdaMetaStore *store; GdaMetaStruct *mstruct; } GdaSqlStatementCheckValidityData;
Validation against a dictionary
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.
GdaSqlStatementCompound
typedef struct { GdaSqlAnyPart any; GdaSqlStatementCompoundType compound_type; GSList *stmt_list; /* list of SELECT or COMPOUND statements */ } GdaSqlStatementCompound;
GdaSqlStatementDelete
typedef struct { GdaSqlAnyPart any; GdaSqlTable *table; GdaSqlExpr *cond; } GdaSqlStatementDelete;
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).
Members
GdaSqlAnyPart |
inheritance structure |
|
gchar * |
conflict resolution clause if there is one (such as "OR REPLACE") |
|
GdaSqlTable * |
name of the table to which data is inserted |
|
GSList * |
list of GdaSqlField fields which are valued for insertion |
|
GSList * |
list of list of GdaSqlExpr expressions (this is a list of list, not a simple list) |
|
GdaSqlAnyPart * |
a GdaSqlStatementSelect or GdaSqlStatementCompound structure representing the values to insert |
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;
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.
Members
GdaSqlAnyPart |
inheritance structure |
|
GdaTransactionIsolation |
isolation level as a GdaTransactionIsolation |
|
gchar * |
transaction mode (DEFERRED, IMMEDIATE, EXCLUSIVE, READ_WRITE, READ_ONLY) |
|
gchar * |
transaction name |
GdaSqlStatementUnknown
typedef struct { GdaSqlAnyPart any; GSList *expressions; } GdaSqlStatementUnknown;
Represents any statement which type is not identified (any DDL statement or database specific dialect)