[libgda] Updated sample/vala/SampleDataObject.vala to GdaData.Object API changes
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Updated sample/vala/SampleDataObject.vala to GdaData.Object API changes
- Date: Wed, 4 Jan 2012 16:40:35 +0000 (UTC)
commit 79bcd1ba01e09759fde6caca7694c93606b0df86
Author: Daniel Espinosa <despinosa src gnome org>
Date: Mon Jan 2 16:28:08 2012 -0600
Updated sample/vala/SampleDataObject.vala to GdaData.Object API changes
samples/vala/SampleDataObject.vala | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/samples/vala/SampleDataObject.vala b/samples/vala/SampleDataObject.vala
index 9417892..a75e967 100644
--- a/samples/vala/SampleDataObject.vala
+++ b/samples/vala/SampleDataObject.vala
@@ -22,7 +22,7 @@ using GdaData;
namespace Sample {
- class DbRecord : GdaData.Object {
+ class DbRecord : GdaData.Object<DbRecord> {
private static string dbtable = "user";
/**
@@ -66,6 +66,25 @@ namespace Sample {
}
}
+ public override DbRecord append ()
+ throws ObjectError
+ {
+ var sql = new SqlBuilder (SqlStatementType.INSERT);
+ sql.set_table (this.table);
+ sql.add_field_value_as_gvalue ("functions", functions);
+ sql.add_field_value_as_gvalue ("name", name);
+ Set last_inserted;
+ var i = this.connection.statement_execute_non_select (sql.get_statement (), null, out last_inserted);
+ if (i != 1) {
+ throw new GdaData.ObjectError.APPEND ("Have been added more or less rows than expected");
+ }
+ var id = last_inserted.get_holder_value ("0");
+ var n = new DbRecord ();
+ n.connection = this.connection;
+ n.set_id ("id", id);
+ return n;
+ }
+
/**
* This function is a wrapper to set the id field
* and id value used to retrieve a record from the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]