libgda r3316 - in trunk: . doc/C doc/C/tmpl libgda libgda/sql-parser
- From: vivien svn gnome org
- To: svn-commits-list gnome org
- Subject: libgda r3316 - in trunk: . doc/C doc/C/tmpl libgda libgda/sql-parser
- Date: Sun, 8 Feb 2009 21:46:09 +0000 (UTC)
Author: vivien
Date: Sun Feb 8 21:46:09 2009
New Revision: 3316
URL: http://svn.gnome.org/viewvc/libgda?rev=3316&view=rev
Log:
2009-02-08 Vivien Malerba <malerba gnome-db org>
* doc/C:
* libgda/sql-parser:
* libgda/libgda.symbols:
- documentation improvements, fixes bug #570787
- removed symbols which should never have been public
Modified:
trunk/ChangeLog
trunk/doc/C/libgda-4.0-docs.sgml
trunk/doc/C/libgda-4.0-sections.txt
trunk/doc/C/prov-writing.xml
trunk/doc/C/tmpl/gda-sql-statement.sgml
trunk/libgda/libgda.symbols
trunk/libgda/sql-parser/gda-statement-struct-compound.c
trunk/libgda/sql-parser/gda-statement-struct-compound.h
trunk/libgda/sql-parser/gda-statement-struct-delete.c
trunk/libgda/sql-parser/gda-statement-struct-delete.h
trunk/libgda/sql-parser/gda-statement-struct-insert.c
trunk/libgda/sql-parser/gda-statement-struct-insert.h
trunk/libgda/sql-parser/gda-statement-struct-parts.c
trunk/libgda/sql-parser/gda-statement-struct-parts.h
trunk/libgda/sql-parser/gda-statement-struct-pspec.c
trunk/libgda/sql-parser/gda-statement-struct-select.c
trunk/libgda/sql-parser/gda-statement-struct-select.h
trunk/libgda/sql-parser/gda-statement-struct-trans.c
trunk/libgda/sql-parser/gda-statement-struct-trans.h
trunk/libgda/sql-parser/gda-statement-struct-unknown.c
trunk/libgda/sql-parser/gda-statement-struct-unknown.h
trunk/libgda/sql-parser/gda-statement-struct-update.c
trunk/libgda/sql-parser/gda-statement-struct-update.h
trunk/libgda/sql-parser/gda-statement-struct-util.c
trunk/libgda/sql-parser/gda-statement-struct.c
Modified: trunk/doc/C/libgda-4.0-docs.sgml
==============================================================================
--- trunk/doc/C/libgda-4.0-docs.sgml (original)
+++ trunk/doc/C/libgda-4.0-docs.sgml Sun Feb 8 21:46:09 2009
@@ -503,7 +503,11 @@
documentation for a description of this syntax.
</para>
</listitem>
- <listitem><para>by building it from its structure (see the <link linkend="GdaSqlStatement">GdaSqlStatement</link>).
+ <listitem><para>by building it from its structure: see the
+ <link linkend="GdaSqlStatement">GdaSqlStatement</link> for reference.
+ However keep in mind that this API is meant to be used primarily by database
+ provider's implementations and for &LIBGDA;'s internal usage. A more user friendly
+ API will be added in the future.
</para></listitem>
</itemizedlist>
</para>
@@ -530,7 +534,6 @@
&libgda-GdaBatch;
&libgda-GdaHolder;
&libgda-GdaSet;
- &libgda-GdaSqlStatement;
&libgda-GdaConnection-event;
&libgda-transaction-status;
&libgda-xa-transaction;
Modified: trunk/doc/C/libgda-4.0-sections.txt
==============================================================================
--- trunk/doc/C/libgda-4.0-sections.txt (original)
+++ trunk/doc/C/libgda-4.0-sections.txt Sun Feb 8 21:46:09 2009
@@ -1184,7 +1184,6 @@
GdaSqlStatementCompound
gda_sql_statement_compound_set_type
gda_sql_statement_compound_take_stmt
-gda_sql_statement_compound_reduce
<SUBSECTION>
GdaSqlExpr
gda_sql_expr_new
@@ -1278,8 +1277,11 @@
gda_sql_select_order_free
gda_sql_select_order_copy
gda_sql_select_order_serialize
+<SUBSECTION>
+gda_sql_value_stringify
</SECTION>
+
<SECTION>
<FILE>gda-meta-store</FILE>
<TITLE>GdaMetaStore</TITLE>
Modified: trunk/doc/C/prov-writing.xml
==============================================================================
--- trunk/doc/C/prov-writing.xml (original)
+++ trunk/doc/C/prov-writing.xml Sun Feb 8 21:46:09 2009
@@ -816,6 +816,7 @@
</itemizedlist>
</para>
</sect1>
+ &libgda-GdaSqlStatement;
</chapter>
<chapter id="libgda-provider-pack">
Modified: trunk/doc/C/tmpl/gda-sql-statement.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-sql-statement.sgml (original)
+++ trunk/doc/C/tmpl/gda-sql-statement.sgml Sun Feb 8 21:46:09 2009
@@ -637,15 +637,6 @@
@s:
-<!-- ##### FUNCTION gda_sql_statement_compound_reduce ##### -->
-<para>
-
-</para>
-
- compound_or_select:
- Returns:
-
-
<!-- ##### STRUCT GdaSqlExpr ##### -->
<para>
This structure contains any expression, either as a value (the @value part is set), a variable (the @param_spec is set),
@@ -663,6 +654,50 @@
@_gda_reserved1:
@_gda_reserved2:
+<!-- ##### FUNCTION gda_sql_expr_new ##### -->
+<para>
+
+</para>
+
+ parent:
+ Returns:
+
+
+<!-- ##### FUNCTION gda_sql_expr_free ##### -->
+<para>
+
+</para>
+
+ expr:
+
+
+<!-- ##### FUNCTION gda_sql_expr_copy ##### -->
+<para>
+
+</para>
+
+ expr:
+ Returns:
+
+
+<!-- ##### FUNCTION gda_sql_expr_serialize ##### -->
+<para>
+
+</para>
+
+ expr:
+ Returns:
+
+
+<!-- ##### FUNCTION gda_sql_expr_take_select ##### -->
+<para>
+
+</para>
+
+ expr:
+ stmt:
+
+
<!-- ##### STRUCT GdaSqlParamSpec ##### -->
<para>
@@ -753,12 +788,66 @@
This structure represents the name of a table's field.
</para>
+ any:
+ field_name:
+ validity_meta_table_column:
+ _gda_reserved1:
+ _gda_reserved2:
+
+<!-- ##### FUNCTION gda_sql_field_new ##### -->
+<para>
+
+</para>
+
+ parent:
+ Returns:
+
+
+<!-- ##### FUNCTION gda_sql_field_free ##### -->
+<para>
+
+</para>
+
+ field:
+
+
+<!-- ##### FUNCTION gda_sql_field_copy ##### -->
+<para>
+
+</para>
+
+ field:
+ Returns:
+
+
+<!-- ##### FUNCTION gda_sql_field_serialize ##### -->
+<para>
+
+</para>
+
+ field:
+ Returns:
+
+
+<!-- ##### FUNCTION gda_sql_field_take_name ##### -->
+<para>
+
+</para>
+
+ field:
+ value:
+
<!-- ##### STRUCT GdaSqlTable ##### -->
<para>
This structure represents the name of a table.
</para>
+ any:
+ table_name:
+ validity_meta_object:
+ _gda_reserved1:
+ _gda_reserved2:
<!-- ##### FUNCTION gda_sql_table_new ##### -->
<para>
@@ -1342,3 +1431,12 @@
@Returns:
+<!-- ##### FUNCTION gda_sql_value_stringify ##### -->
+<para>
+
+</para>
+
+ value:
+ Returns:
+
+
Modified: trunk/libgda/libgda.symbols
==============================================================================
--- trunk/libgda/libgda.symbols (original)
+++ trunk/libgda/libgda.symbols Sun Feb 8 21:46:09 2009
@@ -555,13 +555,11 @@
gda_sql_delimiterTrace
gda_sql_error_quark
gda_sql_error_type_get_type
- gda_sql_expr_check_clean
gda_sql_expr_copy
gda_sql_expr_free
gda_sql_expr_new
gda_sql_expr_serialize
gda_sql_expr_take_select
- gda_sql_field_check_clean
gda_sql_field_copy
gda_sql_field_free
gda_sql_field_new
@@ -622,7 +620,6 @@
gda_sql_parser_set_overflow_error
gda_sql_parser_set_syntax_error
gda_sql_parserTrace
- gda_sql_select_field_check_clean
gda_sql_select_field_copy
gda_sql_select_field_free
gda_sql_select_field_new
@@ -646,7 +643,6 @@
gda_sql_select_order_free
gda_sql_select_order_new
gda_sql_select_order_serialize
- gda_sql_select_target_check_clean
gda_sql_select_target_copy
gda_sql_select_target_free
gda_sql_select_target_new
@@ -654,28 +650,17 @@
gda_sql_select_target_take_alias
gda_sql_select_target_take_select
gda_sql_select_target_take_table_name
- gda_sql_statement_begin_get_infos
gda_sql_statement_check_clean
gda_sql_statement_check_structure
gda_sql_statement_check_validity
- gda_sql_statement_commit_get_infos
- gda_sql_statement_compound_copy
- gda_sql_statement_compound_free
- gda_sql_statement_compound_get_infos
- gda_sql_statement_compound_get_n_cols
- gda_sql_statement_compound_reduce
- gda_sql_statement_compound_serialize
gda_sql_statement_compound_set_type
gda_sql_statement_compound_take_stmt
gda_sql_statement_compound_type_get_type
gda_sql_statement_copy
- gda_sql_statement_delete_get_infos
- gda_sql_statement_delete_savepoint_get_infos
gda_sql_statement_delete_take_condition
gda_sql_statement_delete_take_table_name
gda_sql_statement_free
gda_sql_statement_get_contents_infos
- gda_sql_statement_insert_get_infos
gda_sql_statement_insert_take_1_values_list
gda_sql_statement_insert_take_extra_values_list
gda_sql_statement_insert_take_fields_list
@@ -684,14 +669,6 @@
gda_sql_statement_insert_take_table_name
gda_sql_statement_new
gda_sql_statement_normalize
- gda_sql_statement_rollback_get_infos
- gda_sql_statement_rollback_savepoint_get_infos
- gda_sql_statement_savepoint_get_infos
- gda_sql_statement_select_copy
- gda_sql_statement_select_free
- gda_sql_statement_select_get_infos
- gda_sql_statement_select_new
- gda_sql_statement_select_serialize
gda_sql_statement_select_take_distinct
gda_sql_statement_select_take_expr_list
gda_sql_statement_select_take_from
@@ -707,14 +684,11 @@
gda_sql_statement_trans_take_name
gda_sql_statement_type_get_type
gda_sql_statement_type_to_string
- gda_sql_statement_unknown_get_infos
gda_sql_statement_unknown_take_expressions
- gda_sql_statement_update_get_infos
gda_sql_statement_update_take_condition
gda_sql_statement_update_take_on_conflict
gda_sql_statement_update_take_set_value
gda_sql_statement_update_take_table_name
- gda_sql_table_check_clean
gda_sql_table_copy
gda_sql_table_free
gda_sql_table_new
Modified: trunk/libgda/sql-parser/gda-statement-struct-compound.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-compound.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-compound.c Sun Feb 8 21:46:09 2009
@@ -31,16 +31,16 @@
GDA_SQL_STATEMENT_COMPOUND,
"COMPOUND",
gda_sql_statement_compound_new,
- gda_sql_statement_compound_free,
- gda_sql_statement_compound_copy,
- gda_sql_statement_compound_serialize,
+ _gda_sql_statement_compound_free,
+ _gda_sql_statement_compound_copy,
+ _gda_sql_statement_compound_serialize,
gda_sql_statement_compound_check_structure,
NULL
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_compound_get_infos (void)
+_gda_sql_statement_compound_get_infos (void)
{
return &compound_infos;
}
@@ -56,7 +56,7 @@
}
void
-gda_sql_statement_compound_free (gpointer stmt)
+_gda_sql_statement_compound_free (gpointer stmt)
{
GdaSqlStatementCompound *compound = (GdaSqlStatementCompound *) stmt;
@@ -68,7 +68,7 @@
}
gpointer
-gda_sql_statement_compound_copy (gpointer src)
+_gda_sql_statement_compound_copy (gpointer src)
{
GdaSqlStatementCompound *dest;
GdaSqlStatementCompound *compound = (GdaSqlStatementCompound *) src;
@@ -87,7 +87,7 @@
}
gchar *
-gda_sql_statement_compound_serialize (gpointer stmt)
+_gda_sql_statement_compound_serialize (gpointer stmt)
{
GString *string;
gchar *str;
@@ -135,6 +135,14 @@
return str;
}
+/**
+ * gda_sql_statement_compound_take_stmt
+ * @stmt: a #GdaSqlStatement pointer
+ * @s: a #GdaSqlStatement pointer
+ *
+ * Adds the @s sub-statement to the @stmt compound statement. @s's reference is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_compound_take_stmt (GdaSqlStatement *stmt, GdaSqlStatement *s)
{
@@ -168,7 +176,7 @@
}
GdaSqlAnyPart *
-gda_sql_statement_compound_reduce (GdaSqlAnyPart *compound_or_select)
+_gda_sql_statement_compound_reduce (GdaSqlAnyPart *compound_or_select)
{
GdaSqlAnyPart *part;
@@ -181,14 +189,22 @@
rpart = GDA_SQL_ANY_PART (((GdaSqlStatement *) compound->stmt_list->data)->contents);
g_slist_free (compound->stmt_list);
compound->stmt_list = NULL;
- gda_sql_statement_compound_free (compound);
- part = gda_sql_statement_compound_reduce (rpart);
+ _gda_sql_statement_compound_free (compound);
+ part = _gda_sql_statement_compound_reduce (rpart);
}
}
return part;
}
+
+/**
+ * gda_sql_statement_compound_set_type
+ * @stmt: a #GdaSqlStatement pointer
+ * @type: a #GdaSqlStatementCompoundType value
+ *
+ * Specifies @stmt's type of compound
+ */
void
gda_sql_statement_compound_set_type (GdaSqlStatement *stmt, GdaSqlStatementCompoundType type)
{
@@ -197,7 +213,7 @@
}
gint
-gda_sql_statement_compound_get_n_cols (GdaSqlStatementCompound *compound, GError **error)
+_gda_sql_statement_compound_get_n_cols (GdaSqlStatementCompound *compound, GError **error)
{
if (!compound || !compound->stmt_list) {
g_set_error (error, GDA_SQL_ERROR, GDA_SQL_STRUCTURE_CONTENTS_ERROR,
@@ -216,7 +232,7 @@
return g_slist_length (((GdaSqlStatementSelect*) sqlstmt->contents)->expr_list);
}
else if (sqlstmt->stmt_type == GDA_SQL_STATEMENT_COMPOUND)
- return gda_sql_statement_compound_get_n_cols ((GdaSqlStatementCompound*) sqlstmt->contents, error);
+ return _gda_sql_statement_compound_get_n_cols ((GdaSqlStatementCompound*) sqlstmt->contents, error);
else {
g_set_error (error, GDA_SQL_ERROR, GDA_SQL_STRUCTURE_CONTENTS_ERROR,
"%s", _("COMPOUND statement contains a non SELECT statement"));
@@ -255,7 +271,7 @@
nb = g_slist_length (((GdaSqlStatementSelect*) sqlstmt->contents)->expr_list);
}
else if (sqlstmt->stmt_type == GDA_SQL_STATEMENT_COMPOUND) {
- nb = gda_sql_statement_compound_get_n_cols ((GdaSqlStatementCompound*) sqlstmt->contents, error);
+ nb = _gda_sql_statement_compound_get_n_cols ((GdaSqlStatementCompound*) sqlstmt->contents, error);
if (nb < 0)
return FALSE;
}
Modified: trunk/libgda/sql-parser/gda-statement-struct-compound.h
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-compound.h (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-compound.h Sun Feb 8 21:46:09 2009
@@ -53,17 +53,21 @@
/*
* Common operations
*/
-gpointer gda_sql_statement_compound_copy (gpointer src);
-void gda_sql_statement_compound_free (gpointer stmt);
-gchar *gda_sql_statement_compound_serialize (gpointer stmt);
-GdaSqlStatementContentsInfo *gda_sql_statement_compound_get_infos (void);
-gint gda_sql_statement_compound_get_n_cols (GdaSqlStatementCompound *compound, GError **error);
+gpointer _gda_sql_statement_compound_copy (gpointer src);
+void _gda_sql_statement_compound_free (gpointer stmt);
+gchar *_gda_sql_statement_compound_serialize (gpointer stmt);
+GdaSqlStatementContentsInfo *_gda_sql_statement_compound_get_infos (void);
+
+/*
+ * compound specific operations
+ */
+gint _gda_sql_statement_compound_get_n_cols (GdaSqlStatementCompound *compound, GError **error);
+GdaSqlAnyPart * _gda_sql_statement_compound_reduce (GdaSqlAnyPart *compound_or_select);
/*
* Functions used by the parser
*/
void gda_sql_statement_compound_set_type (GdaSqlStatement *stmt, GdaSqlStatementCompoundType type);
void gda_sql_statement_compound_take_stmt (GdaSqlStatement *stmt, GdaSqlStatement *s);
-GdaSqlAnyPart * gda_sql_statement_compound_reduce (GdaSqlAnyPart *compound_or_select);
#endif
Modified: trunk/libgda/sql-parser/gda-statement-struct-delete.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-delete.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-delete.c Sun Feb 8 21:46:09 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 - 2008 Vivien Malerba
+ * Copyright (C) 2007 - 2009 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -44,7 +44,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_delete_get_infos (void)
+_gda_sql_statement_delete_get_infos (void)
{
return &delete_infos;
}
@@ -117,6 +117,14 @@
return str;
}
+/**
+ * gda_sql_statement_delete_take_table_name
+ * @stmt: a #GdaSqlStatement pointer
+ * @value: a table name as a G_TYPE_STRING #GValue
+ *
+ * Sets the name of the table to delete from in @stmt. @value's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_delete_take_table_name (GdaSqlStatement *stmt, GValue *value)
{
@@ -127,6 +135,14 @@
}
}
+/**
+ * gda_sql_statement_delete_take_condition
+ * @stmt: a #GdaSqlStatement pointer
+ * @cond: the WHERE condition of the DELETE statement, as a #GdaSqlExpr
+ *
+ * Sets the WHERE condition of @stmt. @cond's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_delete_take_condition (GdaSqlStatement *stmt, GdaSqlExpr *cond)
{
Modified: trunk/libgda/sql-parser/gda-statement-struct-delete.h
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-delete.h (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-delete.h Sun Feb 8 21:46:09 2009
@@ -42,7 +42,7 @@
/*
* Common operations
*/
-GdaSqlStatementContentsInfo *gda_sql_statement_delete_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_delete_get_infos (void);
/*
* Functions used by the parser
Modified: trunk/libgda/sql-parser/gda-statement-struct-insert.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-insert.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-insert.c Sun Feb 8 21:46:09 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 - 2008 Vivien Malerba
+ * Copyright (C) 2007 - 2009 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -45,7 +45,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_insert_get_infos (void)
+_gda_sql_statement_insert_get_infos (void)
{
return &insert_infos;
}
@@ -78,9 +78,9 @@
g_slist_free (insert->fields_list);
if (insert->select) {
if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_SELECT)
- gda_sql_statement_select_free (insert->select);
+ _gda_sql_statement_select_free (insert->select);
else if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_COMPOUND)
- gda_sql_statement_compound_free (insert->select);
+ _gda_sql_statement_compound_free (insert->select);
else
g_assert_not_reached ();
}
@@ -120,9 +120,9 @@
}
if (insert->select) {
if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_SELECT)
- dest->select = gda_sql_statement_select_copy (insert->select);
+ dest->select = _gda_sql_statement_select_copy (insert->select);
else if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_COMPOUND)
- dest->select = gda_sql_statement_compound_copy (insert->select);
+ dest->select = _gda_sql_statement_compound_copy (insert->select);
else
g_assert_not_reached ();
gda_sql_any_part_set_parent (dest->select, dest);
@@ -193,9 +193,9 @@
if (insert->select) {
g_string_append (string, ",\"select\":{");
if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_SELECT)
- str = gda_sql_statement_select_serialize (insert->select);
+ str = _gda_sql_statement_select_serialize (insert->select);
else if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_COMPOUND)
- str = gda_sql_statement_compound_serialize (insert->select);
+ str = _gda_sql_statement_compound_serialize (insert->select);
else
g_assert_not_reached ();
@@ -217,6 +217,14 @@
return str;
}
+/**
+ * gda_sql_statement_insert_take_table_name
+ * @stmt: a #GdaSqlStatement pointer
+ * @value: name of the table to insert into, as a G_TYPE_STRING #GValue
+ *
+ * Sets the name of the table to insert into in @stmt. @value's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_insert_take_table_name (GdaSqlStatement *stmt, GValue *value)
{
@@ -227,6 +235,14 @@
}
}
+/**
+ * gda_sql_statement_insert_take_on_conflict
+ * @stmt: a #GdaSqlStatement pointer
+ * @value: name of the resolution conflict algotithm, as a G_TYPE_STRING #GValue
+ *
+ * Sets the name of the resolution conflict algotithm used by @stmt. @value's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_insert_take_on_conflict (GdaSqlStatement *stmt, GValue *value)
{
@@ -238,6 +254,15 @@
}
}
+/**
+ * gda_sql_statement_insert_take_fields_list
+ * @stmt: a #GdaSqlStatement pointer
+ * @list: a list of #GdaSqlField pointers
+ *
+ * Sets the list of fields for which values will be specified in @stmt. @list's
+ * responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_insert_take_fields_list (GdaSqlStatement *stmt, GSList *list)
{
@@ -249,8 +274,14 @@
gda_sql_any_part_set_parent (l->data, insert);
}
-/*
- * @list is a list of GdaSqlExpr
+/**
+ * gda_sql_statement_insert_take_1_values_list
+ * @stmt: a #GdaSqlStatement pointer
+ * @list: a list of #GdaSqlExpr pointers
+ *
+ * Sets a list of values to be inserted by @stmt. @list's
+ * responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
*/
void
gda_sql_statement_insert_take_1_values_list (GdaSqlStatement *stmt, GSList *list)
@@ -263,8 +294,14 @@
insert->values_list = g_slist_prepend (insert->values_list, list);
}
-/*
- * @list is a list of list of GdaSqlExpr
+/**
+ * gda_sql_statement_insert_take_1_values_list
+ * @stmt: a #GdaSqlStatement pointer
+ * @list: a list of #GSQliet of #GdaSqlExpr pointers
+ *
+ * Sets a list of list of values to be inserted by @stmt. @list's
+ * responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
*/
void
gda_sql_statement_insert_take_extra_values_list (GdaSqlStatement *stmt, GSList *list)
@@ -278,6 +315,16 @@
insert->values_list = g_slist_concat (insert->values_list, list);
}
+
+/**
+ * gda_sql_statement_insert_take_select
+ * @stmt: a #GdaSqlStatement pointer
+ * @select: a SELECT #GdaSqlStatement pointer
+ *
+ * Specifies a SELECT statement, the values inserted will be the result set of @select. @select's
+ * responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_insert_take_select (GdaSqlStatement *stmt, GdaSqlStatement *select)
{
@@ -286,7 +333,7 @@
part = GDA_SQL_ANY_PART (select->contents);
select->contents = NULL;
gda_sql_statement_free (select);
- insert->select = gda_sql_statement_compound_reduce (part);
+ insert->select = _gda_sql_statement_compound_reduce (part);
gda_sql_any_part_set_parent (insert->select, insert);
}
@@ -318,7 +365,7 @@
}
else if (GDA_SQL_ANY_PART (insert->select)->type == GDA_SQL_ANY_STMT_COMPOUND) {
GdaSqlStatementCompound *compound = (GdaSqlStatementCompound*) insert->select;
- len = gda_sql_statement_compound_get_n_cols (compound, error);
+ len = _gda_sql_statement_compound_get_n_cols (compound, error);
if (len < 0)
return FALSE;
}
Modified: trunk/libgda/sql-parser/gda-statement-struct-insert.h
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-insert.h (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-insert.h Sun Feb 8 21:46:09 2009
@@ -45,7 +45,7 @@
/*
* Common operations
*/
-GdaSqlStatementContentsInfo *gda_sql_statement_insert_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_insert_get_infos (void);
/*
* Functions used by the parser
Modified: trunk/libgda/sql-parser/gda-statement-struct-parts.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-parts.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-parts.c Sun Feb 8 21:46:09 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 - 2008 Vivien Malerba
+ * Copyright (C) 2007 - 2009 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -63,7 +63,7 @@
{
if (!expr) return;
- gda_sql_expr_check_clean (expr);
+ _gda_sql_expr_check_clean (expr);
if (expr->value) {
g_value_unset (expr->value);
g_free (expr->value);
@@ -73,9 +73,9 @@
gda_sql_operation_free (expr->cond);
if (expr->select) {
if (GDA_SQL_ANY_PART (expr->select)->type == GDA_SQL_ANY_STMT_SELECT)
- gda_sql_statement_select_free (expr->select);
+ _gda_sql_statement_select_free (expr->select);
else if (GDA_SQL_ANY_PART (expr->select)->type == GDA_SQL_ANY_STMT_COMPOUND)
- gda_sql_statement_compound_free (expr->select);
+ _gda_sql_statement_compound_free (expr->select);
else
g_assert_not_reached ();
}
@@ -118,9 +118,9 @@
if (expr->select) {
if (GDA_SQL_ANY_PART (expr->select)->type == GDA_SQL_ANY_STMT_SELECT)
- copy->select = gda_sql_statement_select_copy (expr->select);
+ copy->select = _gda_sql_statement_select_copy (expr->select);
else if (GDA_SQL_ANY_PART (expr->select)->type == GDA_SQL_ANY_STMT_COMPOUND)
- copy->select = gda_sql_statement_compound_copy (expr->select);
+ copy->select = _gda_sql_statement_compound_copy (expr->select);
else
g_assert_not_reached ();
gda_sql_any_part_set_parent (copy->select, copy);
@@ -165,9 +165,9 @@
}
else if (expr->select) {
if (GDA_SQL_ANY_PART (expr->select)->type == GDA_SQL_ANY_STMT_SELECT)
- str = gda_sql_statement_select_serialize (expr->select);
+ str = _gda_sql_statement_select_serialize (expr->select);
else if (GDA_SQL_ANY_PART (expr->select)->type == GDA_SQL_ANY_STMT_COMPOUND)
- str = gda_sql_statement_compound_serialize (expr->select);
+ str = _gda_sql_statement_compound_serialize (expr->select);
else
g_assert_not_reached ();
g_string_append_printf (string, "\"select\":{%s}", str);
@@ -224,7 +224,7 @@
part = GDA_SQL_ANY_PART (stmt->contents);
stmt->contents = NULL;
gda_sql_statement_free (stmt);
- expr->select = gda_sql_statement_compound_reduce (part);
+ expr->select = _gda_sql_statement_compound_reduce (part);
gda_sql_any_part_set_parent (expr->select, expr);
}
}
@@ -259,7 +259,7 @@
{
if (!field) return;
- gda_sql_field_check_clean (field);
+ _gda_sql_field_check_clean (field);
g_free (field->field_name);
g_free (field);
}
@@ -351,7 +351,7 @@
{
if (!table) return;
- gda_sql_table_check_clean (table);
+ _gda_sql_table_check_clean (table);
g_free (table->table_name);
g_free (table);
}
@@ -537,7 +537,6 @@
*
* Sets the function's name using the string holded by @value. When call, @value is freed using
* #gda_value_free().
- *
*/
void
gda_sql_function_take_name (GdaSqlFunction *function, GValue *value)
@@ -549,7 +548,7 @@
}
/**
- * gda_sql_function_take_name
+ * gda_sql_function_take_args_list
* @function: a #GdaSqlFunction structure
* @args: a #GSList to take from
*
@@ -557,7 +556,8 @@
* list's data elements' parent to @function.
*
*/
-void gda_sql_function_take_args_list (GdaSqlFunction *function, GSList *args)
+void
+gda_sql_function_take_args_list (GdaSqlFunction *function, GSList *args)
{
GSList *list;
function->args_list = args;
@@ -756,7 +756,7 @@
}
/**
- * gda_sql_operator_from_string
+ * gda_sql_operation_operator_from_string
* @op: a #GdaSqlOperation structure
*
* Returns #GdaSqlOperatorType that correspond with the string @op.
@@ -1000,7 +1000,7 @@
{
if (!field) return;
- gda_sql_select_field_check_clean (field);
+ _gda_sql_select_field_check_clean (field);
gda_sql_expr_free (field->expr);
g_free (field->field_name);
g_free (field->table_name);
@@ -1176,7 +1176,7 @@
{
if (!target) return;
- gda_sql_select_target_check_clean (target);
+ _gda_sql_select_target_check_clean (target);
gda_sql_expr_free (target->expr);
g_free (target->table_name);
g_free (target->as);
Modified: trunk/libgda/sql-parser/gda-statement-struct-parts.h
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-parts.h (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-parts.h Sun Feb 8 21:46:09 2009
@@ -57,11 +57,12 @@
gpointer _gda_reserved1;
gpointer _gda_reserved2;
};
+
GdaSqlExpr *gda_sql_expr_new (GdaSqlAnyPart *parent);
void gda_sql_expr_free (GdaSqlExpr *expr);
GdaSqlExpr *gda_sql_expr_copy (GdaSqlExpr *expr);
gchar *gda_sql_expr_serialize (GdaSqlExpr *expr);
-void gda_sql_expr_check_clean (GdaSqlExpr *expr);
+void _gda_sql_expr_check_clean (GdaSqlExpr *expr);
void gda_sql_expr_take_select (GdaSqlExpr *expr, GdaSqlStatement *stmt);
@@ -79,11 +80,12 @@
gpointer _gda_reserved1;
gpointer _gda_reserved2;
};
+
GdaSqlField *gda_sql_field_new (GdaSqlAnyPart *parent);
void gda_sql_field_free (GdaSqlField *field);
GdaSqlField *gda_sql_field_copy (GdaSqlField *field);
gchar *gda_sql_field_serialize (GdaSqlField *field);
-void gda_sql_field_check_clean (GdaSqlField *field);
+void _gda_sql_field_check_clean (GdaSqlField *field);
void gda_sql_field_take_name (GdaSqlField *field, GValue *value);
@@ -107,7 +109,7 @@
void gda_sql_table_free (GdaSqlTable *table);
GdaSqlTable *gda_sql_table_copy (GdaSqlTable *table);
gchar *gda_sql_table_serialize (GdaSqlTable *table);
-void gda_sql_table_check_clean (GdaSqlTable *table);
+void _gda_sql_table_check_clean (GdaSqlTable *table);
void gda_sql_table_take_name (GdaSqlTable *table, GValue *value);
@@ -233,7 +235,7 @@
void gda_sql_select_field_free (GdaSqlSelectField *field);
GdaSqlSelectField *gda_sql_select_field_copy (GdaSqlSelectField *field);
gchar *gda_sql_select_field_serialize (GdaSqlSelectField *field);
-void gda_sql_select_field_check_clean (GdaSqlSelectField *field);
+void _gda_sql_select_field_check_clean (GdaSqlSelectField *field);
void gda_sql_select_field_take_star_value(GdaSqlSelectField *field, GValue *value);
void gda_sql_select_field_take_expr (GdaSqlSelectField *field, GdaSqlExpr *expr);
@@ -261,7 +263,7 @@
void gda_sql_select_target_free (GdaSqlSelectTarget *target);
GdaSqlSelectTarget *gda_sql_select_target_copy (GdaSqlSelectTarget *target);
gchar *gda_sql_select_target_serialize (GdaSqlSelectTarget *target);
-void gda_sql_select_target_check_clean (GdaSqlSelectTarget *target);
+void _gda_sql_select_target_check_clean (GdaSqlSelectTarget *target);
void gda_sql_select_target_take_table_name (GdaSqlSelectTarget *target, GValue *value);
void gda_sql_select_target_take_select (GdaSqlSelectTarget *target, GdaSqlStatement *stmt);
Modified: trunk/libgda/sql-parser/gda-statement-struct-pspec.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-pspec.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-pspec.c Sun Feb 8 21:46:09 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Vivien Malerba
+ * Copyright (C) 2007 - 2009 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -23,10 +23,13 @@
#include <libgda/sql-parser/gda-statement-struct-util.h>
#include <libgda/gda-util.h>
-/*
- *
- * Param specs
+/**
+ * gda_sql_param_spec_take_name
+ * @pspec: a #GdaSqlParamSpec pointer
+ * @value: a G_TYPE_STRING #GValue
*
+ * Sets @pspec's name. @value's responsability is transfered to
+ * @pspec (which means @pspec is then responsible to freeing it when no longer needed).
*/
void
gda_sql_param_spec_take_name (GdaSqlParamSpec *pspec, GValue *value)
@@ -42,6 +45,14 @@
}
}
+/**
+ * gda_sql_param_spec_take_descr
+ * @pspec: a #GdaSqlParamSpec pointer
+ * @value: a G_TYPE_STRING #GValue
+ *
+ * Sets @pspec's description. @value's responsability is transfered to
+ * @pspec (which means @pspec is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_param_spec_take_descr (GdaSqlParamSpec *pspec, GValue *value)
{
@@ -56,6 +67,16 @@
}
}
+/**
+ * gda_sql_param_spec_take_nullok
+ * @pspec: a #GdaSqlParamSpec pointer
+ * @value: a G_TYPE_STRING #GValue.
+ *
+ * Sets @pspec's ability of being NULL. @value's responsability is transfered to
+ * @pspec (which means @pspec is then responsible to freeing it when no longer needed).
+ *
+ * If @value's string starts by 't' or 'T' then @pspec will be allowed to be %NULL
+ */
void
gda_sql_param_spec_take_nullok (GdaSqlParamSpec *pspec, GValue *value)
{
@@ -72,6 +93,16 @@
}
}
+/**
+ * gda_sql_param_spec_take_type
+ * @pspec: a #GdaSqlParamSpec pointer
+ * @value: a G_TYPE_STRING #GValue
+ *
+ * Sets @pspec's data type. @value's responsability is transfered to
+ * @pspec (which means @pspec is then responsible to freeing it when no longer needed).
+ *
+ * @value must represent a data type, as understood by gda_g_type_from_string().
+ */
void
gda_sql_param_spec_take_type (GdaSqlParamSpec *pspec, GValue *value)
{
@@ -87,6 +118,17 @@
}
}
+/**
+ * gda_sql_param_spec_new
+ * @value: a G_TYPE_STRING #GValue
+ *
+ * @value must contain a string representing a variable, see the documentation associated to the
+ * #GdaSqlParser object.
+ *
+ * @value is destroyed by this function.
+ *
+ * Returns: a new #GdaSqlParamSpec
+ */
GdaSqlParamSpec *
gda_sql_param_spec_new (GValue *value)
{
@@ -131,6 +173,14 @@
return pspec;
}
+/**
+ * gda_sql_param_spec_copy
+ * @pspec: #GdaSqlParamSpec pointer
+ *
+ * Creates a copy of @pspec.
+ *
+ * Returns: a new #GdaSqlParamSpec
+ */
GdaSqlParamSpec *
gda_sql_param_spec_copy (GdaSqlParamSpec *pspec)
{
@@ -149,6 +199,12 @@
return copy;
}
+/**
+ * gda_sql_param_spec_free
+ * @pspec: #GdaSqlParamSpec pointer
+ *
+ * Destroys @pspec.
+ */
void
gda_sql_param_spec_free (GdaSqlParamSpec *pspec)
{
@@ -159,6 +215,14 @@
g_free (pspec);
}
+/**
+ * gda_sql_param_spec_serialize
+ * @pspec: a #GdaSqlParamSpec pointer
+ *
+ * Creates a new string representing @pspec.
+ *
+ * Returns: a new string.
+ */
gchar *
gda_sql_param_spec_serialize (GdaSqlParamSpec *pspec)
{
Modified: trunk/libgda/sql-parser/gda-statement-struct-select.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-select.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-select.c Sun Feb 8 21:46:09 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Vivien Malerba
+ * Copyright (C) 2007 - 2009 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -24,6 +24,7 @@
#include <string.h>
#include <glib/gi18n-lib.h>
+static gpointer gda_sql_statement_select_new (void);
static gboolean gda_sql_statement_select_check_structure (GdaSqlAnyPart *stmt, gpointer data, GError **error);
static gboolean gda_sql_statement_select_check_validity (GdaSqlAnyPart *stmt, gpointer data, GError **error);
@@ -31,21 +32,21 @@
GDA_SQL_STATEMENT_SELECT,
"SELECT",
gda_sql_statement_select_new,
- gda_sql_statement_select_free,
- gda_sql_statement_select_copy,
- gda_sql_statement_select_serialize,
+ _gda_sql_statement_select_free,
+ _gda_sql_statement_select_copy,
+ _gda_sql_statement_select_serialize,
gda_sql_statement_select_check_structure,
gda_sql_statement_select_check_validity
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_select_get_infos (void)
+_gda_sql_statement_select_get_infos (void)
{
return &select_infos;
}
-gpointer
+static gpointer
gda_sql_statement_select_new (void)
{
GdaSqlStatementSelect *stmt;
@@ -55,7 +56,7 @@
}
void
-gda_sql_statement_select_free (gpointer stmt)
+_gda_sql_statement_select_free (gpointer stmt)
{
GdaSqlStatementSelect *select = (GdaSqlStatementSelect *) stmt;
@@ -82,7 +83,7 @@
}
gpointer
-gda_sql_statement_select_copy (gpointer src)
+_gda_sql_statement_select_copy (gpointer src)
{
GdaSqlStatementSelect *dest;
GdaSqlStatementSelect *select = (GdaSqlStatementSelect *) src;
@@ -134,7 +135,7 @@
}
gchar *
-gda_sql_statement_select_serialize (gpointer stmt)
+_gda_sql_statement_select_serialize (gpointer stmt)
{
GString *string;
gchar *str;
@@ -235,6 +236,17 @@
return str;
}
+/**
+ * gda_sql_statement_select_take_distinct
+ * @stmt: a #GdaSqlStatement pointer
+ * @distinct: a TRUE/FALSE value
+ * @distinct_expr: a #GdaSqlExpr pointer representing what the DISTINCT is on, or %NULL
+ *
+ * Sets the DISTINCT clause of @stmt.
+ *
+ * @distinct_expr's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_select_take_distinct (GdaSqlStatement *stmt, gboolean distinct, GdaSqlExpr *distinct_expr)
{
@@ -244,6 +256,16 @@
gda_sql_any_part_set_parent (select->distinct_expr, select);
}
+/**
+ * gda_sql_statement_select_take_expr_list
+ * @stmt: a #GdaSqlStatement pointer
+ * @expr_list: a list of #GdaSqlSelectField pointers
+ *
+ * Sets list of expressions selected by @stmt
+ *
+ * @expr_list's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_select_take_expr_list (GdaSqlStatement *stmt, GSList *expr_list)
{
@@ -254,6 +276,16 @@
gda_sql_any_part_set_parent (l->data, select);
}
+/**
+ * gda_sql_statement_select_take_from
+ * @stmt: a #GdaSqlStatement pointer
+ * @from: a #GdaSqlSelectFrom pointer
+ *
+ * Sets the FROM clause of @stmt
+ *
+ * @from's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_select_take_from (GdaSqlStatement *stmt, GdaSqlSelectFrom *from)
{
@@ -262,6 +294,16 @@
gda_sql_any_part_set_parent (from, select);
}
+/**
+ * gda_sql_statement_select_take_where_cond
+ * @stmt: a #GdaSqlStatement pointer
+ * @expr: a #GdaSqlExpr pointer
+ *
+ * Sets the WHERE clause of @stmt
+ *
+ * @expr's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_select_take_where_cond (GdaSqlStatement *stmt, GdaSqlExpr *expr)
{
@@ -270,6 +312,16 @@
gda_sql_any_part_set_parent (expr, select);
}
+/**
+ * gda_sql_statement_select_take_group_by
+ * @stmt: a #GdaSqlStatement pointer
+ * @group_by: a list of #GdaSqlExpr pointer
+ *
+ * Sets the GROUP BY clause of @stmt
+ *
+ * @group_by's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_select_take_group_by (GdaSqlStatement *stmt, GSList *group_by)
{
@@ -280,6 +332,16 @@
gda_sql_any_part_set_parent (l->data, select);
}
+/**
+ * gda_sql_statement_select_take_having_cond
+ * @stmt: a #GdaSqlStatement pointer
+ * @expr: a #GdaSqlExpr pointer
+ *
+ * Sets the HAVING clause of @stmt
+ *
+ * @expr's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_select_take_having_cond (GdaSqlStatement *stmt, GdaSqlExpr *expr)
{
@@ -288,6 +350,16 @@
gda_sql_any_part_set_parent (expr, select);
}
+/**
+ * gda_sql_statement_select_take_order_by
+ * @stmt: a #GdaSqlStatement pointer
+ * @order_by: a list of #GdaSqlSelectOrder pointer
+ *
+ * Sets the ORDER BY clause of @stmt
+ *
+ * @order_by's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_select_take_order_by (GdaSqlStatement *stmt, GSList *order_by)
{
@@ -298,6 +370,17 @@
gda_sql_any_part_set_parent (l->data, select);
}
+/**
+ * gda_sql_statement_select_take_limits
+ * @stmt: a #GdaSqlStatement pointer
+ * @count: a #GdaSqlExpr pointer
+ * @offset: a #GdaSqlExpr pointer
+ *
+ * Sets the LIMIT clause of @stmt
+ *
+ * @count and @offset's responsability are transfered to
+ * @stmt (which means @stmt is then responsible to freeing them when no longer needed).
+ */
void
gda_sql_statement_select_take_limits (GdaSqlStatement *stmt, GdaSqlExpr *count, GdaSqlExpr *offset)
{
Modified: trunk/libgda/sql-parser/gda-statement-struct-select.h
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-select.h (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-select.h Sun Feb 8 21:46:09 2009
@@ -52,11 +52,10 @@
/*
* Common operations
*/
-gpointer gda_sql_statement_select_new (void);
-gpointer gda_sql_statement_select_copy (gpointer src);
-void gda_sql_statement_select_free (gpointer stmt);
-gchar *gda_sql_statement_select_serialize (gpointer stmt);
-GdaSqlStatementContentsInfo *gda_sql_statement_select_get_infos (void);
+gpointer _gda_sql_statement_select_copy (gpointer src);
+void _gda_sql_statement_select_free (gpointer stmt);
+gchar *_gda_sql_statement_select_serialize (gpointer stmt);
+GdaSqlStatementContentsInfo *_gda_sql_statement_select_get_infos (void);
/*
* Functions used by the parser
Modified: trunk/libgda/sql-parser/gda-statement-struct-trans.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-trans.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-trans.c Sun Feb 8 21:46:09 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 - 2008 Vivien Malerba
+ * Copyright (C) 2007 - 2009 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -41,7 +41,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_begin_get_infos (void)
+_gda_sql_statement_begin_get_infos (void)
{
return &begin_infos;
}
@@ -58,7 +58,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_commit_get_infos (void)
+_gda_sql_statement_commit_get_infos (void)
{
return &commit_infos;
}
@@ -75,7 +75,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_rollback_get_infos (void)
+_gda_sql_statement_rollback_get_infos (void)
{
return &rollback_infos;
}
@@ -92,7 +92,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_savepoint_get_infos (void)
+_gda_sql_statement_savepoint_get_infos (void)
{
return &svp_infos;
}
@@ -109,7 +109,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_rollback_savepoint_get_infos (void)
+_gda_sql_statement_rollback_savepoint_get_infos (void)
{
return &rollback_svp_infos;
}
@@ -126,7 +126,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_delete_savepoint_get_infos (void)
+_gda_sql_statement_delete_savepoint_get_infos (void)
{
return &delete_svp_infos;
}
@@ -217,6 +217,16 @@
return str;
}
+/**
+ * gda_sql_statement_trans_take_name
+ * @stmt: a #GdaSqlStatement pointer
+ * @value: a G_TYPE_STRING value
+ *
+ * Sets the name of the transaction
+ *
+ * @value's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_trans_take_name (GdaSqlStatement *stmt, GValue *value)
{
@@ -232,6 +242,16 @@
}
}
+/**
+ * gda_sql_statement_trans_take_mode
+ * @stmt: a #GdaSqlStatement pointer
+ * @value: a G_TYPE_STRING value
+ *
+ * Sets the model of the transaction
+ *
+ * @value's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_trans_take_mode (GdaSqlStatement *stmt, GValue *value)
{
@@ -247,6 +267,13 @@
}
}
+/**
+ * gda_sql_statement_set_isol_level
+ * @stmt: a #GdaSqlStatement pointer
+ * @level: the transacion level
+ *
+ * Sets the transaction level of the transaction
+ */
void
gda_sql_statement_trans_set_isol_level (GdaSqlStatement *stmt, GdaTransactionIsolation level)
{
Modified: trunk/libgda/sql-parser/gda-statement-struct-trans.h
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-trans.h (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-trans.h Sun Feb 8 21:46:09 2009
@@ -43,13 +43,13 @@
/*
* Common operations
*/
-GdaSqlStatementContentsInfo *gda_sql_statement_begin_get_infos (void);
-GdaSqlStatementContentsInfo *gda_sql_statement_commit_get_infos (void);
-GdaSqlStatementContentsInfo *gda_sql_statement_rollback_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_begin_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_commit_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_rollback_get_infos (void);
-GdaSqlStatementContentsInfo *gda_sql_statement_savepoint_get_infos (void);
-GdaSqlStatementContentsInfo *gda_sql_statement_rollback_savepoint_get_infos (void);
-GdaSqlStatementContentsInfo *gda_sql_statement_delete_savepoint_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_savepoint_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_rollback_savepoint_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_delete_savepoint_get_infos (void);
/*
* Functions used by the parser
Modified: trunk/libgda/sql-parser/gda-statement-struct-unknown.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-unknown.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-unknown.c Sun Feb 8 21:46:09 2009
@@ -39,7 +39,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_unknown_get_infos (void)
+_gda_sql_statement_unknown_get_infos (void)
{
return &unknown_infos;
}
@@ -104,6 +104,17 @@
return str;
}
+/**
+ * gda_sql_statement_unknown_take_expressions
+ * @stmt: a #GdaSqlStatement pointer
+ * @expressions: a list of #GdaSqlExpr pointers
+ *
+ * Sets @stmt's list of expressions
+ *
+ * @expressions's
+ * responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_unknown_take_expressions (GdaSqlStatement *stmt, GSList *expressions)
{
Modified: trunk/libgda/sql-parser/gda-statement-struct-unknown.h
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-unknown.h (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-unknown.h Sun Feb 8 21:46:09 2009
@@ -40,7 +40,7 @@
/*
* Common operations
*/
-GdaSqlStatementContentsInfo *gda_sql_statement_unknown_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_unknown_get_infos (void);
/*
* Functions used by the parser
Modified: trunk/libgda/sql-parser/gda-statement-struct-update.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-update.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-update.c Sun Feb 8 21:46:09 2009
@@ -44,7 +44,7 @@
};
GdaSqlStatementContentsInfo *
-gda_sql_statement_update_get_infos (void)
+_gda_sql_statement_update_get_infos (void)
{
return &update_infos;
}
@@ -184,6 +184,16 @@
return str;
}
+/**
+ * gda_sql_statement_update_take_table_name
+ * @stmt: a #GdaSqlStatement pointer
+ * @value: a table name, as a G_TYPE_STRING #GValue
+ *
+ * Sets the name of the table to delete from in @stmt.
+ *
+ * @value's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_update_take_table_name (GdaSqlStatement *stmt, GValue *value)
{
@@ -194,6 +204,14 @@
}
}
+/**
+ * gda_sql_statement_update_take_on_conflict
+ * @stmt: a #GdaSqlStatement pointer
+ * @value: name of the resolution conflict algotithm, as a G_TYPE_STRING #GValue
+ *
+ * Sets the name of the resolution conflict algotithm used by @stmt. @value's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_update_take_on_conflict (GdaSqlStatement *stmt, GValue *value)
{
@@ -205,6 +223,16 @@
}
}
+/**
+ * gda_sql_statement_update_take_condition
+ * @stmt: a #GdaSqlStatement pointer
+ * @cond: a #GdaSqlExpr pointer
+ *
+ * Sets the WHERE clause of @stmt
+ *
+ * @expr's responsability is transfered to
+ * @stmt (which means @stmt is then responsible to freeing it when no longer needed).
+ */
void
gda_sql_statement_update_take_condition (GdaSqlStatement *stmt, GdaSqlExpr *cond)
{
@@ -213,6 +241,18 @@
gda_sql_any_part_set_parent (cond, update);
}
+
+/**
+ * gda_sql_statement_update_take_set_value
+ * @stmt: a #GdaSqlStatement pointer
+ * @fname: a field name, as a G_TYPE_STRING #GValue
+ * @expr: a #GdaSqlExpr pointer
+ *
+ * Specifies that the field named @fname will be updated with the expression @expr.
+ *
+ * @fname and @expr's responsability are transfered to
+ * @stmt (which means @stmt is then responsible to freeing them when no longer needed).
+ */
void
gda_sql_statement_update_take_set_value (GdaSqlStatement *stmt, GValue *fname, GdaSqlExpr *expr)
{
Modified: trunk/libgda/sql-parser/gda-statement-struct-update.h
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-update.h (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-update.h Sun Feb 8 21:46:09 2009
@@ -45,7 +45,7 @@
/*
* Common operations
*/
-GdaSqlStatementContentsInfo *gda_sql_statement_update_get_infos (void);
+GdaSqlStatementContentsInfo *_gda_sql_statement_update_get_infos (void);
/*
* Functions used by the parser
Modified: trunk/libgda/sql-parser/gda-statement-struct-util.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct-util.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct-util.c Sun Feb 8 21:46:09 2009
@@ -20,10 +20,13 @@
#include <string.h>
#include <libgda/sql-parser/gda-statement-struct.h>
-/*
+/**
+ * gda_sql_value_stringify
+ * @value: a #GValue pointer
*
- * Utility functions
+ * Simplified version of gda_value_stringify().
*
+ * Returns: a new string
*/
gchar *
gda_sql_value_stringify (const GValue *value)
Modified: trunk/libgda/sql-parser/gda-statement-struct.c
==============================================================================
--- trunk/libgda/sql-parser/gda-statement-struct.c (original)
+++ trunk/libgda/sql-parser/gda-statement-struct.c Sun Feb 8 21:46:09 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 - 2008 Vivien Malerba
+ * Copyright (C) 2007 - 2009 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -58,28 +58,31 @@
if (!contents) {
contents = g_new0 (GdaSqlStatementContentsInfo *, GDA_SQL_STATEMENT_NONE);
- contents [GDA_SQL_STATEMENT_SELECT] = gda_sql_statement_select_get_infos ();
- contents [GDA_SQL_STATEMENT_INSERT] = gda_sql_statement_insert_get_infos ();
- contents [GDA_SQL_STATEMENT_DELETE] = gda_sql_statement_delete_get_infos ();
- contents [GDA_SQL_STATEMENT_UPDATE] = gda_sql_statement_update_get_infos ();
- contents [GDA_SQL_STATEMENT_BEGIN] = gda_sql_statement_begin_get_infos ();
- contents [GDA_SQL_STATEMENT_COMPOUND] = gda_sql_statement_compound_get_infos ();
- contents [GDA_SQL_STATEMENT_COMMIT] = gda_sql_statement_commit_get_infos ();
- contents [GDA_SQL_STATEMENT_ROLLBACK] = gda_sql_statement_rollback_get_infos ();
- contents [GDA_SQL_STATEMENT_UNKNOWN] = gda_sql_statement_unknown_get_infos ();
- contents [GDA_SQL_STATEMENT_SAVEPOINT] = gda_sql_statement_savepoint_get_infos ();
- contents [GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT] = gda_sql_statement_rollback_savepoint_get_infos ();
- contents [GDA_SQL_STATEMENT_DELETE_SAVEPOINT] = gda_sql_statement_delete_savepoint_get_infos ();
+ contents [GDA_SQL_STATEMENT_SELECT] = _gda_sql_statement_select_get_infos ();
+ contents [GDA_SQL_STATEMENT_INSERT] = _gda_sql_statement_insert_get_infos ();
+ contents [GDA_SQL_STATEMENT_DELETE] = _gda_sql_statement_delete_get_infos ();
+ contents [GDA_SQL_STATEMENT_UPDATE] = _gda_sql_statement_update_get_infos ();
+ contents [GDA_SQL_STATEMENT_BEGIN] = _gda_sql_statement_begin_get_infos ();
+ contents [GDA_SQL_STATEMENT_COMPOUND] = _gda_sql_statement_compound_get_infos ();
+ contents [GDA_SQL_STATEMENT_COMMIT] = _gda_sql_statement_commit_get_infos ();
+ contents [GDA_SQL_STATEMENT_ROLLBACK] = _gda_sql_statement_rollback_get_infos ();
+ contents [GDA_SQL_STATEMENT_UNKNOWN] = _gda_sql_statement_unknown_get_infos ();
+ contents [GDA_SQL_STATEMENT_SAVEPOINT] = _gda_sql_statement_savepoint_get_infos ();
+ contents [GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT] = _gda_sql_statement_rollback_savepoint_get_infos ();
+ contents [GDA_SQL_STATEMENT_DELETE_SAVEPOINT] = _gda_sql_statement_delete_savepoint_get_infos ();
}
g_static_mutex_unlock (&mutex);
return contents[type];
}
-/*
+/**
+ * gda_sql_statement_new
+ * @type: type of statement to create
*
- * Statement
+ * Use this function to create a #GdaSqlStatement of the specified @type type.
*
+ * Returns: a new #GdaSqlStatement
*/
GdaSqlStatement *
gda_sql_statement_new (GdaSqlStatementType type)
@@ -99,6 +102,14 @@
return stmt;
}
+/**
+ * gda_sql_statement_copy
+ * @stmt: a #GdaSqlStatement pointer
+ *
+ * Creates a copy of @stmt.
+ *
+ * Returns: a new #GdaSqlStatement
+ */
GdaSqlStatement *
gda_sql_statement_copy (GdaSqlStatement *stmt)
{
@@ -132,6 +143,12 @@
return copy;
}
+/**
+ * gda_sql_statement_free
+ * @stmt: a #GdaSqlStatement pointer
+ *
+ * Releases any memory associated to @stmt.
+ */
void
gda_sql_statement_free (GdaSqlStatement *stmt)
{
@@ -152,6 +169,14 @@
g_free (stmt);
}
+/**
+ * gda_sql_statement_type_to_string
+ * @type: a #GdaSqlStatementType value
+ *
+ * Converts a #GdaSqlStatementType to a string, see also gda_sql_statement_string_to_type()
+ *
+ * Returns: a constant string
+ */
const gchar *
gda_sql_statement_type_to_string (GdaSqlStatementType type)
{
@@ -165,6 +190,14 @@
return infos->name;
}
+/**
+ * gda_sql_statement_string_to_type
+ * @type: a string representing a #GdaSqlStatementType type
+ *
+ * Converts a string to a #GdaSqlStatementType value, see also gda_sql_statement_type_to_string()
+ *
+ * Returns: a #GdaSqlStatementType value
+ */
GdaSqlStatementType
gda_sql_statement_string_to_type (const gchar *type)
{
@@ -207,6 +240,14 @@
}
+/**
+ * gda_sql_statement_serialize
+ * @stmt: a #GdaSqlStatement pointer
+ *
+ * Creates a string representation of @stmt.
+ *
+ * Returns: a new string
+ */
gchar *
gda_sql_statement_serialize (GdaSqlStatement *stmt)
{
@@ -435,7 +476,7 @@
{
if (!expr) return TRUE;
if (!expr->param_spec) return TRUE;
- gda_sql_expr_check_clean (expr);
+ _gda_sql_expr_check_clean (expr);
/* 2 checks to do here:
* - try to find the data type from expr->param_spec->type using data->mstruct (not yet possible)
@@ -447,7 +488,7 @@
}
void
-gda_sql_expr_check_clean (GdaSqlExpr *expr)
+_gda_sql_expr_check_clean (GdaSqlExpr *expr)
{
if (!expr) return;
if (expr->param_spec && expr->param_spec->validity_meta_dict)
@@ -461,7 +502,7 @@
GdaSqlTable *stable;
if (!field) return TRUE;
- gda_sql_field_check_clean (field);
+ _gda_sql_field_check_clean (field);
if (!data->cnc) return TRUE;
@@ -511,7 +552,7 @@
}
void
-gda_sql_field_check_clean (GdaSqlField *field)
+_gda_sql_field_check_clean (GdaSqlField *field)
{
if (!field) return;
field->validity_meta_table_column = NULL;
@@ -593,7 +634,7 @@
GdaMetaDbObject *dbo;
if (!table) return TRUE;
- gda_sql_table_check_clean (table);
+ _gda_sql_table_check_clean (table);
if (!table->table_name) {
g_set_error (error, GDA_SQL_ERROR, GDA_SQL_VALIDATION_ERROR,
@@ -614,7 +655,7 @@
}
void
-gda_sql_table_check_clean (GdaSqlTable *table)
+_gda_sql_table_check_clean (GdaSqlTable *table)
{
if (!table) return;
table->validity_meta_object = NULL;
@@ -628,7 +669,7 @@
gboolean starred_field = FALSE;
if (!field) return TRUE;
- gda_sql_select_field_check_clean (field);
+ _gda_sql_select_field_check_clean (field);
if (!field->field_name)
/* field is not a table.field */
@@ -721,7 +762,7 @@
}
void
-gda_sql_select_field_check_clean (GdaSqlSelectField *field)
+_gda_sql_select_field_check_clean (GdaSqlSelectField *field)
{
if (!field) return;
field->validity_meta_object = NULL;
@@ -749,7 +790,7 @@
}
void
-gda_sql_select_target_check_clean (GdaSqlSelectTarget *target)
+_gda_sql_select_target_check_clean (GdaSqlSelectTarget *target)
{
if (!target) return;
target->validity_meta_object = NULL;
@@ -783,19 +824,19 @@
switch (node->type) {
case GDA_SQL_ANY_EXPR:
- gda_sql_expr_check_clean ((GdaSqlExpr*) node);
+ _gda_sql_expr_check_clean ((GdaSqlExpr*) node);
break;
case GDA_SQL_ANY_SQL_FIELD:
- gda_sql_field_check_clean ((GdaSqlField*) node);
+ _gda_sql_field_check_clean ((GdaSqlField*) node);
break;
case GDA_SQL_ANY_SQL_TABLE:
- gda_sql_table_check_clean ((GdaSqlTable*) node);
+ _gda_sql_table_check_clean ((GdaSqlTable*) node);
break;
case GDA_SQL_ANY_SQL_SELECT_FIELD:
- gda_sql_select_field_check_clean ((GdaSqlSelectField*) node);
+ _gda_sql_select_field_check_clean ((GdaSqlSelectField*) node);
break;
case GDA_SQL_ANY_SQL_SELECT_TARGET:
- gda_sql_select_target_check_clean ((GdaSqlSelectTarget*) node);
+ _gda_sql_select_target_check_clean ((GdaSqlSelectTarget*) node);
break;
default:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]