[libgda] Add a GdaSqlBuilderId typedef and use it instead of guint.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Add a GdaSqlBuilderId typedef and use it instead of guint.
- Date: Mon, 14 Jun 2010 13:35:32 +0000 (UTC)
commit e118b17677c4e4c3fe393cc15fa78b3f7f30a9d9
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jun 14 13:24:26 2010 +0200
Add a GdaSqlBuilderId typedef and use it instead of guint.
doc/C/libgda-sections.txt | 1 +
libgda/gda-sql-builder.c | 108 ++++++++--------
libgda/gda-sql-builder.h | 66 +++++-----
libgda/sql-parser/gda-sql-parser.c | 158 +++++++++++-----------
providers/reuseable/mysql/gda-mysql-reuseable.c | 6 +-
samples/SqlBuilder/example.c | 52 ++++----
samples/SqlBuilder/example_cnc.c | 44 +++---
tests/test-sql-builder.c | 32 +++---
tools/browser/browser-connection.c | 4 +-
tools/browser/browser-favorites.c | 6 +-
tools/browser/data-manager/data-source.c | 6 +-
11 files changed, 243 insertions(+), 240 deletions(-)
---
diff --git a/doc/C/libgda-sections.txt b/doc/C/libgda-sections.txt
index cb187fe..a358910 100644
--- a/doc/C/libgda-sections.txt
+++ b/doc/C/libgda-sections.txt
@@ -1668,6 +1668,7 @@ gda_tree_mgr_select_get_type
<FILE>gda-sql-builder</FILE>
<TITLE>GdaSqlBuilder</TITLE>
GdaSqlBuilder
+GdaSqlBuilderId
gda_sql_builder_new
gda_sql_builder_get_statement
gda_sql_builder_get_sql_statement
diff --git a/libgda/gda-sql-builder.c b/libgda/gda-sql-builder.c
index 8a4dae8..0bd59e1 100644
--- a/libgda/gda-sql-builder.c
+++ b/libgda/gda-sql-builder.c
@@ -53,8 +53,8 @@ typedef struct {
struct _GdaSqlBuilderPrivate {
GdaSqlStatement *main_stmt;
- GHashTable *parts_hash; /* key = part ID as an guint, value = SqlPart */
- guint next_assigned_id;
+ GHashTable *parts_hash; /* key = part ID as an GdaSqlBuilderId, value = SqlPart */
+ GdaSqlBuilderId next_assigned_id;
};
@@ -269,12 +269,12 @@ gda_sql_builder_get_property (GObject *object,
}
}
-static guint
+static GdaSqlBuilderId
add_part (GdaSqlBuilder *builder, GdaSqlAnyPart *part)
{
SqlPart *p;
- guint *realid = g_new0 (guint, 1);
- const guint id = builder->priv->next_assigned_id --;
+ GdaSqlBuilderId *realid = g_new0 (GdaSqlBuilderId, 1);
+ const GdaSqlBuilderId id = builder->priv->next_assigned_id --;
*realid = id;
p = g_new0 (SqlPart, 1);
p->part = part;
@@ -283,10 +283,10 @@ add_part (GdaSqlBuilder *builder, GdaSqlAnyPart *part)
}
static SqlPart *
-get_part (GdaSqlBuilder *builder, guint id, GdaSqlAnyPartType req_type)
+get_part (GdaSqlBuilder *builder, GdaSqlBuilderId id, GdaSqlAnyPartType req_type)
{
SqlPart *p;
- guint lid = id;
+ GdaSqlBuilderId lid = id;
if (id == 0)
return NULL;
p = g_hash_table_lookup (builder->priv->parts_hash, &lid);
@@ -437,7 +437,7 @@ gda_sql_builder_set_table (GdaSqlBuilder *builder, const gchar *table_name)
* Since: 4.2
*/
void
-gda_sql_builder_set_where (GdaSqlBuilder *builder, guint cond_id)
+gda_sql_builder_set_where (GdaSqlBuilder *builder, GdaSqlBuilderId cond_id)
{
g_return_if_fail (GDA_IS_SQL_BUILDER (builder));
g_return_if_fail (builder->priv->main_stmt);
@@ -492,7 +492,7 @@ gda_sql_builder_set_where (GdaSqlBuilder *builder, guint cond_id)
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_select_add_field (GdaSqlBuilder *builder, const gchar *field_name, const gchar *table_name, const gchar *alias)
{
gchar *tmp;
@@ -509,7 +509,7 @@ gda_sql_builder_select_add_field (GdaSqlBuilder *builder, const gchar *field_nam
else
tmp = (gchar*) field_name;
- const guint field_id = gda_sql_builder_add_id (builder, tmp);
+ const GdaSqlBuilderId field_id = gda_sql_builder_add_id (builder, tmp);
if (alias && *alias)
gda_sql_builder_add_field_value_id (builder,
field_id,
@@ -568,7 +568,7 @@ gda_sql_builder_add_field_value (GdaSqlBuilder *builder, const gchar *field_name
return;
}
- guint id1, id2;
+ GdaSqlBuilderId id1, id2;
GValue *value;
va_list ap;
@@ -610,7 +610,7 @@ gda_sql_builder_add_field_value_as_gvalue (GdaSqlBuilder *builder, const gchar *
return;
}
- guint id1, id2;
+ GdaSqlBuilderId id1, id2;
id1 = gda_sql_builder_add_id (builder, field_name);
id2 = gda_sql_builder_add_expr_value (builder, NULL, value);
gda_sql_builder_add_field_value_id (builder, id1, id2);
@@ -640,7 +640,7 @@ gda_sql_builder_add_field_value_as_gvalue (GdaSqlBuilder *builder, const gchar *
* Since: 4.2
*/
void
-gda_sql_builder_add_field_value_id (GdaSqlBuilder *builder, guint field_id, guint value_id)
+gda_sql_builder_add_field_value_id (GdaSqlBuilder *builder, GdaSqlBuilderId field_id, GdaSqlBuilderId value_id)
{
g_return_if_fail (GDA_IS_SQL_BUILDER (builder));
g_return_if_fail (builder->priv->main_stmt);
@@ -748,7 +748,7 @@ gda_sql_builder_add_field_value_id (GdaSqlBuilder *builder, guint field_id, guin
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_expr_value (GdaSqlBuilder *builder, GdaDataHandler *dh, const GValue *value)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
@@ -817,7 +817,7 @@ gda_sql_builder_add_expr_value (GdaSqlBuilder *builder, GdaDataHandler *dh, cons
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_expr (GdaSqlBuilder *builder, GdaDataHandler *dh, GType type, ...)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
@@ -825,7 +825,7 @@ gda_sql_builder_add_expr (GdaSqlBuilder *builder, GdaDataHandler *dh, GType type
va_list ap;
GValue *value;
- guint retval;
+ GdaSqlBuilderId retval;
va_start (ap, type);
value = create_typed_value (type, &ap);
@@ -867,7 +867,7 @@ gda_sql_builder_add_expr (GdaSqlBuilder *builder, GdaDataHandler *dh, GType type
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_id (GdaSqlBuilder *builder, const gchar *string)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
@@ -909,7 +909,7 @@ gda_sql_builder_add_id (GdaSqlBuilder *builder, const gchar *string)
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_param (GdaSqlBuilder *builder, const gchar *param_name, GType type, gboolean nullok)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
@@ -941,8 +941,8 @@ gda_sql_builder_add_param (GdaSqlBuilder *builder, const gchar *param_name, GTyp
*
* Since: 4.2
*/
-guint
-gda_sql_builder_add_cond (GdaSqlBuilder *builder, GdaSqlOperatorType op, guint op1, guint op2, guint op3)
+GdaSqlBuilderId
+gda_sql_builder_add_cond (GdaSqlBuilder *builder, GdaSqlOperatorType op, GdaSqlBuilderId op1, GdaSqlBuilderId op2, GdaSqlBuilderId op3)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
g_return_val_if_fail (builder->priv->main_stmt, 0);
@@ -988,9 +988,9 @@ gda_sql_builder_add_cond (GdaSqlBuilder *builder, GdaSqlOperatorType op, guint o
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_cond_v (GdaSqlBuilder *builder, GdaSqlOperatorType op,
- const guint *op_ids, gint op_ids_size)
+ const GdaSqlBuilderId *op_ids, gint op_ids_size)
{
gint i;
SqlPart **parts;
@@ -1031,7 +1031,7 @@ gda_sql_builder_add_cond_v (GdaSqlBuilder *builder, GdaSqlOperatorType op,
typedef struct {
GdaSqlSelectTarget target; /* inheritance! */
- guint part_id; /* copied from this part ID */
+ GdaSqlBuilderId part_id; /* copied from this part ID */
} BuildTarget;
/**
@@ -1048,8 +1048,8 @@ typedef struct {
*
* Since: 4.2
*/
-guint
-gda_sql_builder_select_add_target_id (GdaSqlBuilder *builder, guint table_id, const gchar *alias)
+GdaSqlBuilderId
+gda_sql_builder_select_add_target_id (GdaSqlBuilder *builder, GdaSqlBuilderId table_id, const gchar *alias)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
g_return_val_if_fail (builder->priv->main_stmt, 0);
@@ -1131,10 +1131,10 @@ gda_sql_builder_select_add_target_id (GdaSqlBuilder *builder, guint table_id, co
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_select_add_target (GdaSqlBuilder *builder, const gchar *table_name, const gchar *alias)
{
- guint id;
+ GdaSqlBuilderId id;
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
g_return_val_if_fail (builder->priv->main_stmt, 0);
@@ -1152,7 +1152,7 @@ gda_sql_builder_select_add_target (GdaSqlBuilder *builder, const gchar *table_na
typedef struct {
GdaSqlSelectJoin join; /* inheritance! */
- guint part_id; /* copied from this part ID */
+ GdaSqlBuilderId part_id; /* copied from this part ID */
} BuilderJoin;
/**
@@ -1174,11 +1174,11 @@ typedef struct {
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_select_join_targets (GdaSqlBuilder *builder,
- guint left_target_id, guint right_target_id,
+ GdaSqlBuilderId left_target_id, GdaSqlBuilderId right_target_id,
GdaSqlSelectJoinType join_type,
- guint join_expr)
+ GdaSqlBuilderId join_expr)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
g_return_val_if_fail (builder->priv->main_stmt, 0);
@@ -1268,7 +1268,7 @@ gda_sql_builder_select_join_targets (GdaSqlBuilder *builder,
* Since: 4.2
*/
void
-gda_sql_builder_join_add_field (GdaSqlBuilder *builder, guint join_id, const gchar *field_name)
+gda_sql_builder_join_add_field (GdaSqlBuilder *builder, GdaSqlBuilderId join_id, const gchar *field_name)
{
g_return_if_fail (GDA_IS_SQL_BUILDER (builder));
g_return_if_fail (builder->priv->main_stmt);
@@ -1315,7 +1315,7 @@ gda_sql_builder_join_add_field (GdaSqlBuilder *builder, guint join_id, const gch
* Since: 4.2
*/
void
-gda_sql_builder_select_order_by (GdaSqlBuilder *builder, guint expr_id,
+gda_sql_builder_select_order_by (GdaSqlBuilder *builder, GdaSqlBuilderId expr_id,
gboolean asc, const gchar *collation_name)
{
SqlPart *part;
@@ -1360,7 +1360,7 @@ gda_sql_builder_select_order_by (GdaSqlBuilder *builder, guint expr_id,
* Since: 4.2
*/
void
-gda_sql_builder_select_set_distinct (GdaSqlBuilder *builder, gboolean distinct, guint expr_id)
+gda_sql_builder_select_set_distinct (GdaSqlBuilder *builder, gboolean distinct, GdaSqlBuilderId expr_id)
{
GdaSqlStatementSelect *sel;
SqlPart *part = NULL;
@@ -1407,7 +1407,7 @@ gda_sql_builder_select_set_distinct (GdaSqlBuilder *builder, gboolean distinct,
*/
void
gda_sql_builder_select_set_limit (GdaSqlBuilder *builder,
- guint limit_count_expr_id, guint limit_offset_expr_id)
+ GdaSqlBuilderId limit_count_expr_id, GdaSqlBuilderId limit_offset_expr_id)
{
GdaSqlStatementSelect *sel;
SqlPart *part1 = NULL, *part2 = NULL;
@@ -1458,7 +1458,7 @@ gda_sql_builder_select_set_limit (GdaSqlBuilder *builder,
* Since: 4.2
*/
void
-gda_sql_builder_select_set_having (GdaSqlBuilder *builder, guint cond_id)
+gda_sql_builder_select_set_having (GdaSqlBuilder *builder, GdaSqlBuilderId cond_id)
{
GdaSqlStatementSelect *sel;
@@ -1494,7 +1494,7 @@ gda_sql_builder_select_set_having (GdaSqlBuilder *builder, guint cond_id)
* Since: 4.2
*/
void
-gda_sql_builder_select_group_by (GdaSqlBuilder *builder, guint expr_id)
+gda_sql_builder_select_group_by (GdaSqlBuilder *builder, GdaSqlBuilderId expr_id)
{
GdaSqlStatementSelect *sel;
@@ -1535,7 +1535,7 @@ gda_sql_builder_select_group_by (GdaSqlBuilder *builder, guint expr_id)
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_function (GdaSqlBuilder *builder, const gchar *func_name, ...)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
@@ -1546,14 +1546,14 @@ gda_sql_builder_add_function (GdaSqlBuilder *builder, const gchar *func_name, ..
GSList *list = NULL;
va_list ap;
SqlPart *part;
- guint aid;
+ GdaSqlBuilderId aid;
expr = gda_sql_expr_new (NULL);
expr->func = gda_sql_function_new (GDA_SQL_ANY_PART (expr));
expr->func->function_name = g_strdup (func_name);
va_start (ap, func_name);
- for (aid = va_arg (ap, guint); aid; aid = va_arg (ap, guint)) {
+ for (aid = va_arg (ap, GdaSqlBuilderId); aid; aid = va_arg (ap, GdaSqlBuilderId)) {
part = get_part (builder, aid, GDA_SQL_ANY_EXPR);
if (!part) {
expr->func->args_list = list;
@@ -1581,9 +1581,9 @@ gda_sql_builder_add_function (GdaSqlBuilder *builder, const gchar *func_name, ..
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_function_v (GdaSqlBuilder *builder, const gchar *func_name,
- const guint *args, gint args_size)
+ const GdaSqlBuilderId *args, gint args_size)
{
gint i;
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
@@ -1623,7 +1623,7 @@ gda_sql_builder_add_function_v (GdaSqlBuilder *builder, const gchar *func_name,
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_sub_select (GdaSqlBuilder *builder, GdaSqlStatement *sqlst)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
@@ -1720,9 +1720,9 @@ gda_sql_builder_compound_add_sub_select (GdaSqlBuilder *builder, GdaSqlStatement
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_case (GdaSqlBuilder *builder,
- guint test_expr, guint else_expr, ...)
+ GdaSqlBuilderId test_expr, GdaSqlBuilderId else_expr, ...)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
g_return_val_if_fail (builder->priv->main_stmt, 0);
@@ -1741,12 +1741,12 @@ gda_sql_builder_add_case (GdaSqlBuilder *builder,
expr->case_s->else_expr = (GdaSqlExpr*) use_part (pelse, GDA_SQL_ANY_PART (expr->case_s));
va_list ap;
- guint id1;
+ GdaSqlBuilderId id1;
va_start (ap, else_expr);
- for (id1 = va_arg (ap, guint); id1; id1 = va_arg (ap, guint)) {
- guint id2;
+ for (id1 = va_arg (ap, GdaSqlBuilderId); id1; id1 = va_arg (ap, GdaSqlBuilderId)) {
+ GdaSqlBuilderId id2;
SqlPart *pwhen, *pthen;
- id2 = va_arg (ap, guint);
+ id2 = va_arg (ap, GdaSqlBuilderId);
if (!id2)
goto cleanups;
pwhen = get_part (builder, id1, GDA_SQL_ANY_EXPR);
@@ -1787,10 +1787,10 @@ gda_sql_builder_add_case (GdaSqlBuilder *builder,
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_add_case_v (GdaSqlBuilder *builder,
- guint test_expr, guint else_expr,
- const guint *when_array, const guint *then_array, gint args_size)
+ GdaSqlBuilderId test_expr, GdaSqlBuilderId else_expr,
+ const GdaSqlBuilderId *when_array, const GdaSqlBuilderId *then_array, gint args_size)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
g_return_val_if_fail (builder->priv->main_stmt, 0);
@@ -1845,7 +1845,7 @@ gda_sql_builder_add_case_v (GdaSqlBuilder *builder,
* Since: 4.2
*/
GdaSqlExpr *
-gda_sql_builder_export_expression (GdaSqlBuilder *builder, guint id)
+gda_sql_builder_export_expression (GdaSqlBuilder *builder, GdaSqlBuilderId id)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), NULL);
g_return_val_if_fail (builder->priv->main_stmt, NULL);
@@ -1869,7 +1869,7 @@ gda_sql_builder_export_expression (GdaSqlBuilder *builder, guint id)
*
* Since: 4.2
*/
-guint
+GdaSqlBuilderId
gda_sql_builder_import_expression (GdaSqlBuilder *builder, GdaSqlExpr *expr)
{
g_return_val_if_fail (GDA_IS_SQL_BUILDER (builder), 0);
diff --git a/libgda/gda-sql-builder.h b/libgda/gda-sql-builder.h
index 78eec89..955d7fe 100644
--- a/libgda/gda-sql-builder.h
+++ b/libgda/gda-sql-builder.h
@@ -66,66 +66,68 @@ struct _GdaSqlBuilderClass
void (*_gda_reserved4) (void);
};
+typedef guint GdaSqlBuilderId;
+
GType gda_sql_builder_get_type (void) G_GNUC_CONST;
GdaSqlBuilder *gda_sql_builder_new (GdaSqlStatementType stmt_type);
GdaStatement *gda_sql_builder_get_statement (GdaSqlBuilder *builder, GError **error);
GdaSqlStatement *gda_sql_builder_get_sql_statement (GdaSqlBuilder *builder);
/* Expression API */
-guint gda_sql_builder_add_id (GdaSqlBuilder *builder, const gchar *string);
-guint gda_sql_builder_add_expr (GdaSqlBuilder *builder, GdaDataHandler *dh, GType type, ...);
-guint gda_sql_builder_add_expr_value (GdaSqlBuilder *builder, GdaDataHandler *dh, const GValue *value);
-guint gda_sql_builder_add_param (GdaSqlBuilder *builder, const gchar *param_name, GType type, gboolean nullok);
-
-guint gda_sql_builder_add_cond (GdaSqlBuilder *builder, GdaSqlOperatorType op,
- guint op1, guint op2, guint op3);
-guint gda_sql_builder_add_cond_v (GdaSqlBuilder *builder, GdaSqlOperatorType op,
- const guint *op_ids, gint op_ids_size);
-guint gda_sql_builder_add_function (GdaSqlBuilder *builder, const gchar *func_name, ...);
-guint gda_sql_builder_add_function_v (GdaSqlBuilder *builder, const gchar *func_name,
- const guint *args, gint args_size);
-guint gda_sql_builder_add_sub_select (GdaSqlBuilder *builder, GdaSqlStatement *sqlst);
-guint gda_sql_builder_add_case (GdaSqlBuilder *builder, guint test_expr, guint else_expr, ...);
-guint gda_sql_builder_add_case_v (GdaSqlBuilder *builder, guint test_expr, guint else_expr,
- const guint *when_array, const guint *then_array, gint args_size);
+GdaSqlBuilderId gda_sql_builder_add_id (GdaSqlBuilder *builder, const gchar *string);
+GdaSqlBuilderId gda_sql_builder_add_expr (GdaSqlBuilder *builder, GdaDataHandler *dh, GType type, ...);
+GdaSqlBuilderId gda_sql_builder_add_expr_value (GdaSqlBuilder *builder, GdaDataHandler *dh, const GValue *value);
+GdaSqlBuilderId gda_sql_builder_add_param (GdaSqlBuilder *builder, const gchar *param_name, GType type, gboolean nullok);
+
+GdaSqlBuilderId gda_sql_builder_add_cond (GdaSqlBuilder *builder, GdaSqlOperatorType op,
+ GdaSqlBuilderId op1, GdaSqlBuilderId op2, GdaSqlBuilderId op3);
+GdaSqlBuilderId gda_sql_builder_add_cond_v (GdaSqlBuilder *builder, GdaSqlOperatorType op,
+ const GdaSqlBuilderId *op_ids, gint op_ids_size);
+GdaSqlBuilderId gda_sql_builder_add_function (GdaSqlBuilder *builder, const gchar *func_name, ...);
+GdaSqlBuilderId gda_sql_builder_add_function_v (GdaSqlBuilder *builder, const gchar *func_name,
+ const GdaSqlBuilderId *args, gint args_size);
+GdaSqlBuilderId gda_sql_builder_add_sub_select (GdaSqlBuilder *builder, GdaSqlStatement *sqlst);
+GdaSqlBuilderId gda_sql_builder_add_case (GdaSqlBuilder *builder, GdaSqlBuilderId test_expr, GdaSqlBuilderId else_expr, ...);
+GdaSqlBuilderId gda_sql_builder_add_case_v (GdaSqlBuilder *builder, GdaSqlBuilderId test_expr, GdaSqlBuilderId else_expr,
+ const GdaSqlBuilderId *when_array, const GdaSqlBuilderId *then_array, gint args_size);
/* General Statement API */
void gda_sql_builder_add_field_value (GdaSqlBuilder *builder, const gchar *field_name, GType type, ...);
void gda_sql_builder_add_field_value_as_gvalue (GdaSqlBuilder *builder, const gchar *field_name,
const GValue *value);
-void gda_sql_builder_add_field_value_id (GdaSqlBuilder *builder, guint field_id, guint value_id);
+void gda_sql_builder_add_field_value_id (GdaSqlBuilder *builder, GdaSqlBuilderId field_id, GdaSqlBuilderId value_id);
void gda_sql_builder_set_table (GdaSqlBuilder *builder, const gchar *table_name);
-void gda_sql_builder_set_where (GdaSqlBuilder *builder, guint cond_id);
+void gda_sql_builder_set_where (GdaSqlBuilder *builder, GdaSqlBuilderId cond_id);
/* SELECT Statement API */
-guint gda_sql_builder_select_add_field (GdaSqlBuilder *builder, const gchar *field_name,
+GdaSqlBuilderId gda_sql_builder_select_add_field (GdaSqlBuilder *builder, const gchar *field_name,
const gchar *table_name, const gchar *alias);
-guint gda_sql_builder_select_add_target (GdaSqlBuilder *builder, const gchar *table_name, const gchar *alias);
-guint gda_sql_builder_select_add_target_id (GdaSqlBuilder *builder, guint table_id, const gchar *alias);
-guint gda_sql_builder_select_join_targets (GdaSqlBuilder *builder,
- guint left_target_id, guint right_target_id,
+GdaSqlBuilderId gda_sql_builder_select_add_target (GdaSqlBuilder *builder, const gchar *table_name, const gchar *alias);
+GdaSqlBuilderId gda_sql_builder_select_add_target_id (GdaSqlBuilder *builder, GdaSqlBuilderId table_id, const gchar *alias);
+GdaSqlBuilderId gda_sql_builder_select_join_targets (GdaSqlBuilder *builder,
+ GdaSqlBuilderId left_target_id, GdaSqlBuilderId right_target_id,
GdaSqlSelectJoinType join_type,
- guint join_expr);
-void gda_sql_builder_join_add_field (GdaSqlBuilder *builder, guint join_id, const gchar *field_name);
-void gda_sql_builder_select_order_by (GdaSqlBuilder *builder, guint expr_id,
+ GdaSqlBuilderId join_expr);
+void gda_sql_builder_join_add_field (GdaSqlBuilder *builder, GdaSqlBuilderId join_id, const gchar *field_name);
+void gda_sql_builder_select_order_by (GdaSqlBuilder *builder, GdaSqlBuilderId expr_id,
gboolean asc, const gchar *collation_name);
void gda_sql_builder_select_set_distinct (GdaSqlBuilder *builder,
- gboolean distinct, guint expr_id);
+ gboolean distinct, GdaSqlBuilderId expr_id);
void gda_sql_builder_select_set_limit (GdaSqlBuilder *builder,
- guint limit_count_expr_id, guint limit_offest_expr_id);
+ GdaSqlBuilderId limit_count_expr_id, GdaSqlBuilderId limit_offest_expr_id);
-void gda_sql_builder_select_set_having (GdaSqlBuilder *builder, guint cond_id);
-void gda_sql_builder_select_group_by (GdaSqlBuilder *builder, guint expr_id);
+void gda_sql_builder_select_set_having (GdaSqlBuilder *builder, GdaSqlBuilderId cond_id);
+void gda_sql_builder_select_group_by (GdaSqlBuilder *builder, GdaSqlBuilderId expr_id);
/* COMPOUND SELECT Statement API */
void gda_sql_builder_compound_set_type (GdaSqlBuilder *builder, GdaSqlStatementCompoundType compound_type);
void gda_sql_builder_compound_add_sub_select (GdaSqlBuilder *builder, GdaSqlStatement *sqlst);
/* import/Export API */
-GdaSqlExpr *gda_sql_builder_export_expression (GdaSqlBuilder *builder, guint id);
-guint gda_sql_builder_import_expression (GdaSqlBuilder *builder, GdaSqlExpr *expr);
+GdaSqlExpr *gda_sql_builder_export_expression (GdaSqlBuilder *builder, GdaSqlBuilderId id);
+GdaSqlBuilderId gda_sql_builder_import_expression (GdaSqlBuilder *builder, GdaSqlExpr *expr);
G_END_DECLS
diff --git a/libgda/sql-parser/gda-sql-parser.c b/libgda/sql-parser/gda-sql-parser.c
index fd6419e..b593f8e 100644
--- a/libgda/sql-parser/gda-sql-parser.c
+++ b/libgda/sql-parser/gda-sql-parser.c
@@ -30,8 +30,8 @@
#include <libgda/sql-parser/token_types.h>
#include <libgda/gda-lockable.h>
-/*
- * Main static functions
+/*
+ * Main static functions
*/
static void gda_sql_parser_class_init (GdaSqlParserClass *klass);
static void gda_sql_parser_init (GdaSqlParser *stmt);
@@ -57,7 +57,7 @@ static void gda_sql_parser_unlock (GdaLockable *lockable);
static GObjectClass *parent_class = NULL;
static void gda_sql_parser_reset (GdaSqlParser *parser);
-static GValue *tokenizer_get_next_token (GdaSqlParser *parser);
+static GValue *tokenizer_get_next_token (GdaSqlParser *parser);
static void push_tokenizer_context (GdaSqlParser *parser);
static void pop_tokenizer_context (GdaSqlParser *parser);
@@ -132,7 +132,7 @@ gda_sql_parser_get_type (void)
NULL,
NULL
};
-
+
g_static_mutex_lock (®istering);
if (type == 0) {
type = g_type_register_static (G_TYPE_OBJECT, "GdaSqlParser", &info, 0);
@@ -156,28 +156,28 @@ gda_sql_parser_class_init (GdaSqlParserClass * klass)
object_class->set_property = gda_sql_parser_set_property;
object_class->get_property = gda_sql_parser_get_property;
g_object_class_install_property (object_class, PROP_FLAVOUR,
- g_param_spec_int ("tokenizer-flavour", NULL, NULL,
- GDA_SQL_PARSER_FLAVOUR_STANDARD,
+ g_param_spec_int ("tokenizer-flavour", NULL, NULL,
+ GDA_SQL_PARSER_FLAVOUR_STANDARD,
GDA_SQL_PARSER_FLAVOUR_POSTGRESQL,
GDA_SQL_PARSER_FLAVOUR_STANDARD,
G_PARAM_WRITABLE | G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_MODE,
- g_param_spec_int ("mode", NULL, NULL,
- GDA_SQL_PARSER_MODE_PARSE,
+ g_param_spec_int ("mode", NULL, NULL,
+ GDA_SQL_PARSER_MODE_PARSE,
GDA_SQL_PARSER_MODE_DELIMIT,
GDA_SQL_PARSER_MODE_PARSE,
G_PARAM_WRITABLE | G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_LINE_ERROR,
- g_param_spec_int ("line-error", NULL, NULL,
+ g_param_spec_int ("line-error", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_COL_ERROR,
- g_param_spec_int ("column-error", NULL, NULL,
+ g_param_spec_int ("column-error", NULL, NULL,
0, G_MAXINT, 0,
G_PARAM_READABLE));
#ifdef GDA_DEBUG
g_object_class_install_property (object_class, PROP_DEBUG,
- g_param_spec_boolean ("debug", NULL, NULL,
+ g_param_spec_boolean ("debug", NULL, NULL,
FALSE,
G_PARAM_WRITABLE));
#endif
@@ -243,7 +243,7 @@ gda_sql_parser_init (GdaSqlParser *parser)
parser->priv->lemon_parser = gda_sql_parserAlloc ((void*(*)(size_t)) g_malloc);
parser->priv->mode = GDA_SQL_PARSER_MODE_PARSE;
parser->priv->flavour = GDA_SQL_PARSER_FLAVOUR_STANDARD;
-
+
parser->priv->sql = NULL;
parser->priv->passed_tokens = g_array_new (FALSE, FALSE, sizeof (gint));
@@ -303,7 +303,7 @@ gda_sql_parser_finalize (GObject *object)
parser = GDA_SQL_PARSER (object);
if (parser->priv) {
GdaSqlParserClass *klass;
-
+
klass = (GdaSqlParserClass*) G_OBJECT_GET_CLASS (parser);
gda_sql_parser_reset (parser);
g_free (parser->priv->context);
@@ -333,7 +333,7 @@ gda_sql_parser_finalize (GObject *object)
}
-static void
+static void
gda_sql_parser_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -355,23 +355,23 @@ gda_sql_parser_set_property (GObject *object,
case PROP_DEBUG: {
gboolean debug = g_value_get_boolean (value);
GdaSqlParserClass *klass;
-
+
klass = (GdaSqlParserClass*) G_OBJECT_GET_CLASS (parser);
if (klass->delim_alloc) {
g_assert (klass->delim_trace);
- klass->delim_trace ((parser->priv->mode == GDA_SQL_PARSER_MODE_DELIMIT) && debug ?
+ klass->delim_trace ((parser->priv->mode == GDA_SQL_PARSER_MODE_DELIMIT) && debug ?
stdout : NULL, ".......DELIMITER DEBUG:");
}
else
- gda_sql_delimiterTrace ((parser->priv->mode == GDA_SQL_PARSER_MODE_DELIMIT) && debug ?
+ gda_sql_delimiterTrace ((parser->priv->mode == GDA_SQL_PARSER_MODE_DELIMIT) && debug ?
stdout : NULL, ".......DELIMITER DEBUG:");
if (klass->parser_alloc) {
g_assert (klass->parser_trace);
- klass->parser_trace ((parser->priv->mode == GDA_SQL_PARSER_MODE_PARSE) && debug ?
+ klass->parser_trace ((parser->priv->mode == GDA_SQL_PARSER_MODE_PARSE) && debug ?
stdout : NULL, ".......PARSE DEBUG:");
}
else
- gda_sql_parserTrace ((parser->priv->mode == GDA_SQL_PARSER_MODE_PARSE) && debug ?
+ gda_sql_parserTrace ((parser->priv->mode == GDA_SQL_PARSER_MODE_PARSE) && debug ?
stdout : NULL, ".......PARSE DEBUG:");
break;
}
@@ -392,7 +392,7 @@ gda_sql_parser_get_property (GObject *object,
{
GdaSqlParser *parser;
parser = GDA_SQL_PARSER (object);
-
+
if (parser->priv) {
switch (param_id) {
case PROP_FLAVOUR:
@@ -410,7 +410,7 @@ gda_sql_parser_get_property (GObject *object,
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
- }
+ }
}
}
@@ -454,7 +454,7 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
if (remain)
*remain = NULL;
-
+
klass = (GdaSqlParserClass*) G_OBJECT_GET_CLASS (parser);
if (klass->delim_alloc) {
g_assert (klass->delim_parse);
@@ -488,7 +488,7 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
gda_value_free (value);
break;
case L_SPACE:
- if (parser->priv->context->in_param_spec ||
+ if (parser->priv->context->in_param_spec ||
(parser->priv->mode == GDA_SQL_PARSER_MODE_PARSE)) {
/* ignore space */
gda_value_free (value);
@@ -551,7 +551,7 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
if (G_VALUE_TYPE (v) == G_TYPE_STRING) {
const gchar *str;
str = g_value_get_string (v);
- if (str)
+ if (str)
parser->priv->context->delimiter = *str;
}
else
@@ -564,16 +564,16 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
/* send found tokens until end of buffer */
g_array_append_val (parser->priv->passed_tokens, parser->priv->context->token_type);
-
+
switch (parser->priv->mode) {
case GDA_SQL_PARSER_MODE_PARSE:
/*g_print ("TRANS %d => %d\n", parser->priv->context->token_type,
parser_trans [parser->priv->context->token_type]);*/
- _parse (parser->priv->lemon_parser,
+ _parse (parser->priv->lemon_parser,
parser_trans [parser->priv->context->token_type], value, &piface);
break;
case GDA_SQL_PARSER_MODE_DELIMIT:
- _delimit (parser->priv->lemon_delimiter,
+ _delimit (parser->priv->lemon_delimiter,
delim_trans [parser->priv->context->token_type], value, &piface);
break;
default:
@@ -619,7 +619,7 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
piface.parsed_statement->sql = g_strdup (parser->priv->sql);
*parser->priv->context->next_token_start = hold;
- stmt = g_object_new (GDA_TYPE_STATEMENT,
+ stmt = g_object_new (GDA_TYPE_STATEMENT,
"structure", piface.parsed_statement, NULL);
gda_sql_statement_free (piface.parsed_statement);
}
@@ -656,7 +656,7 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
* Parse @sql and creates a #GdaBatch object which contains all the #GdaStatement objects created while parsing (one object
* per SQL statement). Empty statements (composed of spaces only) do not appear in the resulting object.
*
- * @sql is parsed and #GdaStatement objects are created as long as no error is found in @sql. If an error is found
+ * @sql is parsed and #GdaStatement objects are created as long as no error is found in @sql. If an error is found
* at some point, then the parsing stops and @remain may contain a non %NULL pointer, @error may be set, and %NULL
* is returned.
*
@@ -683,7 +683,7 @@ gda_sql_parser_parse_string_as_batch (GdaSqlParser *parser, const gchar *sql, co
if (remain)
*remain = NULL;
-
+
batch = gda_batch_new ();
if (!sql)
return batch;
@@ -694,10 +694,10 @@ gda_sql_parser_parse_string_as_batch (GdaSqlParser *parser, const gchar *sql, co
while (int_sql && allok) {
GError *lerror = NULL;
const gchar *int_remain = NULL;
-
+
stmt = gda_sql_parser_parse_string (parser, int_sql, &int_remain, &lerror);
if (stmt) {
- if (gda_statement_is_useless (stmt))
+ if (gda_statement_is_useless (stmt))
n_empty++;
else {
gda_batch_add_statement (batch, stmt);
@@ -709,7 +709,7 @@ gda_sql_parser_parse_string_as_batch (GdaSqlParser *parser, const gchar *sql, co
(lerror->code == GDA_SQL_PARSER_EMPTY_SQL_ERROR))
n_empty++;
else {
- if (int_remain)
+ if (int_remain)
allok = FALSE;
if (lerror) {
g_propagate_error (error, lerror);
@@ -733,7 +733,7 @@ gda_sql_parser_parse_string_as_batch (GdaSqlParser *parser, const gchar *sql, co
}
gda_mutex_unlock (parser->priv->mutex);
-
+
return batch;
}
@@ -746,7 +746,7 @@ gda_sql_parser_parse_string_as_batch (GdaSqlParser *parser, const gchar *sql, co
* Parse @filename's contents and creates a #GdaBatch object which contains all the
* #GdaStatement objects created while parsing (one object per SQL statement).
*
- * @filename's contents are parsed and #GdaStatement objects are created as long as no error is found. If an error is found
+ * @filename's contents are parsed and #GdaStatement objects are created as long as no error is found. If an error is found
* at some point, then the parsing stops, @error may be set and %NULL is returned
*
* if @sql is %NULL, then the returned #GdaBatch object will contain no statement.
@@ -791,7 +791,7 @@ get_position (GdaSqlParser *parser)
l++;
c = 0;
}
- else
+ else
c++;
}
parser->priv->error_line = l + 1;
@@ -808,7 +808,7 @@ gda_sql_parser_set_syntax_error (GdaSqlParser *parser)
parser->priv->error_pos = get_position (parser);
parser->priv->error_msg = g_strdup_printf (_("Syntax error at line %d, column %d"),
parser->priv->error_line, parser->priv->error_col);
- /*g_print ("@syntax error at line %d, col %d\n",
+ /*g_print ("@syntax error at line %d, col %d\n",
parser->priv->error_line, parser->priv->error_col);*/
}
}
@@ -821,7 +821,7 @@ gda_sql_parser_set_overflow_error (GdaSqlParser *parser)
parser->priv->error_pos = get_position (parser);
parser->priv->error_msg = g_strdup_printf (_("Overflow error at line %d, column %d"),
parser->priv->error_line, parser->priv->error_col);
- /*g_print ("@overflow error at line %d, col %d\n",
+ /*g_print ("@overflow error at line %d, col %d\n",
parser->priv->error_line, parser->priv->error_col);*/
}
}
@@ -836,10 +836,10 @@ gda_sql_parser_set_overflow_error (GdaSqlParser *parser)
/*
** If X is a character that can be used in an identifier then
** IdChar(X) will be true. Otherwise it is false.
-**
+**
** For ASCII, any character with the high-order bit set is
-** allowed in an identifier. For 7-bit characters,
-** sqlite3IsIdChar[X] must be 1.
+** allowed in an identifier. For 7-bit characters,
+** sqlite3IsIdChar[X] must be 1.
*/
static const char AsciiIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
@@ -870,12 +870,12 @@ static const unsigned char UpperToLower[] = {
252,253,254,255
};
-static gboolean
+static gboolean
str_caseequal (gconstpointer v1, gconstpointer v2)
{
const gchar *string1 = v1;
const gchar *string2 = v2;
-
+
return strcasecmp (string1, string2) == 0;
}
@@ -885,11 +885,11 @@ str_casehash (gconstpointer v)
/* 31 bit hash function */
const signed char *p = v;
guint32 h = UpperToLower[*p];
-
+
if (h)
for (p += 1; *p != '\0'; p++)
h = (h << 5) - h + UpperToLower[*p];
-
+
return h;
}
@@ -1062,16 +1062,16 @@ getToken (GdaSqlParser *parser)
debug_hold = z[50];
z[50] = 0;
}
-
+
g_print ("TOK for `%s` (delim='%c') is: ", z, parser->priv->context->delimiter);
if (debugcut)
z[50] = debug_hold;
#endif
if (*z == parser->priv->context->delimiter) {
- if (!parser->priv->context->ignore_semi && (parser->priv->context->block_level == 0))
+ if (!parser->priv->context->ignore_semi && (parser->priv->context->block_level == 0))
parser->priv->context->token_type = L_SEMI;
- else
+ else
parser->priv->context->token_type = L_RAWSTRING;
consumed_chars = 1;
retval = token_as_string (parser->priv->context->next_token_start, 1);
@@ -1092,7 +1092,7 @@ getToken (GdaSqlParser *parser)
}
break;
}
- case '-':
+ case '-':
if ( z[1]=='-' ){
for (i=2; (c=z[i])!=0 && c!='\n'; i++){}
parser->priv->context->token_type = L_SQLCOMMENT;
@@ -1104,21 +1104,21 @@ getToken (GdaSqlParser *parser)
}
break;
- case '(':
+ case '(':
parser->priv->context->token_type = L_LP;
consumed_chars = 1;
break;
- case ')':
+ case ')':
parser->priv->context->token_type = L_RP;
consumed_chars = 1;
break;
- case '+':
+ case '+':
if (parser->priv->mode != GDA_SQL_PARSER_MODE_DELIMIT) {
parser->priv->context->token_type = L_PLUS;
consumed_chars = 1;
}
break;
- case '*':
+ case '*':
if (z[1] == '/') {
parser->priv->context->token_type = L_RSBRACKET;
consumed_chars = 2;
@@ -1149,13 +1149,13 @@ getToken (GdaSqlParser *parser)
parser->priv->context->in_param_spec = TRUE;
}
break;
- case '=':
+ case '=':
if (parser->priv->mode != GDA_SQL_PARSER_MODE_DELIMIT) {
parser->priv->context->token_type = L_EQ;
consumed_chars = 1 + (z[1] == '=');
}
break;
- case '<':
+ case '<':
if ((c = z[1]) == '=') {
parser->priv->context->token_type = L_LEQ;
consumed_chars = 2;
@@ -1173,7 +1173,7 @@ getToken (GdaSqlParser *parser)
consumed_chars = 1;
}
break;
- case '>':
+ case '>':
if ((c = z[1]) == '=') {
parser->priv->context->token_type = L_GEQ;
consumed_chars = 2;
@@ -1187,7 +1187,7 @@ getToken (GdaSqlParser *parser)
consumed_chars = 1;
}
break;
- case '!':
+ case '!':
if (parser->priv->mode != GDA_SQL_PARSER_MODE_DELIMIT) {
if ((c = z[1]) == '=') {
parser->priv->context->token_type = L_DIFF;
@@ -1205,7 +1205,7 @@ getToken (GdaSqlParser *parser)
}
}
break;
- case '|':
+ case '|':
if (parser->priv->mode != GDA_SQL_PARSER_MODE_DELIMIT) {
if (z[1] != '|') {
parser->priv->context->token_type = L_BITOR;
@@ -1220,17 +1220,17 @@ getToken (GdaSqlParser *parser)
consumed_chars = 1;
}
break;
- case ',':
+ case ',':
parser->priv->context->token_type = L_COMMA;
consumed_chars = 1;
break;
- case '&':
+ case '&':
if (parser->priv->mode != GDA_SQL_PARSER_MODE_DELIMIT) {
parser->priv->context->token_type = L_BITAND;
consumed_chars = 1;
}
break;
- case '~':
+ case '~':
if (parser->priv->mode != GDA_SQL_PARSER_MODE_DELIMIT) {
if (z[1] == '*') {
parser->priv->context->token_type = L_REGEXP_CI;
@@ -1261,19 +1261,19 @@ getToken (GdaSqlParser *parser)
}
}
if (c) {
- if (delim == '"')
+ if (delim == '"')
parser->priv->context->token_type = L_TEXTUAL;
- else
+ else
parser->priv->context->token_type = L_STRING;
consumed_chars = i+1;
- }
+ }
else {
parser->priv->context->token_type = L_ILLEGAL;
consumed_chars = 0;
}
break;
}
- case '.':
+ case '.':
if (parser->priv->mode != GDA_SQL_PARSER_MODE_DELIMIT) {
if (! isdigit (z[1])) {
parser->priv->context->token_type = L_DOT;
@@ -1292,7 +1292,7 @@ getToken (GdaSqlParser *parser)
while (isdigit (z[i])) {i++;}
parser->priv->context->token_type = L_FLOAT;
}
- if ((z[i]=='e' || z[i]=='E') &&
+ if ((z[i]=='e' || z[i]=='E') &&
(isdigit (z[i+1]) || ((z[i+1]=='+' || z[i+1]=='-') && isdigit (z[i+2])))) {
i += 2;
while (isdigit (z[i])) {i++;}
@@ -1324,11 +1324,11 @@ getToken (GdaSqlParser *parser)
case '#': {
if (z[1] == '#') {
/* parameter */
- for (i=2; (z[i]) &&
- (IdChar (z[i]) || (z[i] == '+') || (z[i] == '-') || (z[i] == '.') || (z[i] == ':') ||
+ for (i=2; (z[i]) &&
+ (IdChar (z[i]) || (z[i] == '+') || (z[i] == '-') || (z[i] == '.') || (z[i] == ':') ||
(z[i] == '|') || (z[i] == '@') || (z[i] == '?')) &&
(z[i] != '/') && (z[i] != parser->priv->context->delimiter)
- /*(!isspace (z[i])) && (z[i] != '/') &&
+ /*(!isspace (z[i])) && (z[i] != '/') &&
(z[i] != parser->priv->context->delimiter)*/; i++) {}
if (i > 2) {
parser->priv->context->token_type = L_SIMPLEPARAM;
@@ -1452,7 +1452,7 @@ getToken (GdaSqlParser *parser)
else {
if ((! parser->priv->context->in_param_spec) && IdChar (*z)) {
gint ttype;
-
+
for (i=1; IdChar (z[i]); i++){}
ttype = keywordCode (parser, (char*)z, i);
if (ttype != L_RAWSTRING) {
@@ -1487,8 +1487,8 @@ getToken (GdaSqlParser *parser)
consumed_chars = 0;
}
else {
- for (i=1; z[i] && (! isspace (z[i])) &&
- (z[i] != parser->priv->context->delimiter) && (z[i] != '*') &&
+ for (i=1; z[i] && (! isspace (z[i])) &&
+ (z[i] != parser->priv->context->delimiter) && (z[i] != '*') &&
(z[i] != '\'') && (z[i] != '"'); i++){}
parser->priv->context->token_type = L_RAWSTRING;
consumed_chars = i;
@@ -1509,11 +1509,11 @@ getToken (GdaSqlParser *parser)
if (parser->priv->context->token_type == L_END)
handle_composed_2_keywords (parser, retval, L_LOOP, L_ENDLOOP);
- else if (parser->priv->context->token_type == L_IS)
+ else if (parser->priv->context->token_type == L_IS)
handle_composed_2_keywords (parser, retval, L_NULL, L_ISNULL);
- else if (parser->priv->context->token_type == L_NOT)
+ else if (parser->priv->context->token_type == L_NOT)
handle_composed_2_keywords (parser, retval, L_NULL, L_NOTNULL);
- else if (parser->priv->context->token_type == L_SIMILAR)
+ else if (parser->priv->context->token_type == L_SIMILAR)
handle_composed_2_keywords (parser, retval, L_TO, L_SIMILAR);
#ifdef GDA_DEBUG_NO
@@ -1538,7 +1538,7 @@ handle_composed_2_keywords (GdaSqlParser *parser, GValue *retval, gint second, g
gchar *newstr;
merge_tokenizer_contexts (parser, npushed);
parser->priv->context->token_type = replacer;
-
+
newstr = g_strdup_printf ("%s %s", g_value_get_string (retval), g_value_get_string (v));
g_value_reset (retval);
g_value_take_string (retval, newstr);
@@ -1559,7 +1559,7 @@ static void
push_tokenizer_context (GdaSqlParser *parser)
{
TokenizerContext *nc;
-
+
nc = g_new (TokenizerContext, 1);
*nc = *parser->priv->context;
parser->priv->pushed_contexts = g_slist_prepend (parser->priv->pushed_contexts, parser->priv->context);
@@ -1582,7 +1582,7 @@ pop_tokenizer_context (GdaSqlParser *parser)
}
/*
- * Looks forward which tokens are available next, and returns the number of tokens corresponding to
+ * Looks forward which tokens are available next, and returns the number of tokens corresponding to
* expected token(s)
*
* extra arguments are a list of (gint expected_type, GValue **value) followed by 0
@@ -1663,7 +1663,7 @@ merge_tokenizer_contexts (GdaSqlParser *parser, gint n_contexts)
parser->priv->context->delimiter = c->delimiter;
for (i = 0; i < n_contexts; i++) {
g_free (parser->priv->pushed_contexts->data);
- parser->priv->pushed_contexts = g_slist_remove (parser->priv->pushed_contexts,
+ parser->priv->pushed_contexts = g_slist_remove (parser->priv->pushed_contexts,
parser->priv->pushed_contexts->data);
}
}
diff --git a/providers/reuseable/mysql/gda-mysql-reuseable.c b/providers/reuseable/mysql/gda-mysql-reuseable.c
index 3a5ef3b..eb69aaf 100644
--- a/providers/reuseable/mysql/gda-mysql-reuseable.c
+++ b/providers/reuseable/mysql/gda-mysql-reuseable.c
@@ -139,7 +139,7 @@ execute_select (GdaConnection *cnc, GdaMysqlReuseable *rdata, const gchar *sql,
GdaStatement *stmt;
GdaDataModel *model;
parser = _gda_mysql_reuseable_create_parser ((GdaProviderReuseable*) rdata);
-
+
stmt = gda_sql_parser_parse_string (parser, sql, NULL, NULL);
g_object_unref (parser);
g_assert (stmt);
@@ -158,7 +158,7 @@ _gda_mysql_compute_version (GdaConnection *cnc, GdaMysqlReuseable *rdata, GError
GdaDataModel *model;
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
- const guint id_func = gda_sql_builder_add_function (b, "version", 0);
+ const GdaSqlBuilderId id_func = gda_sql_builder_add_function (b, "version", 0);
gda_sql_builder_add_field_value_id (b, id_func, 0);
stmt = gda_sql_builder_get_statement (b, NULL);
g_object_unref (b);
@@ -168,7 +168,7 @@ _gda_mysql_compute_version (GdaConnection *cnc, GdaMysqlReuseable *rdata, GError
g_object_unref (stmt);
if (!model)
return FALSE;
-
+
const GValue *cvalue;
cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
if (!cvalue) {
diff --git a/samples/SqlBuilder/example.c b/samples/SqlBuilder/example.c
index 15fbd7e..fcfe72d 100644
--- a/samples/SqlBuilder/example.c
+++ b/samples/SqlBuilder/example.c
@@ -22,7 +22,7 @@ main (int argc, char *argv[])
gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 15));
gda_sql_builder_add_field_value_id (b, gda_sql_builder_add_id (b, "g"),
gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "joe"));
-
+
render_as_sql (b);
g_object_unref (b);
@@ -32,9 +32,9 @@ main (int argc, char *argv[])
gda_sql_builder_set_table (b, "products");
gda_sql_builder_add_field_value (b, "ref", G_TYPE_STRING, "A0E'FESP");
- guint id_field = gda_sql_builder_add_id (b, "id");
- guint id_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 14);
- guint id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id_field, id_value, 0);
+ GdaSqlBuilderId id_field = gda_sql_builder_add_id (b, "id");
+ GdaSqlBuilderId id_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 14);
+ GdaSqlBuilderId id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id_field, id_value, 0);
gda_sql_builder_set_where (b, id_cond);
render_as_sql (b);
@@ -53,26 +53,26 @@ main (int argc, char *argv[])
gda_sql_builder_set_table (b, "items");
id_field = gda_sql_builder_add_id (b, "id");
- guint id_param = gda_sql_builder_add_param (b, "theid", G_TYPE_INT, FALSE);
+ GdaSqlBuilderId id_param = gda_sql_builder_add_param (b, "theid", G_TYPE_INT, FALSE);
id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id_field, id_param, 0);
gda_sql_builder_set_where (b, id_cond);
render_as_sql (b);
g_object_unref (b);
-
+
/*
* The next statement shows automatic quoting of reserved SQL keywords (DATE and SELECT here)
*
* SELECT c."date", name, date AS person FROM "select" as c, orders
*/
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-
- guint id_table = gda_sql_builder_add_id (b, "select"); /* SELECT is an SQL reserved keyword */
- guint id_target1 = gda_sql_builder_select_add_target_id (b, id_table, "c");
- guint id_target2 = gda_sql_builder_select_add_target_id (b,
+
+ GdaSqlBuilderId id_table = gda_sql_builder_add_id (b, "select"); /* SELECT is an SQL reserved keyword */
+ GdaSqlBuilderId id_target1 = gda_sql_builder_select_add_target_id (b, id_table, "c");
+ GdaSqlBuilderId id_target2 = gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_id (b, "orders"),
NULL);
- guint id_join = gda_sql_builder_select_join_targets (b, id_target1, id_target2, GDA_SQL_SELECT_JOIN_INNER, 0);
+ GdaSqlBuilderId id_join = gda_sql_builder_select_join_targets (b, id_target1, id_target2, GDA_SQL_SELECT_JOIN_INNER, 0);
gda_sql_builder_add_field_value_id (b,
gda_sql_builder_add_id (b, "c.date"), 0); /* DATE is an SQL reserved keyword */
@@ -93,7 +93,7 @@ main (int argc, char *argv[])
gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_id (b, "mytable"),
NULL);
- guint id_function_myfunc = gda_sql_builder_add_function (b, "myfunc",
+ GdaSqlBuilderId id_function_myfunc = gda_sql_builder_add_function (b, "myfunc",
gda_sql_builder_add_id (b, "a"),
gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 5),
gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "Joe"),
@@ -103,11 +103,11 @@ main (int argc, char *argv[])
/* reuse the same GdaSqlBuilder object to have:
* SELECT myfunc (a, 5, 'Joe'), MAX (myfunc (a, 5, 'Joe'), b, 10) FROM mytable */
- guint id_b = gda_sql_builder_add_id (b, "b");
- guint id_b_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 10);
+ GdaSqlBuilderId id_b = gda_sql_builder_add_id (b, "b");
+ GdaSqlBuilderId id_b_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 10);
- guint args[] = {id_function_myfunc, id_b, id_b_value};
- guint id_function_max = gda_sql_builder_add_function_v (b, "MAX", args, 3);
+ GdaSqlBuilderId args[] = {id_function_myfunc, id_b, id_b_value};
+ GdaSqlBuilderId id_function_max = gda_sql_builder_add_function_v (b, "MAX", args, 3);
gda_sql_builder_add_field_value_id (b, id_function_max, 0);
render_as_sql (b);
@@ -136,7 +136,7 @@ main (int argc, char *argv[])
gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_id (b, "MyTable"),
NULL);
- guint id_function = gda_sql_builder_add_function (b, "date",
+ GdaSqlBuilderId id_function = gda_sql_builder_add_function (b, "date",
gda_sql_builder_add_id (b, "a"),
gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 5),
gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "Joe"),
@@ -161,7 +161,7 @@ main (int argc, char *argv[])
gda_sql_builder_add_id (b, "master"),
NULL);
id_field = gda_sql_builder_add_id (b, "id");
- guint id_subselect = gda_sql_builder_add_sub_select (b, sub);
+ GdaSqlBuilderId id_subselect = gda_sql_builder_add_sub_select (b, sub);
gda_sql_statement_free (sub);
id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_IN, id_field, id_subselect, 0);
gda_sql_builder_set_where (b, id_cond);
@@ -193,7 +193,7 @@ main (int argc, char *argv[])
render_as_sql (b);
g_object_unref (b);
-
+
/* Subselect in INSERT: INSERT INTO customers (e, f, g) SELECT id, name, location FROM subdate */
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
gda_sql_builder_add_field_value_id (b, gda_sql_builder_add_id (b, "id"), 0);
@@ -213,7 +213,7 @@ main (int argc, char *argv[])
gda_sql_builder_add_field_value_id (b, gda_sql_builder_add_id (b, "g"), 0);
gda_sql_builder_add_field_value_id (b, gda_sql_builder_add_sub_select (b, sub), 0);
gda_sql_statement_free (sub);
-
+
render_as_sql (b);
g_object_unref (b);
@@ -251,8 +251,8 @@ main (int argc, char *argv[])
id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_LT,
gda_sql_builder_add_id (b, "price"),
gda_sql_builder_add_expr (b, NULL, G_TYPE_FLOAT, 1.2), 0);
-
- guint id_case = gda_sql_builder_add_case (b,
+
+ GdaSqlBuilderId id_case = gda_sql_builder_add_case (b,
0,
gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 1),
id_cond, gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 2),
@@ -287,7 +287,7 @@ main (int argc, char *argv[])
* SELECT people.firstname AS person, people.lastname, "date" AS birthdate, age FROM people
*/
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-
+
gda_sql_builder_select_add_field (b, "firstname", "people", "person");
gda_sql_builder_select_add_field (b, "lastname", "people", NULL);
gda_sql_builder_select_add_field (b, "date", NULL, "birthdate");
@@ -305,7 +305,7 @@ main (int argc, char *argv[])
gda_sql_builder_set_table (b, "customers");
gda_sql_builder_add_field_value (b, "f", G_TYPE_INT, 15);
gda_sql_builder_add_field_value (b, "g", G_TYPE_STRING, "joe");
-
+
render_as_sql (b);
g_object_unref (b);
@@ -360,7 +360,7 @@ main (int argc, char *argv[])
gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_sub_select (b, sub), "sub");
gda_sql_statement_free (sub);
-
+
render_as_sql (b);
g_object_unref (b);
@@ -393,7 +393,7 @@ render_as_sql (GdaSqlBuilder *b)
else {
g_print ("SQL: %s\n", sql);
g_free (sql);
- }
+ }
g_object_unref (stmt);
}
}
diff --git a/samples/SqlBuilder/example_cnc.c b/samples/SqlBuilder/example_cnc.c
index 7dd61a6..3c888cf 100644
--- a/samples/SqlBuilder/example_cnc.c
+++ b/samples/SqlBuilder/example_cnc.c
@@ -22,7 +22,7 @@ main (int argc, char *argv[])
gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 15));
gda_sql_builder_add_field_value_id (b, gda_sql_builder_add_id (b, "g"),
gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "joe"));
-
+
render_as_sql (b);
g_object_unref (b);
@@ -34,9 +34,9 @@ main (int argc, char *argv[])
gda_sql_builder_add_field_value_id (b,
gda_sql_builder_add_id (b, "ref"),
gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "A0E'FESP"));
- guint id_field = gda_sql_builder_add_id (b, "id");
- guint id_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 14);
- guint id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id_field, id_value, 0);
+ GdaSqlBuilderId id_field = gda_sql_builder_add_id (b, "id");
+ GdaSqlBuilderId id_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 14);
+ GdaSqlBuilderId id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id_field, id_value, 0);
gda_sql_builder_set_where (b, id_cond);
render_as_sql (b);
@@ -55,26 +55,26 @@ main (int argc, char *argv[])
gda_sql_builder_set_table (b, "items");
id_field = gda_sql_builder_add_id (b, "id");
- guint id_param = gda_sql_builder_add_param (b, "theid", G_TYPE_INT, FALSE);
+ GdaSqlBuilderId id_param = gda_sql_builder_add_param (b, "theid", G_TYPE_INT, FALSE);
id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id_field, id_param, 0);
gda_sql_builder_set_where (b, id_cond);
render_as_sql (b);
g_object_unref (b);
-
+
/*
* The next statement shows automatic quoting of reserved SQL keywords (DATE and SELECT here)
*
* SELECT c."date", name, date AS person FROM "select" as c, orders
*/
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-
- guint id_table = gda_sql_builder_add_id (b, "select"); /* SELECT is an SQL reserved keyword */
- guint id_target1 = gda_sql_builder_select_add_target_id (b, id_table, "c");
- guint id_target2 = gda_sql_builder_select_add_target_id (b,
+
+ GdaSqlBuilderId id_table = gda_sql_builder_add_id (b, "select"); /* SELECT is an SQL reserved keyword */
+ GdaSqlBuilderId id_target1 = gda_sql_builder_select_add_target_id (b, id_table, "c");
+ GdaSqlBuilderId id_target2 = gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_id (b, "orders"),
NULL);
- guint id_join = gda_sql_builder_select_join_targets (b, id_target1, id_target2, GDA_SQL_SELECT_JOIN_INNER, 0);
+ GdaSqlBuilderId id_join = gda_sql_builder_select_join_targets (b, id_target1, id_target2, GDA_SQL_SELECT_JOIN_INNER, 0);
gda_sql_builder_add_field_value_id (b,
gda_sql_builder_add_id (b, "c.date"), 0); /* DATE is an SQL reserved keyword */
@@ -95,7 +95,7 @@ main (int argc, char *argv[])
gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_id (b, "mytable"),
NULL);
- guint id_function_myfunc = gda_sql_builder_add_function (b, "myfunc",
+ GdaSqlBuilderId id_function_myfunc = gda_sql_builder_add_function (b, "myfunc",
gda_sql_builder_add_id (b, "a"),
gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 5),
gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "Joe"),
@@ -105,11 +105,11 @@ main (int argc, char *argv[])
/* reuse the same GdaSqlBuilder object to have:
* SELECT myfunc (a, 5, 'Joe'), MAX (myfunc (a, 5, 'Joe'), b, 10) FROM mytable */
- guint id_b = gda_sql_builder_add_id (b, "b");
- guint id_b_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 10);
+ GdaSqlBuilderId id_b = gda_sql_builder_add_id (b, "b");
+ GdaSqlBuilderId id_b_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 10);
- guint args[] = {id_function_myfunc, id_b, id_b_value};
- guint id_function_max = gda_sql_builder_add_function_v (b, "MAX", args, 3);
+ GdaSqlBuilderId args[] = {id_function_myfunc, id_b, id_b_value};
+ GdaSqlBuilderId id_function_max = gda_sql_builder_add_function_v (b, "MAX", args, 3);
gda_sql_builder_add_field_value_id (b, id_function_max, 0);
render_as_sql (b);
@@ -138,7 +138,7 @@ main (int argc, char *argv[])
gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_id (b, "MyTable"),
NULL);
- guint id_function = gda_sql_builder_add_function (b, "date",
+ GdaSqlBuilderId id_function = gda_sql_builder_add_function (b, "date",
gda_sql_builder_add_id (b, "a"),
gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 5),
gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "Joe"),
@@ -151,7 +151,7 @@ main (int argc, char *argv[])
* SELECT people.firstname AS person, people.lastname, "date" AS birthdate, age FROM people
*/
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-
+
gda_sql_builder_select_add_field (b, "firstname", "people", "person");
gda_sql_builder_select_add_field (b, "lastname", "people", NULL);
gda_sql_builder_select_add_field (b, "date", NULL, "birthdate");
@@ -169,7 +169,7 @@ main (int argc, char *argv[])
gda_sql_builder_set_table (b, "customers");
gda_sql_builder_add_field_value (b, "f", G_TYPE_INT, 15);
gda_sql_builder_add_field_value (b, "g", G_TYPE_STRING, "joe");
-
+
render_as_sql (b);
g_object_unref (b);
@@ -208,7 +208,7 @@ main (int argc, char *argv[])
gda_sql_expr_free (expr);
render_as_sql (b);
g_object_unref (b);
-
+
return 0;
}
@@ -218,7 +218,7 @@ render_as_sql (GdaSqlBuilder *b)
GdaStatement *stmt;
GError *error = NULL;
static GdaConnection *cnc = NULL;
-
+
if (!cnc) {
cnc = gda_connection_open_from_string ("SQLite", "DB_DIR=.;DB_NAME=test", NULL,
GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE, NULL);
@@ -244,7 +244,7 @@ render_as_sql (GdaSqlBuilder *b)
else {
g_print ("SQL: %s\n", sql);
g_free (sql);
- }
+ }
g_object_unref (stmt);
}
}
diff --git a/tests/test-sql-builder.c b/tests/test-sql-builder.c
index 5ae8b21..7917868 100644
--- a/tests/test-sql-builder.c
+++ b/tests/test-sql-builder.c
@@ -155,11 +155,11 @@ static GdaSqlStatement *
build1 (void)
{
GdaSqlBuilder *builder;
- guint op_ids [3];
+ GdaSqlBuilderId op_ids [3];
gint index = 0;
GdaSqlStatement *stmt;
- memset (op_ids, 0, sizeof (guint) * 3);
+ memset (op_ids, 0, sizeof (GdaSqlBuilderId) * 3);
builder = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
gda_sql_builder_select_add_target_id (builder,
@@ -172,7 +172,7 @@ build1 (void)
gda_sql_builder_add_id (builder, "rank"), 0);
gda_sql_builder_add_field_value_id (builder,
gda_sql_builder_add_id (builder, "name"), 0);
- guint id_cond1 = gda_sql_builder_add_cond (builder, GDA_SQL_OPERATOR_TYPE_EQ,
+ GdaSqlBuilderId id_cond1 = gda_sql_builder_add_cond (builder, GDA_SQL_OPERATOR_TYPE_EQ,
gda_sql_builder_add_id (builder, "session"),
gda_sql_builder_add_param (builder, "session", G_TYPE_STRING, FALSE), 0);
@@ -186,7 +186,7 @@ build1 (void)
gda_sql_builder_add_expr (builder, NULL, G_TYPE_STRING, "alf"), 0);
index++;
- guint id_cond2 = gda_sql_builder_add_cond_v (builder, GDA_SQL_OPERATOR_TYPE_AND, op_ids, index);
+ GdaSqlBuilderId id_cond2 = gda_sql_builder_add_cond_v (builder, GDA_SQL_OPERATOR_TYPE_AND, op_ids, index);
gda_sql_builder_set_where (builder, gda_sql_builder_add_cond (builder, GDA_SQL_OPERATOR_TYPE_AND, id_cond1, id_cond2, 0));
@@ -273,7 +273,7 @@ build4 (void)
{
GdaSqlBuilder *b;
GdaSqlStatement *stmt;
- guint t1, t2;
+ GdaSqlBuilderId t1, t2;
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
gda_sql_builder_add_field_value_id (b,
@@ -354,10 +354,10 @@ build6 (void)
gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_id (b, "mytable"),
NULL);
- guint id_cond1 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ GdaSqlBuilderId id_cond1 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
gda_sql_builder_add_id (b, "order_key"),
gda_sql_builder_add_param (b, "orderkey", G_TYPE_INT, FALSE), 0);
- guint id_cond2 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_DIFF,
+ GdaSqlBuilderId id_cond2 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_DIFF,
gda_sql_builder_add_id (b, "fav_id"),
gda_sql_builder_add_param (b, "id", G_TYPE_INT, FALSE), 0);
@@ -382,15 +382,15 @@ build7 (void)
gda_sql_builder_add_field_value_id (b,
gda_sql_builder_add_id (b, "rank"),
gda_sql_builder_add_param (b, "newrank", G_TYPE_INT, FALSE));
- guint id_cond1 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ GdaSqlBuilderId id_cond1 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
gda_sql_builder_add_id (b, "fav_id"),
gda_sql_builder_add_param (b, "id", G_TYPE_INT, FALSE),
0);
- guint id_cond2 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ GdaSqlBuilderId id_cond2 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
gda_sql_builder_add_id (b, "order_key"),
gda_sql_builder_add_param (b, "orderkey", G_TYPE_INT, FALSE),
0);
- guint id_cond3 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ GdaSqlBuilderId id_cond3 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
gda_sql_builder_add_id (b, "rank"),
gda_sql_builder_add_param (b, "rank", G_TYPE_INT, FALSE),
0);
@@ -412,7 +412,7 @@ build8 (void)
b = gda_sql_builder_new (GDA_SQL_STATEMENT_DELETE);
gda_sql_builder_set_table (b, "mytable");
-
+
gda_sql_builder_set_where (b, gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
gda_sql_builder_add_id (b, "id"),
gda_sql_builder_add_param (b, "id", G_TYPE_INT, FALSE),
@@ -442,7 +442,7 @@ build9 (void)
stmt = gda_sql_statement_copy (gda_sql_builder_get_sql_statement (builder));
g_object_unref (builder);
-
+
return stmt;
}
@@ -523,7 +523,7 @@ build12 (void)
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
gda_sql_builder_add_field_value_id (b, gda_sql_builder_add_id (b, "store_name"), 0);
- const guint id_func = gda_sql_builder_add_function (b, "sum",
+ const GdaSqlBuilderId id_func = gda_sql_builder_add_function (b, "sum",
gda_sql_builder_add_id (b, "sales"), 0);
gda_sql_builder_add_field_value_id (b, id_func, 0);
@@ -553,13 +553,13 @@ build12 (void)
}
/*
- *
+ *
*/
static gboolean
builder_test_target_id (void)
{
GdaSqlBuilder *builder;
- guint id1, id2;
+ GdaSqlBuilderId id1, id2;
gboolean allok = TRUE;
builder = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
@@ -597,6 +597,6 @@ builder_test_target_id (void)
}
g_object_unref (builder);
-
+
return allok;
}
diff --git a/tools/browser/browser-connection.c b/tools/browser/browser-connection.c
index 064b11f..b8a75ae 100644
--- a/tools/browser/browser-connection.c
+++ b/tools/browser/browser-connection.c
@@ -1205,7 +1205,7 @@ browser_connection_set_table_column_attribute (BrowserConnection *bcnc,
GdaStatement *stmt;
GdaSqlBuilder *builder;
GdaSet *params;
- guint op_ids[4];
+ GdaSqlBuilderId op_ids[4];
GdaMetaDbObject *dbo = (GdaMetaDbObject *) table;
params = gda_set_new_inline (5, "schema", G_TYPE_STRING, dbo->obj_schema,
@@ -1340,7 +1340,7 @@ browser_connection_get_table_column_attribute (BrowserConnection *bcnc,
GdaStatement *stmt;
GdaSqlBuilder *builder;
GdaSet *params;
- guint op_ids[4];
+ GdaSqlBuilderId op_ids[4];
GdaDataModel *model;
const GValue *cvalue;
GdaMetaDbObject *dbo = (GdaMetaDbObject *) table;
diff --git a/tools/browser/browser-favorites.c b/tools/browser/browser-favorites.c
index c0062b5..a5fd898 100644
--- a/tools/browser/browser-favorites.c
+++ b/tools/browser/browser-favorites.c
@@ -436,11 +436,11 @@ favorites_reorder (BrowserFavorites *bfav, gint order_key, gint id, gint new_pos
gda_sql_builder_add_field_value_id (b,
gda_sql_builder_add_id (b, "rank"),
gda_sql_builder_add_param (b, "rank", G_TYPE_INT, FALSE));
- const guint id_cond1 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ const GdaSqlBuilderId id_cond1 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
gda_sql_builder_add_id (b, "fav_id"),
gda_sql_builder_add_param (b, "id", G_TYPE_INT, FALSE),
0);
- const guint id_cond2 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ const GdaSqlBuilderId id_cond2 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
gda_sql_builder_add_id (b, "order_key"),
gda_sql_builder_add_param (b, "orderkey", G_TYPE_INT, FALSE),
0);
@@ -774,7 +774,7 @@ browser_favorites_list (BrowserFavorites *bfav, guint session_id, BrowserFavorit
GdaSqlBuilder *b;
GdaSet *params = NULL;
GdaStatement *stmt;
- guint t1, t2;
+ GdaSqlBuilderId t1, t2;
GdaDataModel *model = NULL;
GSList *fav_list = NULL;
diff --git a/tools/browser/data-manager/data-source.c b/tools/browser/data-manager/data-source.c
index 62227b8..e9b823f 100644
--- a/tools/browser/data-manager/data-source.c
+++ b/tools/browser/data-manager/data-source.c
@@ -493,12 +493,12 @@ init_from_table_node (DataSource *source, xmlNodePtr node, GError **error)
GdaMetaTableColumn *col;
col = GDA_META_TABLE_COLUMN (g_slist_nth_data (mlinked->columns, fk->fk_cols_array [0]));
g_assert (col);
- const guint id1 = gda_sql_builder_add_id (b, fk->fk_names_array [0]);
+ const GdaSqlBuilderId id1 = gda_sql_builder_add_id (b, fk->fk_names_array [0]);
tmp = g_strdup_printf ("%s %s", id ? (gchar*) id : (gchar*) fk_table,
fk->ref_pk_names_array [0]);
- const guint id2 = gda_sql_builder_add_param (b, tmp, col->gtype, FALSE);
+ const GdaSqlBuilderId id2 = gda_sql_builder_add_param (b, tmp, col->gtype, FALSE);
g_free (tmp);
- const guint id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id1, id2, 0);
+ const GdaSqlBuilderId id_cond = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id1, id2, 0);
gda_sql_builder_set_where (b, id_cond);
}
else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]