Top |
Functions
Types and Values
struct | GdaSqlExpr |
struct | GdaSqlField |
struct | GdaSqlTable |
struct | GdaSqlFunction |
enum | GdaSqlOperatorType |
struct | GdaSqlOperation |
struct | GdaSqlCase |
struct | GdaSqlSelectField |
struct | GdaSqlSelectTarget |
enum | GdaSqlSelectJoinType |
struct | GdaSqlSelectJoin |
struct | GdaSqlSelectFrom |
struct | GdaSqlSelectOrder |
Object Hierarchy
GBoxed ├── GdaSqlCase ├── GdaSqlExpr ├── GdaSqlField ├── GdaSqlFunction ├── GdaSqlOperation ├── GdaSqlSelectField ├── GdaSqlSelectFrom ├── GdaSqlSelectJoin ├── GdaSqlSelectOrder ├── GdaSqlSelectTarget ╰── GdaSqlTable GEnum ├── GdaSqlOperatorType ╰── GdaSqlSelectJoinType
Functions
gda_sql_expr_new ()
GdaSqlExpr *
gda_sql_expr_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlField structure, using parent
as its parent part.
gda_sql_expr_free ()
void
gda_sql_expr_free (GdaSqlExpr *expr
);
Frees a GdaSqlExpr structure and its members.
gda_sql_expr_copy ()
GdaSqlExpr *
gda_sql_expr_copy (GdaSqlExpr *expr
);
Creates a new GdaSqlExpr structure initiated with the values stored in expr
.
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()
;
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.
Parameters
expr |
a GdaSqlExpr structure |
|
stmt |
a GdaSqlStatement holding the GdaSqlStatementSelect to take from |
gda_sql_field_new ()
GdaSqlField *
gda_sql_field_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlField structure, using parent
as its parent part.
gda_sql_field_free ()
void
gda_sql_field_free (GdaSqlField *field
);
Frees a GdaSqlField structure and its members.
gda_sql_field_copy ()
GdaSqlField *
gda_sql_field_copy (GdaSqlField *field
);
Creates a new GdaSqlField structure initiated with the values stored in field
.
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()
;
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()
.
gda_sql_table_new ()
GdaSqlTable *
gda_sql_table_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlTable structure, using parent
as its parent part.
gda_sql_table_free ()
void
gda_sql_table_free (GdaSqlTable *table
);
Frees a GdaSqlTable structure and its members.
gda_sql_table_copy ()
GdaSqlTable *
gda_sql_table_copy (GdaSqlTable *table
);
Creates a new GdaSqlTable structure initiated with the values stored in table
.
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()
;
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()
.
gda_sql_function_new ()
GdaSqlFunction *
gda_sql_function_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlFunction structure initiated.
gda_sql_function_free ()
void
gda_sql_function_free (GdaSqlFunction *function
);
Frees a GdaSqlFunction structure and its members.
gda_sql_function_copy ()
GdaSqlFunction *
gda_sql_function_copy (GdaSqlFunction *function
);
Creates a new GdaSqlFunction structure initiated with the values stored in function
.
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()
;
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()
.
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
.
Parameters
function |
a GdaSqlFunction structure |
|
args |
a GSList to take from. |
[element-type Gda.SqlExpr] |
gda_sql_operation_new ()
GdaSqlOperation *
gda_sql_operation_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlOperation structure and sets its parent to parent
.
gda_sql_operation_free ()
void
gda_sql_operation_free (GdaSqlOperation *operation
);
Frees a GdaSqlOperation structure and its members.
gda_sql_operation_copy ()
GdaSqlOperation *
gda_sql_operation_copy (GdaSqlOperation *operation
);
Creates a new GdaSqlOperation structure initiated with the values stored in operation
.
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()
;
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.
gda_sql_operation_operator_from_string ()
GdaSqlOperatorType
gda_sql_operation_operator_from_string
(const gchar *op
);
Returns GdaSqlOperatorType that correspond with the string op
.
gda_sql_case_new ()
GdaSqlCase *
gda_sql_case_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlCase structure and sets its parent to parent
.
gda_sql_case_free ()
void
gda_sql_case_free (GdaSqlCase *sc
);
Frees a GdaSqlCase structure and its members.
gda_sql_case_copy ()
GdaSqlCase *
gda_sql_case_copy (GdaSqlCase *sc
);
Creates a new GdaSqlCase structure initiated with the values stored in sc
.
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()
;
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.
gda_sql_select_field_free ()
void
gda_sql_select_field_free (GdaSqlSelectField *field
);
Frees a GdaSqlSelectField structure and its members.
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
.
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.
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
.
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
.
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.
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.
gda_sql_select_target_free ()
void
gda_sql_select_target_free (GdaSqlSelectTarget *target
);
Frees a GdaSqlSelectTarget structure and its members.
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
.
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.
gda_sql_select_target_take_table_name ()
void gda_sql_select_target_take_table_name (GdaSqlSelectTarget *target
,GValue *value
);
Sets the target's name using the string stored in value
and the expression
to set its value to point to value; after call this function the target owns
value
, then you must not free it.
gda_sql_select_target_take_select ()
void gda_sql_select_target_take_select (GdaSqlSelectTarget *target
,GdaSqlStatement *stmt
);
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.
gda_sql_select_target_take_alias ()
void gda_sql_select_target_take_alias (GdaSqlSelectTarget *target
,GValue *alias
);
gda_sql_select_join_new ()
GdaSqlSelectJoin *
gda_sql_select_join_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlSelectJoin structure and sets its parent to parent
.
gda_sql_select_join_free ()
void
gda_sql_select_join_free (GdaSqlSelectJoin *join
);
Frees a GdaSqlSelectJoin structure and its members.
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
.
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.
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.
gda_sql_select_from_new ()
GdaSqlSelectFrom *
gda_sql_select_from_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlSelectFrom structure and sets its parent to parent
.
gda_sql_select_from_free ()
void
gda_sql_select_from_free (GdaSqlSelectFrom *from
);
Frees a GdaSqlSelectFrom structure and its members.
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
.
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.
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.
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.
gda_sql_select_order_new ()
GdaSqlSelectOrder *
gda_sql_select_order_new (GdaSqlAnyPart *parent
);
Creates a new GdaSqlSelectOrder structure and sets its parent to parent
.
gda_sql_select_order_free ()
void
gda_sql_select_order_free (GdaSqlSelectOrder *order
);
Frees a GdaSqlSelectOrder structure and its members.
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
.
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.
Types and Values
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.
Members
GdaSqlAnyPart |
inheritance structure |
|
GValue * |
a GValue, or |
[allow-none] |
GdaSqlParamSpec * |
a GdaSqlParamSpec, or |
[allow-none] |
GdaSqlFunction * |
not |
[allow-none] |
GdaSqlOperation * |
not |
[allow-none] |
GdaSqlAnyPart * |
not |
[allow-none] |
GdaSqlCase * |
not |
[allow-none] |
gchar * |
not |
[allow-none] |
gboolean |
Please see specific note about the |
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.
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.
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.
Members
GdaSqlAnyPart |
inheritance structure |
|
gchar * |
name of the function , in the form [[catalog.]schema.]function_name |
|
GSList * |
list of GdaSqlExpr expressions, one for each argument |
struct GdaSqlOperation
struct GdaSqlOperation { GdaSqlAnyPart any; GdaSqlOperatorType operator_type; GSList *operands; };
This structure represents an operation between one or more operands.
Members
GdaSqlAnyPart |
inheritance structure |
|
GdaSqlOperatorType |
||
GSList * |
(element-type Gda.SqlExpr) : list of GdaSqlExpr operands |
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
Members
GdaSqlAnyPart |
inheritance structure |
|
GdaSqlExpr * |
expression to test |
|
GSList * |
list of GdaSqlExpr, one for each WHEN clause |
|
GSList * |
list of GdaSqlExpr, one for each THEN clause |
|
GdaSqlExpr * |
default expression for the CASE |
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 ,
set the value of expr->value
instead.
Members
GdaSqlAnyPart |
inheritance structure |
|
GdaSqlExpr * |
expression |
|
gchar * |
field name part of |
|
gchar * |
table name part of |
|
gchar * |
alias |
|
GdaMetaDbObject * |
||
GdaMetaTableColumn * |
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 ,
set the value of expr->value
instead.
Members
GdaSqlAnyPart |
inheritance structure |
|
GdaSqlExpr * |
expression |
|
gchar * |
table name part of |
|
gchar * |
alias |
|
GdaMetaDbObject * |
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.
Members
GdaSqlAnyPart |
inheritance structure |
|
GdaSqlSelectJoinType |
type of join |
|
gint |
represents a join between a target at (pos < |
|
GdaSqlExpr * |
joining expression, or |
[allow-none] |
GSList * |
list of GdaSqlField pointers to use when joining, or |
[allow-none] |
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
Members
GdaSqlAnyPart |
inheritance structure |
|
GSList * |
list of GdaSqlSelectTarget. |
[element-type Gda.SqlSelectTarget] |
GSList * |
list of GdaSqlSelectJoin. |
[element-type Gda.SqlSelectJoin] |
struct GdaSqlSelectOrder
struct GdaSqlSelectOrder { GdaSqlAnyPart any; GdaSqlExpr *expr; gboolean asc; gchar *collation_name; };
This structure represents the ordering of a SELECT statement.
Members
GdaSqlAnyPart |
inheritance structure |
|
GdaSqlExpr * |
expression to order on |
|
gboolean |
TRUE is ordering is ascending |
|
gchar * |
name of the collation to use for ordering |