| Top |
GdaSqlStatement *
gda_sql_statement_new (GdaSqlStatementType type);
Use this function to create a GdaSqlStatement of the specified type
type.
GdaSqlStatement *
gda_sql_statement_copy (GdaSqlStatement *stmt);
Creates a copy of stmt
.
void
gda_sql_statement_free (GdaSqlStatement *stmt);
Releases any memory associated to stmt
.
gchar *
gda_sql_statement_serialize (GdaSqlStatement *stmt);
Creates a string representation of stmt
.
const gchar *
gda_sql_statement_type_to_string (GdaSqlStatementType type);
Converts a GdaSqlStatementType to a string, see also 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()
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).
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 |
[nullable] |
error |
a place to store errors, or |
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 |
[nullable] |
error |
a place to store errors, or |
Since: 4.2
void
gda_sql_statement_check_clean (GdaSqlStatement *stmt);
Cleans any data set by a previous call to gda_sql_statement_check_validity().
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 |
[nullable] |
error |
a place to store errors, or |
GdaSqlStatementContentsInfo *
gda_sql_statement_get_contents_infos (GdaSqlStatementType type);
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 * |
||
GdaSqlStatementType |
type of statement |
|
gpointer |
contents, cast it depending on |
|
GdaMetaStruct * |