[libgda] More SqlBuilder documentation corrections.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] More SqlBuilder documentation corrections.
- Date: Thu, 20 May 2010 19:37:20 +0000 (UTC)
commit 784d39de69e897fb5f6cd3d3b521622ec9b8212b
Author: Murray Cumming <murrayc murrayc com>
Date: Thu May 20 21:36:58 2010 +0200
More SqlBuilder documentation corrections.
doc/C/howto.xml | 4 +-
doc/C/tmpl/gda-sql-builder.sgml | 19 ++--
libgda/gda-sql-builder.c | 6 +-
tests/test-sql-builder.c | 218 +++++++++++++++++++-------------------
4 files changed, 123 insertions(+), 124 deletions(-)
---
diff --git a/doc/C/howto.xml b/doc/C/howto.xml
index 77602e7..34dcaec 100644
--- a/doc/C/howto.xml
+++ b/doc/C/howto.xml
@@ -163,7 +163,7 @@ b = gda_sql_builder_new (GDA_SQL_STATEMENT_DELETE);
gda_sql_builder_set_table (b, "items");
guint id_field = gda_sql_builder_add_id (b, "id");
guint id_param = gda_sql_builder_add_param (b, "theid", G_TYPE_INT, FALSE);
-guint id_cond = gda_sql_builder_add_cond (b, 3, GDA_SQL_OPERATOR_TYPE_EQ, id_field, id_param, 0);
+guint 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);
[...]
g_object_unref (b);
@@ -211,7 +211,7 @@ gda_sql_builder_select_add_target_id (b,
NULL);
guint id_field = gda_sql_builder_add_id (b, "id");
guint id_subselect = gda_sql_builder_add_sub_select (b, sub, TRUE);
-guint id_cond = gda_sql_builder_add_cond (b, 3, GDA_SQL_OPERATOR_TYPE_IN, id_field, id_subselect, 0);
+guint 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);
[...]
g_object_unref (b);
diff --git a/doc/C/tmpl/gda-sql-builder.sgml b/doc/C/tmpl/gda-sql-builder.sgml
index 8d0f434..bd83e0e 100644
--- a/doc/C/tmpl/gda-sql-builder.sgml
+++ b/doc/C/tmpl/gda-sql-builder.sgml
@@ -18,22 +18,21 @@ Factory object for statements
<para>
During the building process, some pieces of the statement are constructed, and assembled into the
final statement. Each of these pieces can be reused anytime in the same #GdaBuilder object, and each
- is identified using a single unsigned integer ID. That ID can either be specified by the user, or
- be dynamically allocated by the object (pass 0 as the requested ID).
+ is identified using a single unsigned integer ID. That ID is dynamically allocated by the object.
</para>
<para>
The following example builds the equivalent of the <![CDATA["name='joe' AND age >= ##ageparam::int"]]> expression:
<programlisting><![CDATA[
GdaSqlBuilder *b=...
-gda_sql_builder_add_id (b, 1, "name"); // build the "name" SQL identifier with requested ID=1
-gda_sql_builder_add_expr (b, 2, NULL, G_TYPE_STRING, "joe"); // 'joe' expression, requested ID=2
-gda_sql_builder_add_cond2 (b, 3, GDA_SQL_OPERATOR_TYPE_EQ, 1, 2); // "name='joe'", requested ID=3
-
-gda_sql_builder_add_cond2 (b, 4, GDA_SQL_OPERATOR_TYPE_GT, // requested ID=4
- gda_sql_builder_add_id (b, 0, "age"), // build the "age" SQL identifier, no specific ID
- gda_sql_builder_add_param (b, 0, "ageparam", G_TYPE_INT, FALSE) // parameter, no specific ID
- );
-gda_sql_builder_add_cond2 (b, 5, GDA_SQL_OPERATOR_TYPE_AND, 3, 4); // whole expression, requested ID=5
+guint id_field = gda_sql_builder_add_id (b, "name"); // build the "name" SQL identifier
+guint id_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "joe"); // 'joe' expression
+guint id_cond1 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, id_field, id_value, 0); // "name='joe'"
+
+guint id_cond2 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_GT,
+ gda_sql_builder_add_id (b, "age"), // build the "age" SQL identifier
+ gda_sql_builder_add_param (b, "ageparam", G_TYPE_INT, FALSE), // parameter
+ 0);
+guint id_cond_and = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_AND, id_cond1, id_cond2, 0); // whole expression
]]></programlisting>
</para>
<para>
diff --git a/libgda/gda-sql-builder.c b/libgda/gda-sql-builder.c
index 44dbce8..f11e591 100644
--- a/libgda/gda-sql-builder.c
+++ b/libgda/gda-sql-builder.c
@@ -798,8 +798,8 @@ gda_sql_builder_add_expr_value (GdaSqlBuilder *builder, GdaDataHandler *dh, cons
*
* For example:
* <programlisting>
- * gda_sql_builder_add_expr (b, 0, G_TYPE_INT, 15);
- * gda_sql_builder_add_expr (b, 5, G_TYPE_STRING, "joe")
+ * gda_sql_builder_add_expr (b, G_TYPE_INT, 15);
+ * gda_sql_builder_add_expr (b, G_TYPE_STRING, "joe")
* </programlisting>
*
* will be rendered as SQL as:
@@ -891,7 +891,7 @@ gda_sql_builder_add_id (GdaSqlBuilder *builder, const gchar *string)
* The new expression will contain the @string literal.
* For example:
* <programlisting>
- * gda_sql_builder_add_param (b, 0, "age", G_TYPE_INT, FALSE)
+ * gda_sql_builder_add_param (b, "age", G_TYPE_INT, FALSE)
* </programlisting>
*
* will be rendered as SQL as:
diff --git a/tests/test-sql-builder.c b/tests/test-sql-builder.c
index d6480bb..558f652 100644
--- a/tests/test-sql-builder.c
+++ b/tests/test-sql-builder.c
@@ -135,9 +135,9 @@ build0 (void)
builder = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "*"), 0);
- gda_sql_builder_select_add_target_id (builder, 0,
- gda_sql_builder_add_id (builder, 0, "mytable"), NULL);
+ gda_sql_builder_add_id (builder, "*"), 0);
+ gda_sql_builder_select_add_target_id (builder,
+ gda_sql_builder_add_id (builder, "mytable"), NULL);
stmt = gda_sql_builder_get_sql_statement (builder);
g_object_unref (builder);
return stmt;
@@ -157,33 +157,33 @@ build1 (void)
memset (op_ids, 0, sizeof (guint) * 3);
builder = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
- gda_sql_builder_select_add_target_id (builder, 0,
- gda_sql_builder_add_id (builder, 0, "mytable"), NULL);
+ gda_sql_builder_select_add_target_id (builder,
+ gda_sql_builder_add_id (builder, "mytable"), NULL);
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "contents"), 0);
+ gda_sql_builder_add_id (builder, "contents"), 0);
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "descr"), 0);
+ gda_sql_builder_add_id (builder, "descr"), 0);
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "rank"), 0);
+ gda_sql_builder_add_id (builder, "rank"), 0);
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "name"), 0);
- gda_sql_builder_add_cond (builder, 1, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (builder, 0, "session"),
- gda_sql_builder_add_param (builder, 0, "session", G_TYPE_STRING, FALSE), 0);
-
- op_ids [index] = gda_sql_builder_add_cond (builder, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (builder, 0, "type"),
- gda_sql_builder_add_expr (builder, 0, NULL, G_TYPE_STRING, "TABLE"), 0);
+ gda_sql_builder_add_id (builder, "name"), 0);
+ guint id_cond = 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);
+
+ op_ids [index] = gda_sql_builder_add_cond (builder, GDA_SQL_OPERATOR_TYPE_EQ,
+ gda_sql_builder_add_id (builder, "type"),
+ gda_sql_builder_add_expr (builder, NULL, G_TYPE_STRING, "TABLE"), 0);
index++;
- op_ids [index] = gda_sql_builder_add_cond (builder, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (builder, 0, "name"),
- gda_sql_builder_add_expr (builder, 0, NULL, G_TYPE_STRING, "alf"), 0);
+ op_ids [index] = gda_sql_builder_add_cond (builder, GDA_SQL_OPERATOR_TYPE_EQ,
+ gda_sql_builder_add_id (builder, "name"),
+ gda_sql_builder_add_expr (builder, NULL, G_TYPE_STRING, "alf"), 0);
index++;
- gda_sql_builder_add_cond_v (builder, 2, GDA_SQL_OPERATOR_TYPE_AND, op_ids, index);
+ guint 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, 0, GDA_SQL_OPERATOR_TYPE_AND, 1, 2, 0));
+ gda_sql_builder_set_where (builder, gda_sql_builder_add_cond (builder, GDA_SQL_OPERATOR_TYPE_AND, id_cond1, id_cond2, 0));
stmt = gda_sql_builder_get_sql_statement (builder);
g_object_unref (builder);
@@ -204,20 +204,20 @@ build2 (void)
gda_sql_builder_set_table (builder, "mytable");
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "session"),
- gda_sql_builder_add_param (builder, 0, "session", G_TYPE_INT, FALSE));
+ gda_sql_builder_add_id (builder, "session"),
+ gda_sql_builder_add_param (builder, "session", G_TYPE_INT, FALSE));
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "type"),
- gda_sql_builder_add_param (builder, 0, "type", G_TYPE_INT, FALSE));
+ gda_sql_builder_add_id (builder, "type"),
+ gda_sql_builder_add_param (builder, "type", G_TYPE_INT, FALSE));
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "name"),
- gda_sql_builder_add_param (builder, 0, "name", G_TYPE_STRING, TRUE));
+ gda_sql_builder_add_id (builder, "name"),
+ gda_sql_builder_add_param (builder, "name", G_TYPE_STRING, TRUE));
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "contents"),
- gda_sql_builder_add_param (builder, 0, "contents", G_TYPE_STRING, FALSE));
+ gda_sql_builder_add_id (builder, "contents"),
+ gda_sql_builder_add_param (builder, "contents", G_TYPE_STRING, FALSE));
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "descr"),
- gda_sql_builder_add_param (builder, 0, "descr", G_TYPE_STRING, TRUE));
+ gda_sql_builder_add_id (builder, "descr"),
+ gda_sql_builder_add_param (builder, "descr", G_TYPE_STRING, TRUE));
stmt = gda_sql_builder_get_sql_statement (builder);
g_object_unref (builder);
@@ -238,19 +238,19 @@ build3 (void)
gda_sql_builder_set_table (builder, "mytable");
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "name"),
- gda_sql_builder_add_param (builder, 0, "name", G_TYPE_STRING, TRUE));
+ gda_sql_builder_add_id (builder, "name"),
+ gda_sql_builder_add_param (builder, "name", G_TYPE_STRING, TRUE));
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "contents"),
- gda_sql_builder_add_param (builder, 0, "contents", G_TYPE_STRING, FALSE));
+ gda_sql_builder_add_id (builder, "contents"),
+ gda_sql_builder_add_param (builder, "contents", G_TYPE_STRING, FALSE));
gda_sql_builder_add_field_id (builder,
- gda_sql_builder_add_id (builder, 0, "descr"),
- gda_sql_builder_add_param (builder, 0, "descr", G_TYPE_STRING, TRUE));
+ gda_sql_builder_add_id (builder, "descr"),
+ gda_sql_builder_add_param (builder, "descr", G_TYPE_STRING, TRUE));
gda_sql_builder_set_where (builder,
- gda_sql_builder_add_cond (builder, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (builder, 0, "id"),
- gda_sql_builder_add_param (builder, 0, "id", G_TYPE_INT, FALSE),
+ gda_sql_builder_add_cond (builder, GDA_SQL_OPERATOR_TYPE_EQ,
+ gda_sql_builder_add_id (builder, "id"),
+ gda_sql_builder_add_param (builder, "id", G_TYPE_INT, FALSE),
0));
stmt = gda_sql_builder_get_sql_statement (builder);
@@ -272,30 +272,30 @@ build4 (void)
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
gda_sql_builder_add_field_id (b,
- gda_sql_builder_add_id (b, 0, "fav.*"), 0);
- t1 = gda_sql_builder_select_add_target_id (b, 0,
- gda_sql_builder_add_id (b, 0, "mytable"),
+ gda_sql_builder_add_id (b, "fav.*"), 0);
+ t1 = gda_sql_builder_select_add_target_id (b,
+ gda_sql_builder_add_id (b, "mytable"),
"fav");
- t2 = gda_sql_builder_select_add_target_id (b, 0,
- gda_sql_builder_add_id (b, 0, "fav_orders"),
+ t2 = gda_sql_builder_select_add_target_id (b,
+ gda_sql_builder_add_id (b, "fav_orders"),
"o");
- gda_sql_builder_select_join_targets (b, 0, t1, t2, GDA_SQL_SELECT_JOIN_LEFT,
- gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "fav.id"),
- gda_sql_builder_add_id (b, 0, "o.fav_id"),
+ gda_sql_builder_select_join_targets (b, t1, t2, GDA_SQL_SELECT_JOIN_LEFT,
+ gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ gda_sql_builder_add_id (b, "fav.id"),
+ gda_sql_builder_add_id (b, "o.fav_id"),
0));
gda_sql_builder_set_where (b,
- gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_AND,
- gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "fav.sesion"),
- gda_sql_builder_add_param (b, 0, "session", G_TYPE_INT, FALSE), 0),
- gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "o.order_key"),
- gda_sql_builder_add_param (b, 0, "okey", G_TYPE_INT, FALSE), 0), 0));
+ gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_AND,
+ gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ gda_sql_builder_add_id (b, "fav.sesion"),
+ gda_sql_builder_add_param (b, "session", G_TYPE_INT, FALSE), 0),
+ gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ gda_sql_builder_add_id (b, "o.order_key"),
+ gda_sql_builder_add_param (b, "okey", G_TYPE_INT, FALSE), 0), 0));
gda_sql_builder_select_order_by (b,
- gda_sql_builder_add_id (b, 0, "o.rank"), TRUE, NULL);
+ gda_sql_builder_add_id (b, "o.rank"), TRUE, NULL);
stmt = gda_sql_builder_get_sql_statement (b);
g_object_unref (b);
return stmt;
@@ -313,19 +313,19 @@ build5 (void)
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
gda_sql_builder_add_field_id (b,
- gda_sql_builder_add_id (b, 0, "id"), 0);
- gda_sql_builder_select_add_target_id (b, 0,
- gda_sql_builder_add_id (b, 0, "mytable"),
+ gda_sql_builder_add_id (b, "id"), 0);
+ gda_sql_builder_select_add_target_id (b,
+ gda_sql_builder_add_id (b, "mytable"),
NULL);
gda_sql_builder_set_where (b,
- gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_AND,
- gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "sesion"),
- gda_sql_builder_add_param (b, 0, "session", G_TYPE_INT, FALSE), 0),
- gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "contents"),
- gda_sql_builder_add_param (b, 0, "contents", G_TYPE_INT, FALSE), 0), 0));
+ gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_AND,
+ gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ gda_sql_builder_add_id (b, "sesion"),
+ gda_sql_builder_add_param (b, "session", G_TYPE_INT, FALSE), 0),
+ gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ,
+ gda_sql_builder_add_id (b, "contents"),
+ gda_sql_builder_add_param (b, "contents", G_TYPE_INT, FALSE), 0), 0));
stmt = gda_sql_builder_get_sql_statement (b);
g_object_unref (b);
@@ -343,20 +343,20 @@ build6 (void)
GdaSqlStatement *stmt;
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
- gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "fav_id"), 0);
- gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "rank"), 0);
+ gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, "fav_id"), 0);
+ gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, "rank"), 0);
- gda_sql_builder_select_add_target_id (b, 0,
- gda_sql_builder_add_id (b, 0, "mytable"),
+ gda_sql_builder_select_add_target_id (b,
+ gda_sql_builder_add_id (b, "mytable"),
NULL);
- gda_sql_builder_add_cond (b, 1, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "order_key"),
- gda_sql_builder_add_param (b, 0, "orderkey", G_TYPE_INT, FALSE), 0);
- gda_sql_builder_add_cond (b, 2, GDA_SQL_OPERATOR_TYPE_DIFF,
- gda_sql_builder_add_id (b, 0, "fav_id"),
- gda_sql_builder_add_param (b, 0, "id", G_TYPE_INT, FALSE), 0);
+ guint 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,
+ gda_sql_builder_add_id (b, "fav_id"),
+ gda_sql_builder_add_param (b, "id", G_TYPE_INT, FALSE), 0);
- gda_sql_builder_set_where (b, gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_AND, 1, 2, 0));
+ gda_sql_builder_set_where (b, gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_AND, id_cond1, id_cond2, 0));
stmt = gda_sql_builder_get_sql_statement (b);
g_object_unref (b);
@@ -375,21 +375,21 @@ build7 (void)
b = gda_sql_builder_new (GDA_SQL_STATEMENT_UPDATE);
gda_sql_builder_set_table (b, "mytable");
gda_sql_builder_add_field_id (b,
- gda_sql_builder_add_id (b, 0, "rank"),
- gda_sql_builder_add_param (b, 0, "newrank", G_TYPE_INT, FALSE));
- gda_sql_builder_add_cond (b, 1, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "fav_id"),
- gda_sql_builder_add_param (b, 0, "id", G_TYPE_INT, FALSE),
+ 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,
+ gda_sql_builder_add_id (b, "fav_id"),
+ gda_sql_builder_add_param (b, "id", G_TYPE_INT, FALSE),
0);
- gda_sql_builder_add_cond (b, 2, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "order_key"),
- gda_sql_builder_add_param (b, 0, "orderkey", G_TYPE_INT, FALSE),
+ guint 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);
- gda_sql_builder_add_cond (b, 3, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "rank"),
- gda_sql_builder_add_param (b, 0, "rank", G_TYPE_INT, FALSE),
+ guint id_cond_3 = 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);
- gda_sql_builder_set_where (b, gda_sql_builder_add_cond (b, 0, GDA_SQL_OPERATOR_TYPE_AND, 1, 2, 3));
+ gda_sql_builder_set_where (b, gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_AND, id_cond1, id_cond2, id_cond3));
stmt = gda_sql_builder_get_sql_statement (b);
g_object_unref (b);
@@ -408,9 +408,9 @@ 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, 0, GDA_SQL_OPERATOR_TYPE_EQ,
- gda_sql_builder_add_id (b, 0, "id"),
- gda_sql_builder_add_param (b, 0, "id", G_TYPE_INT, FALSE),
+ 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),
0));
stmt = gda_sql_builder_get_sql_statement (b);
g_object_unref (b);
@@ -451,14 +451,14 @@ build10 (void)
GdaSqlStatement *stmt;
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
- gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "fav_id"), 0);
- gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "rank"), 0);
+ gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, "fav_id"), 0);
+ gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, "rank"), 0);
- gda_sql_builder_select_add_target_id (b, 0,
- gda_sql_builder_add_id (b, 0, "mytable"),
+ gda_sql_builder_select_add_target_id (b,
+ gda_sql_builder_add_id (b, "mytable"),
NULL);
gda_sql_builder_select_set_distinct (b, TRUE, 0);
- gda_sql_builder_select_set_limit (b, gda_sql_builder_add_expr (b, 0, NULL, G_TYPE_INT, 5), 0);
+ gda_sql_builder_select_set_limit (b, gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 5), 0);
{
GdaStatement *st;
@@ -482,16 +482,16 @@ build11 (void)
GdaSqlStatement *stmt;
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
- gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "fav_id"), 0);
- gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "rank"), 0);
+ gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, "fav_id"), 0);
+ gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, "rank"), 0);
- gda_sql_builder_select_add_target_id (b, 0,
- gda_sql_builder_add_id (b, 0, "mytable"),
+ gda_sql_builder_select_add_target_id (b,
+ gda_sql_builder_add_id (b, "mytable"),
NULL);
gda_sql_builder_select_set_distinct (b, TRUE,
- gda_sql_builder_add_id (b, 0, "rank"));
- gda_sql_builder_select_set_limit (b, gda_sql_builder_add_expr (b, 0, NULL, G_TYPE_INT, 5),
- gda_sql_builder_add_expr (b, 0, NULL, G_TYPE_INT, 2));
+ gda_sql_builder_add_id (b, "rank"));
+ gda_sql_builder_select_set_limit (b, gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 5),
+ gda_sql_builder_add_expr (b, NULL, G_TYPE_INT, 2));
#ifdef DEBUG_NO
{
@@ -517,19 +517,19 @@ build12 (void)
GdaSqlStatement *stmt;
b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
- gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "store_name"), 0);
+ gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, "store_name"), 0);
const guint id_func = gda_sql_builder_add_function (b, "sum",
- gda_sql_builder_add_id (b, 0, "sales"), 0);
+ gda_sql_builder_add_id (b, "sales"), 0);
gda_sql_builder_add_field_id (b, id_func, 0);
- gda_sql_builder_select_add_target_id (b, 0,
+ gda_sql_builder_select_add_target_id (b,
gda_sql_builder_add_id (b, "stores"),
NULL);
gda_sql_builder_select_group_by (b, gda_sql_builder_add_id (b, "store_name"));
gda_sql_builder_select_set_having (b,
gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_GT,
id_func,
- gda_sql_builder_add_expr (b, 0, NULL,
+ gda_sql_builder_add_expr (b, NULL,
G_TYPE_INT, 10),
0));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]