[libgda] Updated documentation in GIR for Gda.DataSelect. Updated sample for Gda.DataProxy in python.
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Updated documentation in GIR for Gda.DataSelect. Updated sample for Gda.DataProxy in python.
- Date: Thu, 2 Feb 2012 00:39:17 +0000 (UTC)
commit 12c5e3f86f32bb7b3c54d09147be71815795e935
Author: Daniel Espinosa <despinosa src gnome org>
Date: Wed Feb 1 18:08:04 2012 -0600
Updated documentation in GIR for Gda.DataSelect. Updated sample for Gda.DataProxy in python.
libgda/Gda-5.0.gir | 31 ++++++++++++++++++++++++++-----
samples/Gir/dataproxy.py | 4 +++-
2 files changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/libgda/Gda-5.0.gir b/libgda/Gda-5.0.gir
index e71debd..ac20be2 100644
--- a/libgda/Gda-5.0.gir
+++ b/libgda/Gda-5.0.gir
@@ -8487,7 +8487,7 @@ default value, the precision and scale for numeric values.</doc>
<doc xml:whitespace="preserve">Makes @model try to compute INSERT, UPDATE and DELETE statements to be used when modifying @model's contents.
Note: any modification statement set using gda_data_select_set_modification_statement() will first be unset
-This function is similar to calling gda_data_select_compute_modification_statements_ext with
+This function is similar to calling gda_data_select_compute_modification_statements_ext() with
@cond_type set to %GDA_DATA_SELECT_COND_PK</doc>
<return-value transfer-ownership="none">
<doc xml:whitespace="preserve">%TRUE if no error occurred. If %FALSE is returned, then some modification statement may still have been computed</doc>
@@ -8556,13 +8556,34 @@ using @mod_stmt to propagate those modifications into the database.
If @mod_stmt is:
<itemizedlist>
-<listitem><para>an UPDATE statement, then all the rows in @model will be modifyable</para></listitem>
+<listitem><para>an UPDATE statement, then all the rows in @model will be writable</para></listitem>
<listitem><para>a DELETE statement, then it will be possible to delete rows in @model</para></listitem>
<listitem><para>in INSERT statement, then it will be possible to add some rows to @model</para></listitem>
<listitem><para>any other statement, then this method will return an error</para></listitem>
</itemizedlist>
-This method can be called several times to specify different types of modification.
+This method can be called several times to specify different types of modification statements.
+
+Each modification statement will be executed when one or more values are modified in the data model;
+each statement should then include variables which will be set to either the old value or the
+new value of a column at the specified modified row (but can also contain other variables). Each variable
+named as "+&lt;number&gt;" will be mapped to the new value of the number'th column (starting at 0), and
+each variable named as "-&lt;number&gt;" will be mapped to the old value of the number'th column.
+
+Examples of the SQL equivalent of each statement are (for example if "mytable" has the "id" field as
+primary key, and if that field is auto incremented and if the data model is the result of
+executing "<![CDATA[SELECT * from mytable]]>").
+
+<itemizedlist>
+<listitem><para>"<![CDATA[INSERT INTO mytable (name) VALUES (##+1::string)]]>": the column ID can not be set
+for new rows</para></listitem>
+<listitem><para>"<![CDATA[DELETE FROM mytable WHERE id=##-0::int]]>"</para></listitem>
+<listitem><para>"<![CDATA[UPDATE mytable SET name=##+1::string WHERE id=##-0::int]]>": the column ID cannot be
+modified</para></listitem>
+</itemizedlist>
+
+Also see the gda_data_select_set_row_selection_condition_sql() for more information about the WHERE
+part of the UPDATE and DELETE statement types.
If @mod_stmt is an UPDATE or DELETE statement then it should have a WHERE part which identifies
a unique row in @model (please note that this property can't be checked but may result
@@ -8577,7 +8598,7 @@ NOTE2: if gda_data_select_set_row_selection_condition()
or gda_data_select_set_row_selection_condition_sql() have not yet been successfully be called before, then
the WHERE part of @mod_stmt will be used as if one of these functions had been called.</doc>
<return-value transfer-ownership="none">
- <doc xml:whitespace="preserve">TRUE if no error occurred.</doc>
+ <doc xml:whitespace="preserve">%TRUE if no error occurred.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
@@ -8590,7 +8611,7 @@ the WHERE part of @mod_stmt will be used as if one of these functions had been c
<method name="set_modification_statement_sql"
c:identifier="gda_data_select_set_modification_statement_sql"
throws="1">
- <doc xml:whitespace="preserve">Offers the same feature as gda_data_select_set_modification_statement() but using an SQL statement</doc>
+ <doc xml:whitespace="preserve">Offers the same feature as gda_data_select_set_modification_statement() but using an SQL statement.</doc>
<return-value transfer-ownership="none">
<doc xml:whitespace="preserve">TRUE if no error occurred.</doc>
<type name="gboolean" c:type="gboolean"/>
diff --git a/samples/Gir/dataproxy.py b/samples/Gir/dataproxy.py
index 1d6e187..836f4e7 100644
--- a/samples/Gir/dataproxy.py
+++ b/samples/Gir/dataproxy.py
@@ -1,5 +1,7 @@
#! python
-from gi.repository import GLib, Gda
+from gi.repository import GLib
+from gi.repository import Gda
+print Gda
GLib.unlink ("dataproxy.db")
c = Gda.Connection.open_from_string("SQLite", "DB_DIR=.;DB_NAME=dataproxy", None, Gda.ConnectionOptions.NONE)
c.execute_non_select_command("CREATE TABLE user (name string PRIMARY KEY, functions string, security_number integer)")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]