[libgda] Last updates due to GdaSqlBuilder API changes



commit 8cc0f65dd943a3a521df94785b0417d890eb1717
Author: Vivien Malerba <malerba gnome-db org>
Date:   Mon Dec 7 22:31:55 2009 +0100

    Last updates due to GdaSqlBuilder API changes

 doc/C/howto.xml                  |   20 ++++++++++----------
 doc/C/libgda-sections.txt        |    1 +
 doc/C/tmpl/gda-sql-builder.sgml  |   11 +++++++++++
 samples/SqlBuilder/example.c     |   30 +++++++++++++++---------------
 samples/SqlBuilder/example_cnc.c |   12 ++++++------
 tests/test-sql-builder.c         |   12 ++++++------
 6 files changed, 49 insertions(+), 37 deletions(-)
---
diff --git a/doc/C/howto.xml b/doc/C/howto.xml
index b84c201..e3a2aaa 100644
--- a/doc/C/howto.xml
+++ b/doc/C/howto.xml
@@ -104,7 +104,7 @@ 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");
 gda_sql_builder_select_add_field (b, "age", NULL, NULL);
-gda_sql_builder_select_add_target (b, 0,
+gda_sql_builder_select_add_target_id (b, 0,
 				   gda_sql_builder_add_id (b, 0, "people"),
 				   NULL);
 [...]	
@@ -119,8 +119,8 @@ g_object_unref (b);
 GdaSqlBuilder *b;
 b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
 gda_sql_builder_add_id (b, 1, "select"); /* SELECT is an SQL reserved keyword */
-gda_sql_builder_select_add_target (b, 1, 1, "c");
-gda_sql_builder_select_add_target (b, 2,
+gda_sql_builder_select_add_target_id (b, 1, 1, "c");
+gda_sql_builder_select_add_target_id (b, 2,
 				   gda_sql_builder_add_id (b, 0, "orders"),
 				   NULL);
 gda_sql_builder_select_join_targets (b, 5, 1, 2, GDA_SQL_SELECT_JOIN_INNER, 0);
@@ -176,7 +176,7 @@ g_object_unref (b);
 	<programlisting>
 GdaSqlBuilder *b;
 b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-gda_sql_builder_select_add_target (b, 0,
+gda_sql_builder_select_add_target_id (b, 0,
 				   gda_sql_builder_add_id (b, 0, "mytable"),
 				   NULL);
 gda_sql_builder_add_function (b, 1, "myfunc",
@@ -198,7 +198,7 @@ GdaSqlBuilder *b;
 GdaSqlStatement *sub;
 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 (b, 0,
+gda_sql_builder_select_add_target_id (b, 0,
 				   gda_sql_builder_add_id (b, 0, "subdata"),
 				   NULL);
 sub = gda_sql_builder_get_sql_statement (b, FALSE);
@@ -206,7 +206,7 @@ g_object_unref (b);
 
 b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
 gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "name"), 0);
-gda_sql_builder_select_add_target (b, 0,
+gda_sql_builder_select_add_target_id (b, 0,
 				   gda_sql_builder_add_id (b, 0, "master"),
 				   NULL);
 gda_sql_builder_add_id (b, 1, "id");
@@ -228,7 +228,7 @@ 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_add_field_id (b, gda_sql_builder_add_id (b, 0, "name"), 0);
 gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "location"), 0);
-gda_sql_builder_select_add_target (b, 0,
+gda_sql_builder_select_add_target_id (b, 0,
 				   gda_sql_builder_add_id (b, 0, "subdate"),
 				   NULL);
 sub = gda_sql_builder_get_sql_statement (b, FALSE);
@@ -254,7 +254,7 @@ GdaSqlStatement *sub1, *sub2;
 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_add_field_id (b, gda_sql_builder_add_id (b, 0, "name"), 0);
-gda_sql_builder_select_add_target (b, 0,
+gda_sql_builder_select_add_target_id (b, 0,
 				   gda_sql_builder_add_id (b, 0, "subdata1"),
 				   NULL);
 sub1 = gda_sql_builder_get_sql_statement (b, FALSE);
@@ -263,7 +263,7 @@ g_object_unref (b);
 b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
 gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "ident"), 0);
 gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "lastname"), 0);
-gda_sql_builder_select_add_target (b, 0,
+gda_sql_builder_select_add_target_id (b, 0,
 				   gda_sql_builder_add_id (b, 0, "subdata2"),
 				   NULL);
 sub2 = gda_sql_builder_get_sql_statement (b, FALSE);
@@ -294,7 +294,7 @@ gda_sql_builder_add_case (b, 10,
 			  gda_sql_builder_add_expr (b, 0, NULL, G_TYPE_INT, 3),
 			  0);
 gda_sql_builder_add_field_id (b, 10, 0);
-gda_sql_builder_select_add_target (b, 0,
+gda_sql_builder_select_add_target_id (b, 0,
 				   gda_sql_builder_add_id (b, 0, "data"),
 				   NULL);
 [...]	
diff --git a/doc/C/libgda-sections.txt b/doc/C/libgda-sections.txt
index 8bf3446..b93bbd3 100644
--- a/doc/C/libgda-sections.txt
+++ b/doc/C/libgda-sections.txt
@@ -1687,6 +1687,7 @@ gda_sql_builder_add_cond_v
 gda_sql_builder_set_where
 <SUBSECTION>
 gda_sql_builder_select_add_target
+gda_sql_builder_select_add_target_id
 gda_sql_builder_select_add_field
 gda_sql_builder_select_join_targets
 gda_sql_builder_join_add_field
diff --git a/doc/C/tmpl/gda-sql-builder.sgml b/doc/C/tmpl/gda-sql-builder.sgml
index b50dc6b..938eb4e 100644
--- a/doc/C/tmpl/gda-sql-builder.sgml
+++ b/doc/C/tmpl/gda-sql-builder.sgml
@@ -284,6 +284,17 @@ gda_sql_builder_add_cond2 (b, 5, GDA_SQL_OPERATOR_TYPE_AND, 3, 4); // whole expr
 </para>
 
 @builder: 
+ table_name: 
+ alias: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_sql_builder_select_add_target_id ##### -->
+<para>
+
+</para>
+
+ builder: 
 @id: 
 @table_id: 
 @alias: 
diff --git a/samples/SqlBuilder/example.c b/samples/SqlBuilder/example.c
index feea7d9..35aa5ad 100644
--- a/samples/SqlBuilder/example.c
+++ b/samples/SqlBuilder/example.c
@@ -69,8 +69,8 @@ main (int argc, char *argv[])
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
 	
 	gda_sql_builder_add_id (b, 1, "select"); /* SELECT is an SQL reserved keyword */
-	gda_sql_builder_select_add_target (b, 1, 1, "c");
-	gda_sql_builder_select_add_target (b, 2,
+	gda_sql_builder_select_add_target_id (b, 1, 1, "c");
+	gda_sql_builder_select_add_target_id (b, 2,
 					   gda_sql_builder_add_id (b, 0, "orders"),
 					   NULL);
 	gda_sql_builder_select_join_targets (b, 5, 1, 2, GDA_SQL_SELECT_JOIN_INNER, 0);
@@ -91,7 +91,7 @@ main (int argc, char *argv[])
 
 	/* SELECT myfunc (a, 5, 'Joe') FROM mytable */
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "mytable"),
 					   NULL);
 	gda_sql_builder_add_function (b, 1, "myfunc",
@@ -131,10 +131,10 @@ main (int argc, char *argv[])
 
 	/* testing identifiers which are SQL reserved keywords */
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-	gda_sql_builder_select_add_target (b, 1,
+	gda_sql_builder_select_add_target_id (b, 1,
 					   gda_sql_builder_add_id (b, 0, "date"),
 					   NULL);
-	gda_sql_builder_select_add_target (b, 2,
+	gda_sql_builder_select_add_target_id (b, 2,
 					   gda_sql_builder_add_id (b, 0, "MyTable"),
 					   NULL);
 	gda_sql_builder_add_function (b, 1, "date",
@@ -150,7 +150,7 @@ main (int argc, char *argv[])
 	GdaSqlStatement *sub;
 	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 (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "subdata"),
 					   NULL);
 	sub = gda_sql_builder_get_sql_statement (b, FALSE);
@@ -158,7 +158,7 @@ main (int argc, char *argv[])
 
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
 	gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "name"), 0);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "master"),
 					   NULL);
 	gda_sql_builder_add_id (b, 1, "id");
@@ -170,7 +170,7 @@ main (int argc, char *argv[])
 
 	/* SELECT id, name, (SELECT MAX (ts) FROM documents AS d WHERE t.id = d.topic) FROM topics AS t */
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "documents"), "d");
 	gda_sql_builder_add_field_id (b,
 				      gda_sql_builder_add_function (b, 0, "MAX",
@@ -184,7 +184,7 @@ main (int argc, char *argv[])
 	g_object_unref (b);
 
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "topics"), "t");
 	gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "id"), 0);
 	gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "name"), 0);
@@ -198,7 +198,7 @@ main (int argc, char *argv[])
 	gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "id"), 0);
 	gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "name"), 0);
 	gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "location"), 0);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "subdate"),
 					   NULL);
 	sub = gda_sql_builder_get_sql_statement (b, FALSE);
@@ -221,7 +221,7 @@ main (int argc, char *argv[])
 	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_add_field_id (b, gda_sql_builder_add_id (b, 0, "name"), 0);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "subdata1"),
 					   NULL);
 	sub1 = gda_sql_builder_get_sql_statement (b, FALSE);
@@ -230,7 +230,7 @@ main (int argc, char *argv[])
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
 	gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "ident"), 0);
 	gda_sql_builder_add_field_id (b, gda_sql_builder_add_id (b, 0, "lastname"), 0);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "subdata2"),
 					   NULL);
 	sub2 = gda_sql_builder_get_sql_statement (b, FALSE);
@@ -254,7 +254,7 @@ main (int argc, char *argv[])
 				  1, gda_sql_builder_add_expr (b, 0, NULL, G_TYPE_INT, 2),
 				  0);
 	gda_sql_builder_add_field_id (b, 10, 0);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "data"),
 					   NULL);
 	render_as_sql (b);
@@ -273,7 +273,7 @@ main (int argc, char *argv[])
 				  gda_sql_builder_add_expr (b, 0, NULL, G_TYPE_INT, 3),
 				  0);
 	gda_sql_builder_add_field_id (b, 10, 0);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "data"),
 					   NULL);
 	render_as_sql (b);
@@ -288,7 +288,7 @@ main (int argc, char *argv[])
 	gda_sql_builder_select_add_field (b, "lastname", "people", NULL);
 	gda_sql_builder_select_add_field (b, "date", NULL, "birthdate");
 	gda_sql_builder_select_add_field (b, "age", NULL, NULL);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "people"),
 					   NULL);
 
diff --git a/samples/SqlBuilder/example_cnc.c b/samples/SqlBuilder/example_cnc.c
index 1f28b52..5f5f60e 100644
--- a/samples/SqlBuilder/example_cnc.c
+++ b/samples/SqlBuilder/example_cnc.c
@@ -70,8 +70,8 @@ main (int argc, char *argv[])
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
 	
 	gda_sql_builder_add_id (b, 1, "select"); /* SELECT is an SQL reserved keyword */
-	gda_sql_builder_select_add_target (b, 1, 1, "c");
-	gda_sql_builder_select_add_target (b, 2,
+	gda_sql_builder_select_add_target_id (b, 1, 1, "c");
+	gda_sql_builder_select_add_target_id (b, 2,
 					   gda_sql_builder_add_id (b, 0, "orders"),
 					   NULL);
 	gda_sql_builder_select_join_targets (b, 5, 1, 2, GDA_SQL_SELECT_JOIN_INNER, 0);
@@ -92,7 +92,7 @@ main (int argc, char *argv[])
 
 	/* SELECT myfunc (a, 5, 'Joe') FROM mytable */
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "mytable"),
 					   NULL);
 	gda_sql_builder_add_function (b, 1, "myfunc",
@@ -132,10 +132,10 @@ main (int argc, char *argv[])
 
 	/* testing identifiers which are SQL reserved keywords */
 	b = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-	gda_sql_builder_select_add_target (b, 1,
+	gda_sql_builder_select_add_target_id (b, 1,
 					   gda_sql_builder_add_id (b, 0, "date"),
 					   NULL);
-	gda_sql_builder_select_add_target (b, 2,
+	gda_sql_builder_select_add_target_id (b, 2,
 					   gda_sql_builder_add_id (b, 0, "MyTable"),
 					   NULL);
 	
@@ -156,7 +156,7 @@ main (int argc, char *argv[])
 	gda_sql_builder_select_add_field (b, "lastname", "people", NULL);
 	gda_sql_builder_select_add_field (b, "date", NULL, "birthdate");
 	gda_sql_builder_select_add_field (b, "age", NULL, NULL);
-	gda_sql_builder_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "people"),
 					   NULL);
 
diff --git a/tests/test-sql-builder.c b/tests/test-sql-builder.c
index 688a1be..6ed180a 100644
--- a/tests/test-sql-builder.c
+++ b/tests/test-sql-builder.c
@@ -128,7 +128,7 @@ 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 (builder, 0,
+	gda_sql_builder_select_add_target_id (builder, 0,
 					   gda_sql_builder_add_id (builder, 0, "mytable"), NULL);
 	stmt = gda_sql_builder_get_sql_statement (builder, FALSE);
 	g_object_unref (builder);
@@ -149,7 +149,7 @@ build1 (void)
 	memset (op_ids, 0, sizeof (guint) * 3);
 
 	builder = gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
-	gda_sql_builder_select_add_target (builder, 0,
+	gda_sql_builder_select_add_target_id (builder, 0,
 					   gda_sql_builder_add_id (builder, 0, "mytable"), NULL);
 	gda_sql_builder_add_field_id (builder,
 				   gda_sql_builder_add_id (builder, 0, "contents"), 0);
@@ -265,10 +265,10 @@ 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 (b, 0,
+	t1 = gda_sql_builder_select_add_target_id (b, 0,
 						gda_sql_builder_add_id (b, 0, "mytable"),
 						"fav");
-	t2 = gda_sql_builder_select_add_target (b, 0,
+	t2 = gda_sql_builder_select_add_target_id (b, 0,
 						gda_sql_builder_add_id (b, 0, "fav_orders"),
 						"o");
 	gda_sql_builder_select_join_targets (b, 0, t1, t2, GDA_SQL_SELECT_JOIN_LEFT,
@@ -306,7 +306,7 @@ 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 (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "mytable"),
 					   NULL);
 
@@ -338,7 +338,7 @@ build6 (void)
 	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_select_add_target (b, 0,
+	gda_sql_builder_select_add_target_id (b, 0,
 					   gda_sql_builder_add_id (b, 0, "mytable"),
 					   NULL);
 	gda_sql_builder_add_cond (b, 1, GDA_SQL_OPERATOR_TYPE_EQ,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]