[libgda/libgda-vala] Moved DbTable.TableType.from_string () as a unum function member
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/libgda-vala] Moved DbTable.TableType.from_string () as a unum function member
- Date: Tue, 14 May 2013 18:13:56 +0000 (UTC)
commit 908b4e83b9f0847af055730a2299635e2deb47e8
Author: Daniel Espinosa <esodan gmail com>
Date: Mon May 13 18:33:49 2013 -0500
Moved DbTable.TableType.from_string () as a unum function member
libgda/data/DbTable.vala | 54 +++++++++++++++++++++---------------------
libgda/data/GdaData-5.0.gir | 20 ++++++++--------
libgda/data/Schema.vala | 2 +-
tests/vala/CheckTable.vala | 3 +-
4 files changed, 40 insertions(+), 39 deletions(-)
---
diff --git a/libgda/data/DbTable.vala b/libgda/data/DbTable.vala
index 5909c30..71db1bd 100644
--- a/libgda/data/DbTable.vala
+++ b/libgda/data/DbTable.vala
@@ -2,17 +2,17 @@
/*
* libgdadata
* Copyright (C) Daniel Espinosa Ortiz 2011 <esodan gmail com>
- *
+ *
* libgda is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* libgda is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -32,40 +32,40 @@ namespace GdaData
public abstract Collection<DbTable> referenced { owned get; }
public abstract Collection<DbFieldInfo> fields { owned get; }
public abstract Collection<DbFieldInfo> primary_keys { owned get; }
-
+
public abstract void set_field (DbFieldInfo field) throws Error;
public abstract DbFieldInfo get_field (string name) throws Error;
-
+
public enum TableType {
NONE,
BASE_TABLE,
- VIEW,
+ VIEW,
LOCAL_TEMPORARY,
SYSTEM_TABLE,
GLOBAL_TEMPORARY,
ALIAS,
- SYNONYM
- }
-
- public static TableType type_from_string (string str)
- {
- if (str == "BASE TABLE")
- return TableType.BASE_TABLE;
- if (str == "VIEW")
- return TableType.VIEW;
- if (str == "LOCAL TEMPORARY")
- return TableType.LOCAL_TEMPORARY;
- if (str == "SYSTEM TABLE")
- return TableType.SYSTEM_TABLE;
- if (str == "GLOBAL TEMPORARY")
- return TableType.GLOBAL_TEMPORARY;
- if (str == "ALIAS")
- return TableType.ALIAS;
- if (str == "SYNONYM")
- return TableType.SYNONYM;
-
- return TableType.NONE;
+ SYNONYM;
+
+ public static TableType from_string (string str)
+ {
+ if (str == "BASE TABLE")
+ return TableType.BASE_TABLE;
+ if (str == "VIEW")
+ return TableType.VIEW;
+ if (str == "LOCAL TEMPORARY")
+ return TableType.LOCAL_TEMPORARY;
+ if (str == "SYSTEM TABLE")
+ return TableType.SYSTEM_TABLE;
+ if (str == "GLOBAL TEMPORARY")
+ return TableType.GLOBAL_TEMPORARY;
+ if (str == "ALIAS")
+ return TableType.ALIAS;
+ if (str == "SYNONYM")
+ return TableType.SYNONYM;
+
+ return TableType.NONE;
+ }
}
}
diff --git a/libgda/data/GdaData-5.0.gir b/libgda/data/GdaData-5.0.gir
index 9c10d53..e588e74 100644
--- a/libgda/data/GdaData-5.0.gir
+++ b/libgda/data/GdaData-5.0.gir
@@ -502,16 +502,6 @@
</parameter>
</parameters>
</virtual-method>
- <function name="type_from_string" c:identifier="gda_data_db_table_type_from_string">
- <return-value transfer-ownership="full">
- <type name="GdaData.DbTableTableType" c:type="GdaDataDbTableTableType"/>
- </return-value>
- <parameters>
- <parameter name="str" transfer-ownership="none">
- <type name="utf8" c:type="const gchar*"/>
- </parameter>
- </parameters>
- </function>
<property name="catalog" writable="1">
<type name="GdaData.DbCatalog" c:type="GdaDataDbCatalog*"/>
</property>
@@ -592,6 +582,16 @@
<member name="alias" c:identifier="GDA_DATA_DB_TABLE_TABLE_TYPE_ALIAS" value="6"/>
<member name="synonym" c:identifier="GDA_DATA_DB_TABLE_TABLE_TYPE_SYNONYM" value="7"/>
</enumeration>
+ <function name="db_table_table_type_from_string"
c:identifier="gda_data_db_table_table_type_from_string">
+ <return-value transfer-ownership="full">
+ <type name="GdaData.DbTableTableType" c:type="GdaDataDbTableTableType"/>
+ </return-value>
+ <parameters>
+ <parameter name="str" transfer-ownership="none">
+ <type name="utf8" c:type="const gchar*"/>
+ </parameter>
+ </parameters>
+ </function>
<interface name="DbRecord" c:type="GdaDataDbRecord" glib:type-name="GdaDataDbRecord"
glib:get-type="gda_data_db_record_get_type" glib:type-struct="DbRecordIface">
<prerequisite name="GObject.Object"/>
<prerequisite name="GdaData.DbObject"/>
diff --git a/libgda/data/Schema.vala b/libgda/data/Schema.vala
index ef7bd9f..f6cda70 100644
--- a/libgda/data/Schema.vala
+++ b/libgda/data/Schema.vala
@@ -44,7 +44,7 @@ namespace GdaData
t.connection = connection;
t.name = (string) mt.get_value_at (mt.get_column_index ("table_name"), r);
t.table_type =
- DbTable.type_from_string((string) mt.get_value_at
(mt.get_column_index ("table_type"), r));
+ DbTable.TableType.from_string((string) mt.get_value_at
(mt.get_column_index ("table_type"), r));
t.schema = this;
tables.set (t.name, t);
}
diff --git a/tests/vala/CheckTable.vala b/tests/vala/CheckTable.vala
index 8c3bf7c..2e2fd9b 100644
--- a/tests/vala/CheckTable.vala
+++ b/tests/vala/CheckTable.vala
@@ -414,8 +414,9 @@ namespace Check {
}
stdout.printf (">>>>>>>> TEST PASS <<<<<<<<<<<\n");
return 0;
-*/
+
}
+*/
public int append () throws Error
{
stdout.printf("\n\n\n>>>>>>>>>>>>>>> NEW TEST: Gda.DbTable - Append...\n");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]