libgda r3054 - in branches/V4-branch: . doc/C doc/C/tmpl libgda libgda/providers-support libgda/sqlite libgda/sqlite/virtual providers providers/bdb providers/mdb providers/skel-implementation providers/skel-implementation/capi providers/skel-implementation/models providers/sqlite samples/BDB testing/tests_data tests/meta-store tests/providers tests/value-holders



Author: vivien
Date: Thu Feb 14 18:20:30 2008
New Revision: 3054
URL: http://svn.gnome.org/viewvc/libgda?rev=3054&view=rev

Log:
2008-02-14  Vivien Malerba <malerba gnome-db org>

	* Makefile.am:
	* libgda/global.h:
	* libgda/md5.h:
	* libgda/md5c.c: imported files from the RSA reference implementation included in the RFC-1321,
	see http://www.freesoft.org/CIE/RFC/1321/
	* libgda/gda-data-model-dir.c: don't use libgcrypt anymore for MD5 computation, see bug #513019
	* libgda/gda-data-model-dir.c: implemented gda_data_model_dir_get_errors() and
	gda_data_model_dir_clean_errors()
	* libgda/gda-data-model-bdb.c: implemented gda_data_model_bdb_get_errors() and
	gda_data_model_bdb_clean_errors()
	* configure.in:
	   - don't check for libgcrypt,
	   - add a minimum pkg-config version of 0.18 because PKG_CHECK_EXISTS is used, see bug #514925
	   - use the BDB version in 'dir' when the --with-bdb=dir flag is used
	   - create Makefiles and XML files for skeleton implementations in
	     providers/skel-implementation, but don't compile or install them
	* providers/Makefile.am: re-enabled compilation of the BDB and MDB providers
	* providers/bdb/gda-bdb-provider.c:
	* providers/bdb/gda-bdb-test.c:
	* providers/mdb/gda-mdb-provider.c: modifications to make the providers work again
	* providers/skel-implementation/capi/*: completed the skeleton implementation for providers
	based on a C API
	* providers/skel-implementation/models/*: new skeleton implementation for providers based
	on tables which are implemented by libgda's data model objects
	* sqlite/virtual/gda-virtual-connection.[ch]: added gda_virtual_connection_internal_[sg]et_provider_data()
	for virtual provider's implementations
	* libgda/gda-connection.c: clear provider specific data when connection is closed (and not when
	the object is destroyed)
	* doc/C: documentation updates, with new instructions on how to write database providers
	* tests/providers/prov-test-util.c:
	* tests/meta-store: updated tests
	* providers/sqlite/libmain.c: removed gda_sqlite_provider_new()
	* libgda/:
	* libgda/sqlite/: misc. improvements
	* samples/BDB/access-raw.c: updated example


Added:
   branches/V4-branch/doc/C/prov-writing.xml
   branches/V4-branch/doc/C/tmpl/gda-pmodel.sgml
   branches/V4-branch/doc/C/tmpl/gda-prow.sgml
   branches/V4-branch/doc/C/tmpl/gda-pstmt.sgml
   branches/V4-branch/doc/C/tmpl/provider-support.sgml
   branches/V4-branch/libgda/global.h
   branches/V4-branch/libgda/md5.h
   branches/V4-branch/libgda/md5c.c
   branches/V4-branch/providers/skel-implementation/capi/capi_specs_create_table.xml.in
   branches/V4-branch/providers/skel-implementation/capi/capi_specs_dsn.xml.in
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-blob-op.c
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-blob-op.h
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-ddl.c
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-ddl.h
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-meta.c
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-meta.h
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-parser.c
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-parser.h
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-provider.c
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-provider.h
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-pstmt.c
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-pstmt.h
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-recordset.c
   branches/V4-branch/providers/skel-implementation/capi/gda-capi-recordset.h
   branches/V4-branch/providers/skel-implementation/capi/gen_def.c
   branches/V4-branch/providers/skel-implementation/capi/libmain.c
   branches/V4-branch/providers/skel-implementation/capi/parser.y
   branches/V4-branch/providers/skel-implementation/models/   (props changed)
   branches/V4-branch/providers/skel-implementation/models/Makefile.am
   branches/V4-branch/providers/skel-implementation/models/gda-models-provider.c
   branches/V4-branch/providers/skel-implementation/models/gda-models-provider.h
   branches/V4-branch/providers/skel-implementation/models/gda-models.h
   branches/V4-branch/providers/skel-implementation/models/libgda-models-4.0.pc.in
   branches/V4-branch/providers/skel-implementation/models/libmain.c
   branches/V4-branch/providers/skel-implementation/models/models_specs_dsn.xml.in
Removed:
   branches/V4-branch/testing/tests_data/
Modified:
   branches/V4-branch/ChangeLog
   branches/V4-branch/configure.in
   branches/V4-branch/doc/C/libgda-4.0-docs.sgml
   branches/V4-branch/doc/C/libgda-4.0-sections.txt
   branches/V4-branch/doc/C/migration2.xml
   branches/V4-branch/doc/C/tmpl/gda-blob-op.sgml
   branches/V4-branch/doc/C/tmpl/gda-server-provider.sgml
   branches/V4-branch/doc/C/tmpl/gda-virtual-connection.sgml
   branches/V4-branch/libgda/Makefile.am
   branches/V4-branch/libgda/gda-connection-private.h
   branches/V4-branch/libgda/gda-connection.c
   branches/V4-branch/libgda/gda-data-model-bdb.c
   branches/V4-branch/libgda/gda-data-model-bdb.h
   branches/V4-branch/libgda/gda-data-model-dir.c
   branches/V4-branch/libgda/gda-data-model-dir.h
   branches/V4-branch/libgda/gda-data-model-import.c
   branches/V4-branch/libgda/gda-data-proxy.c
   branches/V4-branch/libgda/gda-server-provider-extra.c
   branches/V4-branch/libgda/gda-server-provider-extra.h
   branches/V4-branch/libgda/gda-server-provider.c
   branches/V4-branch/libgda/gda-server-provider.h
   branches/V4-branch/libgda/providers-support/Makefile.am
   branches/V4-branch/libgda/providers-support/gda-pmodel.h
   branches/V4-branch/libgda/sqlite/gda-sqlite-meta.c
   branches/V4-branch/libgda/sqlite/gda-sqlite-meta.h
   branches/V4-branch/libgda/sqlite/gda-sqlite-provider.c
   branches/V4-branch/libgda/sqlite/gda-sqlite-provider.h
   branches/V4-branch/libgda/sqlite/gda-sqlite-recordset.c
   branches/V4-branch/libgda/sqlite/utils.c
   branches/V4-branch/libgda/sqlite/virtual/gda-virtual-connection.c
   branches/V4-branch/libgda/sqlite/virtual/gda-virtual-connection.h
   branches/V4-branch/libgda/sqlite/virtual/gda-vprovider-data-model.c
   branches/V4-branch/providers/Makefile.am
   branches/V4-branch/providers/bdb/Makefile.am
   branches/V4-branch/providers/bdb/bdb_specs_dsn.xml.in
   branches/V4-branch/providers/bdb/gda-bdb-provider.c
   branches/V4-branch/providers/bdb/gda-bdb-provider.h
   branches/V4-branch/providers/bdb/gda-bdb-test.c
   branches/V4-branch/providers/bdb/gda-bdb.h
   branches/V4-branch/providers/bdb/libmain.c
   branches/V4-branch/providers/mdb/gda-mdb-provider.c
   branches/V4-branch/providers/mdb/gda-mdb-provider.h
   branches/V4-branch/providers/mdb/gda-mdb.h
   branches/V4-branch/providers/mdb/libmain.c
   branches/V4-branch/providers/skel-implementation/Makefile.am
   branches/V4-branch/providers/skel-implementation/capi/   (props changed)
   branches/V4-branch/providers/skel-implementation/capi/Makefile.am
   branches/V4-branch/providers/skel-implementation/capi/gda-capi.h
   branches/V4-branch/providers/sqlite/libmain.c
   branches/V4-branch/samples/BDB/access-raw.c
   branches/V4-branch/tests/meta-store/common.c
   branches/V4-branch/tests/meta-store/data_columns.csv
   branches/V4-branch/tests/providers/prov-test-util.c
   branches/V4-branch/tests/value-holders/check_set.c
   branches/V4-branch/tests/value-holders/common.c

Modified: branches/V4-branch/configure.in
==============================================================================
--- branches/V4-branch/configure.in	(original)
+++ branches/V4-branch/configure.in	Thu Feb 14 18:20:30 2008
@@ -114,6 +114,12 @@
 ALL_LINGUAS="ar az ca cs da de dz el en_CA en_GB es eu fa fi fr ga gl hr hu it ja ko lt mk ml ms nb ne nl oc pa pl pt pt_BR ru rw sk sl sq sr sr Latn sv tr uk vi zh_CN zh_HK zh_TW"
 AM_GLIB_GNU_GETTEXT
 
+
+dnl ******************************
+dnl Check for pkg-config version; want >= 0.18 because we need PKG_CHECK_EXISTS
+dnl ******************************
+PKG_PROG_PKG_CONFIG([0.18])
+
 dnl ******************************
 dnl Checks for libraries
 dnl ******************************
@@ -186,39 +192,6 @@
 AC_SUBST(FAM_CFLAGS)
 
 dnl ******************************
-dnl Checks for libgcrypt
-dnl ******************************
-LIBGCRYPT_CFLAGS=""
-LIBGCRYPT_LIBS=""
-if test x$platform_win32 != xyes; then
-        AC_DEFUN([VERSION_TO_NUMBER],[`$1 | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
-        AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
-        if test "$LIBGCRYPT_CONFIG" != "no" ; then
-                LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
-                if test VERSION_TO_NUMBER(echo $LIBGCRYPT_VERSION) -lt VERSION_TO_NUMBER(echo "1.1.42") ; then
-                        LIBGCRYPT_CFLAGS=""
-                        LIBGCRYPT_LIBS=""
-                        AM_CONDITIONAL(HAVE_LIBGCRYPT, 0)
-                        echo "GdaDataModelDir object won't compute MD5 column, install libgcrypt >= 1.1.42 and reconfigure to make available."
-                else
-                        LIBGCRYPT_CFLAGS="`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags` -DHAVE_LIBGCRYPT"
-                        LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
-                        AM_CONDITIONAL(HAVE_LIBGCRYPT, true)
-                fi
-        else
-        LIBGCRYPT_CFLAGS=""
-        LIBGCRYPT_LIBS=""
-        AM_CONDITIONAL(HAVE_LIBGCRYPT, 0)
-        echo "GdaDataModelDir object won't compute MD5 column, install libgcrypt and reconfigure to make available."
-        fi
-else
-        AM_CONDITIONAL(HAVE_LIBGCRYPT, false)
-fi
-
-AC_SUBST(LIBGCRYPT_CFLAGS)
-AC_SUBST(LIBGCRYPT_LIBS)
-
-dnl ******************************
 dnl Checks for Gnome VFS
 dnl ******************************
 
@@ -300,10 +273,13 @@
 bdbdir=""
 if test $try_bdb = true
 then
-	AC_CHECK_HEADER(db.h, bdb_ok=yes, bdb_ok=no, [])
-	if test $bdb_ok = yes ; then
-		bdbdir=yes
-		BDB_LIBS="-ldb"
+	if test $withval = yes
+	then
+		AC_CHECK_HEADER(db.h, bdb_ok=yes, bdb_ok=no, [])
+		if test $bdb_ok = yes ; then
+		        bdbdir=yes
+		   	BDB_LIBS="-ldb"
+		fi
 	else
 		AC_MSG_CHECKING(for Berkeley DB files)
 		for d in $dir /usr /usr/local
@@ -1243,6 +1219,8 @@
 providers/skel-implementation/Makefile
 providers/skel-implementation/capi/Makefile
 providers/skel-implementation/capi/libgda-capi-4.0.pc
+providers/skel-implementation/models/Makefile
+providers/skel-implementation/models/libgda-models-4.0.pc
 libgda-report/Makefile
 libgda-report/engine/Makefile
 libgda-report/DocBook/Makefile

Modified: branches/V4-branch/doc/C/libgda-4.0-docs.sgml
==============================================================================
--- branches/V4-branch/doc/C/libgda-4.0-docs.sgml	(original)
+++ branches/V4-branch/doc/C/libgda-4.0-docs.sgml	Thu Feb 14 18:20:30 2008
@@ -98,8 +98,13 @@
 <!ENTITY libgda-GdaBatch SYSTEM "xml/gda-batch.xml">
 <!ENTITY libgda-GdaSqlParser SYSTEM "xml/gda-sql-parser.xml">
 <!ENTITY libgda-GdaMetaStore SYSTEM "xml/gda-meta-store.xml">
+<!ENTITY libgda-PRow SYSTEM "xml/gda-prow.xml">
+<!ENTITY libgda-PModel SYSTEM "xml/gda-pmodel.xml">
+<!ENTITY libgda-PStmt SYSTEM "xml/gda-pstmt.xml">
 <!ENTITY libgda-Enums SYSTEM "xml/gda-enums.xml">
 <!ENTITY libgda-convenient SYSTEM "xml/gda-convenient.xml">
+<!ENTITY provider-writing SYSTEM "prov-writing.xml">
+<!ENTITY provider-support SYSTEM "xml/provider-support.xml">
 <!ENTITY fdl-appendix SYSTEM "fdl-appendix.sgml">
 <!ENTITY libgda-TreeIndex SYSTEM "xml/tree_index.sgml">
 ]>
@@ -911,40 +916,48 @@
 
   <part id="part_providers">
     <title>Databases providers for developers</title>
-    <chapter id="libgda-provider-introduction">
-      <title>Introduction</title>
       <para>
-	For each different data source supported by &LIBGDA; there must be a
-	GObject that implements the virtual methods defined in &GDASERVERPROVIDER;
-	class.
+	For each database engine, &LIBGDA; requires an object which maps &LIBGDA;'s API
+	to the native API offered by that database engine. That object, a <emphasis>database provider</emphasis> 
+	needs to inherit <link linkend="GdaServerProvider">GdaServerProvider</link> and implement its
+	virtual methods.
       </para>
       <para>
-	Providers must also create their own object to implement the virtual
-	methods defined in &GDADATAMODEL; or one of
-	its subclasses to support recordsets.
+	Database provider objects are generally instanciated once by the &LIBGDA; framework and can be used several
+	times to open and work on connections to several databases of the same type.
       </para>
       <para>
 	Since &LIBGDA; itself is developed in the C language, and that most
 	providers are also implemented in that language, the &LIBGDA; library
 	itself contains a set of helper classes and functions to guide you
-	in the addition of a new provider to the GDA framework.
-      </para>
-    </chapter>
+	in the addition of a new provider to the GDA framework. Two reference implementations
+	are provided in the <filename class="directory">providers/skel-implementation</filename>
+	directory of &LIBGDA;'s sources:
+	<itemizedlist>
+	  <listitem><para>in <filename class="directory">providers/skel-implementation/capi</filename>: a skeleton
+	    implementation from scratch for a database accessed through a C API, where all the methods to implement are partially
+	    coded</para></listitem>
+	  <listitem><para>in <filename class="directory">providers/skel-implementation/models</filename>: a skeleton
+	    implementation to write a provider for sources which are not databases (which do not implement any SQL) such
+	    as the Berkeley DB provider (a BDB database is a key/value collection) or the MDB (MS Access files) provider.
+	    This kind of provider "export" tables which are in fact data models.</para></listitem>
+      </itemizedlist>
+    </para>
+    <para>
+      The helper objects and functions to write database providers are documented in the 
+      <link linkend="psupport">Providers' support API</link> section.
+    </para>
 
-    <chapter id="libgda-provider-class">
-      <title>Virtual methods for providers</title>
-      <para>
-	To write.
-      </para>
-    </chapter>
 
-    <chapter id="libgda-provider-recordset">
-      <title>Virtual methods for recordsets</title>
-      <para>
-	To write.
-      </para>
+    <chapter id="psupport">
+      <title>Providers' support API</title>
+      &libgda-GdaServerProvider;
+      &libgda-PModel;
+      &libgda-PRow;
+      &libgda-PStmt;
+      &provider-support;
     </chapter>
-    &libgda-GdaServerProvider;
+    &provider-writing;
   </part>
 
   &fdl-appendix;

Modified: branches/V4-branch/doc/C/libgda-4.0-sections.txt
==============================================================================
--- branches/V4-branch/doc/C/libgda-4.0-sections.txt	(original)
+++ branches/V4-branch/doc/C/libgda-4.0-sections.txt	Thu Feb 14 18:20:30 2008
@@ -624,7 +624,9 @@
 <FILE>gda-server-provider</FILE>
 <TITLE>GdaServerProvider</TITLE>
 GdaServerProvider
+GdaServerProviderClass
 GdaServerProviderError
+GdaServerProviderMeta
 gda_server_provider_get_name
 gda_server_provider_get_version
 gda_server_provider_get_server_version
@@ -632,7 +634,6 @@
 gda_server_provider_reset_connection
 gda_server_provider_close_connection
 gda_server_provider_get_database
-gda_server_provider_change_database
 gda_server_provider_supports_operation
 gda_server_provider_create_operation
 gda_server_provider_render_operation
@@ -706,6 +707,8 @@
 <FILE>gda-virtual-connection</FILE>
 <TITLE>GdaVirtualConnection</TITLE>
 GdaVirtualConnection
+gda_virtual_connection_internal_set_provider_data
+gda_virtual_connection_internal_get_provider_data
 <SUBSECTION Standard>
 GDA_IS_VIRTUAL_CONNECTION
 GDA_IS_VIRTUAL_CONNECTION_CLASS
@@ -1388,7 +1391,6 @@
 <SECTION>
 <FILE>gda-meta-store</FILE>
 <TITLE>GdaMetaStore</TITLE>
-<INCLUDE>gda-meta-store.h</INCLUDE>
 GdaMetaStore
 GdaMetaStoreError
 GdaMetaStoreChange
@@ -1407,3 +1409,84 @@
 GDA_TYPE_META_STORE
 gda_meta_store_get_type
 </SECTION>
+
+<SECTION>
+<FILE>gda-prow</FILE>
+<TITLE>GdaPRow</TITLE>
+<INCLUDE>providers-support/gda-prow.h</INCLUDE>
+GdaPRow
+gda_prow_new
+gda_prow_get_length
+gda_prow_get_value
+<SUBSECTION Standard>
+GDA_IS_PROW
+GDA_PROW
+GDA_PROW_CLASS
+GDA_TYPE_PROW
+gda_prow_get_type
+</SECTION>
+
+<SECTION>
+<FILE>gda-pmodel</FILE>
+<TITLE>GdaPModel</TITLE>
+<INCLUDE>providers-support/gda-pmodel.h</INCLUDE>
+GdaPModel
+GdaPModelClass
+gda_pmodel_take_row
+gda_pmodel_get_stored_row
+<SUBSECTION Standard>
+GDA_IS_PMODEL
+GDA_PMODEL
+GDA_PMODEL_CLASS
+GDA_TYPE_PMODEL
+gda_pmodel_get_type
+</SECTION>
+
+<SECTION>
+<FILE>gda-pstmt</FILE>
+<TITLE>GdaPStmt</TITLE>
+<INCLUDE>providers-support/gda-pstmt.h</INCLUDE>
+GdaPStmt
+gda_pstmt_copy_contents
+<SUBSECTION Standard>
+GDA_IS_PSTMT
+GDA_PSTMT
+GDA_PSTMT_CLASS
+GDA_TYPE_PSTMT
+gda_pstmt_get_type
+</SECTION>
+
+<SECTION>
+<FILE>provider-support</FILE>
+<TITLE>Misc API</TITLE>
+gda_server_provider_internal_get_parser
+<SUBSECTION>
+gda_server_provider_perform_operation_default
+gda_server_provider_get_data_handler_default
+<SUBSECTION>
+gda_server_provider_handler_find
+gda_server_provider_handler_declare
+<SUBSECTION>
+gda_server_provider_find_file
+gda_server_provider_load_file_contents
+<SUBSECTION>
+gda_connection_internal_set_provider_data
+gda_connection_internal_get_provider_data
+gda_virtual_connection_internal_set_provider_data
+gda_virtual_connection_internal_get_provider_data
+<SUBSECTION>
+gda_connection_add_prepared_statement
+gda_connection_del_prepared_statement
+gda_connection_get_prepared_statement
+<SUBSECTION>
+gda_connection_internal_transaction_started
+gda_connection_internal_transaction_rolledback
+gda_connection_internal_transaction_committed
+gda_connection_internal_statement_executed
+gda_connection_internal_savepoint_added
+gda_connection_internal_savepoint_rolledback
+gda_connection_internal_savepoint_removed
+gda_connection_internal_change_transaction_state
+<SUBSECTION>
+gda_connection_get_meta_store
+</SECTION>

Modified: branches/V4-branch/doc/C/migration2.xml
==============================================================================
--- branches/V4-branch/doc/C/migration2.xml	(original)
+++ branches/V4-branch/doc/C/migration2.xml	Thu Feb 14 18:20:30 2008
@@ -108,6 +108,7 @@
  	  <listitem><para>gda_delimiter_*()</para></listitem>
  	  <listitem><para>gda_sql_transaction_parse*()</para></listitem>
  	  <listitem><para>sql_*() (from the libsql library)</para></listitem>
+	  <listitem><para>gda_server_provider_change_database()</para></listitem>
 	</itemizedlist>
       </para>
     </sect2>

Added: branches/V4-branch/doc/C/prov-writing.xml
==============================================================================
--- (empty file)
+++ branches/V4-branch/doc/C/prov-writing.xml	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,460 @@
+<chapter id="libgda-provider-class">
+  <title>Virtual methods for providers</title>
+  <para>
+    Database providers usually (that is except for <emphasis>virtual</emphasis> providers explained later) subclass
+    the <link linkend="GdaServerProvider">GdaServerProvider</link> class and implement at least the mandatory
+    virtual methods.
+  </para>
+  <para>
+    Virtual providers are database providers when the database engine accessed does not support SQL (or
+    supports it poorly), such as Berkeley databases or MDB (or even LDAP). These provider's implementation's
+    design is to create <link linkend="GdaDataModel">GdaDataModel</link> data model objects and make
+    each of them appear as a named table once the connection is opened. For example the MDB provider creates
+    a read-only data model for each table in an MDB file and make it appear using the original table
+    name used in MS Access (the tables cannot be modified but it is possible to use all SQLite's SQL
+    to make SELECT queries).
+  </para>
+  <para>
+    Virtual providers inherit the <link linkend="GdaVproviderDataModel">GdaVproviderDataModel</link> class
+    and not the <link linkend="GdaServerProvider">GdaServerProvider</link> as "normal" providers do,
+    and the number of virtual methods to implement is very limited: only the <link linkend="prov-get-name">get_name()</link>,
+    <link linkend="prov-get-version">get_version()</link>, <link linkend="prov-get-server-version">get_server_version()</link>, 
+    <link linkend="prov-open-connection">open_connection()</link> and <link linkend="prov-get-database">get_database()</link>
+    should be implemented, optionnally the <link linkend="prov-close-connection">close_connection()</link> can
+    also be implemented.
+  </para>
+  <para>
+    To implement a virtual provider, one can copy the contents of the 
+    <filename class="directory">providers/skel-implementation/models</filename> directory, change all references
+    to "models" with the correct provider name, and implement the missing parts, using if necessary the
+    BDB an MDB providers' implementations as examples.
+  </para>
+  <sect1>
+    <title>Methods - provider's information</title>
+    <sect2 id="prov-get-name">
+      <title>get_name() - mandatory</title>
+      <para>This method returns the name of the provider; it should only contain alphanumeric characters.</para>
+    </sect2>
+    <sect2 id="prov-get-version">
+      <title>get_version() - mandatory</title>
+      <para>This method returns the version of the provider (providers built as part of &LIBGDA; have the same
+	version as &LIBGDA;).</para>
+    </sect2>
+    <sect2 id="prov-get-server-version">
+      <title>get_server_version() - mandatory</title>
+      <para>This method returns the version of the database server to which a connection is opened</para>
+    </sect2>
+    <sect2>
+      <title>supports_feature()</title>
+      <para>This method allows one to ask the provider if some specific features are available</para>
+    </sect2>
+  </sect1>
+
+  <sect1>
+    <title>Methods - connection management</title>
+    <sect2 id="prov-open-connection">
+      <title>open_connection() - mandatory</title>
+      <para>
+	This method actually opens a connection to the database.
+      </para>
+      <para>
+	Any data specific to the connection (such as 
+	a database handle created by the database API when opening the connection) must be stored in a private structure
+	(which should be defined in the <filename>gda-&lt;providername&gt;.h</filename> file as a 
+	<classname>&lt;Providername&gt;ConnectionData</classname>); this private structure's adress should be
+	"attached" to the <link linkend="GdaConnection">GdaConnection</link> object using the
+	<link linkend="gda-connection-internal-set-provider-data">gda_connection_internal_set_provider_data()</link>.
+      </para>
+    </sect2>
+    <sect2 id="prov-close-connection">
+      <title>close_connection() - mandatory</title>
+      <para>
+	This method actually closes a connection previously opened by the 
+	<link linkend="prov-open-connection">open_connection()</link> virtual method. This method is not mandatory for
+	virtual providers.
+      </para>
+      <para>
+	The connection specific data for the database API can be retreived using the
+	<link linkend="gda-connection-internal-get-provider-data">gda_connection_internal_get_provider_data()</link> method.
+      </para>
+    </sect2>
+    <sect2>
+      <title>get_database()</title>
+      <para>This method returns the name of the database to which a connection is opened.</para>
+    </sect2>
+  </sect1>
+
+  <sect1>
+    <title>Methods - DDL queries</title>
+    <para>
+      This group of virtual methods is composed of virtual methods which make it possible to handle DDL (data definition) queries
+      to be executed using descriptions of the data required for each kind of DDL query, rather than using SQL directly (because
+      DDL SQL is usually very database specific and must thus be adapted when migrating to another database type). For more
+      information, see the <link linkend="DDLIntro">global introduction to DDL queries</link>.
+    </para>
+    <para>
+      Implementing these methods is not mandatory, and virtual provider's implementation should not implement them.
+    </para>
+    <sect2>
+      <title>supports_operation()</title>
+      <para>
+	This virtual method tells if a particular DDL query type is supported (DDL query types are identified as 
+      <link linkend="GdaServerOperationType">GdaServerOperationType</link> enums).
+      </para>
+    </sect2>
+    <sect2>
+      <title>create_operation()</title>
+      <para>
+	This virtual method is used to create and initialize a <link linkend="GdaServerOperation">GdaServerOperation</link>
+	object.
+      </para>
+    </sect2>
+    <sect2>
+      <title>render_operation()</title>
+      <para>
+	This virtual method uses the information stored in a <link linkend="GdaServerOperation">GdaServerOperation</link> object
+	to create the SQL statement(s) which would be executed if the operation was performed.
+      </para>
+      <para>
+	Note: more than one SQL statement may be returned by this method
+      </para>
+      <para>
+	Note: some operations don't return any SQL at all, if the operation can only be done using an API (and not through SQL)
+      </para>
+    </sect2>
+    <sect2>
+      <title>perform_operation()</title>
+      <para>
+	This virtual method "performs" (execute) a <link linkend="GdaServerOperation">GdaServerOperation</link> object.
+      </para>
+    </sect2>
+  </sect1>
+
+  <sect1>
+    <title>Methods - transactions management</title>
+    <para>
+      When a connection has been opened and no transaction has been started, then the provider should execute queries in
+      auto commit mode.
+    </para>
+    <sect2>
+      <title>begin_transaction()</title>
+      <para>
+	This method starts a new transaction.
+      </para>
+    </sect2>
+    <sect2>
+      <title>commit_transaction()</title>
+      <para>
+	This method commits the current transaction.
+      </para>
+    </sect2>
+    <sect2>
+      <title>rollback_transaction()</title>
+      <para>
+	This method cancels the current transaction.
+      </para>
+    </sect2>
+    <sect2>
+      <title>add_savepoint()</title>
+      <para>
+	This method adds a save point to the current transaction, which allows for partial rollbacks within transactions.
+      </para>
+    </sect2>
+    <sect2>
+      <title>rollback_savepoint()</title>
+      <para>
+	This method rolls back to a previously defined save point within the current transaction.
+      </para>
+    </sect2>
+    <sect2>
+      <title>delete_savepoint()</title>
+      <para>
+	This method deletes a previously defined save point within the current transaction, it does not affect the
+	transaction but it simply won't be possible to roll back to the savepoint afterwards.
+      </para>
+    </sect2>
+  </sect1>
+
+  <sect1>
+    <title>Methods - DML queries</title>
+    <para>
+      This group of virtual methods is related to executing SQL queries of any kind. &LIBGDA; imposes that SQL
+      statements be converted to one or more <link linkend="GdaStatement">GdaStatement</link> object(s), each
+      GdaStatement object containing exactly one SQL statement (usually terminated
+      by a semi colon). Each GdaStatement can then be prepared and/or executed individually.
+    </para>
+    <para>
+      Creating a <link linkend="GdaStatement">GdaStatement</link> object from some SQL is the job of a
+      <link linkend="GdaSqlParser">GdaSqlParser</link> object.
+    </para>
+    <sect2>
+      <title>create_parser()</title>
+      <para>
+	This method instanciates a <link linkend="GdaSqlParser">GdaSqlParser</link> object which is
+	adapted to the database's specific SQL dialect. If the provider does not implement its own parser,
+	then this method should not be implemented.
+      </para>
+    </sect2>
+    <sect2>
+      <title>statement_to_sql()</title>
+      <para>
+	This method converts a <link linkend="GdaStatement">GdaStatement</link> object to its SQL representation. It should be
+	implemented only if the default rendering is incorrect (to support some SQL specific dialect). The rendering process
+	is decomposed into several rendering methods, and it is possible to override only some of the methods (see the
+	PostgreSQL's implementation as an example).
+      </para>
+    </sect2>
+    <sect2>
+      <title>statement_prepare()</title>
+      <para>
+	This method requests that a <link linkend="GdaStatement">GdaStatement</link> object be prepared for a future execution.
+	It is called when <link linkend="gda-connection-statement-prepare">gda_connection_statement_prepare()</link> is called.
+      </para>
+    </sect2>
+    <sect2>
+      <title>statement_execute() - mandatory</title>
+      <para>
+	This method actually executes a query represented by a <link linkend="GdaStatement">GdaStatement</link> object. See
+	<link linkend="gda-connection-statement-execute">gda_connection_statement_execute()</link> for more information, note that
+	this method is also always the one called when any of the gda_connection_statement_execute*() methods are called.
+      </para>
+    </sect2>
+  </sect1>
+
+  <sect1>
+    <title>Methods - data representation</title>
+    <para>
+      This group of virtual methods is related to converting some data between the three representations which are the 
+      SQL representation (to be directly included in a SQL statement), the human readable representation, and the 
+      <link linkend="GValue">GValue</link> representation. For each type of data (identified as a 
+      <link linkend="GType">GType</link> type) which the provider can handle, a <link linkend="GdaDataHandler">GdaDataHandler</link>
+      object is responsible of the conversions.
+    </para>
+    <sect2>
+      <title>get_data_handler()</title>
+      <para>
+	This method returns a <link linkend="GdaDataHandler">GdaDataHandler</link> for the requested data type. It should
+	only instanciate each <link linkend="GdaDataHandler">GdaDataHandler</link> once and reuse it if the same request happens 
+	(the returned object will not be modified).
+      </para>
+      <para>
+	This method is called by both
+	<link linkend="gda-server-provider-get-data-handler-gtype">gda_server_provider_get_data_handler_gtype()</link> and
+	<link linkend="gda-server-provider-get-data-handler-dbms">gda_server_provider_get_data_handler_dbms()</link> methods.
+      </para>
+    </sect2>
+    <sect2>
+      <title>get_def_dbms_type()</title>
+      <para>
+	This method returns the name of the most common (database specific) data type which has the requested type.
+      </para>
+    </sect2>
+    <sect2>
+      <title>escape_string()</title>
+      <para>
+	This method adds escape characters to a string, to be able to safely add it into an SQL statement.
+      </para>
+    </sect2>
+    <sect2>
+      <title>unescape_string()</title>
+      <para>
+	This method does the reverse of the escape_string() method.
+      </para>
+    </sect2>
+  </sect1>
+
+  <sect1>
+    <title>Methods - misc.</title>
+    <sect2>
+      <title>create_connection()</title>
+      <para>
+	Reserved for internal implementation.
+      </para>
+    </sect2>
+    <sect2>
+      <title>meta_funcs</title>
+      <para>
+	The <fieldsynopsis>meta_funcs</fieldsynopsis> is composed of several functions which are listed in the
+	<link linkend="GdaServerProviderMeta">GdaServerProviderMeta</link> structure.
+	Related to <link linkend="GdaMetaStore">GdaMetaStore</link>.
+      </para>
+    </sect2>
+  </sect1>
+</chapter>
+
+<chapter id="libgda-provider-recordset">
+  <title>Virtual methods for recordsets</title>
+  <para>
+    This section explains how to write virtual methods for the <link linkend="GdaPModel">GdaPModel</link> subclasses
+    implementations, which should be done when implementing a database provider.
+  </para>
+  <sect2>
+    <title>fetch_nb_rows()</title>
+    <para>
+      This method is called when the user calls <link linkend="gda-data-model-get-n-rows">gda_data_model_get_n_rows ()</link>.
+    </para>
+    <para>
+      Note that the number of rows of the data model may not be known until the cursor has reached the
+      Once known, the number of rows can be stored in the <structfield>advertized_nrows</structfield>'s member of the
+      <link linkend="GdaPModel">GdaPModel</link> object.
+    </para>
+  </sect2>
+
+  <sect2>
+    <title>fetch_random()</title>
+    <para>
+      To write.
+    </para>
+  </sect2>
+
+  <sect2>
+    <title>fetch_next()</title>
+    <para>
+      To write.
+    </para>
+  </sect2>
+
+  <sect2>
+    <title>fetch_prev()</title>
+    <para>
+      To write.
+    </para>
+  </sect2>
+
+  <sect2>
+    <title>fetch_at()</title>
+    <para>
+      To write.
+    </para>
+  </sect2>
+</chapter>
+
+<chapter id="libgda-provider-blobop">
+  <title>Virtual methods for Blob operations</title>
+  <para>
+    Blobs are a special feature of databases because they allow one to access the contents of a "cell" from the
+    API without using SQL (usually no SQL can be used to manipulate a blob's contents: an SQL statement is used to
+    create, delete or retreive a blob, but the contents is accessed through the API).
+  </para>
+  <para>
+    &LIBGDA; encapsulates all blob operations in objects which must be implemented by each provider if they want to support
+    blobs; otherwise binary data may still be used if supported by the database, but the whole binary data is transfered in
+    the SQL statement which is not suitable for large data.
+  </para>
+  <sect2>
+    <title>get_length()</title>
+    <para>
+      To write.
+    </para>
+  </sect2>
+
+  <sect2>
+    <title>read()</title>
+    <para>
+      To write.
+    </para>
+  </sect2>
+
+  <sect2>
+    <title>write()</title>
+    <para>
+      To write.
+    </para>
+  </sect2>
+
+  <sect2>
+    <title>write_all()</title>
+    <para>
+      To write.
+    </para>
+  </sect2>
+</chapter>
+
+<chapter id="libgda-provider-pack">
+  <title>Assembling all the parts</title>
+  <para>
+    A database provider is in fact a shared library which is loaded when &LIBGDA; is initialized. The skeleton implementations
+    in <filename class="directory">providers/skel-implementation</filename> propose the following files layout (some of the files
+    are not required for virtual providers).
+  </para>
+  <para> Of course this files layout is not required, but make it easy for maintenance. In the folloing list,
+    the filenames here are the one for the "Capi" provider, and each provider should rename them:
+    <itemizedlist>
+      <listitem><para><filename>gda-capi.h</filename>: contains the provider name, the include files necessary to use the API and the
+	  declaration of the provider's specific connection data</para></listitem>
+      <listitem><para><filename>gda-capi-provider.[ch]</filename>: are the header and implementation files for the object
+	  inheriting the <link linkend="GdaServerProvider">GdaServerProvider</link> object. This object must implement its
+	  <link linkend="libgda-provider-class">virtual methods</link>.</para></listitem>
+      <listitem><para><filename>gda-capi-recordset.[ch]</filename>: are the header and implementation files for the object
+	  inheriting the <link linkend="GdaPModel">GdaPModel</link> object. This object must implement its
+	  <link linkend="libgda-provider-recordset">virtual methods</link>.</para></listitem>
+      <listitem><para><filename>gda-capi-ddl.[ch]</filename>: are the files implementing the DDL queries</para></listitem>
+      <listitem><para><filename>gda-capi-parser.[ch]</filename>: are the header and implementation files 
+	  for the object implementing a specific parser,
+	  inheriting <link linkend="GdaSqlParser">GdaSqlParser</link>, see the PostgreSQL provider's implementation for 
+	  example.</para></listitem>
+      <listitem><para><filename>gda-capi-pstmt.[ch]</filename>: are the header and implementation files for the object
+      representing prepared statement and inheriting <link linkend="GdaPStmt">GdaPStmt</link></para></listitem>
+      <listitem><para><filename>gda-capi-blob-op.[ch]</filename>: are the header and implementation files for the object
+	  inheriting the <link linkend="GdaBlobOp">GdaBlopOp</link> object. This object must implement its
+	  <link linkend="libgda-provider-blobop">virtual methods</link>.</para></listitem>
+      <listitem><para><filename>gda-capi-meta.[ch]</filename>: are the files where the meta-data information extraction
+      is implemented.</para></listitem>
+      <listitem><para><filename>libmain.c</filename>: file to make it possible for &LIBGDA; to identify the provider.</para></listitem>
+      <listitem><para><filename>capi_specs_dsn.xml.in</filename>: file where the connection parameters are described, 
+	  before being translated</para></listitem>
+      <listitem><para><filename>libgda-capi-4.0.pc.in</filename>: file to be used by <command>pkg-config</command> to identify
+	  the provider, before being computed by the <command>configure</command> script.</para></listitem>
+      <listitem><para>other .xml.in files: DDL queries' parameters, before translation</para></listitem>
+    </itemizedlist>
+  </para>
+
+  <sect1>
+    <title>libmain.c</title>
+    <para>
+      Once the shared library implementing the provider is loaded (and
+      all the necessary dependencies are also loaded), &LIBGDA; tries to locate some functions to identify the provider (if any of
+      these function is missing, then the DLL is unloaded and the provider is not availaibe).
+    </para>
+    <para>
+      The skeleton implementations in <filename class="directory">providers/skel-implementation</filename> propose to implement those
+      functions in a <filename>libmain.c</filename> file. The functions are the following ones:
+    </para>
+    <sect2>
+      <title>plugin_init()</title>
+      <para>This function initializes the plugin; it has a single argument which is the path where the provider is.</para>
+    </sect2>
+    <sect2>
+      <title>plugin_get_name()</title>
+      <para>This funtion returns the name of the provider, it <emphasis>must</emphasis> return the same string as what the
+	<link linkend="prov-get-name">get_name()</link>'s provider's virtual method returns.</para>
+    </sect2>
+    <sect2>
+      <title>plugin_get_description()</title>
+      <para>This funtion returns a description of the provider.</para>
+    </sect2>
+    <sect2>
+      <title>plugin_get_dsn_spec()</title>
+      <para>This function returns a description of the parameters which have or can be set when opening a connection. This
+	description uses an XML syntax and is usually stored in a separate XML file (for easier translation).</para>
+      <para>Here is an example, when only one "DB_NAME" parameter is required:
+	<programlisting>
+&lt;?xml version="1.0"?&gt;
+&lt;data-set-spec&gt;
+  &lt;parameters&gt;
+    &lt;parameter id="DB_NAME" _name="Database name" _descr="The name of a database to use" gdatype="gchararray" nullok="FALSE"/&gt;
+  &lt;/parameters&gt;
+&lt;/data-set-spec&gt;
+	</programlisting>
+	Note that the the attributes which have a name starting with an underscore should be translated (see the
+	<filename>Makefile.am</filename> file for some example on ho this is done).
+      </para>
+    </sect2>
+    <sect2>
+      <title>plugin_create_provider()</title>
+      <para>This function actually instanciates a provider object and returns it.</para>
+    </sect2>
+  </sect1>
+
+</chapter>
+

Modified: branches/V4-branch/doc/C/tmpl/gda-blob-op.sgml
==============================================================================
--- branches/V4-branch/doc/C/tmpl/gda-blob-op.sgml	(original)
+++ branches/V4-branch/doc/C/tmpl/gda-blob-op.sgml	Thu Feb 14 18:20:30 2008
@@ -24,9 +24,14 @@
 </para>
 
 <para>
-Note that a <link linkend="GdaBlob">GdaBlob</link> value will often not contain any data (or only some part of the actual BLOB)
-and that it's up to the user to use the associated <link linkend="GdaBlobOp">GdaBlobOp</link> object to "load" the data into
-the container (into the actual process heap).
+  Note that a <link linkend="GdaBlob">GdaBlob</link> value will often not contain any data (or only some part of the actual BLOB)
+  and that it's up to the user to use the associated <link linkend="GdaBlobOp">GdaBlobOp</link> object to "load" the data into
+  the container (into the actual process heap).
+</para>
+
+<para>
+  See the <link linkend="libgda-provider-blobop">Virtual methods for Blob operations</link> section for more information
+  about how to implement the virtual methods when creating a database provider.
 </para>
 
 <!-- ##### SECTION See_Also ##### -->

Added: branches/V4-branch/doc/C/tmpl/gda-pmodel.sgml
==============================================================================
--- (empty file)
+++ branches/V4-branch/doc/C/tmpl/gda-pmodel.sgml	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,75 @@
+<!-- ##### SECTION Title ##### -->
+GdaPModel
+
+<!-- ##### SECTION Short_Description ##### -->
+Proposed base implementation for data models returned by the execution of a SELECT statement
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+  This data model implements the <link linkend="GdaDataModel">GdaDataModel</link> interface and is the proposed
+  base object when database providers implement a data model returned when a SELECT statement has been executed.
+</para>
+<para>
+  Specifically it offers the following features:
+  <itemizedlist>
+    <listitem><para>Manages its list of <link linkend="GdaColumn">GdaColumn</link> using the list exported by the prepared statement object (<link linkend="GdaPStmt">GdaPStmt</link>)</para></listitem>
+    <listitem><para>Allows random or cursor based access</para></listitem>
+    <listitem><para>Allows for efficient memory usage allowing the subclass to finely tune its memory usage</para></listitem>
+    <listitem><para>Will provide a generic mechanism for writable data models</para></listitem>
+  </itemizedlist>
+</para>
+<para>
+  See the <link linkend="libgda-provider-recordset">Virtual methods for recordsets</link> section for more information
+  about how to implement the virtual methods.
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT GdaPModel ##### -->
+<para>
+
+</para>
+
+ object: base object
+ priv: private data
+ prep_stmt: SELECT prepared statement for which the execution gave this object
+ advertized_nrows: initially set to -1, set to a value >= 0 when the number of rows in the data model is known
+
+<!-- ##### STRUCT GdaPModelClass ##### -->
+<para>
+
+</para>
+
+ parent_class: parent object class
+ fetch_nb_rows: virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_RANDOM
+ fetch_random: virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_RANDOM
+ fetch_next: virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD
+ fetch_prev: virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD
+ fetch_at: virtual method which can be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD or GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD
+
+<!-- ##### FUNCTION gda_pmodel_take_row ##### -->
+<para>
+
+</para>
+
+ model: 
+ row: 
+ rownum: 
+
+
+<!-- ##### FUNCTION gda_pmodel_get_stored_row ##### -->
+<para>
+
+</para>
+
+ model: 
+ rownum: 
+ Returns: 
+
+

Added: branches/V4-branch/doc/C/tmpl/gda-prow.sgml
==============================================================================
--- (empty file)
+++ branches/V4-branch/doc/C/tmpl/gda-prow.sgml	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,55 @@
+<!-- ##### SECTION Title ##### -->
+GdaPRow
+
+<!-- ##### SECTION Short_Description ##### -->
+A row within the <link linkend="GdaPModel">GdaPModel</link> data model
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT GdaPRow ##### -->
+<para>
+
+</para>
+
+ object: 
+ priv: 
+
+<!-- ##### FUNCTION gda_prow_new ##### -->
+<para>
+
+</para>
+
+ count: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_prow_get_length ##### -->
+<para>
+
+</para>
+
+ prow: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_prow_get_value ##### -->
+<para>
+
+</para>
+
+ prow: 
+ num: 
+ Returns: 
+
+

Added: branches/V4-branch/doc/C/tmpl/gda-pstmt.sgml
==============================================================================
--- (empty file)
+++ branches/V4-branch/doc/C/tmpl/gda-pstmt.sgml	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,40 @@
+<!-- ##### SECTION Title ##### -->
+GdaPStmt
+
+<!-- ##### SECTION Short_Description ##### -->
+Prepared statement base class
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT GdaPStmt ##### -->
+<para>
+
+</para>
+
+ object: base object
+ sql: actual SQL code used for this prepared statement, its memory is freed by the object itself
+ param_ids: list of parameters' IDs (as gchar *), the memory is freed by object itself
+ ncols: number of columns in the returned data model (if the prepared statement is a SELECT statement)
+ types: array of ncols types (if the prepared statement is a SELECT statement)
+ tmpl_columns: list of <link linkend="GdaColumn">GdaColumn</link> objects which data models created from this prepared statement can copy
+
+<!-- ##### FUNCTION gda_pstmt_copy_contents ##### -->
+<para>
+
+</para>
+
+ src: 
+ dest: 
+
+

Modified: branches/V4-branch/doc/C/tmpl/gda-server-provider.sgml
==============================================================================
--- branches/V4-branch/doc/C/tmpl/gda-server-provider.sgml	(original)
+++ branches/V4-branch/doc/C/tmpl/gda-server-provider.sgml	Thu Feb 14 18:20:30 2008
@@ -6,8 +6,12 @@
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
-The #GdaServerProvider class is a virtual class which all the DBMS providers
-must inherit, and implement its virtual mathods.
+  The #GdaServerProvider class is a virtual class which all the DBMS providers
+  must inherit, and implement its virtual mathods.
+</para>
+<para>
+  See the <link linkend="libgda-provider-class">Virtual methods for providers</link> section for more information
+  about how to implement the virtual methods.
 </para>
 
 <!-- ##### SECTION See_Also ##### -->
@@ -24,6 +28,41 @@
 </para>
 
 
+<!-- ##### STRUCT GdaServerProviderClass ##### -->
+<para>
+
+</para>
+
+ parent_class: 
+ last_connection_gone: 
+ get_name: 
+ get_version: 
+ get_server_version: 
+ supports_feature: 
+ get_data_handler: 
+ get_def_dbms_type: 
+ escape_string: 
+ unescape_string: 
+ open_connection: 
+ close_connection: 
+ get_database: 
+ supports_operation: 
+ create_operation: 
+ render_operation: 
+ perform_operation: 
+ begin_transaction: 
+ commit_transaction: 
+ rollback_transaction: 
+ add_savepoint: 
+ rollback_savepoint: 
+ delete_savepoint: 
+ create_parser: 
+ statement_to_sql: 
+ statement_prepare: 
+ statement_execute: 
+ create_connection: 
+ meta_funcs: 
+
 <!-- ##### ENUM GdaServerProviderError ##### -->
 <para>
 
@@ -36,6 +75,20 @@
 @GDA_SERVER_PROVIDER_OPERATION_ERROR: 
 @GDA_SERVER_PROVIDER_INTERNAL_ERROR: 
 
+<!-- ##### STRUCT GdaServerProviderMeta ##### -->
+<para>
+
+</para>
+
+ info: 
+ btypes: 
+ schemata: 
+ tables_views: 
+ tables_views_s: 
+ columns: 
+ columns_t: 
+ columns_c: 
+
 <!-- ##### FUNCTION gda_server_provider_get_name ##### -->
 <para>
 
@@ -97,17 +150,6 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_server_provider_change_database ##### -->
-<para>
-
-</para>
-
- provider: 
- cnc: 
- name: 
- Returns: 
-
-
 <!-- ##### FUNCTION gda_server_provider_supports_operation ##### -->
 <para>
 

Modified: branches/V4-branch/doc/C/tmpl/gda-virtual-connection.sgml
==============================================================================
--- branches/V4-branch/doc/C/tmpl/gda-virtual-connection.sgml	(original)
+++ branches/V4-branch/doc/C/tmpl/gda-virtual-connection.sgml	Thu Feb 14 18:20:30 2008
@@ -23,3 +23,22 @@
 </para>
 
 
+<!-- ##### FUNCTION gda_virtual_connection_internal_set_provider_data ##### -->
+<para>
+
+</para>
+
+ vcnc: 
+ data: 
+ destroy_func: 
+
+
+<!-- ##### FUNCTION gda_virtual_connection_internal_get_provider_data ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ Returns: 
+
+

Added: branches/V4-branch/doc/C/tmpl/provider-support.sgml
==============================================================================
--- (empty file)
+++ branches/V4-branch/doc/C/tmpl/provider-support.sgml	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,250 @@
+<!-- ##### SECTION Title ##### -->
+Misc API
+
+<!-- ##### SECTION Short_Description ##### -->
+Methods dedicated to implementing providers
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION gda_server_provider_internal_get_parser ##### -->
+<para>
+
+</para>
+
+ prov: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_server_provider_perform_operation_default ##### -->
+<para>
+
+</para>
+
+ provider: 
+ cnc: 
+ op: 
+ error: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_server_provider_get_data_handler_default ##### -->
+<para>
+
+</para>
+
+ provider: 
+ cnc: 
+ type: 
+ dbms_type: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_server_provider_handler_find ##### -->
+<para>
+
+</para>
+
+ prov: 
+ cnc: 
+ g_type: 
+ dbms_type: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_server_provider_handler_declare ##### -->
+<para>
+
+</para>
+
+ prov: 
+ dh: 
+ cnc: 
+ g_type: 
+ dbms_type: 
+
+
+<!-- ##### FUNCTION gda_server_provider_find_file ##### -->
+<para>
+
+</para>
+
+ prov: 
+ inst_dir: 
+ filename: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_server_provider_load_file_contents ##### -->
+<para>
+
+</para>
+
+ inst_dir: 
+ data_dir: 
+ filename: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_set_provider_data ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ data: 
+ destroy_func: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_get_provider_data ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_virtual_connection_internal_set_provider_data ##### -->
+<para>
+
+</para>
+
+ vcnc: 
+ data: 
+ destroy_func: 
+
+
+<!-- ##### FUNCTION gda_virtual_connection_internal_get_provider_data ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_connection_add_prepared_statement ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ gda_stmt: 
+ prepared_stmt: 
+
+
+<!-- ##### FUNCTION gda_connection_del_prepared_statement ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ gda_stmt: 
+
+
+<!-- ##### FUNCTION gda_connection_get_prepared_statement ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ gda_stmt: 
+ Returns: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_transaction_started ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ parent_trans: 
+ trans_name: 
+ isol_level: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_transaction_rolledback ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ trans_name: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_transaction_committed ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ trans_name: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_statement_executed ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ stmt: 
+ error: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_savepoint_added ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ parent_trans: 
+ svp_name: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_savepoint_rolledback ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ svp_name: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_savepoint_removed ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ svp_name: 
+
+
+<!-- ##### FUNCTION gda_connection_internal_change_transaction_state ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ newstate: 
+
+
+<!-- ##### FUNCTION gda_connection_get_meta_store ##### -->
+<para>
+
+</para>
+
+ cnc: 
+ Returns: 
+
+

Modified: branches/V4-branch/libgda/Makefile.am
==============================================================================
--- branches/V4-branch/libgda/Makefile.am	(original)
+++ branches/V4-branch/libgda/Makefile.am	Thu Feb 14 18:20:30 2008
@@ -15,8 +15,7 @@
 	$(LIBGDA_CFLAGS) \
 	$(FAM_CFLAGS) \
 	$(BDB_CFLAGS) \
-	$(GNOMEVFS_CFLAGS) \
-	$(LIBGCRYPT_CFLAGS)
+	$(GNOMEVFS_CFLAGS)
 
 gda_marshal_built_files = gda-marshal.h gda-marshal.c
 
@@ -116,7 +115,10 @@
 	gda-threader.c \
 	gda-transaction-status.c \
 	gda-util.c \
-	gda-value.c 
+	gda-value.c \
+	global.h \
+	md5.h \
+	md5c.c
 
 gda-enum-types.h: s-enum-types-h
 	@true
@@ -173,7 +175,7 @@
 	binreloc/libgda_binreloc-4.0.la \
 	sqlite/libgda-sqlite.la \
 	$(LIBGDA_LIBS) $(FAM_LIBS) \
-	$(BDB_LIBS) $(GNOMEVFS_LIBS) $(LIBGCRYPT_LIBS)
+	$(BDB_LIBS) $(GNOMEVFS_LIBS) 
 
 gdaincludedir=$(includedir)/libgda-$(GDA_ABI_MAJOR_VERSION).$(GDA_ABI_MINOR_VERSION)/libgda
 gdainclude_HEADERS=$(libgda_built_headers) $(gda_headers)

Modified: branches/V4-branch/libgda/gda-connection-private.h
==============================================================================
--- branches/V4-branch/libgda/gda-connection-private.h	(original)
+++ branches/V4-branch/libgda/gda-connection-private.h	Thu Feb 14 18:20:30 2008
@@ -41,7 +41,7 @@
 void gda_connection_internal_transaction_rolledback (GdaConnection *cnc, const gchar *trans_name);
 void gda_connection_internal_transaction_committed (GdaConnection *cnc, const gchar *trans_name);
 
-void gda_connection_internal_sql_executed (GdaConnection *cnc, const gchar *sql, GdaConnectionEvent *error);
+void gda_connection_internal_sql_executed (GdaConnection *cnc, const gchar *sql, GdaConnectionEvent *error); /* REMOVE */
 void gda_connection_internal_statement_executed (GdaConnection *cnc, GdaStatement *stmt, GdaConnectionEvent *error);
 
 void gda_connection_internal_savepoint_added (GdaConnection *cnc, const gchar *parent_trans, const gchar *svp_name);

Modified: branches/V4-branch/libgda/gda-connection.c
==============================================================================
--- branches/V4-branch/libgda/gda-connection.c	(original)
+++ branches/V4-branch/libgda/gda-connection.c	Thu Feb 14 18:20:30 2008
@@ -144,7 +144,7 @@
         gda_connection_signals[CONN_CLOSED] =    /* runs after user handlers */
                 g_signal_new ("conn_closed",
                               G_TYPE_FROM_CLASS (object_class),
-                              G_SIGNAL_RUN_FIRST,
+                              G_SIGNAL_RUN_LAST,
                               G_STRUCT_OFFSET (GdaConnectionClass, conn_closed),
                               NULL, NULL,
                               gda_marshal_VOID__VOID,
@@ -258,14 +258,6 @@
 		cnc->priv->trans_status = NULL;
 	}
 
-	if (cnc->priv->provider_data) {
-		if (cnc->priv->provider_data_destroy_func)
-			cnc->priv->provider_data_destroy_func (cnc->priv->provider_data);
-		else
-			g_warning ("Provider did not clean its connection data");
-		cnc->priv->provider_data = NULL;
-	}
-
 	/* chain to parent class */
 	parent_class->dispose (object);
 }
@@ -648,6 +640,14 @@
 	gda_client_notify_connection_closed_event (cnc->priv->client, cnc);
 	cnc->priv->is_open = FALSE;
 
+	if (cnc->priv->provider_data) {
+		if (cnc->priv->provider_data_destroy_func)
+			cnc->priv->provider_data_destroy_func (cnc->priv->provider_data);
+		else
+			g_warning ("Provider did not clean its connection data");
+		cnc->priv->provider_data = NULL;
+	}
+
 #ifdef GDA_DEBUG_signal
         g_print (">> 'CONN_CLOSED' from %s\n", __FUNCTION__);
 #endif
@@ -1203,7 +1203,7 @@
  */
 static GObject *
 gda_connection_statement_execute_v (GdaConnection *cnc, GdaStatement *stmt, GdaSet *params, 
-				    GdaStatementModelUsage model_usage, GdaSet **last_insert_row, GError **error, ...)
+				    GdaStatementModelUsage model_usage, GdaSet **last_inserted_row, GError **error, ...)
 {
 	va_list ap;
 	GObject *obj;
@@ -1211,10 +1211,13 @@
 	va_start (ap, error);
 	types = make_col_types_array (10, ap);
 	va_end (ap);
+
+	if (last_inserted_row) 
+		*last_inserted_row = NULL;
 	obj = PROV_CLASS (cnc->priv->provider_obj)->statement_execute (cnc->priv->provider_obj, 
 								       cnc, stmt, params, 
 								       model_usage, 
-								       types, last_insert_row, error);
+								       types, last_inserted_row, error);
 	g_free (types);
 	return obj;
 }
@@ -1249,20 +1252,18 @@
  */
 GObject *
 gda_connection_statement_execute (GdaConnection *cnc, GdaStatement *stmt, GdaSet *params, 
-				  GdaStatementModelUsage model_usage, GdaSet **last_insert_row, GError **error)
+				  GdaStatementModelUsage model_usage, GdaSet **last_inserted_row, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
 	g_return_val_if_fail (cnc->priv, NULL);
 	g_return_val_if_fail (cnc->priv->provider_obj, NULL);
 	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL);
+	g_return_val_if_fail (PROV_CLASS (cnc->priv->provider_obj)->statement_execute, NULL);
 
-	if (PROV_CLASS (cnc->priv->provider_obj)->statement_execute)
-		return gda_connection_statement_execute_v (cnc, stmt, params, model_usage, last_insert_row, error, -1);
-	else {
-		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
-			     _("Provider does not support statement execution"));
-		return NULL;
-	}
+	if (last_inserted_row) 
+		*last_inserted_row = NULL;
+
+	return gda_connection_statement_execute_v (cnc, stmt, params, model_usage, last_inserted_row, error, -1);
 }
 
 
@@ -1299,6 +1300,7 @@
 	g_return_val_if_fail (cnc->priv, -1);
 	g_return_val_if_fail (cnc->priv->provider_obj, -1);
 	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), -1);
+	g_return_val_if_fail (PROV_CLASS (cnc->priv->provider_obj)->statement_execute, -1);
 
 	if ((gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_SELECT) ||
 	    (gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_COMPOUND)) {
@@ -1310,18 +1312,11 @@
 	if (last_insert_row)
 		*last_insert_row = NULL;
 
-	if (PROV_CLASS (cnc->priv->provider_obj)->statement_execute) {
-		set = (GdaSet *) gda_connection_statement_execute_v (cnc, stmt, params, 
-								     GDA_STATEMENT_MODEL_RANDOM_ACCESS, last_insert_row, 
-								     error, -1);
-		if (!set)
-			return -1;
-	}
-	else {
-		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
-			     _("Provider does not support statement execution"));
+	set = (GdaSet *) gda_connection_statement_execute_v (cnc, stmt, params, 
+							     GDA_STATEMENT_MODEL_RANDOM_ACCESS, last_insert_row, 
+							     error, -1);
+	if (!set)
 		return -1;
-	}
 	
 	if (!GDA_IS_SET (set)) {
 		g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_STATEMENT_TYPE_ERROR,
@@ -1370,29 +1365,24 @@
 gda_connection_statement_execute_select (GdaConnection *cnc, GdaStatement *stmt,
 					 GdaSet *params, GError **error)
 {
+	GdaDataModel *model;
+
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
 	g_return_val_if_fail (cnc->priv, NULL);
 	g_return_val_if_fail (cnc->priv->provider_obj, NULL);
 	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL);
+	g_return_val_if_fail (PROV_CLASS (cnc->priv->provider_obj)->statement_execute, NULL);
 
-	if (PROV_CLASS (cnc->priv->provider_obj)->statement_execute) {
-		GdaDataModel *model;
-		model = (GdaDataModel *) gda_connection_statement_execute_v (cnc, stmt, params, 
-									     GDA_STATEMENT_MODEL_RANDOM_ACCESS, NULL,
-									     error, -1);
-		if (model && !GDA_IS_DATA_MODEL (model)) {
-			g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_STATEMENT_TYPE_ERROR,
-				     _("Statement is not a selection statement"));
-			g_object_unref (model);
-			model = NULL;
-		}
-		return model;
-	}
-	else {
-		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
-			     _("Provider does not support statement execution"));
-		return NULL;
+	model = (GdaDataModel *) gda_connection_statement_execute_v (cnc, stmt, params, 
+								     GDA_STATEMENT_MODEL_RANDOM_ACCESS, NULL,
+								     error, -1);
+	if (model && !GDA_IS_DATA_MODEL (model)) {
+		g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_STATEMENT_TYPE_ERROR,
+			     _("Statement is not a selection statement"));
+		g_object_unref (model);
+		model = NULL;
 	}
+	return model;
 }
 
 /**
@@ -1428,33 +1418,27 @@
 	g_return_val_if_fail (cnc->priv, NULL);
 	g_return_val_if_fail (cnc->priv->provider_obj, NULL);
 	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL);
+	g_return_val_if_fail (PROV_CLASS (cnc->priv->provider_obj)->statement_execute, NULL);
 
-	if (PROV_CLASS (cnc->priv->provider_obj)->statement_execute) {
-		va_list ap;
-		GdaDataModel *model;
-		GType *types;
-
-		va_start (ap, error);
-		types = make_col_types_array (10, ap);
-		va_end (ap);
-		model = (GdaDataModel *) PROV_CLASS (cnc->priv->provider_obj)->statement_execute (cnc->priv->provider_obj, 
-												  cnc, stmt, params, 
-												  model_usage, 
-												  types, NULL, error);
-		g_free (types);
-		if (model && !GDA_IS_DATA_MODEL (model)) {
-			g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_STATEMENT_TYPE_ERROR,
-				     _("Statement is not a selection statement"));
-			g_object_unref (model);
-			model = NULL;
-		}
-		return model;
-	}
-	else {
-		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
-			     _("Provider does not support statement execution"));
-		return NULL;
+	va_list ap;
+	GdaDataModel *model;
+	GType *types;
+	
+	va_start (ap, error);
+	types = make_col_types_array (10, ap);
+	va_end (ap);
+	model = (GdaDataModel *) PROV_CLASS (cnc->priv->provider_obj)->statement_execute (cnc->priv->provider_obj, 
+											  cnc, stmt, params, 
+											  model_usage, 
+											  types, NULL, error);
+	g_free (types);
+	if (model && !GDA_IS_DATA_MODEL (model)) {
+		g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_STATEMENT_TYPE_ERROR,
+			     _("Statement is not a selection statement"));
+		g_object_unref (model);
+		model = NULL;
 	}
+	return model;
 }
 
 /**
@@ -1487,30 +1471,25 @@
 					      GdaSet *params, GdaStatementModelUsage model_usage,
 					      GType *col_types, GError **error)
 {
+	GdaDataModel *model;
+
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
 	g_return_val_if_fail (cnc->priv, NULL);
 	g_return_val_if_fail (cnc->priv->provider_obj, NULL);
 	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL);
+	g_return_val_if_fail (PROV_CLASS (cnc->priv->provider_obj)->statement_execute, NULL);
 
-	if (PROV_CLASS (cnc->priv->provider_obj)->statement_execute) {
-		GdaDataModel *model;
-		model = (GdaDataModel *) PROV_CLASS (cnc->priv->provider_obj)->statement_execute (cnc->priv->provider_obj, 
-												  cnc, stmt, params, 
-												  model_usage, 
-												  col_types, NULL, error);
-		if (model && !GDA_IS_DATA_MODEL (model)) {
-			g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_STATEMENT_TYPE_ERROR,
-				     _("Statement is not a selection statement"));
-			g_object_unref (model);
-			model = NULL;
-		}
-		return model;
-	}
-	else {
-		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
-			     _("Provider does not support statement execution"));
-		return NULL;
+	model = (GdaDataModel *) PROV_CLASS (cnc->priv->provider_obj)->statement_execute (cnc->priv->provider_obj, 
+											  cnc, stmt, params, 
+											  model_usage, 
+											  col_types, NULL, error);
+	if (model && !GDA_IS_DATA_MODEL (model)) {
+		g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_STATEMENT_TYPE_ERROR,
+			     _("Statement is not a selection statement"));
+		g_object_unref (model);
+		model = NULL;
 	}
+	return model;
 }
 
 /**
@@ -1525,7 +1504,7 @@
  *
  * Before starting a transaction, you can check whether the underlying
  * provider does support transactions or not by using the
- * #gda_connection_supports_feature() function.
+ * gda_connection_supports_feature() function.
  *
  * Returns: %TRUE if the transaction was started successfully, %FALSE
  * otherwise.
@@ -1703,6 +1682,210 @@
 	return gda_server_provider_supports_feature (cnc->priv->provider_obj, cnc, feature);
 }
 
+/*
+ *
+ */
+static gint
+check_parameters (GdaMetaContext *context, GError **error, gint nb, ...)
+{
+#define MAX_PARAMS 10
+	gint i;
+	va_list ap;
+	gint retval = -1;
+	GValue **pvalue;
+	struct {
+		GValue **pvalue;
+		GType    type;
+	} spec_array [MAX_PARAMS];
+	gint nb_params = 0;
+
+	va_start (ap, nb);
+	/* make a list of all the GValue pointers */
+	for (pvalue = va_arg (ap, GValue **); pvalue; pvalue = va_arg (ap, GValue **), nb_params++) {
+		g_assert (nb_params < MAX_PARAMS); /* hard limit, recompile to change it (should never be needed) */
+		spec_array[nb_params].pvalue = pvalue;
+		spec_array[nb_params].type = va_arg (ap, GType);
+	}
+
+	/* test against each test case */
+	for (i = 0; i < nb; i++) {
+		gchar *pname;
+		gboolean allfound = TRUE;
+		gint j;
+		for (j = 0; j < nb_params; j++)
+			*(spec_array[j].pvalue) = NULL;
+
+		for (pname = va_arg (ap, gchar*); pname; pname = va_arg (ap, gchar*)) {
+			gint j;
+			pvalue = va_arg (ap, GValue **);
+			*pvalue = NULL;
+			for (j = 0; allfound && (j < context->size); j++) {
+				if (!strcmp (context->column_names[j], pname)) {
+					*pvalue = context->column_values[j];
+					break;
+				}
+			}
+			if (j == context->size)
+				allfound = FALSE;
+		}
+		if (allfound) {
+			retval = i;
+			break;
+		}
+	}
+	va_end (ap);
+
+	if (retval >= 0) {
+		gint j;
+		for (j = 0; j < nb_params; j++) {
+			GValue *v = *(spec_array[j].pvalue);
+			if (v && (gda_value_is_null (v) || (G_VALUE_TYPE (v) != spec_array[j].type))) {
+				g_set_error (error, 0, 0,
+					     _("Invalid argument"));
+				retval = -1;
+			}
+		}
+	}
+	else 
+		g_set_error (error, 0, 0,
+			     _("Missing and/or wrong arguments"));
+
+	g_print ("Check context => %d\n", retval);
+	return retval;
+}
+
+static gboolean
+local_meta_update (GdaServerProvider *provider, GdaConnection *cnc, GdaMetaContext *context, GError **error)
+{
+#ifdef GDA_DEBUG
+#define ASSERT_TABLE_NAME(x,y) g_assert (!strcmp ((x), (y)));
+#else
+#define ASSERT_TABLE_NAME(x,y)
+#endif
+	const gchar *tname = context->table_name;
+	GdaMetaStore *store;
+
+	if (*tname != '_')
+		return TRUE;
+	tname ++;
+	
+	store = gda_connection_get_meta_store (cnc);
+	switch (*tname) {
+	case 'i':
+		/* _information_schema_catalog_name, params: 
+		 *  - none
+		 */
+		ASSERT_TABLE_NAME (tname, "information_schema_catalog_name")
+		if (!PROV_CLASS (provider)->meta_funcs.info)
+			break;
+		return PROV_CLASS (provider)->meta_funcs.info (provider, cnc, store, context, error);
+
+	case 's': {
+		/* _schemata, params: 
+		 *  - none
+		 *  - @schema_name
+		 */
+		GValue *p_schema_name = NULL;
+		if (check_parameters (context, error, 2,
+				      &p_schema_name, G_TYPE_STRING, NULL,
+				      "schema_name", &p_schema_name, NULL,
+				      NULL) < 0)
+			return FALSE;
+		ASSERT_TABLE_NAME (tname, "schemata")
+		if (!PROV_CLASS (provider)->meta_funcs.schemata)
+			break;
+		return PROV_CLASS (provider)->meta_funcs.schemata (provider, cnc, store, context, error, p_schema_name);
+	}
+	case 't': 
+		if ((tname[1] == 'a') && (tname[2] == 'b') && (tname[3] == 'l') && (tname[4] == 'e') && (tname[5] == 's')) {
+			/* _tables, params: 
+			 *  - none
+			 *  - @table_schema
+			 *  - @table_schema AND @table_name
+			 */
+			const GValue *p_table_schema = NULL;
+			const GValue *p_table_name = NULL;
+			if (check_parameters (context, error, 3,
+					      &p_table_schema, G_TYPE_STRING,
+					      &p_table_name, G_TYPE_STRING, NULL,
+					      "table_schema", &p_table_schema, "table_name", &p_table_name, NULL,
+					      "table_schema", &p_table_schema, NULL,
+					      NULL) < 0)
+				return FALSE;
+			
+			ASSERT_TABLE_NAME (tname, "tables")
+				if (p_table_schema) {
+					if (!PROV_CLASS (provider)->meta_funcs.tables_views_s)
+						break;
+					return PROV_CLASS (provider)->meta_funcs.tables_views_s (provider, cnc, store, context, error, 
+												 p_table_schema, p_table_name);
+				}
+				else {
+					if (!PROV_CLASS (provider)->meta_funcs.tables_views)
+						break;
+					return PROV_CLASS (provider)->meta_funcs.tables_views (provider, cnc, store, context, error);
+				}
+		}
+		break;
+
+	case 'c': 
+		if ((tname[1] == 'o') && (tname[2] == 'l') && (tname[2] == 'u')) {
+			/* _columns,  params: 
+			 *  - none
+			 *  - @table_schema AND @table_name
+			 *  - @table_schema AND @table_name AND @column_name
+			 */
+			const GValue *p_table_schema = NULL;
+			const GValue *p_table_name = NULL;
+			const GValue *p_column_name = NULL;
+			
+			if (check_parameters (context, error, 3,
+					      &p_table_schema, G_TYPE_STRING,
+					      &p_table_name, G_TYPE_STRING,
+					      &p_column_name, G_TYPE_STRING, NULL,
+					      "table_schema", &p_table_schema, "table_name", &p_table_name, "column_name", &p_column_name, NULL,
+					      "table_schema", &p_table_schema, "table_name", &p_table_name, NULL,
+					      NULL) < 0)
+				return FALSE;
+			
+			ASSERT_TABLE_NAME (tname, "columns")
+			if (p_table_schema) {
+				if (p_column_name) {
+					if (!PROV_CLASS (provider)->meta_funcs.columns_c)
+						return FALSE;
+					return PROV_CLASS (provider)->meta_funcs.columns_c (provider, cnc, store, context, error, 
+											    p_table_schema, p_table_name, p_column_name);
+				}
+				else {
+					if (!PROV_CLASS (provider)->meta_funcs.columns_t)
+						return FALSE;
+					return PROV_CLASS (provider)->meta_funcs.columns_t (provider, cnc, store, context, error, 
+											    p_table_schema, p_table_name);
+				}
+			}
+			else {
+				if (!PROV_CLASS (provider)->meta_funcs.columns)
+					return FALSE;
+				return PROV_CLASS (provider)->meta_funcs.columns (provider, cnc, store, context, error);
+			}
+		}
+		break;
+	
+	case 'b': {
+		/* _builtin_data_types, params: 
+		 *  - none
+		 */
+		ASSERT_TABLE_NAME (tname, "builtin_data_types")
+		if (!PROV_CLASS (provider)->meta_funcs.btypes)
+			break;
+		return PROV_CLASS (provider)->meta_funcs.btypes (provider, cnc, store, context, error);
+	}
+	default:
+		break;
+	}
+	return TRUE;
+}
+
 typedef struct {
 	GdaServerProvider  *prov;
 	GdaConnection      *cnc;
@@ -1715,7 +1898,7 @@
 {
 	if (data->error_set)
 		return;
-	if (!PROV_CLASS (data->prov)->meta_update (data->prov, data->cnc, suggest, data->error)) 
+	if (!local_meta_update (data->prov, data->cnc, suggest, data->error))
 		data->error_set = TRUE;
 }
 
@@ -1739,12 +1922,6 @@
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
 	g_return_val_if_fail (cnc->priv->provider_obj, FALSE);
 
-	if (!(PROV_CLASS (cnc->priv->provider_obj)->meta_update)) {
-		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
-			     _("Provider does not report meta data"));
-		return FALSE;
-	}
-
 	/* Get or create the GdaMetaStore object */
 	store = gda_connection_get_meta_store (cnc);
 	g_assert (store);
@@ -1757,8 +1934,7 @@
 			GdaMetaContext lcontext;
 			memset (&lcontext, 0, sizeof (GdaMetaContext));
 			lcontext.table_name = (gchar *) list->data;
-			if (! PROV_CLASS (cnc->priv->provider_obj)->meta_update (cnc->priv->provider_obj, 
-										 cnc, &lcontext, error)) {
+			if (!local_meta_update (cnc->priv->provider_obj, cnc, &lcontext, error)) {
 				retval = FALSE;
 				break;
 			}
@@ -1786,7 +1962,7 @@
 		signal_id = g_signal_connect (store, "suggest_update",
 					      G_CALLBACK (suggest_update_cb_detailled), &cbd);
 		
-		retval = PROV_CLASS (cnc->priv->provider_obj)->meta_update (cnc->priv->provider_obj, cnc, &lcontext, error);
+		retval = local_meta_update (cnc->priv->provider_obj, cnc, &lcontext, error);
 		
 		g_signal_handler_disconnect (store, signal_id);
 		if (cbd.error_set)
@@ -1972,12 +2148,6 @@
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
 	g_return_val_if_fail (cnc->priv->provider_obj, NULL);
 
-	if (!(PROV_CLASS (cnc->priv->provider_obj)->meta_update)) {
-		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
-			     _("Provider does not report meta data"));
-		return NULL;
-	}
-
 	/* Get or create the GdaMetaStore object */
 	store = gda_connection_get_meta_store (cnc);
 	g_assert (store);
@@ -2420,6 +2590,7 @@
 gpointer
 gda_connection_internal_get_provider_data (GdaConnection *cnc)
 {
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
 	if (! cnc->priv->provider_data)
 		gda_connection_add_event_string (cnc, _("Internal error: invalid provider handle"));
 	return cnc->priv->provider_data;

Modified: branches/V4-branch/libgda/gda-data-model-bdb.c
==============================================================================
--- branches/V4-branch/libgda/gda-data-model-bdb.c	(original)
+++ branches/V4-branch/libgda/gda-data-model-bdb.c	Thu Feb 14 18:20:30 2008
@@ -207,7 +207,6 @@
 	GError *error = NULL;
 
         g_set_error (&error, 0, 0, err);
-	g_print ("ADD_ERROR (%s)\n", err);
         model->priv->errors = g_slist_append (model->priv->errors, error);
 }
 
@@ -430,6 +429,43 @@
 	return model;
 }
 
+/**
+ * gda_data_model_bdb_get_errors
+ * @model: a #GdaDataModelBdb object
+ *
+ * Get the list of errors which have occurred while using @model
+ *
+ * Returns: a read-only list of #GError pointers, or %NULL if no error has occurred
+ */
+const GSList *
+gda_data_model_bdb_get_errors (GdaDataModelBdb *model)
+{
+	g_return_val_if_fail (GDA_IS_DATA_MODEL_BDB (model), NULL);
+	g_return_val_if_fail (model->priv, NULL);
+
+	return model->priv->errors;
+}
+
+/**
+ * gda_data_model_bdb_clean_errors
+ * @model: a #GdaDataModelBdb object
+ *
+ * Reset the list of errors which have occurred while using @model
+ */
+void
+gda_data_model_bdb_clean_errors (GdaDataModelBdb *model)
+{
+	g_return_if_fail (GDA_IS_DATA_MODEL_BDB (model));
+	g_return_if_fail (model->priv);
+
+	if (model->priv->errors) {
+		g_slist_foreach (model->priv->errors, (GFunc) g_error_free, NULL);
+		g_slist_free (model->priv->errors);
+		model->priv->errors = NULL;
+	}
+}
+
+
 static gint
 gda_data_model_bdb_get_n_rows (GdaDataModel *model)
 {

Modified: branches/V4-branch/libgda/gda-data-model-bdb.h
==============================================================================
--- branches/V4-branch/libgda/gda-data-model-bdb.h	(original)
+++ branches/V4-branch/libgda/gda-data-model-bdb.h	Thu Feb 14 18:20:30 2008
@@ -64,7 +64,7 @@
 GType         gda_data_model_bdb_get_type     (void) G_GNUC_CONST;
 GdaDataModel *gda_data_model_bdb_new          (const gchar *filename, const gchar *db_name);
 
-GSList       *gda_data_model_bdb_get_errors   (GdaDataModelBdb *model);
+const GSList *gda_data_model_bdb_get_errors   (GdaDataModelBdb *model);
 void          gda_data_model_bdb_clean_errors (GdaDataModelBdb *model);
 G_END_DECLS
 

Modified: branches/V4-branch/libgda/gda-data-model-dir.c
==============================================================================
--- branches/V4-branch/libgda/gda-data-model-dir.c	(original)
+++ branches/V4-branch/libgda/gda-data-model-dir.c	Thu Feb 14 18:20:30 2008
@@ -31,9 +31,9 @@
 #include <libgnomevfs/gnome-vfs-mime.h>
 #endif
 
-#ifdef HAVE_LIBGCRYPT
-#include <gcrypt.h>
-#endif
+/* Use the RSA reference implementation included in the RFC-1321, http://www.freesoft.org/CIE/RFC/1321/ */
+#include "global.h"
+#include "md5.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -242,7 +242,6 @@
 	GError *error = NULL;
 
         g_set_error (&error, 0, 0, err);
-	g_print ("ADD_ERROR (%s)\n", err);
         model->priv->errors = g_slist_append (model->priv->errors, error);
 }
 
@@ -482,14 +481,10 @@
 {
 	gboolean changed = TRUE;
 	GValue *value = NULL;
-
-	/* compute md5sum value */
-#ifdef HAVE_LIBGCRYPT
-	gcry_md_hd_t mdctx = NULL;
 	int fd;
-	gpointer map;
-	guint length;
-		
+        gpointer map;
+        guint length;
+
 	/* file mapping in mem */
 	length = g_value_get_uint (row->size_value);
 	if (length == 0)
@@ -516,25 +511,23 @@
 		goto md5end;
 	}
 #endif /* !G_OS_WIN32 */
+
 	/* MD5 computation */
-	gcry_md_open (&mdctx, GCRY_MD_MD5, 0);
-	if (mdctx) {
-		unsigned char *md5str;
-		int i;
-		GString *md5pass;
-			
-		gcry_md_write (mdctx, map, length);
-		md5str = gcry_md_read (mdctx, GCRY_MD_MD5);
-			
-		md5pass = g_string_new ("");
-		for (i = 0; i < 16; i++)
-			g_string_append_printf (md5pass, "%02x", md5str[i]);
-		value = gda_value_new (G_TYPE_STRING);
-		g_value_take_string (value, md5pass->str);
-		g_string_free (md5pass, FALSE);
-			
-		gcry_md_close (mdctx);	
-	}
+	MD5_CTX context;
+	unsigned char digest[16];
+	GString *md5str;
+	gint i;
+
+	MD5Init (&context);
+	MD5Update (&context, map, length);
+	MD5Final (digest, &context);
+	
+	md5str = g_string_new ("");
+	for (i = 0; i < 16; i++)
+		g_string_append_printf (md5str, "%02x", digest[i]);
+	value = gda_value_new (G_TYPE_STRING);
+	g_value_take_string (value, md5str->str);
+	g_string_free (md5str, FALSE);
 		
 #ifndef G_OS_WIN32
 	munmap (map, length);
@@ -542,7 +535,7 @@
 	UnmapViewOfFile (map);
 #endif /* !G_OS_WIN32 */
 	close (fd);
-#endif /* HAVE_LIBGCRYPT */
+
  md5end:
 	if (value) {
 		if (row->md5sum_value && (G_VALUE_TYPE (row->md5sum_value) == G_TYPE_STRING)
@@ -665,6 +658,42 @@
 	return model;
 }
 
+/**
+ * gda_data_model_dir_get_errors
+ * @model: a #GdaDataModelDir object
+ *
+ * Get the list of errors which have occurred while using @model
+ *
+ * Returns: a read-only list of #GError pointers, or %NULL if no error has occurred
+ */
+const GSList *
+gda_data_model_dir_get_errors (GdaDataModelDir *model)
+{
+	g_return_val_if_fail (GDA_IS_DATA_MODEL_DIR (model), NULL);
+	g_return_val_if_fail (model->priv, NULL);
+
+	return model->priv->errors;
+}
+
+/**
+ * gda_data_model_dir_clean_errors
+ * @model: a #GdaDataModelDir object
+ *
+ * Reset the list of errors which have occurred while using @model
+ */
+void
+gda_data_model_dir_clean_errors (GdaDataModelDir *model)
+{
+	g_return_if_fail (GDA_IS_DATA_MODEL_DIR (model));
+	g_return_if_fail (model->priv);
+
+	if (model->priv->errors) {
+		g_slist_foreach (model->priv->errors, (GFunc) g_error_free, NULL);
+		g_slist_free (model->priv->errors);
+		model->priv->errors = NULL;
+	}
+}
+
 static gint
 gda_data_model_dir_get_n_rows (GdaDataModel *model)
 {

Modified: branches/V4-branch/libgda/gda-data-model-dir.h
==============================================================================
--- branches/V4-branch/libgda/gda-data-model-dir.h	(original)
+++ branches/V4-branch/libgda/gda-data-model-dir.h	Thu Feb 14 18:20:30 2008
@@ -49,7 +49,7 @@
 GType         gda_data_model_dir_get_type     (void) G_GNUC_CONST;
 GdaDataModel *gda_data_model_dir_new          (const gchar *basedir);
 
-GSList       *gda_data_model_dir_get_errors   (GdaDataModelDir *model);
+const GSList *gda_data_model_dir_get_errors   (GdaDataModelDir *model);
 void          gda_data_model_dir_clean_errors (GdaDataModelDir *model);
 G_END_DECLS
 

Modified: branches/V4-branch/libgda/gda-data-model-import.c
==============================================================================
--- branches/V4-branch/libgda/gda-data-model-import.c	(original)
+++ branches/V4-branch/libgda/gda-data-model-import.c	Thu Feb 14 18:20:30 2008
@@ -1125,10 +1125,8 @@
 		node = xmlTextReaderCurrentNode (reader);
 		
 		prop = (gchar*)xmlGetProp (node, (xmlChar*)"id");
-		if (prop) {
-			g_warning ("TO REMOVE: the 'id' property is not used anymore");
-			xmlFree (prop);
-		}
+		if (prop) 
+			g_object_set_data_full (G_OBJECT (model), "id", prop, xmlFree);
 		prop = (gchar*)xmlGetProp (node, (xmlChar*)"name");
 		if (prop) 
 			g_object_set_data_full (G_OBJECT (model), "name", prop, xmlFree);
@@ -1550,10 +1548,8 @@
 	ramodel = gda_data_model_array_new (nbfields);
 	model->priv->random_access_model = ramodel;
 	str = (gchar*)xmlGetProp (node, (xmlChar*)"id");
-	if (str) {
-		g_warning ("TO REMOVE: the 'id' property is not used anymore");
-		xmlFree (str);
-	}
+	if (str) 
+		g_object_set_data_full (G_OBJECT (model), "id", str, xmlFree);
 	str = (gchar*)xmlGetProp (node, (xmlChar*)"name");
 	if (str) 
 		g_object_set_data_full (G_OBJECT (model), "name", str, xmlFree);

Modified: branches/V4-branch/libgda/gda-data-proxy.c
==============================================================================
--- branches/V4-branch/libgda/gda-data-proxy.c	(original)
+++ branches/V4-branch/libgda/gda-data-proxy.c	Thu Feb 14 18:20:30 2008
@@ -22,6 +22,7 @@
 #include <glib/gi18n-lib.h>
 #include "gda-data-proxy.h"
 #include "gda-data-model.h"
+#include "gda-data-model-array.h"
 #include "gda-data-model-extra.h"
 #include "gda-data-model-iter.h"
 #include "gda-data-model-query.h"
@@ -78,7 +79,7 @@
 static void                 gda_data_proxy_send_hint       (GdaDataModel *model, GdaDataModelHint hint, 
 							    const GValue *hint_value);
 #define DEBUG_SYNC
-#undef DEBUG_SYNC
+/*#undef DEBUG_SYNC*/
 
 /* get a pointer to the parents to be able to call their destructor */
 static GObjectClass  *parent_class = NULL;
@@ -2287,7 +2288,6 @@
 #define IDLE_STEP 50
 
 	gboolean finished = FALSE;
-	gboolean has_changed = FALSE;
 	gint index;
 	gint step, max_steps;
 	GdaDataModelIter *iter = NULL;
@@ -2324,9 +2324,6 @@
 	display_chunks_dump (proxy);
 #endif
 
-	/* disable the emision of the "changed" signal each time a "row_*" signal is
-	 * emitted, and instead send that signal only once at the end */
-	gda_data_model_freeze (GDA_DATA_MODEL (proxy));
 	for (index = proxy->priv->chunk_sep, step = 0; 
 	     step < max_steps && !finished; 
 	     step++) {
@@ -2371,10 +2368,10 @@
 
 			if (cur_row != repl_row) 
 				if (proxy->priv->notify_changes) {
-					gda_data_model_row_updated ((GdaDataModel *) proxy, index + signal_row_offset);
 #ifdef DEBUG_SYNC
 					g_print ("Signal: Update row %d\n", index + signal_row_offset);
 #endif
+					gda_data_model_row_updated ((GdaDataModel *) proxy, index + signal_row_offset);
 				}
 			index++;
 		}
@@ -2384,10 +2381,10 @@
 				g_array_remove_index (proxy->priv->chunk->mapping, index);
 			proxy->priv->chunk_proxy_nb_rows--;
 			if (proxy->priv->notify_changes) {
-				gda_data_model_row_removed ((GdaDataModel *) proxy, index + signal_row_offset);
 #ifdef DEBUG_SYNC
 				g_print ("Signal: Remove row %d\n", index + signal_row_offset);
 #endif
+				gda_data_model_row_removed ((GdaDataModel *) proxy, index + signal_row_offset);
 			}
 		}
 		else if ((cur_row < 0) && (repl_row >= 0)) {
@@ -2410,12 +2407,6 @@
 	if (iter)
 		g_object_unref (iter);
 		
-	/* re-enable the emision of the "changed" signal each time a "row_*" signal is
-	 * emitted */
-	gda_data_model_thaw (GDA_DATA_MODEL (proxy));
-	if (has_changed)
-		gda_data_model_signal_emit_changed ((GdaDataModel *) proxy);
-
 	if (finished) {
 		if (proxy->priv->chunk_sync_idle_id) {
 			g_idle_remove_by_data (proxy);
@@ -2825,9 +2816,9 @@
 		sql = g_strdup_printf ("SELECT __gda_row_nb FROM proxy WHERE %s", filter_expr);
 	g_free (tmp);
 
-	stmt = gda_sql_parser_parse_string (internal_parser, sql, NULL, NULL);
+	stmt = gda_sql_parser_parse_string (internal_parser, sql, &ptr, NULL);
 	g_free (sql);
-	if (!stmt || (gda_statement_get_statement_type (stmt) != GDA_SQL_STATEMENT_SELECT)) {
+	if (ptr || !stmt || (gda_statement_get_statement_type (stmt) != GDA_SQL_STATEMENT_SELECT)) {
 		/* also catches problems with multiple statements in @filter_expr, such as SQL code injection */
 		g_set_error (error, GDA_DATA_PROXY_ERROR, GDA_DATA_PROXY_FILTER_ERROR,
 			     _("Incorrect filter expression"));
@@ -2852,21 +2843,28 @@
 	}
 	g_object_unref (wrapper);
 	
-	
 	/* execute statement */
 	filtered_rows = gda_connection_statement_execute_select (vcnc, stmt, NULL, NULL);
 	g_object_unref (stmt);
-
-	/* remove virtual table */
-	g_assert (gda_vconnection_data_model_remove (GDA_VCONNECTION_DATA_MODEL (vcnc), "proxy", NULL));
-	if (!filtered_rows) {
+     	if (!filtered_rows) {
 		g_set_error (error, GDA_DATA_PROXY_ERROR, GDA_DATA_PROXY_FILTER_ERROR,
 			     _("Error in filter expression"));
 		proxy->priv->force_direct_mapping = FALSE;
 		return FALSE;
 	}
-	/*gda_data_model_dump (filtered_rows, stdout);*/
 
+	/* copy filtered_rows and remove virtual table */
+	GdaDataModel *copy;
+	copy = gda_data_model_array_copy_model (filtered_rows, NULL);
+	g_object_unref (filtered_rows);
+	gda_vconnection_data_model_remove (GDA_VCONNECTION_DATA_MODEL (vcnc), "proxy", NULL);
+	if (!copy) {
+		g_set_error (error, GDA_DATA_PROXY_ERROR, GDA_DATA_PROXY_FILTER_ERROR,
+			     _("Error in filter expression"));
+		proxy->priv->force_direct_mapping = FALSE;
+		return FALSE;
+	}
+	filtered_rows = copy;
 	proxy->priv->force_direct_mapping = FALSE;
 
 

Modified: branches/V4-branch/libgda/gda-server-provider-extra.c
==============================================================================
--- branches/V4-branch/libgda/gda-server-provider-extra.c	(original)
+++ branches/V4-branch/libgda/gda-server-provider-extra.c	Thu Feb 14 18:20:30 2008
@@ -29,6 +29,12 @@
 #include <glib/gi18n-lib.h>
 #include <libgda/sql-parser/gda-sql-parser.h>
 
+#include <libgda/handlers/gda-handler-numerical.h>
+#include <libgda/handlers/gda-handler-boolean.h>
+#include <libgda/handlers/gda-handler-time.h>
+#include <libgda/handlers/gda-handler-string.h>
+#include <libgda/handlers/gda-handler-type.h>
+
 /**
  * gda_server_provider_internal_get_parser
  * @prov:
@@ -52,6 +58,130 @@
 }
 
 /**
+ * gda_server_provider_perform_operation_default
+ * @provider: a #GdaServerProvider object
+ * @cnc: a #GdaConnection object which will be used to perform an action, or %NULL
+ * @op: a #GdaServerOperation object
+ * @error: a place to store an error, or %NULL
+ *
+ * Performs the operation described by @op, using the SQL from the rendering of the operation
+ *
+ * Returns: TRUE if no error occurred
+ */
+gboolean
+gda_server_provider_perform_operation_default (GdaServerProvider *provider, GdaConnection *cnc,
+					       GdaServerOperation *op, GError **error)
+{
+	gchar *sql;
+	GdaBatch *batch;
+	const GSList *list;
+	gboolean retval = TRUE;
+
+	sql = gda_server_provider_render_operation (provider, cnc, op, error);
+	if (!sql)
+		return FALSE;
+
+	batch = gda_sql_parser_parse_string_as_batch (provider->priv->parser, sql, NULL, error);
+	g_free (sql);
+	if (!batch)
+		return FALSE;
+
+	for (list = gda_batch_get_statements (batch); list; list = list->next) {
+		if (gda_connection_statement_execute_non_select (cnc, GDA_STATEMENT (list->data), NULL, NULL, error) == -1) {
+			retval = FALSE;
+			break;
+		}
+	}
+	g_object_unref (batch);
+
+	return retval;;
+}
+
+/**
+ * gda_server_provider_get_data_handler_default
+ * @provider: a server provider.
+ * @cnc: a #GdaConnection object, or %NULL
+ * @for_type: a #GType
+ * @dbms_type: a DBMS type definition
+ *
+ * Provides the implementation when the default Libgda's data handlers must be used
+ * 
+ * Returns: a #GdaDataHandler, or %NULL
+ */
+GdaDataHandler *
+gda_server_provider_get_data_handler_default (GdaServerProvider *provider, GdaConnection *cnc,
+					      GType type, const gchar *dbms_type)
+{
+	GdaDataHandler *dh;
+	if ((type == G_TYPE_INT64) ||
+	    (type == G_TYPE_UINT64) ||
+	    (type == G_TYPE_DOUBLE) ||
+	    (type == G_TYPE_INT) ||
+	    (type == GDA_TYPE_NUMERIC) ||
+	    (type == G_TYPE_FLOAT) ||
+	    (type == GDA_TYPE_SHORT) ||
+	    (type == GDA_TYPE_USHORT) ||
+	    (type == G_TYPE_CHAR) ||
+	    (type == G_TYPE_UCHAR) ||
+	    (type == G_TYPE_UINT)) {
+		dh = gda_server_provider_handler_find (provider, NULL, type, NULL);
+		if (!dh) {
+			dh = gda_handler_numerical_new ();
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_INT64, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_UINT64, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_DOUBLE, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_INT, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, GDA_TYPE_NUMERIC, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_FLOAT, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, GDA_TYPE_SHORT, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, GDA_TYPE_USHORT, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_CHAR, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_UCHAR, NULL);
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_UINT, NULL);
+			g_object_unref (dh);
+		}
+	}
+        else if ((type == GDA_TYPE_BINARY) ||
+		 (type == GDA_TYPE_BLOB)) {
+		/* no default binary data handler, it's too database specific */
+		dh = NULL;
+	}
+        else if (type == G_TYPE_BOOLEAN) {
+		dh = gda_server_provider_handler_find (provider, NULL, type, NULL);
+		if (!dh) {
+			dh = gda_handler_boolean_new ();
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_BOOLEAN, NULL);
+			g_object_unref (dh);
+		}
+	}
+	else if ((type == GDA_TYPE_TIME) ||
+		 (type == GDA_TYPE_TIMESTAMP) ||
+		 (type == G_TYPE_DATE)) {
+		/* no default time related data handler, it's too database specific */
+		dh = NULL;
+	}
+	else if (type == G_TYPE_STRING) {
+		dh = gda_server_provider_handler_find (provider, NULL, type, NULL);
+		if (!dh) {
+			dh = gda_handler_string_new ();
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_STRING, NULL);
+			g_object_unref (dh);
+		}
+	}
+	else if (type == G_TYPE_ULONG) {
+		dh = gda_server_provider_handler_find (provider, NULL, type, NULL);
+		if (!dh) {
+			dh = gda_handler_type_new ();
+			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_ULONG, NULL);
+			g_object_unref (dh);
+		}
+	}
+
+	return dh;
+}
+
+
+/**
  * gda_server_provider_get_schema_nb_columns
  * @schema:
  *
@@ -350,37 +480,6 @@
 	return TRUE;
 }
 
-guint
-gda_server_provider_handler_info_hash_func  (GdaServerProviderHandlerInfo *key)
-{
-	guint hash;
-
-	hash = g_int_hash (&(key->g_type));
-	if (key->dbms_type)
-		hash += g_str_hash (key->dbms_type);
-	hash += GPOINTER_TO_UINT (key->cnc);
-
-	return hash;
-}
-
-gboolean
-gda_server_provider_handler_info_equal_func (GdaServerProviderHandlerInfo *a, GdaServerProviderHandlerInfo *b)
-{
-	if ((a->g_type == b->g_type) &&
-	    (a->cnc == b->cnc) &&
-	    ((!a->dbms_type && !b->dbms_type) || !strcmp (a->dbms_type, b->dbms_type)))
-		return TRUE;
-	else
-		return FALSE;
-}
-
-void
-gda_server_provider_handler_info_free (GdaServerProviderHandlerInfo *info)
-{
-	g_free (info->dbms_type);
-	g_free (info);
-}
-
 GdaDataHandler *
 gda_server_provider_handler_find (GdaServerProvider *prov, GdaConnection *cnc, 
 				  GType g_type, const gchar *dbms_type)

Modified: branches/V4-branch/libgda/gda-server-provider-extra.h
==============================================================================
--- branches/V4-branch/libgda/gda-server-provider-extra.h	(original)
+++ branches/V4-branch/libgda/gda-server-provider-extra.h	Thu Feb 14 18:20:30 2008
@@ -40,6 +40,16 @@
 gboolean  gda_server_provider_init_schema_model     (GdaDataModel *model, GdaConnectionSchema schema);
 gboolean  gda_server_provider_test_schema_model     (GdaDataModel *model, GdaConnectionSchema schema, GError **error);
 
+/*
+ * Default perform operation
+ */
+gboolean gda_server_provider_perform_operation_default (GdaServerProvider *provider, GdaConnection *cnc,
+							GdaServerOperation *op, GError **error);
+
+/* default data handler method */
+GdaDataHandler *gda_server_provider_get_data_handler_default (GdaServerProvider *provider, GdaConnection *cnc,
+							      GType type, const gchar *dbms_type);
+
 
 /*
  * Help to implement the GdaDataHandler retreiving for the providers
@@ -50,11 +60,6 @@
 	gchar         *dbms_type;
 } GdaServerProviderHandlerInfo;
 
-guint           gda_server_provider_handler_info_hash_func  (GdaServerProviderHandlerInfo *key);
-gboolean        gda_server_provider_handler_info_equal_func (GdaServerProviderHandlerInfo *a, 
-							     GdaServerProviderHandlerInfo *b);
-void            gda_server_provider_handler_info_free       (GdaServerProviderHandlerInfo *info);
-
 GdaDataHandler *gda_server_provider_handler_find            (GdaServerProvider *prov, GdaConnection *cnc, 
 							     GType g_type, const gchar *dbms_type);
 void            gda_server_provider_handler_declare         (GdaServerProvider *prov, GdaDataHandler *dh,

Modified: branches/V4-branch/libgda/gda-server-provider.c
==============================================================================
--- branches/V4-branch/libgda/gda-server-provider.c	(original)
+++ branches/V4-branch/libgda/gda-server-provider.c	Thu Feb 14 18:20:30 2008
@@ -85,12 +85,10 @@
 	klass->supports_feature = NULL;
 
 	klass->get_data_handler = NULL;
-	klass->string_to_value = NULL;
 
 	klass->open_connection = NULL;
 	klass->close_connection = NULL;
 	klass->get_database = NULL;
-	klass->change_database = NULL;
 
 	klass->supports_operation = NULL;
 	klass->create_operation = NULL;
@@ -106,6 +104,37 @@
         object_class->get_property = gda_server_provider_get_property;
 }
 
+static guint
+gda_server_provider_handler_info_hash_func  (GdaServerProviderHandlerInfo *key)
+{
+        guint hash;
+
+        hash = g_int_hash (&(key->g_type));
+        if (key->dbms_type)
+                hash += g_str_hash (key->dbms_type);
+        hash += GPOINTER_TO_UINT (key->cnc);
+
+        return hash;
+}
+
+static gboolean
+gda_server_provider_handler_info_equal_func (GdaServerProviderHandlerInfo *a, GdaServerProviderHandlerInfo *b)
+{
+        if ((a->g_type == b->g_type) &&
+            (a->cnc == b->cnc) &&
+            ((!a->dbms_type && !b->dbms_type) || !strcmp (a->dbms_type, b->dbms_type)))
+                return TRUE;
+        else
+                return FALSE;
+}
+
+static void
+gda_server_provider_handler_info_free (GdaServerProviderHandlerInfo *info)
+{
+        g_free (info->dbms_type);
+        g_free (info);
+}
+
 static void
 gda_server_provider_init (GdaServerProvider *provider,
 			  GdaServerProviderClass *klass)
@@ -207,11 +236,9 @@
 gda_server_provider_get_version (GdaServerProvider *provider)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
+	g_return_val_if_fail (CLASS (provider)->get_version, NULL);
 
-	if (CLASS (provider)->get_version != NULL)
-		return CLASS (provider)->get_version (provider);
-
-	return PACKAGE_VERSION;
+	return CLASS (provider)->get_version (provider);
 }
 
 /**
@@ -226,13 +253,9 @@
 gda_server_provider_get_name (GdaServerProvider *provider)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
+	g_return_val_if_fail (CLASS (provider)->get_name, NULL);
 
-	if (CLASS (provider)->get_name != NULL)
-		return CLASS (provider)->get_name (provider);
-	else {
-		g_warning ("Provider does not implement the get_name() virtual method");
-		return NULL;
-	}
+	return CLASS (provider)->get_name (provider);
 }
 
 /**
@@ -335,8 +358,9 @@
  * @username: user name for logging in.
  * @password: password for authentication.
  *
- * Tries to open a new connection on the given #GdaServerProvider
- * object.
+ * Tries to open the @cnc connection using methods implemented by @provider. In case of failure,
+ * or as a general notice, some #GdaConnectionEvent events (or errors) may be added to the connection
+ * during that method, see gda_connection_get_events().
  *
  * Returns: TRUE if no error occurred
  */
@@ -370,11 +394,12 @@
 
 /**
  * gda_server_provider_close_connection
- * @provider:
- * @cnc:
+ * @provider: a #GdaServerProvider object.
+ * @cnc: a #GdaConnection object.
  *
- * Returns:
- * 
+ * Close the connection.
+ *
+ * Returns: TRUE if no error occurred
  */
 gboolean
 gda_server_provider_close_connection (GdaServerProvider *provider, GdaConnection *cnc)
@@ -394,10 +419,12 @@
 
 /**
  * gda_server_provider_get_server_version
- * @provider:
- * @cnc:
+ * @provider: a #GdaServerProvider object.
+ * @cnc: a #GdaConnection object.
  *
- * Returns:
+ * Get the version of the database to which the connection is opened.
+ * 
+ * Returns: a (read only) string, or %NULL if an error occurred
  */
 const gchar *
 gda_server_provider_get_server_version (GdaServerProvider *provider, GdaConnection *cnc)
@@ -413,10 +440,10 @@
  * @provider: a #GdaServerProvider object.
  * @cnc: a #GdaConnection object.
  *
- * Proxy the call to the get_database method on the
- * #GdaServerProvider class to the corresponding provider.
+ * Get the database name of the @cnc.
  *
- * Returns: the name of the current database.
+ * Returns: the name of the current database, or %NULL if an error occurred or if the provider
+ * does not implement that method.
  */
 const gchar *
 gda_server_provider_get_database (GdaServerProvider *provider,
@@ -424,39 +451,17 @@
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-	g_return_val_if_fail (CLASS (provider)->get_database != NULL, NULL);
-
-	return CLASS (provider)->get_database (provider, cnc);
-}
-
-/**
- * gda_server_provider_change_database
- * @provider: a #GdaServerProvider object.
- * @cnc: a #GdaConnection object.
- * @name: database name.
- *
- * Proxy the call to the change_database method on the
- " #GdaServerProvider class to the corresponding provider.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- */
-gboolean
-gda_server_provider_change_database (GdaServerProvider *provider,
-				     GdaConnection *cnc,
-				     const gchar *name)
-{
-	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (name != NULL, FALSE);
-	g_return_val_if_fail (CLASS (provider)->change_database != NULL, FALSE);
 
-	return CLASS (provider)->change_database (provider, cnc, name);
+	if (CLASS (provider)->get_database)
+		return CLASS (provider)->get_database (provider, cnc);
+	else
+		return NULL;
 }
 
 /**
  * gda_server_provider_supports_operation
  * @provider: a #GdaServerProvider object
- * @cnc: a #GdaConnection object which would be used to perform an action
+ * @cnc: a #GdaConnection object which would be used to perform an action, or %NULL
  * @type: the type of operation requested
  * @options: a list of named parameters, or %NULL
  *
@@ -470,10 +475,6 @@
 					GdaServerOperationType type, GdaSet *options)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	if (cnc) {
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
-	}
 	if (CLASS (provider)->supports_operation)
 		return CLASS (provider)->supports_operation (provider, cnc, type, options);
 	else
@@ -561,7 +562,7 @@
 /**
  * gda_server_provider_create_operation
  * @provider: a #GdaServerProvider object
- * @cnc: a #GdaConnection object which will be used to perform an action
+ * @cnc: a #GdaConnection object which will be used to perform an action, or %NULL
  * @type: the type of operation requested
  * @options: an optional list of parameters
  * @error: a place to store an error, or %NULL
@@ -604,10 +605,7 @@
 	}
 
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
-	if (cnc) {
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
-	}
+
 	if (CLASS (provider)->create_operation) {
 		GdaServerOperation *op;
 
@@ -662,12 +660,15 @@
 /**
  * gda_server_provider_render_operation
  * @provider: a #GdaServerProvider object
- * @cnc: a #GdaConnection object which will be used to perform an action
+ * @cnc: a #GdaConnection object which will be used to render the action, or %NULL
  * @op: a #GdaServerOperation object
  * @error: a place to store an error, or %NULL
  *
  * Creates an SQL statement (possibly using some specific extensions of the DBMS) corresponding to the
- * @op operation.
+ * @op operation. Note that the returned string may actually contain more than one SQL statement.
+ *
+ * This function's purpose is mainly informative to get the actual SQL code which would be executed to perform
+ * the operation; to actually perform the operation, use gda_server_provider_perform_operation().
  *
  * Returns: a new string, or %NULL if an error occurred or operation cannot be rendered as SQL.
  */
@@ -676,10 +677,6 @@
 				      GdaServerOperation *op, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
-	if (cnc) {
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
-	}
 	if (CLASS (provider)->render_operation)
 		return CLASS (provider)->render_operation (provider, cnc, op, error);
 	else
@@ -689,7 +686,7 @@
 /**
  * gda_server_provider_perform_operation
  * @provider: a #GdaServerProvider object
- * @cnc: a #GdaConnection object which will be used to perform an action
+ * @cnc: a #GdaConnection object which will be used to perform the action, or %NULL
  * @op: a #GdaServerOperation object
  * @error: a place to store an error, or %NULL
  *
@@ -702,98 +699,81 @@
 				       GdaServerOperation *op, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	if (cnc) {
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
-	}
 	if (CLASS (provider)->perform_operation)
 		return CLASS (provider)->perform_operation (provider, cnc, op, error);
-	else {
-		/* use the SQL from the provider to perform the action */
-		gchar *sql;
-		GdaStatement *stmt;
-
-		sql = gda_server_provider_render_operation (provider, cnc, op, error);
-		if (!sql)
-			return FALSE;
-
-		stmt = gda_sql_parser_parse_string (provider->priv->parser, sql, NULL, error);
-		g_free (sql);
-		if (!stmt)
-			return FALSE;
-
-		if (gda_connection_statement_execute_non_select (cnc, stmt, NULL, NULL, error) == -1) {
-			g_object_unref (stmt);
-			return FALSE;
-		}
-		g_object_unref (stmt);
-		return TRUE;
-	}
+	else 
+		return gda_server_provider_perform_operation_default (provider, cnc, op, error);
 }
 
 /**
  * gda_server_provider_begin_transaction
- * @provider:
- * @cnc:
+ * @provider: a #GdaServerProvider object
+ * @cnc: a #GdaConnection object
  * @name: the name of the transation to start
  * @level:
  * @error: a place to store errors, or %NULL
  *
- * Returns:
+ * Starts a new transaction on @cnc.
+ *
+ * Returns: TRUE if no error occurred
  */
 gboolean
-gda_server_provider_begin_transaction (GdaServerProvider *provider,
-				       GdaConnection *cnc,
+gda_server_provider_begin_transaction (GdaServerProvider *provider, GdaConnection *cnc,
 				       const gchar *name, GdaTransactionIsolation level,
 				       GError **error)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (CLASS (provider)->begin_transaction != NULL, FALSE);
 
-	return CLASS (provider)->begin_transaction (provider, cnc, name, level, error);
+	if (CLASS (provider)->begin_transaction)
+		return CLASS (provider)->begin_transaction (provider, cnc, name, level, error);
+	else
+		return FALSE;
 }
 
 /**
  * gda_server_provider_commit_transaction
- * @provider:
- * @cnc:
+ * @provider: a #GdaServerProvider object
+ * @cnc: a #GdaConnection object
  * @name: the name of the transation to commit
  * @error: a place to store errors, or %NULL
  *
- * Returns:
+ * Commit the current transaction
+ *
+ * Returns: TRUE if no error occurred
  */
 gboolean
-gda_server_provider_commit_transaction (GdaServerProvider *provider,
-					GdaConnection *cnc,
+gda_server_provider_commit_transaction (GdaServerProvider *provider, GdaConnection *cnc,
 					const gchar *name, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (CLASS (provider)->commit_transaction != NULL, FALSE);
 
-	return CLASS (provider)->commit_transaction (provider, cnc, name, error);
+	if (CLASS (provider)->commit_transaction)
+		return CLASS (provider)->commit_transaction (provider, cnc, name, error);
+	else
+		return FALSE;
 }
 
 /**
  * gda_server_provider_rollback_transaction
- * @provider:
- * @cnc:
+ * @provider: a #GdaServerProvider object
+ * @cnc: a #GdaConnection object
  * @name: the name of the transation to commit
  * @error: a place to store errors, or %NULL
  *
- * Returns:
+ * Rolls back the current transaction
+ *
+ * Returns: TRUE if no error occurred
  */
 gboolean
-gda_server_provider_rollback_transaction (GdaServerProvider *provider,
-					  GdaConnection *cnc,
+gda_server_provider_rollback_transaction (GdaServerProvider *provider, GdaConnection *cnc,
 					  const gchar *name, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (CLASS (provider)->rollback_transaction != NULL, FALSE);
 
-	return CLASS (provider)->rollback_transaction (provider, cnc, name, error);
+	if (CLASS (provider)->rollback_transaction)
+		return CLASS (provider)->rollback_transaction (provider, cnc, name, error);
+	else
+		return FALSE;
 }
 
 /**
@@ -803,6 +783,8 @@
  * @name: name of the savepoint to add
  * @error: a place to store errors or %NULL
  *
+ * Add a savepoint within the current transaction
+ *
  * Returns: TRUE if no error occurred
  */
 gboolean
@@ -810,10 +792,11 @@
 				   const gchar *name, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (CLASS (provider)->add_savepoint != NULL, FALSE);
-
-	return CLASS (provider)->add_savepoint (provider, cnc, name, error);
+	
+	if (CLASS (provider)->add_savepoint)
+		return CLASS (provider)->add_savepoint (provider, cnc, name, error);
+	else
+		return FALSE;
 }
 
 /**
@@ -823,6 +806,8 @@
  * @name: name of the savepoint to rollback to
  * @error: a place to store errors or %NULL
  *
+ * Rolls back to a savepoint within the current transaction
+ *
  * Returns: TRUE if no error occurred
  */
 gboolean
@@ -830,10 +815,11 @@
 					const gchar *name, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (CLASS (provider)->rollback_savepoint != NULL, FALSE);
 
-	return CLASS (provider)->rollback_savepoint (provider, cnc, name, error);
+	if (CLASS (provider)->rollback_savepoint)
+		return CLASS (provider)->rollback_savepoint (provider, cnc, name, error);
+	else
+		return FALSE;
 }
 
 /**
@@ -843,6 +829,8 @@
  * @name: name of the savepoint to delete
  * @error: a place to store errors or %NULL
  *
+ * Delete a savepoint within the current transaction
+ *
  * Returns: TRUE if no error occurred
  */
 gboolean
@@ -850,33 +838,33 @@
 				      const gchar *name, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (CLASS (provider)->delete_savepoint != NULL, FALSE);
 
-	return CLASS (provider)->delete_savepoint (provider, cnc, name, error);
+	if (CLASS (provider)->delete_savepoint)
+		return CLASS (provider)->delete_savepoint (provider, cnc, name, error);
+	else
+		return FALSE;
 }
 
 /**
  * gda_server_provider_supports_feature
- * @provider:
- * @cnc:
- * @feature:
+ * @provider: a #GdaServerProvider object
+ * @cnc: a #GdaConnection object, or %NULL
+ * @feature: #GdaConnectionFeature feature to test
+ *
+ * Tests if a feature is supported
  *
- * Returns:
+ * Returns: TRUE if @feature is supported
  */
 gboolean
-gda_server_provider_supports_feature (GdaServerProvider *provider,
-			      GdaConnection *cnc,
-			      GdaConnectionFeature feature)
+gda_server_provider_supports_feature (GdaServerProvider *provider, GdaConnection *cnc,
+				      GdaConnectionFeature feature)
 {
-	gboolean retval;
+	gboolean retval = FALSE;
 
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	if (cnc)
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (CLASS (provider)->supports_feature != NULL, FALSE);
 
-	retval = CLASS (provider)->supports_feature (provider, cnc, feature);
+	if (CLASS (provider)->supports_feature)
+		retval = CLASS (provider)->supports_feature (provider, cnc, feature);
 
 	if (retval) {
 		switch (feature) {
@@ -901,7 +889,6 @@
 	}
 
 	return retval;
-
 }
 
 /**
@@ -910,22 +897,19 @@
  * @cnc: a #GdaConnection object, or %NULL
  * @for_type: a #GType
  *
- * Find a #GdaDataHandler object to manipulate data of type @for_type.
+ * Find a #GdaDataHandler object to manipulate data of type @for_type. The returned object must not be modified.
  * 
  * Returns: a #GdaDataHandler, or %NULL if the provider does not support the requested @for_type data type 
  */
 GdaDataHandler *
-gda_server_provider_get_data_handler_gtype (GdaServerProvider *provider,
-					  GdaConnection *cnc,
-					  GType for_type)
+gda_server_provider_get_data_handler_gtype (GdaServerProvider *provider, GdaConnection *cnc, GType for_type)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
-	if (cnc)
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
 
 	if (CLASS (provider)->get_data_handler)
 		return CLASS (provider)->get_data_handler (provider, cnc, for_type, NULL);
-	return NULL;
+	else
+		return gda_server_provider_get_data_handler_default (provider, cnc, for_type, NULL);
 }
 
 /**
@@ -939,26 +923,49 @@
  * Returns: a #GdaDataHandler, or %NULL if the provider does not know about the @for_type type
  */
 GdaDataHandler *
-gda_server_provider_get_data_handler_dbms (GdaServerProvider *provider,
-					   GdaConnection *cnc,
-					   const gchar *for_type)
+gda_server_provider_get_data_handler_dbms (GdaServerProvider *provider, GdaConnection *cnc, const gchar *for_type)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
-	if (cnc)
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
 	g_return_val_if_fail (for_type && *for_type, NULL);
 
 	if (CLASS (provider)->get_data_handler)
 		return CLASS (provider)->get_data_handler (provider, cnc, G_TYPE_INVALID, for_type);
-	return NULL;
+	else
+		return gda_server_provider_get_data_handler_default (provider, cnc, G_TYPE_INVALID, for_type);
+}
+
+/**
+ * gda_server_provider_get_default_dbms_type
+ * @provider: a server provider.
+ * @cnc: a #GdaConnection object or %NULL
+ * @type: a #GType value type
+ *
+ * Get the name of the most common data type which has @type type.
+ *
+ * The returned value may be %NULL either if the provider does not implement that method, or if
+ * there is no DBMS data type which could contain data of the @g_type type (for example %NULL may be
+ * returned if a DBMS has integers only up to 4 bytes and a G_TYPE_INT64 is requested).
+ *
+ * Returns: the name of the DBMS type, or %NULL
+ */
+const gchar *
+gda_server_provider_get_default_dbms_type (GdaServerProvider *provider, GdaConnection *cnc, GType type)
+{
+	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
+	
+	if (CLASS (provider)->get_def_dbms_type)
+		return (CLASS (provider)->get_def_dbms_type)(provider, cnc, type);
+	else
+		return NULL;
 }
 
+
 /**
  * gda_server_provider_string_to_value
  * @provider: a server provider.
  * @cnc: a #GdaConnection object.
  * @string: the SQL string to convert to a value
- * @prefered_type: a #GType
+ * @prefered_type: a #GType, or G_TYPE_INVALID
  *
  * Use @provider to create a new #GValue from a single string representation. 
  *
@@ -974,30 +981,68 @@
  * Returns: a new #GValue, or %NULL
  */
 GValue *
-gda_server_provider_string_to_value (GdaServerProvider *provider,
-				     GdaConnection *cnc,
-				     const gchar *string, 
+gda_server_provider_string_to_value (GdaServerProvider *provider,  GdaConnection *cnc, const gchar *string, 
 				     GType prefered_type, gchar **dbms_type)
 {
 	GValue *retval = NULL;
-	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
-	if (cnc)
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+	GdaDataHandler *dh;
+	gint i;
 
-	if (CLASS (provider)->string_to_value)
-		retval = CLASS (provider)->string_to_value (provider, cnc, string, prefered_type, dbms_type);
-	
-	if (!retval) {
-		GdaDataHandler *dh;
-		gint i;
+	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
 
-		if (prefered_type != G_TYPE_INVALID) {
-			dh = gda_server_provider_get_data_handler_gtype (provider, cnc, prefered_type);
+	if (prefered_type != G_TYPE_INVALID) {
+		dh = gda_server_provider_get_data_handler_gtype (provider, cnc, prefered_type);
+		if (dh) {
+			retval = gda_data_handler_get_value_from_sql (dh, string, prefered_type);
+			if (retval) {
+				gchar *tmp;
+				
+				tmp = gda_data_handler_get_sql_from_value (dh, retval);
+				if (strcmp (tmp, string)) {
+					gda_value_free (retval);
+					retval = NULL;
+				}
+				else {
+					if (dbms_type)
+						*dbms_type = (gchar *) gda_server_provider_get_default_dbms_type (provider, 
+														  cnc, prefered_type);
+				}
+				
+				g_free (tmp);
+			}
+		}
+	}
+	else {
+		/* test all the possible data types and see if we have a match */
+		GType types[] = {G_TYPE_UCHAR,
+				 GDA_TYPE_USHORT,
+				 G_TYPE_UINT,
+				 G_TYPE_UINT64,
+				 
+				 G_TYPE_CHAR,
+				 GDA_TYPE_SHORT,
+				 G_TYPE_INT,
+				 G_TYPE_INT64,
+				 
+				 G_TYPE_FLOAT,
+				 G_TYPE_DOUBLE,
+				 GDA_TYPE_NUMERIC,
+				 
+				 G_TYPE_BOOLEAN,
+				 GDA_TYPE_TIME,
+				 G_TYPE_DATE,
+				 GDA_TYPE_TIMESTAMP,
+				 GDA_TYPE_GEOMETRIC_POINT,
+				 G_TYPE_STRING,
+				 GDA_TYPE_BINARY};
+		
+		for (i = 0; !retval && (i <= (sizeof(types)/sizeof (GType)) - 1); i++) {
+			dh = gda_server_provider_get_data_handler_gtype (provider, cnc, types [i]);
 			if (dh) {
-				retval = gda_data_handler_get_value_from_sql (dh, string, prefered_type);
+				retval = gda_data_handler_get_value_from_sql (dh, string, types [i]);
 				if (retval) {
 					gchar *tmp;
-
+					
 					tmp = gda_data_handler_get_sql_from_value (dh, retval);
 					if (strcmp (tmp, string)) {
 						gda_value_free (retval);
@@ -1006,59 +1051,12 @@
 					else {
 						if (dbms_type)
 							*dbms_type = (gchar *) gda_server_provider_get_default_dbms_type (provider, 
-														cnc, prefered_type);
+															  cnc, types[i]);
 					}
-
 					g_free (tmp);
 				}
 			}
 		}
-		else {
-			/* test all the possible data types and see if we have a match */
-			GType types[] = {G_TYPE_UCHAR,
-					 GDA_TYPE_USHORT,
-					 G_TYPE_UINT,
-					 G_TYPE_UINT64,
-					 
-					 G_TYPE_CHAR,
-					 GDA_TYPE_SHORT,
-					 G_TYPE_INT,
-					 G_TYPE_INT64,
-					 
-					 G_TYPE_FLOAT,
-					 G_TYPE_DOUBLE,
-					 GDA_TYPE_NUMERIC,
-					 
-					 G_TYPE_BOOLEAN,
-					 GDA_TYPE_TIME,
-					 G_TYPE_DATE,
-					 GDA_TYPE_TIMESTAMP,
-					 GDA_TYPE_GEOMETRIC_POINT,
-					 G_TYPE_STRING,
-					 GDA_TYPE_BINARY};
-
-			for (i = 0; !retval && (i <= (sizeof(types)/sizeof (GType)) - 1); i++) {
-				dh = gda_server_provider_get_data_handler_gtype (provider, cnc, types [i]);
-				if (dh) {
-					retval = gda_data_handler_get_value_from_sql (dh, string, types [i]);
-					if (retval) {
-						gchar *tmp;
-						
-						tmp = gda_data_handler_get_sql_from_value (dh, retval);
-						if (strcmp (tmp, string)) {
-							gda_value_free (retval);
-							retval = NULL;
-						}
-						else {
-							if (dbms_type)
-								*dbms_type = (gchar *) gda_server_provider_get_default_dbms_type (provider, 
-															cnc, types[i]);
-						}
-						g_free (tmp);
-					}
-				}
-			}
-		}
 	}
 
 	return retval;
@@ -1149,38 +1147,6 @@
 		return gda_default_unescape_string (str);
 }
 
-/**
- * gda_server_provider_get_default_dbms_type
- * @provider: a server provider.
- * @cnc: a #GdaConnection object or %NULL
- * @type: a #GType value type
- *
- * Get the name of the most common data type which has @type type.
-
- * The returned value may be %NULL either if the provider does not implement that method, or if
- * there is no DBMS data type which could contain data of the @g_type type (for example %NULL may be
- * returned if a DBMS has integers only up to 4 bytes and a G_TYPE_INT64 is requested).
- *
- * Returns: the name of the DBMS type, or %NULL
- */
-const gchar *
-gda_server_provider_get_default_dbms_type (GdaServerProvider *provider,
-					   GdaConnection *cnc,
-					   GType type)
-{
-	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
-	if (cnc)
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-	
-	if (CLASS (provider)->get_def_dbms_type)
-		return (CLASS (provider)->get_def_dbms_type)(provider, cnc, type);
-	else
-		return NULL;
-}
-
-/*
- * GdaStatement
- */
 
 /**
  * gda_server_provider_create_parser
@@ -1199,8 +1165,7 @@
 gda_server_provider_create_parser (GdaServerProvider *provider, GdaConnection *cnc)
 {
 	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
-	if (cnc)
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+
 	if (CLASS (provider)->create_parser)
 		return (CLASS (provider)->create_parser)(provider, cnc);
 	else

Modified: branches/V4-branch/libgda/gda-server-provider.h
==============================================================================
--- branches/V4-branch/libgda/gda-server-provider.h	(original)
+++ branches/V4-branch/libgda/gda-server-provider.h	Thu Feb 14 18:20:30 2008
@@ -61,17 +61,26 @@
 	GdaServerProviderPrivate *priv;
 };
 
+typedef struct {
+	gboolean (*info)          (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *, GError **);
+	gboolean (*btypes)        (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *, GError **);
+	gboolean (*schemata)      (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *, GError **, 
+				   const GValue *schema_name);
+	gboolean (*tables_views)  (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *, GError **);
+	gboolean (*tables_views_s)(GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *, GError **, 
+				   const GValue *table_schema, const GValue *table_name);
+	gboolean (*columns)       (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *, GError **);
+	gboolean (*columns_t)     (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *, GError **, 
+				   const GValue *table_schema, const GValue *table_name);
+	gboolean (*columns_c)     (GdaServerProvider *, GdaConnection *, GdaMetaStore *, GdaMetaContext *, GError **, 
+				   const GValue *table_schema, const GValue *table_name, const GValue *column_name);
+} GdaServerProviderMeta;
+
 struct _GdaServerProviderClass {
 	GObjectClass parent_class;
 
 	/* signals */
 	void                   (* last_connection_gone) (GdaServerProvider *provider);
-	gpointer                  sig_reserved1;
-	gpointer                  sig_reserved2;
-	gpointer                  sig_reserved3;
-	gpointer                  sig_reserved4;
-
-	/* virtual methods */
 
 	/* provider information */
 	const gchar           *(* get_name) (GdaServerProvider *provider);
@@ -86,11 +95,6 @@
 						     GdaConnection *cnc,
 						     GType g_type,
 						     const gchar *dbms_type);
-	GValue                *(* string_to_value) (GdaServerProvider *provider,
-						    GdaConnection *cnc,
-						    const gchar *string, 
-						    GType prefered_type,
-						    gchar **dbms_type);
 	const gchar           *(*get_def_dbms_type) (GdaServerProvider *provider,
 						     GdaConnection *cnc,
 						     GType g_type);
@@ -110,9 +114,6 @@
 	
 	const gchar           *(* get_database) (GdaServerProvider *provider,
 						 GdaConnection *cnc);
-	gboolean               (* change_database) (GdaServerProvider *provider,
-						    GdaConnection *cnc,
-						    const gchar *name);
 	/* operations */
 	gboolean               (* supports_operation) (GdaServerProvider *provider, GdaConnection *cnc, 
 						       GdaServerOperationType type, GdaSet *options);
@@ -158,12 +159,9 @@
 						      GType *col_types, GdaSet **last_inserted_row, GError **error);
 
 	GdaConnection          *(* create_connection)  (GdaServerProvider *provider);
-	gboolean                (* meta_update)       (GdaServerProvider *provider, GdaConnection *cnc,
-						       GdaMetaContext *context, GError **error);
+	GdaServerProviderMeta      meta_funcs;
 };
 
-
-
 GType                  gda_server_provider_get_type (void) G_GNUC_CONST;
 
 /* provider information */
@@ -218,9 +216,6 @@
 
 const gchar           *gda_server_provider_get_database     (GdaServerProvider *provider,
 							     GdaConnection *cnc);
-gboolean               gda_server_provider_change_database  (GdaServerProvider *provider,
-							     GdaConnection *cnc,
-							     const gchar *name);
 
 /* actions with parameters */
 gboolean               gda_server_provider_supports_operation (GdaServerProvider *provider, GdaConnection *cnc, 

Added: branches/V4-branch/libgda/global.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/libgda/global.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,46 @@
+/* GLOBAL.H - RSAREF types and constants */
+
+/* Copyright (C) RSA Laboratories, a division of RSA Data Security,
+     Inc., created 1991. All rights reserved.
+ */
+
+#ifndef _GLOBAL_H_
+#define _GLOBAL_H_ 1
+
+/* PROTOTYPES should be set to one if and only if the compiler supports
+     function argument prototyping.
+   The following makes PROTOTYPES default to 1 if it has not already been
+     defined as 0 with C compiler flags.
+ */
+#ifndef PROTOTYPES
+#define PROTOTYPES 1
+#endif
+
+/* POINTER defines a generic pointer type */
+typedef unsigned char *POINTER;
+
+/* UINT2 defines a two byte word */
+typedef unsigned short int UINT2;
+
+/* UINT4 defines a four byte word */
+typedef unsigned long int UINT4;
+
+#ifndef NULL_PTR
+#define NULL_PTR ((POINTER)0)
+#endif
+
+#ifndef UNUSED_ARG
+#define UNUSED_ARG(x) x = *(&x);
+#endif
+
+/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
+   If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
+     returns an empty list.  
+ */
+#if PROTOTYPES
+#define PROTO_LIST(list) list
+#else
+#define PROTO_LIST(list) ()
+#endif
+
+#endif /* end _GLOBAL_H_ */

Added: branches/V4-branch/libgda/md5.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/libgda/md5.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,49 @@
+/* MD5.H - header file for MD5C.C
+ */
+
+/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+   rights reserved.
+
+   License to copy and use this software is granted provided that it
+   is identified as the "RSA Data Security, Inc. MD5 Message-Digest
+   Algorithm" in all material mentioning or referencing this software
+   or this function.
+
+   License is also granted to make and use derivative works provided
+   that such works are identified as "derived from the RSA Data
+   Security, Inc. MD5 Message-Digest Algorithm" in all material
+   mentioning or referencing the derived work.  
+                                                                    
+   RSA Data Security, Inc. makes no representations concerning either
+   the merchantability of this software or the suitability of this
+   software for any particular purpose. It is provided "as is"
+   without express or implied warranty of any kind.  
+                                                                    
+   These notices must be retained in any copies of any part of this
+   documentation and/or software.  
+ */
+
+#ifndef _MD5_H_
+#define _MD5_H_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* MD5 context. */
+typedef struct {
+  UINT4 state[4];                                   /* state (ABCD) */
+  UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
+  unsigned char buffer[64];                         /* input buffer */
+} MD5_CTX;
+
+void MD5Init PROTO_LIST ((MD5_CTX *));
+void MD5Update PROTO_LIST
+  ((MD5_CTX *, unsigned char *, unsigned int));
+void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Added: branches/V4-branch/libgda/md5c.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/libgda/md5c.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,334 @@
+/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
+ */
+
+/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+   rights reserved.
+
+   License to copy and use this software is granted provided that it
+   is identified as the "RSA Data Security, Inc. MD5 Message-Digest
+   Algorithm" in all material mentioning or referencing this software
+   or this function.
+
+   License is also granted to make and use derivative works provided
+   that such works are identified as "derived from the RSA Data
+   Security, Inc. MD5 Message-Digest Algorithm" in all material
+   mentioning or referencing the derived work.  
+                                                                    
+   RSA Data Security, Inc. makes no representations concerning either
+   the merchantability of this software or the suitability of this
+   software for any particular purpose. It is provided "as is"
+   without express or implied warranty of any kind.  
+                                                                    
+   These notices must be retained in any copies of any part of this
+   documentation and/or software.  
+ */
+
+#include "global.h"
+#include "md5.h"
+
+/* Constants for MD5Transform routine.
+ */
+#define S11 7
+#define S12 12
+#define S13 17
+#define S14 22
+#define S21 5
+#define S22 9
+#define S23 14
+#define S24 20
+#define S31 4
+#define S32 11
+#define S33 16
+#define S34 23
+#define S41 6
+#define S42 10
+#define S43 15
+#define S44 21
+
+static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
+static void Encode PROTO_LIST
+  ((unsigned char *, UINT4 *, unsigned int));
+static void Decode PROTO_LIST
+  ((UINT4 *, unsigned char *, unsigned int));
+static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
+static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
+
+static unsigned char PADDING[64] = {
+  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/* F, G, H and I are basic MD5 functions.
+ */
+#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
+#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define I(x, y, z) ((y) ^ ((x) | (~z)))
+
+/* ROTATE_LEFT rotates x left n bits.
+ */
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+
+/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
+   Rotation is separate from addition to prevent recomputation.
+ */
+#define FF(a, b, c, d, x, s, ac) { \
+    (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
+    (a) = ROTATE_LEFT ((a), (s)); \
+    (a) += (b); \
+  }
+#define GG(a, b, c, d, x, s, ac) { \
+    (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
+    (a) = ROTATE_LEFT ((a), (s)); \
+    (a) += (b); \
+  }
+#define HH(a, b, c, d, x, s, ac) { \
+    (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
+    (a) = ROTATE_LEFT ((a), (s)); \
+    (a) += (b); \
+  }
+#define II(a, b, c, d, x, s, ac) { \
+    (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
+    (a) = ROTATE_LEFT ((a), (s)); \
+    (a) += (b); \
+  }
+
+/* MD5 initialization. Begins an MD5 operation, writing a new context.
+ */
+void MD5Init (context)
+MD5_CTX *context;                                        /* context */
+{
+  context->count[0] = context->count[1] = 0;
+
+  /* Load magic initialization constants.
+   */
+  context->state[0] = 0x67452301;
+  context->state[1] = 0xefcdab89;
+  context->state[2] = 0x98badcfe;
+  context->state[3] = 0x10325476;
+}
+
+/* MD5 block update operation. Continues an MD5 message-digest
+     operation, processing another message block, and updating the
+     context.
+ */
+void MD5Update (context, input, inputLen)
+MD5_CTX *context;                                        /* context */
+unsigned char *input;                                /* input block */
+unsigned int inputLen;                     /* length of input block */
+{
+  unsigned int i, index, partLen;
+
+  /* Compute number of bytes mod 64 */
+  index = (unsigned int)((context->count[0] >> 3) & 0x3F);
+
+  /* Update number of bits */
+  if ((context->count[0] += ((UINT4)inputLen << 3))
+      < ((UINT4)inputLen << 3))
+    context->count[1]++;
+  context->count[1] += ((UINT4)inputLen >> 29);
+  
+  partLen = 64 - index;
+  
+  /* Transform as many times as possible.
+   */
+  if (inputLen >= partLen) {
+    MD5_memcpy
+      ((POINTER)&context->buffer[index], (POINTER)input, partLen);
+    MD5Transform (context->state, context->buffer);
+  
+    for (i = partLen; i + 63 < inputLen; i += 64)
+      MD5Transform (context->state, &input[i]);
+    
+    index = 0;
+  }
+  else
+    i = 0;
+  
+  /* Buffer remaining input */
+  MD5_memcpy 
+    ((POINTER)&context->buffer[index], (POINTER)&input[i],
+     inputLen-i);
+}
+
+/* MD5 finalization. Ends an MD5 message-digest operation, writing the
+     the message digest and zeroizing the context.
+ */
+void MD5Final (digest, context)
+unsigned char digest[16];                         /* message digest */
+MD5_CTX *context;                                       /* context */
+{
+  unsigned char bits[8];
+  unsigned int index, padLen;
+
+  /* Save number of bits */
+  Encode (bits, context->count, 8);
+
+  /* Pad out to 56 mod 64.
+   */
+  index = (unsigned int)((context->count[0] >> 3) & 0x3f);
+  padLen = (index < 56) ? (56 - index) : (120 - index);
+  MD5Update (context, PADDING, padLen);
+  
+  /* Append length (before padding) */
+  MD5Update (context, bits, 8);
+
+  /* Store state in digest */
+  Encode (digest, context->state, 16);
+  
+  /* Zeroize sensitive information.
+   */
+  MD5_memset ((POINTER)context, 0, sizeof (*context));
+}
+
+/* MD5 basic transformation. Transforms state based on block.
+ */
+static void MD5Transform (state, block)
+UINT4 state[4];
+unsigned char block[64];
+{
+  UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
+  
+  Decode (x, block, 64);
+
+  /* Round 1 */
+  FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
+  FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
+  FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
+  FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
+  FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
+  FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
+  FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
+  FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
+  FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
+  FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
+  FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
+  FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
+  FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
+  FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
+  FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
+  FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
+
+  /* Round 2 */
+  GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
+  GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
+  GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
+  GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
+  GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
+  GG (d, a, b, c, x[10], S22,  0x2441453); /* 22 */
+  GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
+  GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
+  GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
+  GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
+  GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
+  GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
+  GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
+  GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
+  GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
+  GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
+
+  /* Round 3 */
+  HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
+  HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
+  HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
+  HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
+  HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
+  HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
+  HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
+  HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
+  HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
+  HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
+  HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
+  HH (b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */
+  HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
+  HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
+  HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
+  HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
+
+  /* Round 4 */
+  II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
+  II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
+  II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
+  II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
+  II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
+  II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
+  II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
+  II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
+  II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
+  II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
+  II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
+  II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
+  II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
+  II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
+  II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
+  II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
+
+  state[0] += a;
+  state[1] += b;
+  state[2] += c;
+  state[3] += d;
+  
+  /* Zeroize sensitive information.
+   */
+  MD5_memset ((POINTER)x, 0, sizeof (x));
+}
+
+/* Encodes input (UINT4) into output (unsigned char). Assumes len is
+     a multiple of 4.
+ */
+static void Encode (output, input, len)
+unsigned char *output;
+UINT4 *input;
+unsigned int len;
+{
+  unsigned int i, j;
+
+  for (i = 0, j = 0; j < len; i++, j += 4) {
+    output[j] = (unsigned char)(input[i] & 0xff);
+    output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
+    output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
+    output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
+  }
+}
+
+/* Decodes input (unsigned char) into output (UINT4). Assumes len is
+     a multiple of 4.
+ */
+static void Decode (output, input, len)
+UINT4 *output;
+unsigned char *input;
+unsigned int len;
+{
+  unsigned int i, j;
+
+  for (i = 0, j = 0; j < len; i++, j += 4)
+    output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
+      (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
+}
+
+/* Note: Replace "for loop" with standard memcpy if possible.
+ */
+static void MD5_memcpy (output, input, len)
+POINTER output;
+POINTER input;
+unsigned int len;
+{
+  unsigned int i;
+  
+  for (i = 0; i < len; i++)
+    output[i] = input[i];
+}
+
+/* Note: Replace "for loop" with standard memset if possible.
+ */
+static void MD5_memset (output, value, len)
+POINTER output;
+int value;
+unsigned int len;
+{
+  unsigned int i;
+  
+  for (i = 0; i < len; i++)
+    ((char *)output)[i] = (char)value;
+}

Modified: branches/V4-branch/libgda/providers-support/Makefile.am
==============================================================================
--- branches/V4-branch/libgda/providers-support/Makefile.am	(original)
+++ branches/V4-branch/libgda/providers-support/Makefile.am	Thu Feb 14 18:20:30 2008
@@ -6,13 +6,19 @@
 	-I$(top_builddir) \
 	$(LIBGDA_CFLAGS) 
 
-libgda_psupport_la_SOURCES = \
+psupport_headers = \
 	gda-pmodel.h \
-	gda-pmodel.c \
 	gda-prow.h \
+	gda-pstmt.h
+
+libgda_psupport_la_SOURCES = \
+	$(psupport_headers) \
+	gda-pmodel.c \
 	gda-prow.c \
-	gda-pstmt.h \
 	gda-pstmt.c
 
 libgda_psupport_la_LDFLAGS = -export-dynamic -module -avoid-version $(NO_UNDEFINED)
 libgda_psupport_la_LIBADD = $(LIBGDA_LIBS)
+
+psupportincludedir=$(includedir)/libgda-$(GDA_ABI_MAJOR_VERSION).$(GDA_ABI_MINOR_VERSION)/providers-support
+psupportinclude_HEADERS=$(psupport_headers)
\ No newline at end of file

Modified: branches/V4-branch/libgda/providers-support/gda-pmodel.h
==============================================================================
--- branches/V4-branch/libgda/providers-support/gda-pmodel.h	(original)
+++ branches/V4-branch/libgda/providers-support/gda-pmodel.h	Thu Feb 14 18:20:30 2008
@@ -55,7 +55,7 @@
  *     REQUIRED: fetch_next
  *     OPTIONAL: fetch_at
  * if GDA_STATEMENT_MODEL_CURSOR_BACKWARD:
- *     REQUIRED: fetch_next
+ *     REQUIRED: fetch_prev
  *     OPTIONAL: fetch_at
  */
 struct _GdaPModelClass {
@@ -65,7 +65,7 @@
 	gint             (*fetch_nb_rows) (GdaPModel *model);
 	GdaPRow         *(*fetch_random)  (GdaPModel *model, gint rownum, GError **error);
 
-	/* GDA_STATEMENT_MODEL_CURSOR */
+	/* GDA_STATEMENT_MODEL_CURSOR_* */
 	GdaPRow         *(*fetch_next)    (GdaPModel *model, gint rownum, GError **error);
 	GdaPRow         *(*fetch_prev)    (GdaPModel *model, gint rownum, GError **error);
 	GdaPRow         *(*fetch_at)      (GdaPModel *model, gint rownum, GError **error);

Modified: branches/V4-branch/libgda/sqlite/gda-sqlite-meta.c
==============================================================================
--- branches/V4-branch/libgda/sqlite/gda-sqlite-meta.c	(original)
+++ branches/V4-branch/libgda/sqlite/gda-sqlite-meta.c	Thu Feb 14 18:20:30 2008
@@ -1,4 +1,4 @@
-/* GNOME DB Sqlite Provider
+/* Gda Sqlite provider
  * Copyright (C) 2008 The GNOME Foundation
  *
  * AUTHORS:
@@ -34,21 +34,6 @@
 #include <libgda/gda-set.h>
 
 static gboolean append_a_row (GdaDataModel *to_model, GError **error, gint nb, ...);
-static gint check_parameters (GdaMetaContext *context, GError **error, gint nb, ...);
-
-typedef gboolean (*UpdateFunc) (GdaSqliteProvider *, SqliteConnectionData *, GdaConnection *, 
-				GdaMetaStore *, GdaMetaContext *, GError **);
-static gboolean update_META_CAT     (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-				     GdaMetaStore *store, GdaMetaContext *context, GError **error);
-static gboolean update_META_SCHEMAS (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-				     GdaMetaStore *store, GdaMetaContext *context, GError **error);
-static gboolean update_META_TABLES_VIEWS  (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-				     GdaMetaStore *store, GdaMetaContext *context, GError **error);
-static gboolean update_META_COLUMNS (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-				     GdaMetaStore *store, GdaMetaContext *context, GError **error);
-static gboolean update_META_BUILTIN_TYPES (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-					   GdaMetaStore *store, GdaMetaContext *context, GError **error);
-
 
 /*
  * predefined statements' IDs
@@ -73,21 +58,16 @@
 static GdaStatement **internal_stmt;
 static GdaSet        *internal_params;
 
-/*
- * Methods hash
- */
-static GHashTable    *methods;
-
 /* 
- * global values
+ * global static values
  */
-GdaSqlParser *internal_parser = NULL;
-GValue       *catalog_value;
-GValue       *table_type_value;
-GValue       *view_type_value;
-GValue       *view_check_option;
-GValue       *false_value;
-GdaSet       *pragma_set;
+static GdaSqlParser *internal_parser = NULL;
+static GValue       *catalog_value;
+static GValue       *table_type_value;
+static GValue       *view_type_value;
+static GValue       *view_check_option;
+static GValue       *false_value;
+static GdaSet       *pragma_set;
 
 /*
  * Meta initialization
@@ -113,13 +93,6 @@
 		}
         }
 
-	methods = g_hash_table_new (g_str_hash, g_str_equal);
-	g_hash_table_insert (methods, "_information_schema_catalog_name", update_META_CAT);
-	g_hash_table_insert (methods, "_schemata", update_META_SCHEMAS);
-	g_hash_table_insert (methods, "_tables", update_META_TABLES_VIEWS);
-	g_hash_table_insert (methods, "_columns", update_META_COLUMNS);
-	g_hash_table_insert (methods, "_builtin_data_types", update_META_BUILTIN_TYPES);
-
 	catalog_value = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (catalog_value, "main");
 
@@ -131,50 +104,10 @@
 	pragma_set = gda_set_new_inline (1, "tblname", G_TYPE_STRING, "");
 }
 
-/*
- * Main dispatcher
- */
-gboolean 
-_gda_sqlite_provider_meta_update (GdaServerProvider *provider, GdaConnection *cnc,
-				  GdaMetaContext *context, GError **error)
-{
-	SqliteConnectionData *scnc;
-	GdaMetaStore *store;
-	UpdateFunc func;
-
-	scnc = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
-	g_assert (scnc);
-
-#ifdef GDA_DEBUG
-	gint i;
-	g_print ("Requested SQLITE meta update for table %s\n", context->table_name);
-	for (i = 0; i < context->size; i++) {
-		gchar *str = gda_value_stringify (context->column_values [i]);
-		g_print ("\t%s = %s\n", context->column_names [i], str);
-		g_free (str);
-	}
-#endif
-
-	store = gda_connection_get_meta_store (cnc);
-	func = g_hash_table_lookup (methods, context->table_name);
-	if (func)
-		return func ((GdaSqliteProvider*) provider, scnc, cnc, store, context, error);
-	else {
-		g_print ("For meta on table '%s' (maybe don't needed...) ", context->table_name);
-		TO_IMPLEMENT;
-	}
-	return TRUE;
-}
-
-/*
- * params: 
- *  - none
- */
-static gboolean
-update_META_CAT (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-		 GdaMetaStore *store, GdaMetaContext *context, GError **error)
+gboolean
+_gda_sqlite_meta_info (GdaServerProvider *prov, GdaConnection *cnc, 
+		       GdaMetaStore *store, GdaMetaContext *context, GError **error)
 {
-	/* actual data computation */
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
@@ -188,24 +121,71 @@
 	return retval;
 }
 
-/*
- * params: 
- *  - none
- *  - @schema_name
- */
-static gboolean
-update_META_SCHEMAS (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-		     GdaMetaStore *store, GdaMetaContext *context, GError **error)
-{
-	/* context's parameters analysis */
-	GValue *p_schema_name = NULL;
-	if (check_parameters (context, error, 2,
-			      &p_schema_name, G_TYPE_STRING, NULL,
-			      "schema_name", &p_schema_name, NULL,
-			      NULL) < 0)
-		return FALSE;
+gboolean
+_gda_sqlite_meta_btypes (GdaServerProvider *prov, GdaConnection *cnc, 
+			 GdaMetaStore *store, GdaMetaContext *context, GError **error)
+{
+	GdaDataModel *mod_model;
+	gboolean retval = TRUE;
+	gint i;
+	typedef struct {
+		gchar *tname;
+		gchar *gtype;
+		gchar *comments;
+		gchar *synonyms;
+	} InternalType;
+
+	InternalType internal_types[] = {
+		{"integer", "gint", "Signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value", "int"},
+		{"real", "gdouble",  "Floating point value, stored as an 8-byte IEEE floating point number", NULL},
+		{"text", "string", "Text string, stored using the database encoding", "string"},
+		{"blob", "GdaBinary", "Blob of data, stored exactly as it was input", NULL},
+		{"timestamp", "GdaTimestamp", "Time stamp, stored as 'YYYY-MM-DD HH:MM:SS.SSS'", NULL},
+		{"time", "GdaTime", "Time, stored as 'HH:MM:SS.SSS'", NULL},
+		{"date", "GDate", "Date, stored as 'YYYY-MM-DD'", NULL},
+		{"boolean", "gboolean", "Boolean value", "bool"}
+	};
+
+	mod_model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (mod_model);
+
+	GValue *vint;
+	g_value_set_boolean (vint = gda_value_new (G_TYPE_BOOLEAN), FALSE);
+	for (i = 0; i < sizeof (internal_types) / sizeof (InternalType); i++) {
+		GValue *v1, *v2, *v3, *v4;
+		InternalType *it = &(internal_types[i]);
+
+		g_value_set_string (v1 = gda_value_new (G_TYPE_STRING), it->tname);
+		g_value_set_string (v2 = gda_value_new (G_TYPE_STRING), it->gtype);
+		g_value_set_string (v3 = gda_value_new (G_TYPE_STRING), it->comments);
+		if (it->synonyms)
+			g_value_set_string (v4 = gda_value_new (G_TYPE_STRING), it->synonyms);
+		else
+			v4 = NULL;
+		
+		if (!append_a_row (mod_model, error, 6,
+				   FALSE, v1, /* short_type_name */
+				   TRUE, v1, /* full_type_name */
+				   TRUE, v2, /* gtype */
+				   TRUE, v3, /* comments */
+				   TRUE, v4, /* synonyms */
+				   FALSE, vint /* internal */)) {
+			retval = FALSE;
+			break;
+		}
+	}
+	gda_value_free (vint);
+	if (retval)
+		retval = gda_meta_store_modify (store, context->table_name, mod_model, NULL, error, NULL);
+	g_object_unref (mod_model);
+	return retval;
+}
 
-	/* actual data computation */
+gboolean 
+_gda_sqlite_meta_schemata (GdaServerProvider *prov, GdaConnection *cnc, 
+			   GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+			   const GValue *schema_name)
+{
 	GdaDataModel *model, *tmpmodel;
 	gboolean retval = TRUE;
 	gint nrows, i;
@@ -222,8 +202,8 @@
 		const GValue *cvalue;
 		
 		cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
-		if (!p_schema_name || 
-		    !gda_value_compare_ext (p_schema_name, cvalue)) {
+		if (!schema_name || 
+		    !gda_value_compare_ext (schema_name, cvalue)) {
 			const gchar *cstr;
 			GValue *v1;
 
@@ -247,65 +227,123 @@
 	return retval;
 }
 
-
 /*
- * params: 
- *  - none
- *  - @table_schema
- *  - @table_schema AND @table_name
+ * Warning: this is a hack where it is assumed that the GValue values from SQLite's SELECT execution are available
+ * event _after_ several calls to gda_data_model_get_value_at(), which might not be TRUE in all the cases.
+ *
+ * For this purpose, the @models list contains the list of data models which then have to be destroyed.
  */
-static gboolean update_META_TABLES_VIEWS_for_schema (GdaConnection *cnc, 
-						     GdaDataModel *to_tables_model, GdaDataModel *to_views_model, 
-						     const GValue *p_table_schema, const GValue *p_table_name,
-						     GError **error);
-static gboolean
-update_META_TABLES_VIEWS (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-			  GdaMetaStore *store, GdaMetaContext *context, GError **error)
+static gboolean 
+fill_tables_views_model (GdaConnection *cnc,
+			 GdaDataModel *to_tables_model, GdaDataModel *to_views_model,
+			 const GValue *p_table_schema, const GValue *p_table_name,
+			 GError **error)
+{
+	gchar *str;
+        GdaDataModel *tmpmodel;
+        gboolean retval = TRUE;
+        gint nrows, i;
+        GdaStatement *stmt;
+        GType col_types[] = {G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE};
+        const gchar *schema_name;
+
+        schema_name = g_value_get_string (p_table_schema);
+        if (!strcmp (schema_name, "temp"))
+                return TRUE; /* nothing to do */
+
+        str = g_strdup_printf ("SELECT tbl_name, type, sql FROM %s.sqlite_master where type='table' OR type='view'",
+                               schema_name);
+        stmt = gda_sql_parser_parse_string (internal_parser, str, NULL, NULL);
+        g_free (str);
+        g_assert (stmt);
+        tmpmodel = gda_connection_statement_execute_select_full (cnc, stmt, NULL,
+                                                                 GDA_STATEMENT_MODEL_RANDOM_ACCESS,
+                                                                 col_types, error);
+        g_object_unref (stmt);
+        if (!tmpmodel)
+                return FALSE;
+
+        nrows = gda_data_model_get_n_rows (tmpmodel);
+        for (i = 0; (i < nrows) && retval; i++) {
+                const GValue *cvalue;
+
+                cvalue = gda_data_model_get_value_at (tmpmodel, 0, i);
+                if (!p_table_name ||
+                    !gda_value_compare_ext (p_table_name, cvalue)) {
+                        GValue *v1, *v2 = NULL;
+                        const GValue *tvalue;
+                        const GValue *dvalue;
+                        gboolean is_view = FALSE;
+                        const gchar *this_table_name;
+
+                        this_table_name = g_value_get_string (cvalue);
+                        g_assert (this_table_name);
+			if (!strcmp (this_table_name, "sqlite_sequence"))
+                                continue; /* ignore that table */
+
+                        tvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
+                        dvalue = gda_data_model_get_value_at (tmpmodel, 2, i);
+                        if (*(g_value_get_string (tvalue)) == 'v')
+                                is_view = TRUE;
+                        g_value_set_boolean ((v1 = gda_value_new (G_TYPE_BOOLEAN)), TRUE);
+                        if (strcmp (schema_name, "main")) {
+                                str = g_strdup_printf ("%s.%s", schema_name, g_value_get_string (cvalue));
+                                g_value_take_string ((v2 = gda_value_new (G_TYPE_STRING)), str);
+                        }
+                        if (! append_a_row (to_tables_model, error, 9,
+                                            FALSE, catalog_value,
+                                            FALSE, p_table_schema,
+                                            FALSE, cvalue,
+                                            FALSE, is_view ? view_type_value : table_type_value,
+                                            TRUE, v1,
+                                            FALSE, NULL,
+                                            FALSE, cvalue,
+                                            v2 ? TRUE : FALSE, v2 ? v2 : cvalue,
+                                            FALSE, NULL))
+                                retval = FALSE;
+                        if (is_view && ! append_a_row (to_views_model, error, 6,
+                                                       FALSE, catalog_value,
+                                                       FALSE, p_table_schema,
+                                                       FALSE, cvalue,
+                                                       FALSE, dvalue,
+                                                       FALSE, view_check_option,
+                                                       FALSE, false_value))
+                                retval = FALSE;
+                }
+        }
+        g_object_unref (tmpmodel);
+
+        return retval;
+}
+
+gboolean
+_gda_sqlite_meta_tables_views (GdaServerProvider *prov, GdaConnection *cnc, 
+			       GdaMetaStore *store, GdaMetaContext *context, GError **error)
 {
-	/* context's parameters analysis */
-	const GValue *p_table_schema = NULL;
-	const GValue *p_table_name = NULL;
-	if (check_parameters (context, error, 3,
-			      &p_table_schema, G_TYPE_STRING,
-			      &p_table_name, G_TYPE_STRING, NULL,
-			      "table_schema", &p_table_schema, "table_name", &p_table_name, NULL,
-			      "table_schema", &p_table_schema, NULL,
-			      NULL) < 0)
-		return FALSE;
-	
-	/* actual data computation */
 	GdaDataModel *tables_model, *views_model;
 	gboolean retval = TRUE;
 	tables_model = gda_meta_store_create_modify_data_model (store, "_tables");
 	g_assert (tables_model);
 	views_model = gda_meta_store_create_modify_data_model (store, "_views");
 	g_assert (views_model);
-	if (p_table_schema) {
-		if (! update_META_TABLES_VIEWS_for_schema (cnc, tables_model, views_model, 
-							   p_table_schema, p_table_name, error))
-			retval = FALSE;
-	}
+	
+	GdaDataModel *sh_model;
+	sh_model = gda_connection_get_meta_store_data (cnc, GDA_CONNECTION_META_NAMESPACES, error, 0);
+	if (!sh_model)
+		retval = TRUE;
 	else {
-		GdaDataModel *sh_model;
-
-		sh_model = gda_connection_get_meta_store_data (cnc, GDA_CONNECTION_META_NAMESPACES, error, 0);
-		if (!sh_model)
-			retval = TRUE;
-		else {
-			gint nrows, i;
-			nrows = gda_data_model_get_n_rows (sh_model);
-			for (i = 0; i < nrows; i++) {
-				p_table_schema = gda_data_model_get_value_at (sh_model, 0, i);
-				if (!update_META_TABLES_VIEWS_for_schema (cnc, tables_model, views_model, 
-									  p_table_schema, NULL, error)) {
-					retval = FALSE;
-					break;
-				}
+		gint nrows, i;
+		nrows = gda_data_model_get_n_rows (sh_model);
+		for (i = 0; i < nrows; i++) {
+			const GValue *p_table_schema = gda_data_model_get_value_at (sh_model, 0, i);
+			if (!fill_tables_views_model (cnc, tables_model, views_model, p_table_schema, NULL, error)) {
+				retval = FALSE;
+				break;
 			}
-			g_object_unref (sh_model);
 		}
+		g_object_unref (sh_model);
 	}
-
+	
 	GdaMetaContext c2;
 	c2 = *context; /* copy contents, just because we need to modify @context->table_name */
 	if (retval) {
@@ -322,169 +360,44 @@
 	return retval;
 }
 
-/*
- * Warning: this is a hack where it is assumed that the GValue values from SQLite's SELECT execution are available
- * event _after_ several calls to gda_data_model_get_value_at(), which might not be TRUE in all the cases.
- *
- * For this purpose, the @models list contains the list of data models which then have to be destroyed.
- */
-static gboolean
-update_META_TABLES_VIEWS_for_schema (GdaConnection *cnc, 
-				     GdaDataModel *to_tables_model, GdaDataModel *to_views_model,
-				     const GValue *p_table_schema, const GValue *p_table_name,
-				     GError **error)
-{
-	gchar *str;
-	GdaDataModel *tmpmodel;
-	gboolean retval = TRUE;
-	gint nrows, i;
-	GdaStatement *stmt;
-	GType col_types[] = {G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE};
-	const gchar *schema_name;
-
-	schema_name = g_value_get_string (p_table_schema);
-	if (!strcmp (schema_name, "temp"))
-		return TRUE; /* nothing to do */
-	
-	str = g_strdup_printf ("SELECT tbl_name, type, sql FROM %s.sqlite_master where type='table' OR type='view'", 
-			       schema_name);
-	stmt = gda_sql_parser_parse_string (internal_parser, str, NULL, NULL);
-	g_free (str);
-	g_assert (stmt);
-	tmpmodel = gda_connection_statement_execute_select_full (cnc, stmt, NULL, 
-								 GDA_STATEMENT_MODEL_RANDOM_ACCESS, 
-								 col_types, error);
-	g_object_unref (stmt);
-	if (!tmpmodel)
-		return FALSE;
-	
-	nrows = gda_data_model_get_n_rows (tmpmodel);
-	for (i = 0; (i < nrows) && retval; i++) {
-		const GValue *cvalue;
-	       
-		cvalue = gda_data_model_get_value_at (tmpmodel, 0, i);
-		if (!p_table_name || 
-		    !gda_value_compare_ext (p_table_name, cvalue)) {
-			GValue *v1, *v2 = NULL;
-			const GValue *tvalue;
-			const GValue *dvalue;
-			gboolean is_view = FALSE;
-			gchar *this_table_name;
-
-			this_table_name = g_value_get_string (cvalue);
-			g_assert (this_table_name);
-			if (!strcmp (this_table_name, "sqlite_sequence"))
-				continue; /* ignore that table */
-
-			tvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
-			dvalue = gda_data_model_get_value_at (tmpmodel, 2, i);
-			if (*(g_value_get_string (tvalue)) == 'v')
-				is_view = TRUE;
-			g_value_set_boolean ((v1 = gda_value_new (G_TYPE_BOOLEAN)), TRUE);
-			if (strcmp (schema_name, "main")) {
-				str = g_strdup_printf ("%s.%s", schema_name, g_value_get_string (cvalue));
-				g_value_take_string ((v2 = gda_value_new (G_TYPE_STRING)), str);
-			}
-			if (! append_a_row (to_tables_model, error, 9, 
-					    FALSE, catalog_value,
-					    FALSE, p_table_schema,
-					    FALSE, cvalue,
-					    FALSE, is_view ? view_type_value : table_type_value,
-					    TRUE, v1,
-					    FALSE, NULL,
-					    FALSE, cvalue,
-					    v2 ? TRUE : FALSE, v2 ? v2 : cvalue,
-					    FALSE, NULL))
-				retval = FALSE;
-			if (is_view && ! append_a_row (to_views_model, error, 6, 
-						       FALSE, catalog_value,
-						       FALSE, p_table_schema,
-						       FALSE, cvalue,
-						       FALSE, dvalue, 
-						       FALSE, view_check_option,
-						       FALSE, false_value))
-				retval = FALSE;
-		}
-	}
-	g_object_unref (tmpmodel);
 
-	return retval;
-}
 
-/*
- * params: 
- *  - none
- *  - @table_schema AND @table_name
- *  - @table_schema AND @table_name AND @column_name
- */
-static gboolean update_META_COLUMNS_for_table (GdaConnection *cnc, SqliteConnectionData *scnc, 
-					       GdaDataModel *mod_model, 
-					       const GValue *p_table_schema, const GValue *p_table_name,
-					       const GValue *p_column_name, GError **error);
-static gboolean
-update_META_COLUMNS (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-		     GdaMetaStore *store, GdaMetaContext *context, GError **error)
-{
-	/* context's parameters analysis */
-	const GValue *p_table_schema = NULL;
-	const GValue *p_table_name = NULL;
-	const GValue *p_column_name = NULL;
-
-	if (check_parameters (context, error, 3,
-			      &p_table_schema, G_TYPE_STRING,
-			      &p_table_name, G_TYPE_STRING, 
-			      &p_column_name, G_TYPE_STRING, NULL,
-			      "table_schema", &p_table_schema, "table_name", &p_table_name, "column_name", &p_column_name, NULL,
-			      "table_schema", &p_table_schema, "table_name", &p_table_name, NULL,
-			      NULL) < 0)
-		return FALSE;
-	
-	/* actual data computation */
+gboolean 
+_gda_sqlite_meta_tables_views_s (GdaServerProvider *prov, GdaConnection *cnc, 
+				 GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+				 const GValue *table_schema, const GValue *table_name)
+{
+	GdaDataModel *tables_model, *views_model;
 	gboolean retval = TRUE;
-	GdaDataModel *mod_model = NULL;
+	tables_model = gda_meta_store_create_modify_data_model (store, "_tables");
+	g_assert (tables_model);
+	views_model = gda_meta_store_create_modify_data_model (store, "_views");
+	g_assert (views_model);
 
-	mod_model = gda_meta_store_create_modify_data_model (store, context->table_name);
-	g_assert (mod_model);
+	if (! fill_tables_views_model (cnc, tables_model, views_model, table_schema, table_name, error))
+		retval = FALSE;
 
-	if (p_table_name) {
-		g_assert (mod_model);
-		retval = update_META_COLUMNS_for_table (cnc, scnc, mod_model, p_table_schema, 
-							p_table_name, p_column_name, error);
+	GdaMetaContext c2;
+	c2 = *context; /* copy contents, just because we need to modify @context->table_name */
+	if (retval) {
+		c2.table_name = "_tables";
+		retval = gda_meta_store_modify_with_context (store, &c2, tables_model, error);
 	}
-	else {
-		GdaDataModel *tmpmodel;
-
-		tmpmodel = gda_connection_get_meta_store_data (cnc, GDA_CONNECTION_META_TABLES, error, 0);
-		if (!tmpmodel)
-			retval = TRUE;
-		else {
-			gint nrows, i;
-			nrows = gda_data_model_get_n_rows (tmpmodel);
-			for (i = 0; i < nrows; i++) {
-				p_table_name = gda_data_model_get_value_at (tmpmodel, 0, i);
-				p_table_schema = gda_data_model_get_value_at (tmpmodel, 1, i);
-				if (!update_META_COLUMNS_for_table (cnc, scnc, mod_model, p_table_schema, 
-								    p_table_name, NULL, error)) {
-					retval = FALSE;
-					break;
-				}
-			}
-			g_object_unref (tmpmodel);
-		}
+	if (retval) {
+		c2.table_name = "_views";
+		retval = gda_meta_store_modify_with_context (store, &c2, views_model, error);
 	}
-	
-	if (retval)
-		retval = gda_meta_store_modify_with_context (store, context, mod_model, error);
-	g_object_unref (mod_model);
+	g_object_unref (tables_model);
+	g_object_unref (views_model);
 
 	return retval;
 }
 
 static gboolean 
-update_META_COLUMNS_for_table (GdaConnection *cnc, SqliteConnectionData *scnc, 
-			       GdaDataModel *mod_model, 
-			       const GValue *p_table_schema, const GValue *p_table_name,
-			       const GValue *p_column_name, GError **error)
+fill_columns_model (GdaConnection *cnc, SqliteConnectionData *cdata, 
+		    GdaDataModel *mod_model, 
+		    const GValue *p_table_schema, const GValue *p_table_name,
+		    const GValue *p_column_name, GError **error)
 {
 	GdaDataModel *tmpmodel;
 	gboolean retval = TRUE;
@@ -535,7 +448,7 @@
 			continue; /* ignore that table */
 		
 		this_col_name = g_value_get_string (this_col_pname);
-		if (sqlite3_table_column_metadata (scnc->connection, g_value_get_string (p_table_schema), 
+		if (sqlite3_table_column_metadata (cdata->connection, g_value_get_string (p_table_schema), 
 						   this_table_name, this_col_name,
 						   &pzDataType, &pzCollSeq, &pNotNull, &pPrimaryKey, &pAutoinc)
 		    != SQLITE_OK) {
@@ -555,7 +468,7 @@
 
 		
 		if (pzDataType)
-			gtype = GPOINTER_TO_INT (g_hash_table_lookup (scnc->types, pzDataType));
+			gtype = GPOINTER_TO_INT (g_hash_table_lookup (cdata->types, pzDataType));
 		if (gtype == 0) {
 			g_warning ("Internal error: could not get GType for DBMS type '%s'", pzDataType);
 			g_value_set_string ((v6 = gda_value_new (G_TYPE_STRING)), "string");
@@ -593,147 +506,76 @@
 	return retval;
 }
 
-/*
- * params: 
- *  - none
- */
-static gboolean
-update_META_BUILTIN_TYPES (GdaSqliteProvider *provider, SqliteConnectionData *scnc, GdaConnection *cnc,
-			   GdaMetaStore *store, GdaMetaContext *context, GError **error)
+gboolean
+_gda_sqlite_meta_columns (GdaServerProvider *prov, GdaConnection *cnc, 
+			  GdaMetaStore *store, GdaMetaContext *context, GError **error)
 {
-	/* actual data computation */
-	GdaDataModel *mod_model;
 	gboolean retval = TRUE;
-	gint i;
-	typedef struct {
-		gchar *tname;
-		gchar *gtype;
-		gchar *comments;
-		gchar *synonyms;
-	} InternalType;
-
-	InternalType internal_types[] = {
-		{"integer", "gint", "Signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value", "int"},
-		{"real", "gdouble",  "Floating point value, stored as an 8-byte IEEE floating point number", NULL},
-		{"text", "string", "Text string, stored using the database encoding", "string"},
-		{"blob", "GdaBinary", "Blob of data, stored exactly as it was input", NULL},
-		{"timestamp", "GdaTimestamp", "Time stamp, stored as 'YYYY-MM-DD HH:MM:SS.SSS'", NULL},
-		{"time", "GdaTime", "Time, stored as 'HH:MM:SS.SSS'", NULL},
-		{"date", "GDate", "Date, stored as 'YYYY-MM-DD'", NULL},
-		{"boolean", "gboolean", "Boolean value", "bool"}
-	};
+	GdaDataModel *mod_model = NULL;
+	SqliteConnectionData *cdata;
+	
+	cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata)
+		return FALSE;
 
 	mod_model = gda_meta_store_create_modify_data_model (store, context->table_name);
 	g_assert (mod_model);
 
-	GValue *vint;
-	g_value_set_boolean (vint = gda_value_new (G_TYPE_BOOLEAN), FALSE);
-	for (i = 0; i < sizeof (internal_types) / sizeof (InternalType); i++) {
-		GValue *v1, *v2, *v3, *v4;
-		InternalType *it = &(internal_types[i]);
-
-		g_value_set_string (v1 = gda_value_new (G_TYPE_STRING), it->tname);
-		g_value_set_string (v2 = gda_value_new (G_TYPE_STRING), it->gtype);
-		g_value_set_string (v3 = gda_value_new (G_TYPE_STRING), it->comments);
-		if (it->synonyms)
-			g_value_set_string (v4 = gda_value_new (G_TYPE_STRING), it->synonyms);
-		else
-			v4 = NULL;
-		
-		if (!append_a_row (mod_model, error, 6,
-				   FALSE, v1, /* short_type_name */
-				   TRUE, v1, /* full_type_name */
-				   TRUE, v2, /* gtype */
-				   TRUE, v3, /* comments */
-				   TRUE, v4, /* synonyms */
-				   FALSE, vint /* internal */)) {
-			retval = FALSE;
-			break;
+	GdaDataModel *tmpmodel;
+	
+	tmpmodel = gda_connection_get_meta_store_data (cnc, GDA_CONNECTION_META_TABLES, error, 0);
+	if (!tmpmodel)
+		retval = TRUE;
+	else {
+		gint nrows, i;
+		nrows = gda_data_model_get_n_rows (tmpmodel);
+		for (i = 0; i < nrows; i++) {
+			const GValue *p_table_name = gda_data_model_get_value_at (tmpmodel, 0, i);
+			const GValue *p_table_schema = gda_data_model_get_value_at (tmpmodel, 1, i);
+			if (!fill_columns_model (cnc, cdata, mod_model, p_table_schema, p_table_name, NULL, error)) {
+				retval = FALSE;
+				break;
+			}
 		}
+		g_object_unref (tmpmodel);
 	}
-	gda_value_free (vint);
+	
 	if (retval)
-		retval = gda_meta_store_modify (store, context->table_name, mod_model, NULL, error, NULL);
+		retval = gda_meta_store_modify_with_context (store, context, mod_model, error);
 	g_object_unref (mod_model);
+
 	return retval;
 }
 
+gboolean
+_gda_sqlite_meta_columns_t (GdaServerProvider *prov, GdaConnection *cnc, 
+			    GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+			    const GValue *table_schema, const GValue *table_name)
+{
+	return _gda_sqlite_meta_columns_c (prov, cnc, store, context, error, table_schema, table_name, NULL);
+}
 
-
-
-
-
-
-
-/*
- *
- */
-static gint
-check_parameters (GdaMetaContext *context, GError **error, gint nb, ...)
+gboolean
+_gda_sqlite_meta_columns_c (GdaServerProvider *prov, GdaConnection *cnc, 
+			    GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+			    const GValue *table_schema, const GValue *table_name, const GValue *column_name)
 {
-#define MAX_PARAMS 10
-	gint i;
-	va_list ap;
-	gint retval = -1;
-	GValue **pvalue;
-	struct {
-		GValue **pvalue;
-		GType    type;
-	} spec_array [MAX_PARAMS];
-	gint nb_params = 0;
-
-	va_start (ap, nb);
-	/* make a list of all the GValue pointers */
-	for (pvalue = va_arg (ap, GValue **); pvalue; pvalue = va_arg (ap, GValue **), nb_params++) {
-		g_assert (nb_params < MAX_PARAMS); /* hard limit, recompile to change it (should never be needed) */
-		spec_array[nb_params].pvalue = pvalue;
-		spec_array[nb_params].type = va_arg (ap, GType);
-	}
+	gboolean retval = TRUE;
+	GdaDataModel *mod_model = NULL;
+	SqliteConnectionData *cdata;
+	
+	cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata)
+		return FALSE;
 
-	/* test against each test case */
-	for (i = 0; i < nb; i++) {
-		gchar *pname;
-		gboolean allfound = TRUE;
-		gint j;
-		for (j = 0; j < nb_params; j++)
-			*(spec_array[j].pvalue) = NULL;
-
-		for (pname = va_arg (ap, gchar*); pname; pname = va_arg (ap, gchar*)) {
-			gint j;
-			pvalue = va_arg (ap, GValue **);
-			*pvalue = NULL;
-			for (j = 0; allfound && (j < context->size); j++) {
-				if (!strcmp (context->column_names[j], pname)) {
-					*pvalue = context->column_values[j];
-					break;
-				}
-			}
-			if (j == context->size)
-				allfound = FALSE;
-		}
-		if (allfound) {
-			retval = i;
-			break;
-		}
-	}
-	va_end (ap);
+	mod_model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (mod_model);
 
-	if (retval >= 0) {
-		gint j;
-		for (j = 0; j < nb_params; j++) {
-			GValue *v = *(spec_array[j].pvalue);
-			if (v && (gda_value_is_null (v) || (G_VALUE_TYPE (v) != spec_array[j].type))) {
-				g_set_error (error, 0, 0,
-					     _("Invalid argument"));
-				retval = -1;
-			}
-		}
-	}
-	else 
-		g_set_error (error, 0, 0,
-			     _("Missing and/or wrong arguments"));
+	retval = fill_columns_model (cnc, cdata, mod_model, table_schema, table_name, column_name, error);	
+	if (retval)
+		retval = gda_meta_store_modify_with_context (store, context, mod_model, error);
+	g_object_unref (mod_model);
 
-	g_print ("Check context => %d\n", retval);
 	return retval;
 }
 

Modified: branches/V4-branch/libgda/sqlite/gda-sqlite-meta.h
==============================================================================
--- branches/V4-branch/libgda/sqlite/gda-sqlite-meta.h	(original)
+++ branches/V4-branch/libgda/sqlite/gda-sqlite-meta.h	Thu Feb 14 18:20:30 2008
@@ -26,10 +26,27 @@
 
 G_BEGIN_DECLS
 
-void     _gda_sqlite_provider_meta_init   (GdaServerProvider *provider);
-gboolean _gda_sqlite_provider_meta_update (GdaServerProvider *provider, GdaConnection *cnc,
-					   GdaMetaContext *context, GError **error);
-
+void     _gda_sqlite_provider_meta_init (GdaServerProvider *provider);
+gboolean _gda_sqlite_meta_info          (GdaServerProvider *prov, GdaConnection *cnc, 
+					 GdaMetaStore *store, GdaMetaContext *context, GError **error);
+gboolean _gda_sqlite_meta_btypes        (GdaServerProvider *prov, GdaConnection *cnc, 
+					 GdaMetaStore *store, GdaMetaContext *context, GError **error);
+gboolean _gda_sqlite_meta_schemata      (GdaServerProvider *prov, GdaConnection *cnc, 
+					 GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+					 const GValue *schema_name);
+gboolean _gda_sqlite_meta_tables_views  (GdaServerProvider *prov, GdaConnection *cnc, 
+					 GdaMetaStore *store, GdaMetaContext *context, GError **error);
+gboolean _gda_sqlite_meta_tables_views_s(GdaServerProvider *prov, GdaConnection *cnc, 
+					 GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+					 const GValue *table_schema, const GValue *table_name);
+gboolean _gda_sqlite_meta_columns        (GdaServerProvider *prov, GdaConnection *cnc, 
+					  GdaMetaStore *store, GdaMetaContext *context, GError **error);
+gboolean _gda_sqlite_meta_columns_t      (GdaServerProvider *prov, GdaConnection *cnc, 
+					  GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+					  const GValue *table_schema, const GValue *table_name);
+gboolean _gda_sqlite_meta_columns_c      (GdaServerProvider *prov, GdaConnection *cnc, 
+					  GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+					  const GValue *table_schema, const GValue *table_name, const GValue *column_name);
 
 G_END_DECLS
 

Modified: branches/V4-branch/libgda/sqlite/gda-sqlite-provider.c
==============================================================================
--- branches/V4-branch/libgda/sqlite/gda-sqlite-provider.c	(original)
+++ branches/V4-branch/libgda/sqlite/gda-sqlite-provider.c	Thu Feb 14 18:20:30 2008
@@ -36,12 +36,7 @@
 #include "gda-sqlite-recordset.h"
 #include "gda-sqlite-ddl.h"
 #include "gda-sqlite-meta.h"
-#include <libgda/handlers/gda-handler-numerical.h>
 #include "gda-sqlite-handler-bin.h"
-#include <libgda/handlers/gda-handler-boolean.h>
-#include <libgda/handlers/gda-handler-time.h>
-#include <libgda/handlers/gda-handler-string.h>
-#include <libgda/handlers/gda-handler-type.h>
 #include <libgda/gda-connection-private.h>
 #include <libgda/binreloc/gda-binreloc.h>
 #include <libgda/gda-set.h>
@@ -56,7 +51,7 @@
 
 #define FILE_EXTENSION ".db"
 #ifdef HAVE_SQLITE
-static SqliteConnectionData *opening_scnc = NULL;
+static SqliteConnectionData *opening_cdata = NULL;
 static GHashTable *db_connections_hash = NULL;
 #endif
 
@@ -66,7 +61,6 @@
 static void gda_sqlite_provider_class_init (GdaSqliteProviderClass *klass);
 static void gda_sqlite_provider_init       (GdaSqliteProvider *provider,
 					    GdaSqliteProviderClass *klass);
-static void gda_sqlite_provider_finalize   (GObject *object);
 static GObjectClass *parent_class = NULL;
 
 /*
@@ -84,9 +78,6 @@
 								   GdaConnection *cnc);
 static const gchar        *gda_sqlite_provider_get_database (GdaServerProvider *provider,
 							     GdaConnection *cnc);
-static gboolean            gda_sqlite_provider_change_database (GdaServerProvider *provider,
-								GdaConnection *cnc,
-								const gchar *name);
 
 /* DDL operations */
 static gboolean            gda_sqlite_provider_supports_operation (GdaServerProvider *provider, GdaConnection *cnc,
@@ -144,7 +135,7 @@
 /* 
  * private connection data destroy 
  */
-static void gda_sqlite_free_cnc (SqliteConnectionData *scnc);
+static void gda_sqlite_free_cnc_data (SqliteConnectionData *cdata);
 
 /* 
  * extending SQLite with our own functions 
@@ -164,6 +155,8 @@
 /*
  * Prepared internal statements
  */
+GdaStatement **internal_stmt;
+
 typedef enum {
 	INTERNAL_PRAGMA_INDEX_LIST,
 	INTERNAL_PRAGMA_INDEX_INFO,
@@ -200,8 +193,6 @@
 	"ROLLBACK TRANSACTION ##name::string"
 };
 
-GdaStatement **internal_stmt;
-
 /*
  * GdaSqliteProvider class implementation
  */
@@ -209,27 +200,22 @@
 static void
 gda_sqlite_provider_class_init (GdaSqliteProviderClass *klass)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 	GdaServerProviderClass *provider_class = GDA_SERVER_PROVIDER_CLASS (klass);
 
 	parent_class = g_type_class_peek_parent (klass);
 
-	object_class->finalize = gda_sqlite_provider_finalize;
-
 	provider_class->get_version = gda_sqlite_provider_get_version;
 	provider_class->get_server_version = gda_sqlite_provider_get_server_version;
 	provider_class->get_name = gda_sqlite_provider_get_name;
 	provider_class->supports_feature = gda_sqlite_provider_supports;
 
 	provider_class->get_data_handler = gda_sqlite_provider_get_data_handler;
-	provider_class->string_to_value = NULL;
 	provider_class->get_def_dbms_type = gda_sqlite_provider_get_default_dbms_type;
 
 	provider_class->create_connection = NULL;
 	provider_class->open_connection = gda_sqlite_provider_open_connection;
 	provider_class->close_connection = gda_sqlite_provider_close_connection;
 	provider_class->get_database = gda_sqlite_provider_get_database;
-	provider_class->change_database = gda_sqlite_provider_change_database;
 
 	provider_class->supports_operation = gda_sqlite_provider_supports_operation;
         provider_class->create_operation = gda_sqlite_provider_create_operation;
@@ -248,7 +234,15 @@
 	provider_class->statement_prepare = gda_sqlite_provider_statement_prepare;
 	provider_class->statement_execute = gda_sqlite_provider_statement_execute;
 
-	provider_class->meta_update = _gda_sqlite_provider_meta_update;
+	memset (&(provider_class->meta_funcs), 0, sizeof (GdaServerProviderMeta));
+	provider_class->meta_funcs.info = _gda_sqlite_meta_info;
+	provider_class->meta_funcs.btypes = _gda_sqlite_meta_btypes;
+	provider_class->meta_funcs.schemata = _gda_sqlite_meta_schemata;
+	provider_class->meta_funcs.tables_views = _gda_sqlite_meta_tables_views;
+	provider_class->meta_funcs.tables_views_s = _gda_sqlite_meta_tables_views_s;
+	provider_class->meta_funcs.columns = _gda_sqlite_meta_columns;
+	provider_class->meta_funcs.columns_t = _gda_sqlite_meta_columns_t;
+	provider_class->meta_funcs.columns_c = _gda_sqlite_meta_columns_c;
 }
 
 static void
@@ -269,17 +263,6 @@
 	_gda_sqlite_provider_meta_init ((GdaServerProvider*) sqlite_prv);
 }
 
-static void
-gda_sqlite_provider_finalize (GObject *object)
-{
-	GdaSqliteProvider *sqlite_prv = (GdaSqliteProvider *) object;
-
-	g_return_if_fail (GDA_IS_SQLITE_PROVIDER (sqlite_prv));
-
-	/* chain to parent class */
-	parent_class->finalize (object);
-}
-
 GType
 gda_sqlite_provider_get_type (void)
 {
@@ -303,16 +286,18 @@
 	return type;
 }
 
-GdaServerProvider *
-gda_sqlite_provider_new (void)
+/*
+ * Get provider name request
+ */
+static const gchar *
+gda_sqlite_provider_get_name (GdaServerProvider *provider)
 {
-	GdaSqliteProvider *provider;
-
-	provider = g_object_new (gda_sqlite_provider_get_type (), NULL);
-	return GDA_SERVER_PROVIDER (provider);
+	return "SQLite";
 }
 
-/* get_version handler for the GdaSqliteProvider class */
+/* 
+ * Get provider's version
+ */
 static const gchar *
 gda_sqlite_provider_get_version (GdaServerProvider *provider)
 {
@@ -321,11 +306,24 @@
 
 #ifndef G_OS_WIN32
 #ifdef HAVE_SQLITE
+static void
+add_g_list_row (gpointer data, GdaDataModelArray *recset)
+{
+        GList *rowlist = data;
+        GError *error = NULL;
+        if (gda_data_model_append_values (GDA_DATA_MODEL (recset), rowlist, &error) < 0) {
+                g_warning ("Data model append error: %s\n", error && error->message ? error->message : "no detail");
+                g_error_free (error);
+        }
+        g_list_foreach (rowlist, (GFunc) gda_value_free, NULL);
+        g_list_free (rowlist);
+}
+
 int sqlite3CreateFunc (sqlite3 *db, const char *name, int nArg, int eTextRep, void *data,
 		       void (*xFunc)(sqlite3_context*,int,sqlite3_value **),
 		       void (*xStep)(sqlite3_context*,int,sqlite3_value **), void (*xFinal)(sqlite3_context*))
 {
-	SqliteConnectionData *scnc = NULL;
+	SqliteConnectionData *cdata = NULL;
 	gboolean is_func = FALSE;
 	gboolean is_agg = FALSE;
 	GdaDataModelArray *recset = NULL;
@@ -342,33 +340,33 @@
 
 	/* try to find which SqliteConnectionData this concerns */
 	if (db_connections_hash) 
-		scnc = g_hash_table_lookup (db_connections_hash, db);
-	if (!scnc)
-		scnc = opening_scnc;
-	if (!scnc)
+		cdata = g_hash_table_lookup (db_connections_hash, db);
+	if (!cdata)
+		cdata = opening_cdata;
+	if (!cdata)
 		return func (db, name, nArg, eTextRep, data, xFunc, xStep, xFinal);
 
 	if (xFunc) {
 		/* It's a function */
-		recset = (GdaDataModelArray *) scnc->functions_model;
+		recset = (GdaDataModelArray *) cdata->functions_model;
 		if (!recset) {
 			recset = GDA_DATA_MODEL_ARRAY (gda_data_model_array_new 
 						       (gda_server_provider_get_schema_nb_columns (GDA_CONNECTION_SCHEMA_PROCEDURES)));
 			g_assert (gda_server_provider_init_schema_model (GDA_DATA_MODEL (recset), 
 									 GDA_CONNECTION_SCHEMA_PROCEDURES));
-			scnc->functions_model = (GdaDataModel *) recset;
+			cdata->functions_model = (GdaDataModel *) recset;
 		}
 		is_func = TRUE;
 	}
 	else if (xStep && xFinal) {
 		/* It's an aggregate */
-		recset = (GdaDataModelArray *) scnc->aggregates_model;
+		recset = (GdaDataModelArray *) cdata->aggregates_model;
 		if (!recset) {
 			recset = GDA_DATA_MODEL_ARRAY (gda_data_model_array_new 
 						       (gda_server_provider_get_schema_nb_columns (GDA_CONNECTION_SCHEMA_AGGREGATES)));
 			g_assert (gda_server_provider_init_schema_model (GDA_DATA_MODEL (recset), 
 									 GDA_CONNECTION_SCHEMA_AGGREGATES));
-			scnc->aggregates_model = (GdaDataModel *) recset;
+			cdata->aggregates_model = (GdaDataModel *) recset;
 		}
 		is_agg = TRUE;
 	}
@@ -382,20 +380,20 @@
 		g_value_set_string (value = gda_value_new (G_TYPE_STRING), name);
 		values = g_slist_prepend (NULL, value);
 		
-		if (scnc->functions_model) {
-			row = gda_data_model_get_row_from_values (scnc->functions_model, values, cols_index);
+		if (cdata->functions_model) {
+			row = gda_data_model_get_row_from_values (cdata->functions_model, values, cols_index);
 			if (row >= 0) {
-				g_object_set (G_OBJECT (scnc->functions_model), "read-only", FALSE, NULL);
-				g_assert (gda_data_model_remove_row (scnc->functions_model, row, NULL));
-				g_object_set (G_OBJECT (scnc->functions_model), "read-only", TRUE, NULL);
+				g_object_set (G_OBJECT (cdata->functions_model), "read-only", FALSE, NULL);
+				g_assert (gda_data_model_remove_row (cdata->functions_model, row, NULL));
+				g_object_set (G_OBJECT (cdata->functions_model), "read-only", TRUE, NULL);
 			}
 		}
-		if (scnc->aggregates_model) {
-			row = gda_data_model_get_row_from_values (scnc->aggregates_model, values, cols_index);
+		if (cdata->aggregates_model) {
+			row = gda_data_model_get_row_from_values (cdata->aggregates_model, values, cols_index);
 			if (row >= 0) {
-				g_object_set (G_OBJECT (scnc->aggregates_model), "read-only", FALSE, NULL);
-				g_assert (gda_data_model_remove_row (scnc->aggregates_model, row, NULL));
-				g_object_set (G_OBJECT (scnc->aggregates_model), "read-only", TRUE, NULL);
+				g_object_set (G_OBJECT (cdata->aggregates_model), "read-only", FALSE, NULL);
+				g_assert (gda_data_model_remove_row (cdata->aggregates_model, row, NULL));
+				g_object_set (G_OBJECT (cdata->aggregates_model), "read-only", TRUE, NULL);
 			}
 		}
 
@@ -477,7 +475,9 @@
 #endif
 #endif
 
-/* open_connection handler for the GdaSqliteProvider class */
+/* 
+ * Open connection request
+ */
 static gboolean
 gda_sqlite_provider_open_connection (GdaServerProvider *provider,
 				     GdaConnection *cnc,
@@ -485,12 +485,13 @@
 				     const gchar *username,
 				     const gchar *password)
 {
+	static gint nb_opened = 1;
 	gchar *filename = NULL;
 	const gchar *dirname = NULL, *dbname = NULL;
 	const gchar *is_virtual = NULL;
 	const gchar *use_extra_functions = NULL;
 	gint errmsg;
-	SqliteConnectionData *scnc;
+	SqliteConnectionData *cdata;
 	gchar *dup = NULL;
 
 	g_return_val_if_fail (GDA_IS_SQLITE_PROVIDER (provider), FALSE);
@@ -576,32 +577,33 @@
 		}
 	}
 
-	scnc = g_new0 (SqliteConnectionData, 1);
+	cdata = g_new0 (SqliteConnectionData, 1);
 #ifdef HAVE_SQLITE
-	opening_scnc = scnc;
+	opening_cdata = cdata;
 #endif
 
-	errmsg = sqlite3_open (filename, &scnc->connection);
+	errmsg = sqlite3_open (filename, &cdata->connection);
+	g_print ("SQLite opened %d connection(s)\n", nb_opened++);
+
 	if (filename)
-		scnc->file = g_strdup (filename);
+		cdata->file = g_strdup (filename);
 
 	if (errmsg != SQLITE_OK) {
-		printf("error %s", sqlite3_errmsg (scnc->connection));
-		gda_connection_add_event_string (cnc, sqlite3_errmsg (scnc->connection));
-		gda_sqlite_free_cnc (scnc);
+		gda_connection_add_event_string (cnc, sqlite3_errmsg (cdata->connection));
+		gda_sqlite_free_cnc_data (cdata);
 			
 #ifdef HAVE_SQLITE
-		opening_scnc = NULL;
+		opening_cdata = NULL;
 #endif
 		return FALSE;
 	}
-	gda_connection_internal_set_provider_data (cnc, scnc, (GDestroyNotify) gda_sqlite_free_cnc);
+	gda_connection_internal_set_provider_data (cnc, cdata, (GDestroyNotify) gda_sqlite_free_cnc_data);
 
 	/* use extended result codes */
-	sqlite3_extended_result_codes (scnc->connection, 1);
+	sqlite3_extended_result_codes (cdata->connection, 1);
 	
 	/* allow a busy timeout of 500 ms */
-	sqlite3_busy_timeout (scnc->connection, 500);
+	sqlite3_busy_timeout (cdata->connection, 500);
 
 	/* try to prepare all the internal statements */
 	InternalStatementItem i;
@@ -625,7 +627,7 @@
 		gint status;
 		gchar *errmsg;
 		
-		status = sqlite3_get_table (scnc->connection, "SELECT name"
+		status = sqlite3_get_table (cdata->connection, "SELECT name"
 					    " FROM (SELECT * FROM sqlite_master UNION ALL "
 					    "       SELECT * FROM sqlite_temp_master)",
 					    &data,
@@ -637,10 +639,10 @@
 		else {
 			gda_connection_add_event_string (cnc, errmsg);
 			sqlite3_free (errmsg);
-			gda_sqlite_free_cnc (scnc);
-			gda_connection_internal_set_provider_data (cnc, NULL, (GDestroyNotify) gda_sqlite_free_cnc);
+			gda_sqlite_free_cnc_data (cdata);
+			gda_connection_internal_set_provider_data (cnc, NULL, (GDestroyNotify) gda_sqlite_free_cnc_data);
 #ifdef HAVE_SQLITE
-			opening_scnc = NULL;
+			opening_cdata = NULL;
 #endif
 			return FALSE;
 		}
@@ -651,14 +653,14 @@
 
 		for (i = 0; i < sizeof (scalars) / sizeof (ScalarFunction); i++) {
 			ScalarFunction *func = (ScalarFunction *) &(scalars [i]);
-			gint res = sqlite3_create_function (scnc->connection, 
+			gint res = sqlite3_create_function (cdata->connection, 
 							    func->name, func->nargs, SQLITE_UTF8, func->user_data, 
 							    func->xFunc, NULL, NULL);
 			if (res != SQLITE_OK) {
-				gda_sqlite_free_cnc (scnc);
-				gda_connection_internal_set_provider_data (cnc, NULL, (GDestroyNotify) gda_sqlite_free_cnc);
+				gda_sqlite_free_cnc_data (cdata);
+				gda_connection_internal_set_provider_data (cnc, NULL, (GDestroyNotify) gda_sqlite_free_cnc_data);
 #ifdef HAVE_SQLITE
-				opening_scnc = NULL;
+				opening_cdata = NULL;
 #endif
 				return FALSE;
 			}
@@ -666,72 +668,65 @@
 	}
 
 #ifdef HAVE_SQLITE
-	/* add the (scnc->connection, scnc) to db_connections_hash */
+	/* add the (cdata->connection, cdata) to db_connections_hash */
 	if (!db_connections_hash)
 		db_connections_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
-	g_hash_table_insert (db_connections_hash, scnc->connection, scnc);
+	g_hash_table_insert (db_connections_hash, cdata->connection, cdata);
 #endif
 
 	return TRUE;
 }
 
-/* close_connection handler for the GdaSqliteProvider class */
+/* 
+ * Close connection request
+ */
 static gboolean
-gda_sqlite_provider_close_connection (GdaServerProvider *provider,
-				      GdaConnection *cnc)
+gda_sqlite_provider_close_connection (GdaServerProvider *provider, GdaConnection *cnc)
 {
-	GdaSqliteProvider *sqlite_prv = (GdaSqliteProvider *) provider;
-
-	g_return_val_if_fail (GDA_IS_SQLITE_PROVIDER (sqlite_prv), FALSE);
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
 
 	/* nothing specific to do */
 	return TRUE;
 }
 
+/*
+ * Server version request
+ */
 static const gchar *
-gda_sqlite_provider_get_server_version (GdaServerProvider *provider,
-					GdaConnection *cnc)
+gda_sqlite_provider_get_server_version (GdaServerProvider *provider, GdaConnection *cnc)
 {
 	static gchar *version_string = NULL;
 
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
+
 	if (!version_string)
 		version_string = g_strdup_printf ("SQLite version %s", SQLITE_VERSION);
 
 	return (const gchar *) version_string;
 }
 
+/*
+ * Get database request
+ */
 static const gchar *
-gda_sqlite_provider_get_database (GdaServerProvider *provider,
-				  GdaConnection *cnc)
+gda_sqlite_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
 {
-	GdaSqliteProvider *sqlite_prv = (GdaSqliteProvider *) provider;
-	SqliteConnectionData *scnc;
+	SqliteConnectionData *cdata;
 
-	g_return_val_if_fail (GDA_IS_SQLITE_PROVIDER (sqlite_prv), NULL);
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
 
-	scnc = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
-	if (!scnc) 
+	cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
 		return NULL;
-	else
-		return scnc->file;
-}
-
-static gboolean
-gda_sqlite_provider_change_database (GdaServerProvider *provider,
-				     GdaConnection *cnc,
-				     const gchar *name)
-{
-	GdaSqliteProvider *sqlite_prv = (GdaSqliteProvider *) provider;
-
-	g_return_val_if_fail (GDA_IS_SQLITE_PROVIDER (sqlite_prv), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-
-	gda_connection_add_event_string (cnc, _("Only one database per connection is allowed"));
-	return FALSE;
+	return cdata->file;
 }
 
+/*
+ * Support operation request
+ */
 static gboolean
 gda_sqlite_provider_supports_operation (GdaServerProvider *provider, GdaConnection *cnc,
 					GdaServerOperationType type, GdaSet *options)
@@ -757,6 +752,9 @@
         }
 }
 
+/*
+ * Create operation request
+ */
 static GdaServerOperation *
 gda_sqlite_provider_create_operation (GdaServerProvider *provider, GdaConnection *cnc,
 				      GdaServerOperationType type,
@@ -787,15 +785,19 @@
         return op;
 }
 
+/*
+ * Render operation request
+ */
 static gchar *
 gda_sqlite_provider_render_operation (GdaServerProvider *provider, GdaConnection *cnc,
-                                     GdaServerOperation *op, GError **error)
+				      GdaServerOperation *op, GError **error)
 {
         gchar *sql = NULL;
         gchar *file;
         gchar *str;
 	gchar *dir;
 
+	/* test @op's validity */
         file = g_utf8_strdown (gda_server_operation_op_type_to_string (gda_server_operation_get_op_type (op)), -1);
         str = g_strdup_printf ("sqlite_specs_%s.xml", file);
         g_free (file);
@@ -815,6 +817,7 @@
         }
         g_free (file);
 
+	/* actual rendering */
         switch (gda_server_operation_get_op_type (op)) {
         case GDA_SERVER_OPERATION_CREATE_DB:
         case GDA_SERVER_OPERATION_DROP_DB:
@@ -851,6 +854,9 @@
         return sql;
 }
 
+/*
+ * Perform operation request
+ */
 static gboolean
 gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnection *cnc,
                                       GdaServerOperation *op, GError **error)
@@ -863,7 +869,7 @@
 		const GValue *value;
 		const gchar *dbname = NULL;
 		const gchar *dir = NULL;
-		SqliteConnectionData *scnc;
+		SqliteConnectionData *cdata;
 		gint errmsg;
 		gchar *filename, *tmp;
 		gboolean retval = TRUE;
@@ -879,15 +885,15 @@
 		filename = g_build_filename (dir, tmp, NULL);
 		g_free (tmp);
 
-		scnc = g_new0 (SqliteConnectionData, 1);
-		errmsg = sqlite3_open (filename, &scnc->connection);
+		cdata = g_new0 (SqliteConnectionData, 1);
+		errmsg = sqlite3_open (filename, &cdata->connection);
 		g_free (filename);
 
 		if (errmsg != SQLITE_OK) {
-			g_set_error (error, 0, 0, sqlite3_errmsg (scnc->connection)); 
+			g_set_error (error, 0, 0, sqlite3_errmsg (cdata->connection)); 
 			retval = FALSE;
 		}
-		gda_sqlite_free_cnc (scnc);
+		gda_sqlite_free_cnc_data (cdata);
 
 		return retval;
         }
@@ -918,41 +924,17 @@
 		
 		return retval;
 	}
-        default: {
+        default: 
                 /* use the SQL from the provider to perform the action */
-                gchar *sql;
-		GdaStatement *stmt;
-		GdaSqlParser *parser;
-		gboolean retval = FALSE;
-		
-		parser = g_object_get_data (G_OBJECT (provider), "_gda_parser");
-		if (!parser) {
-			parser = gda_server_provider_create_parser (provider, NULL);
-			g_assert (parser);
-			g_object_set_data_full (G_OBJECT (provider), "_gda_parser", parser, g_object_unref);
-		}
-
-                sql = gda_server_provider_render_operation (provider, cnc, op, error);
-                if (!sql)
-                        return FALSE;
-		stmt = gda_sql_parser_parse_string (parser, sql, NULL, NULL);
-		if (stmt) {
-			if (gda_connection_statement_execute_non_select (cnc, stmt, NULL, NULL, NULL) != -1) 
-				retval = TRUE;
-			g_object_unref (stmt);
-		}
-		if (!retval) 
-			g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_OPERATION_ERROR,
-				     _("Internal error with generated SQL: %s"), sql);
-		g_free (sql);
-		return retval;
-	}
+		return gda_server_provider_perform_operation_default (provider, cnc, op, error);
 	}
 }
 
+/*
+ * Begin transaction request
+ */
 static gboolean
-gda_sqlite_provider_begin_transaction (GdaServerProvider *provider,
-				       GdaConnection *cnc,
+gda_sqlite_provider_begin_transaction (GdaServerProvider *provider, GdaConnection *cnc,
 				       const gchar *name, GdaTransactionIsolation level,
 				       GError **error)
 {
@@ -960,6 +942,7 @@
 	static GdaSet *params_set = NULL;
 
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
 
 	if (gda_connection_get_options (cnc) & GDA_CONNECTION_OPTIONS_READ_ONLY) {
 		gda_connection_add_event_string (cnc, _("Transactions are not supported in read-only mode"));
@@ -984,15 +967,18 @@
 	return status;
 }
 
+/*
+ * Commit transaction request
+ */
 static gboolean
-gda_sqlite_provider_commit_transaction (GdaServerProvider *provider,
-					GdaConnection *cnc,
+gda_sqlite_provider_commit_transaction (GdaServerProvider *provider, GdaConnection *cnc,
 					const gchar *name, GError **error)
 {
 	gboolean status = TRUE;
 	static GdaSet *params_set = NULL;
 
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
 
 	if (name) {
 		if (!params_set)
@@ -1012,6 +998,9 @@
 	return status;
 }
 
+/*
+ * Rollback transaction request
+ */
 static gboolean
 gda_sqlite_provider_rollback_transaction (GdaServerProvider *provider,
 					  GdaConnection *cnc,
@@ -1021,6 +1010,7 @@
 	static GdaSet *params_set = NULL;
 
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
 
 	if (name) {
 		if (!params_set)
@@ -1040,14 +1030,18 @@
 	return status;
 }
 
+/*
+ * Feature support request
+ */
 static gboolean
 gda_sqlite_provider_supports (GdaServerProvider *provider,
 			      GdaConnection *cnc,
 			      GdaConnectionFeature feature)
 {
-	GdaSqliteProvider *sqlite_prv = (GdaSqliteProvider *) provider;
-
-	g_return_val_if_fail (GDA_IS_SQLITE_PROVIDER (sqlite_prv), FALSE);
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	}
 
 	switch (feature) {
 	case GDA_CONNECTION_FEATURE_SQL :
@@ -1058,59 +1052,30 @@
 	case GDA_CONNECTION_FEATURE_VIEWS :
 	case GDA_CONNECTION_FEATURE_PROCEDURES :
 		return TRUE;
-	default: ;
+	default: 
+		return FALSE;
 	}
-
-	return FALSE;
-}
-
-static const gchar *
-gda_sqlite_provider_get_name (GdaServerProvider *provider)
-{
-	return "SQLite";
 }
 
+/*
+ * Get data handler request
+ */
 static GdaDataHandler *
-gda_sqlite_provider_get_data_handler (GdaServerProvider *provider,
-				      GdaConnection *cnc,
-				      GType type,
-				      const gchar *dbms_type)
+gda_sqlite_provider_get_data_handler (GdaServerProvider *provider, GdaConnection *cnc,
+				      GType type, const gchar *dbms_type)
 {
 	GdaDataHandler *dh = NULL;
 
-	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
-	if (cnc) 
+	if (cnc) {
 		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	}
 
-        if ((type == G_TYPE_INT64) ||
-	    (type == G_TYPE_UINT64) ||
-	    (type == G_TYPE_DOUBLE) ||
-	    (type == G_TYPE_INT) ||
-	    (type == GDA_TYPE_NUMERIC) ||
-	    (type == G_TYPE_FLOAT) ||
-	    (type == GDA_TYPE_SHORT) ||
-	    (type == GDA_TYPE_USHORT) ||
-	    (type == G_TYPE_CHAR) ||
-	    (type == G_TYPE_UCHAR) ||
-	    (type == G_TYPE_UINT)) {
-		dh = gda_server_provider_handler_find (provider, NULL, type, NULL);
-		if (!dh) {
-			dh = gda_handler_numerical_new ();
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_INT64, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_UINT64, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_DOUBLE, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_INT, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, GDA_TYPE_NUMERIC, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_FLOAT, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, GDA_TYPE_SHORT, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, GDA_TYPE_USHORT, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_CHAR, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_UCHAR, NULL);
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_UINT, NULL);
-			g_object_unref (dh);
-		}
+	if (type == G_TYPE_INVALID) {
+		TO_IMPLEMENT; /* use @dbms_type */
+		dh = NULL;
 	}
-        else if (type == GDA_TYPE_BINARY) {
+	else if (type == GDA_TYPE_BINARY) {
 		dh = gda_server_provider_handler_find (provider, cnc, type, NULL);
 		if (!dh) {
 			dh = gda_sqlite_handler_bin_new ();
@@ -1120,14 +1085,6 @@
 			}
 		}
 	}
-        else if (type == G_TYPE_BOOLEAN) {
-		dh = gda_server_provider_handler_find (provider, NULL, type, NULL);
-		if (!dh) {
-			dh = gda_handler_boolean_new ();
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_BOOLEAN, NULL);
-			g_object_unref (dh);
-		}
-	}
 	else if ((type == GDA_TYPE_TIME) ||
 		 (type == GDA_TYPE_TIMESTAMP) ||
 		 (type == G_TYPE_DATE)) {
@@ -1143,38 +1100,18 @@
 			g_object_unref (dh);
 		}
 	}
-	else if (type == G_TYPE_STRING) {
-		dh = gda_server_provider_handler_find (provider, NULL, type, NULL);
-		if (!dh) {
-			dh = gda_handler_string_new ();
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_STRING, NULL);
-			g_object_unref (dh);
-		}
-	}
-	else if (type == G_TYPE_ULONG) {
-		dh = gda_server_provider_handler_find (provider, NULL, type, NULL);
-		if (!dh) {
-			dh = gda_handler_type_new ();
-			gda_server_provider_handler_declare (provider, dh, NULL, G_TYPE_ULONG, NULL);
-			g_object_unref (dh);
-		}
-	}
-	else {
-		/* special case) || we take into account the dbms_type argument */
-		if (dbms_type)
-			TO_IMPLEMENT;
-	}
+	else
+		dh = gda_server_provider_get_data_handler_default (provider, cnc, type, dbms_type);
 
 	return dh;	
 }
 
+/*
+ * Get default DBMS type request
+ */
 static const gchar*
-gda_sqlite_provider_get_default_dbms_type (GdaServerProvider *provider,
-					   GdaConnection *cnc,
-					   GType type)
+gda_sqlite_provider_get_default_dbms_type (GdaServerProvider *provider, GdaConnection *cnc, GType type)
 {
-	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
-
 	if ((type == G_TYPE_INT64) ||
 	    (type == G_TYPE_INT) ||
 	    (type == GDA_TYPE_SHORT) ||
@@ -1217,15 +1154,59 @@
 	return "text";
 }
 
+/*
+ * Create parser request
+ */
 static GdaSqlParser *
 gda_sqlite_provider_create_parser (GdaServerProvider *provider, GdaConnection *cnc)
 {
-	g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
 	return (GdaSqlParser*) g_object_new (GDA_TYPE_SQL_PARSER, "tokenizer-flavour", GDA_SQL_PARSER_FLAVOUR_SQLITE, NULL);
 }
 
+
+/*
+ * GdaStatement to SQL request
+ */
+static gchar * sqlite_render_statement (GdaSqlOperation *op, GdaSqlRenderingContext *context, GError **error);
 static gchar *
-sqlite_render_operation (GdaSqlOperation *op, GdaSqlRenderingContext *context, GError **error)
+gda_sqlite_provider_statement_to_sql (GdaServerProvider *provider, GdaConnection *cnc,
+				      GdaStatement *stmt, GdaSet *params, GdaStatementSqlFlag flags,
+				      GSList **params_used, GError **error)
+{
+	gchar *str;
+	GdaSqlRenderingContext context;
+
+	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL);
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
+	}
+
+	memset (&context, 0, sizeof (context));
+	context.params = params;
+	context.flags = flags;
+	context.render_operation = (GdaSqlRenderingFunc) sqlite_render_statement; /* only this part of the context is 
+										   * modified for SQLite, other rendering
+										   * is the default */
+
+	str = gda_statement_to_sql_real (stmt, &context, error);
+
+	if (str) {
+		if (params_used)
+			*params_used = context.params_used;
+		else
+			g_slist_free (context.params_used);
+	}
+	else {
+		if (params_used)
+			*params_used = NULL;
+		g_slist_free (context.params_used);
+	}
+	return str;
+}
+
+static gchar *
+sqlite_render_statement (GdaSqlOperation *op, GdaSqlRenderingContext *context, GError **error)
 {
 	gchar *str;
 	GSList *list;
@@ -1410,46 +1391,39 @@
 	return str;
 }
 
-static gchar *
-gda_sqlite_provider_statement_to_sql (GdaServerProvider *provider, GdaConnection *cnc,
-				      GdaStatement *stmt, GdaSet *params, GdaStatementSqlFlag flags,
-				      GSList **params_used, GError **error)
+/*
+ * Statement prepare request
+ */
+static GdaSqlitePStmt *real_prepare (GdaServerProvider *provider, GdaConnection *cnc, GdaStatement *stmt, GError **error);
+static gboolean
+gda_sqlite_provider_statement_prepare (GdaServerProvider *provider, GdaConnection *cnc,
+				       GdaStatement *stmt, GError **error)
 {
-	gchar *str;
-	GdaSqlRenderingContext context;
-
-	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL);
-	if (cnc) {
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
-	}
+	GdaSqlitePStmt *ps;
 
-	memset (&context, 0, sizeof (context));
-	context.params = params;
-	context.flags = flags;
-	context.render_operation = (GdaSqlRenderingFunc) sqlite_render_operation;
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), FALSE);
 
-	str = gda_statement_to_sql_real (stmt, &context, error);
+	/* fetch prepares stmt if already done */
+	ps = gda_connection_get_prepared_statement (cnc, stmt);
+	if (ps)
+		return TRUE;
 
-	if (str) {
-		if (params_used)
-			*params_used = context.params_used;
-		else
-			g_slist_free (context.params_used);
-	}
+	ps = real_prepare (provider, cnc, stmt, error);
+	if (!ps)
+		return FALSE;
 	else {
-		if (params_used)
-			*params_used = NULL;
-		g_slist_free (context.params_used);
+		gda_connection_add_prepared_statement (cnc, stmt, ps);
+		return TRUE;
 	}
-	return str;
 }
 
 static GdaSqlitePStmt *
 real_prepare (GdaServerProvider *provider, GdaConnection *cnc, GdaStatement *stmt, GError **error)
 {
 	int status;
-	SqliteConnectionData *scnc;
+	SqliteConnectionData *cdata;
 	sqlite3_stmt *sqlite_stmt;
 	gchar *sql;
 	const char *left;
@@ -1458,8 +1432,8 @@
 	GSList *used_params = NULL;
 
 	/* get SQLite's private data */
-	scnc = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
-	if (!scnc) 
+	cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
 		return NULL;
 
 	/* render as SQL understood by SQLite */
@@ -1472,10 +1446,10 @@
 		goto out_err;
 
 	/* prepare statement */
-	status = sqlite3_prepare_v2 (scnc->connection, sql, -1, &sqlite_stmt, &left);
+	status = sqlite3_prepare_v2 (cdata->connection, sql, -1, &sqlite_stmt, &left);
 	if (status != SQLITE_OK) {
 		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_PREPARE_STMT_ERROR,
-			     sqlite3_errmsg (scnc->connection));
+			     sqlite3_errmsg (cdata->connection));
 		goto out_err;
 	}
 
@@ -1518,30 +1492,9 @@
 	return NULL;
 }
 
-static gboolean
-gda_sqlite_provider_statement_prepare (GdaServerProvider *provider, GdaConnection *cnc,
-				       GdaStatement *stmt, GError **error)
-{
-	GdaSqlitePStmt *ps;
-
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
-	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), FALSE);
-
-	/* fetch prepares stmt if already done */
-	ps = gda_connection_get_prepared_statement (cnc, stmt);
-	if (ps)
-		return TRUE;
-
-	ps = real_prepare (provider, cnc, stmt, error);
-	if (!ps)
-		return FALSE;
-	else {
-		gda_connection_add_prepared_statement (cnc, stmt, ps);
-		return TRUE;
-	}
-}
-
+/*
+ * Execute statement request
+ */
 static GObject *
 gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnection *cnc,
 				       GdaStatement *stmt, GdaSet *params,
@@ -1549,7 +1502,7 @@
 				       GType *col_types, GdaSet **last_inserted_row, GError **error)
 {
 	GdaSqlitePStmt *ps;
-	SqliteConnectionData *scnc;
+	SqliteConnectionData *cdata;
 
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
 	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
@@ -1562,15 +1515,15 @@
 	}
 
 	/* get SQLite's private data */
-	scnc = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
-	if (!scnc) 
+	cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
 		return FALSE;
 
 	/* HACK: force SQLite to reparse the schema and thus discover new tables if necessary */
         {
                 gint status;
                 sqlite3_stmt *istmt = NULL;
-                status = sqlite3_prepare_v2 (scnc->connection, "SELECT 1 FROM sqlite_master LIMIT 1", -1, &istmt, NULL);
+                status = sqlite3_prepare_v2 (cdata->connection, "SELECT 1 FROM sqlite_master LIMIT 1", -1, &istmt, NULL);
                 if (status == SQLITE_OK)
                         sqlite3_step (istmt);
                 if (istmt)
@@ -1591,10 +1544,10 @@
 			if (!sql)
 				return NULL;
 
-			status = sqlite3_prepare_v2 (scnc->connection, sql, -1, &sqlite_stmt, (const char**) &left);
+			status = sqlite3_prepare_v2 (cdata->connection, sql, -1, &sqlite_stmt, (const char**) &left);
 			if (status != SQLITE_OK) {
 				g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_PREPARE_STMT_ERROR,
-					     sqlite3_errmsg (scnc->connection));
+					     sqlite3_errmsg (cdata->connection));
 				g_free (sql);
 				return NULL;
 			}
@@ -1627,7 +1580,7 @@
 		GdaConnectionEvent *event;
 		const char *errmsg;
 
-		errmsg = sqlite3_errmsg (scnc->connection);
+		errmsg = sqlite3_errmsg (cdata->connection);
 		event = gda_connection_event_new (GDA_CONNECTION_EVENT_ERROR);
 		gda_connection_event_set_description (event, errmsg);
 		gda_connection_add_event (cnc, event);
@@ -1879,25 +1832,25 @@
 }
 
 static void
-gda_sqlite_free_cnc (SqliteConnectionData *scnc)
+gda_sqlite_free_cnc_data (SqliteConnectionData *cdata)
 {
-	if (!scnc)
+	if (!cdata)
 		return;
 
 #ifdef HAVE_SQLITE
-	/* remove the (scnc->connection, scnc) to db_connections_hash */
-	if (db_connections_hash && scnc->connection)
-		g_hash_table_remove (db_connections_hash, scnc->connection);
+	/* remove the (cdata->connection, cdata) to db_connections_hash */
+	if (db_connections_hash && cdata->connection)
+		g_hash_table_remove (db_connections_hash, cdata->connection);
 #endif
 
-	if (scnc->connection) 
-		sqlite3_close (scnc->connection);
-	g_free (scnc->file);
-	if (scnc->types)
-		g_hash_table_destroy (scnc->types);
-	if (scnc->aggregates_model) 
-		g_object_unref (scnc->aggregates_model);
-	if (scnc->functions_model) 
-		g_object_unref (scnc->functions_model);
-	g_free (scnc);
+	if (cdata->connection) 
+		sqlite3_close (cdata->connection);
+	g_free (cdata->file);
+	if (cdata->types)
+		g_hash_table_destroy (cdata->types);
+	if (cdata->aggregates_model) 
+		g_object_unref (cdata->aggregates_model);
+	if (cdata->functions_model) 
+		g_object_unref (cdata->functions_model);
+	g_free (cdata);
 }

Modified: branches/V4-branch/libgda/sqlite/gda-sqlite-provider.h
==============================================================================
--- branches/V4-branch/libgda/sqlite/gda-sqlite-provider.h	(original)
+++ branches/V4-branch/libgda/sqlite/gda-sqlite-provider.h	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,5 @@
 /* GDA SQLite provider
- * Copyright (C) 1998 - 2007 The GNOME Foundation.
+ * Copyright (C) 1998 - 2008 The GNOME Foundation.
  *
  * AUTHORS:
  *	Rodrigo Moya <rodrigo gnome-db org>
@@ -47,7 +47,6 @@
 G_BEGIN_DECLS
 
 GType              gda_sqlite_provider_get_type (void) G_GNUC_CONST;
-GdaServerProvider *gda_sqlite_provider_new (void);
 
 G_END_DECLS
 

Modified: branches/V4-branch/libgda/sqlite/gda-sqlite-recordset.c
==============================================================================
--- branches/V4-branch/libgda/sqlite/gda-sqlite-recordset.c	(original)
+++ branches/V4-branch/libgda/sqlite/gda-sqlite-recordset.c	Thu Feb 14 18:20:30 2008
@@ -176,19 +176,19 @@
 gda_sqlite_recordset_new (GdaConnection *cnc, GdaSqlitePStmt *ps, GdaDataModelAccessFlags flags, GType *col_types)
 {
 	GdaSqliteRecordset *model;
-        SqliteConnectionData *scnc;
+        SqliteConnectionData *cdata;
         gint i;
 	GdaDataModelAccessFlags rflags;
 
         g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
         g_return_val_if_fail (ps != NULL, NULL);
 
-	scnc = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
-	if (!scnc)
+	cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata)
 		return NULL;
 
-        if (!scnc->types)
-                _gda_sqlite_update_types_hash (scnc);
+        if (!cdata->types)
+                _gda_sqlite_update_types_hash (cdata);
 
         /* make sure @ps reports the correct number of columns */
 	if (_GDA_PSTMT (ps)->ncols < 0) 
@@ -236,7 +236,7 @@
 			tablename = sqlite3_column_table_name (ps->sqlite_stmt, i);
 			colname = sqlite3_column_origin_name (ps->sqlite_stmt, i);
 			if (!tablename || !colname ||
-			    (sqlite3_table_column_metadata (scnc->connection, NULL, tablename, colname, NULL, NULL,
+			    (sqlite3_table_column_metadata (cdata->connection, NULL, tablename, colname, NULL, NULL,
 							    &notnull, &pkey, &autoinc) != SQLITE_OK)) {
 				notnull = FALSE;
 				autoinc = FALSE;
@@ -292,7 +292,7 @@
 }
 
 static GType
-fuzzy_get_gtype (SqliteConnectionData *scnc, GdaSqlitePStmt *ps, gint colnum)
+fuzzy_get_gtype (SqliteConnectionData *cdata, GdaSqlitePStmt *ps, gint colnum)
 {
 	const gchar *ctype;
 	GType gtype = GDA_TYPE_NULL;
@@ -302,7 +302,7 @@
 	
 	ctype = sqlite3_column_decltype (ps->sqlite_stmt, colnum);
 	if (ctype)
-		gtype = GPOINTER_TO_INT (g_hash_table_lookup (scnc->types, ctype));
+		gtype = GPOINTER_TO_INT (g_hash_table_lookup (cdata->types, ctype));
 	if (gtype == GDA_TYPE_NULL) {
 		int stype;
 		stype = sqlite3_column_type (ps->sqlite_stmt, colnum);
@@ -336,12 +336,12 @@
 fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **error)
 {
 	int rc;
-	SqliteConnectionData *scnc;
+	SqliteConnectionData *cdata;
 	GdaSqlitePStmt *ps;
 	GdaPRow *prow = NULL;
 
-	scnc = (SqliteConnectionData*) gda_connection_internal_get_provider_data (model->priv->cnc);
-	if (!scnc)
+	cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (model->priv->cnc);
+	if (!cdata)
 		return NULL;
 	ps = GDA_SQLITE_PSTMT (GDA_PMODEL (model)->prep_stmt);
 
@@ -356,7 +356,7 @@
 			GType type = _GDA_PSTMT (ps)->types [col];
 			
 			if (type == GDA_TYPE_NULL) {
-				type = fuzzy_get_gtype (scnc, ps, col);
+				type = fuzzy_get_gtype (cdata, ps, col);
 				if (type != GDA_TYPE_NULL) {
 					GdaColumn *column;
 					
@@ -423,7 +423,7 @@
 		break;
 	case SQLITE_ERROR:
 		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
-			     GDA_SERVER_PROVIDER_INTERNAL_ERROR, sqlite3_errmsg (scnc->connection));
+			     GDA_SERVER_PROVIDER_INTERNAL_ERROR, sqlite3_errmsg (cdata->connection));
 		break;
 	case SQLITE_DONE:
 		GDA_PMODEL (model)->advertized_nrows = model->priv->next_row_num;

Modified: branches/V4-branch/libgda/sqlite/utils.c
==============================================================================
--- branches/V4-branch/libgda/sqlite/utils.c	(original)
+++ branches/V4-branch/libgda/sqlite/utils.c	Thu Feb 14 18:20:30 2008
@@ -74,16 +74,16 @@
 }
 
 void
-_gda_sqlite_update_types_hash (SqliteConnectionData *scnc)
+_gda_sqlite_update_types_hash (SqliteConnectionData *cdata)
 {
 	GHashTable *types;
 	gint status;
 	sqlite3_stmt *tables_stmt = NULL;
 
-	types = scnc->types;
+	types = cdata->types;
 	if (!types) {
 		types = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); /* key= type name, value= gda type */
-		scnc->types = types;
+		cdata->types = types;
 	}
 	
 	g_hash_table_insert (types, g_strdup ("integer"), GINT_TO_POINTER (G_TYPE_INT));
@@ -96,14 +96,14 @@
 	g_hash_table_insert (types, g_strdup ("blob"), GINT_TO_POINTER (GDA_TYPE_BINARY));
 
 	/* HACK: force SQLite to reparse the schema and thus discover new tables if necessary */
-	status = sqlite3_prepare_v2 (scnc->connection, "SELECT 1 FROM sqlite_master LIMIT 1", -1, &tables_stmt, NULL);
+	status = sqlite3_prepare_v2 (cdata->connection, "SELECT 1 FROM sqlite_master LIMIT 1", -1, &tables_stmt, NULL);
 	if (status == SQLITE_OK)
 		sqlite3_step (tables_stmt);
 	if (tables_stmt)
 		sqlite3_finalize (tables_stmt);
 
 	/* build a list of tables */
-	status = sqlite3_prepare_v2 (scnc->connection, "SELECT name "
+	status = sqlite3_prepare_v2 (cdata->connection, "SELECT name "
 				     " FROM (SELECT * FROM sqlite_master UNION ALL "
 				     "       SELECT * FROM sqlite_temp_master) "
 				     " WHERE name not like 'sqlite_%%'", -1, &tables_stmt, NULL);
@@ -115,7 +115,7 @@
 		gint fields_status;
 
 		sql = g_strdup_printf ("PRAGMA table_info('%s');", sqlite3_column_text (tables_stmt, 0));
-		fields_status = sqlite3_prepare_v2 (scnc->connection, sql, -1, &fields_stmt, NULL);
+		fields_status = sqlite3_prepare_v2 (cdata->connection, sql, -1, &fields_stmt, NULL);
 		g_free (sql);
 		if ((fields_status != SQLITE_OK) || !fields_stmt)
 			break;

Modified: branches/V4-branch/libgda/sqlite/virtual/gda-virtual-connection.c
==============================================================================
--- branches/V4-branch/libgda/sqlite/virtual/gda-virtual-connection.c	(original)
+++ branches/V4-branch/libgda/sqlite/virtual/gda-virtual-connection.c	Thu Feb 14 18:20:30 2008
@@ -1,6 +1,6 @@
 /* 
  * GDA common library
- * Copyright (C) 2007 The GNOME Foundation.
+ * Copyright (C) 2007 - 2008 The GNOME Foundation.
  *
  * AUTHORS:
  *      Vivien Malerba <malerba gnome-db org>
@@ -30,32 +30,32 @@
 #define CLASS(obj) (GDA_VIRTUAL_CONNECTION_CLASS (G_OBJECT_GET_CLASS (obj)))
 
 struct _GdaVirtualConnectionPrivate {
-	
+	gpointer              v_provider_data;
+        GDestroyNotify        v_provider_data_destroy_func;
 };
 
-/* properties */
-enum
-{
-        PROP_0,
-};
 
 static void gda_virtual_connection_class_init (GdaVirtualConnectionClass *klass);
-static void gda_virtual_connection_init       (GdaVirtualConnection *prov, GdaVirtualConnectionClass *klass);
+static void gda_virtual_connection_init       (GdaVirtualConnection *vcnc, GdaVirtualConnectionClass *klass);
 static void gda_virtual_connection_finalize   (GObject *object);
-static void gda_virtual_connection_set_property (GObject *object,
-						 guint param_id,
-						 const GValue *value,
-						 GParamSpec *pspec);
-static void gda_virtual_connection_get_property (GObject *object,
-						 guint param_id,
-						 GValue *value,
-						 GParamSpec *pspec);
 static GObjectClass *parent_class = NULL;
 
 /*
  * GdaVirtualConnection class implementation
  */
 static void
+conn_closed_cb (GdaVirtualConnection *vcnc)
+{
+	if (vcnc->priv->v_provider_data) {
+                if (vcnc->priv->v_provider_data_destroy_func)
+                        vcnc->priv->v_provider_data_destroy_func (vcnc->priv->v_provider_data);
+                else
+                        g_warning ("Provider did not clean its connection data");
+                vcnc->priv->v_provider_data = NULL;
+        }
+}
+
+static void
 gda_virtual_connection_class_init (GdaVirtualConnectionClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -64,28 +64,27 @@
 
 	/* virtual methods */
 	object_class->finalize = gda_virtual_connection_finalize;
-
-	/* Properties */
-        object_class->set_property = gda_virtual_connection_set_property;
-        object_class->get_property = gda_virtual_connection_get_property;
+	GDA_CONNECTION_CLASS (klass)->conn_closed = conn_closed_cb;
 }
 
 static void
-gda_virtual_connection_init (GdaVirtualConnection *vprov, GdaVirtualConnectionClass *klass)
+gda_virtual_connection_init (GdaVirtualConnection *vcnc, GdaVirtualConnectionClass *klass)
 {
-	vprov->priv = g_new (GdaVirtualConnectionPrivate, 1);
+	vcnc->priv = g_new0 (GdaVirtualConnectionPrivate, 1);
+	vcnc->priv->v_provider_data = NULL;
+	vcnc->priv->v_provider_data_destroy_func = NULL;
 }
 
 static void
 gda_virtual_connection_finalize (GObject *object)
 {
-	GdaVirtualConnection *prov = (GdaVirtualConnection *) object;
+	GdaVirtualConnection *vcnc = (GdaVirtualConnection *) object;
 
-	g_return_if_fail (GDA_IS_VIRTUAL_CONNECTION (prov));
+	g_return_if_fail (GDA_IS_VIRTUAL_CONNECTION (vcnc));
 
 	/* free memory */
-	g_free (prov->priv);
-	prov->priv = NULL;
+	g_free (vcnc->priv);
+	vcnc->priv = NULL;
 
 	/* chain to parent class */
 	parent_class->finalize (object);
@@ -116,36 +115,37 @@
 	return type;
 }
 
-static void
-gda_virtual_connection_set_property (GObject *object,
-				   guint param_id,
-				   const GValue *value,
-				   GParamSpec *pspec)
-{
-        GdaVirtualConnection *prov;
-
-        prov = GDA_VIRTUAL_CONNECTION (object);
-        if (prov->priv) {
-                switch (param_id) {
-		default:
-			break;
-                }
-        }
+/**
+ * gda_virtual_connection_internal_set_provider_data
+ * @vcnc: a #GdaConnection object
+ * @data: an opaque structure, known only to the provider for which @vcnc is opened
+ * @destroy_func: function to call when the connection closes and @data needs to be destroyed
+ *
+ * Note: calling this function more than once will not make it call @destroy_func on any previously
+ * set opaque @data, you'll have to do it yourself.
+ */
+void
+gda_virtual_connection_internal_set_provider_data (GdaVirtualConnection *vcnc, gpointer data, GDestroyNotify destroy_func)
+{
+        g_return_if_fail (GDA_IS_VIRTUAL_CONNECTION (vcnc));
+        vcnc->priv->v_provider_data = data;
+        vcnc->priv->v_provider_data_destroy_func = destroy_func;
 }
 
-static void
-gda_virtual_connection_get_property (GObject *object,
-				 guint param_id,
-				 GValue *value,
-				 GParamSpec *pspec)
-{
-        GdaVirtualConnection *prov;
-
-        prov = GDA_VIRTUAL_CONNECTION (object);
-        if (prov->priv) {
-		switch (param_id) {
-		default:
-			break;
-		}
-        }
+/**
+ * gda_virtual_connection_internal_get_provider_data
+ * @vcnc: a #GdaConnection object
+ *
+ * Get the opaque pointer previously set using gda_virtual_connection_internal_set_provider_data().
+ * If it's not set, then add a connection event and returns %NULL
+ *
+ * Returns: the pointer to the opaque structure set using gda_virtual_connection_internal_set_provider_data()
+ */
+gpointer
+gda_virtual_connection_internal_get_provider_data (GdaVirtualConnection *vcnc)
+{
+	g_return_val_if_fail (GDA_IS_VIRTUAL_CONNECTION (vcnc), NULL);
+        if (! vcnc->priv->v_provider_data)
+                gda_connection_add_event_string (GDA_CONNECTION (vcnc), _("Internal error: invalid provider handle"));
+        return vcnc->priv->v_provider_data;
 }

Modified: branches/V4-branch/libgda/sqlite/virtual/gda-virtual-connection.h
==============================================================================
--- branches/V4-branch/libgda/sqlite/virtual/gda-virtual-connection.h	(original)
+++ branches/V4-branch/libgda/sqlite/virtual/gda-virtual-connection.h	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,5 @@
 /* GDA virtual connection
- * Copyright (C) 2007 The GNOME Foundation.
+ * Copyright (C) 2007 - 2008 The GNOME Foundation.
  *
  * AUTHORS:
  *      Vivien Malerba <malerba gnome-db org>
@@ -46,7 +46,10 @@
 	GdaConnectionClass           parent_class;
 };
 
-GType          gda_virtual_connection_get_type          (void) G_GNUC_CONST;
+GType      gda_virtual_connection_get_type                   (void) G_GNUC_CONST;
+void       gda_virtual_connection_internal_set_provider_data (GdaVirtualConnection *vcnc, 
+							      gpointer data, GDestroyNotify destroy_func);
+gpointer   gda_virtual_connection_internal_get_provider_data (GdaVirtualConnection *cnc);
 
 G_END_DECLS
 

Modified: branches/V4-branch/libgda/sqlite/virtual/gda-vprovider-data-model.c
==============================================================================
--- branches/V4-branch/libgda/sqlite/virtual/gda-vprovider-data-model.c	(original)
+++ branches/V4-branch/libgda/sqlite/virtual/gda-vprovider-data-model.c	Thu Feb 14 18:20:30 2008
@@ -86,6 +86,12 @@
 
 	server_class->get_name = gda_vprovider_data_model_get_name;
 
+	/* explicitely unimplement the DDL queries */
+	server_class->supports_operation = NULL;
+        server_class->create_operation = NULL;
+        server_class->render_operation = NULL;
+        server_class->perform_operation = NULL;
+
 	/* Properties */
         object_class->set_property = gda_vprovider_data_model_set_property;
         object_class->get_property = gda_vprovider_data_model_get_property;

Modified: branches/V4-branch/providers/Makefile.am
==============================================================================
--- branches/V4-branch/providers/Makefile.am	(original)
+++ branches/V4-branch/providers/Makefile.am	Thu Feb 14 18:20:30 2008
@@ -51,15 +51,12 @@
 endif
 
 SUBDIRS = \
-        sqlite
-
-#SUBDIRS = \
-#	sqlite \
-#	$(GDA_BDB_SERVER) \
+	sqlite \
+	$(GDA_BDB_SERVER) \
+	$(GDA_MDB_SERVER)
 #	$(GDA_FREETDS_SERVER) \
 #	$(GDA_IBMDB2_SERVER) \
 #	$(GDA_FIREBIRD_SERVER) \
-#	$(GDA_MDB_SERVER) \
 #	$(GDA_MYSQL_SERVER) \
 #       $(GDA_MSQL_SERVER) \
 #	$(GDA_ODBC_SERVER) \

Modified: branches/V4-branch/providers/bdb/Makefile.am
==============================================================================
--- branches/V4-branch/providers/bdb/Makefile.am	(original)
+++ branches/V4-branch/providers/bdb/Makefile.am	Thu Feb 14 18:20:30 2008
@@ -12,8 +12,8 @@
 libgda_bdb_la_SOURCES = \
 	gda-bdb-provider.c \
 	gda-bdb-provider.h \
-	gda-bdb.h \
 	libmain.c
+
 libgda_bdb_la_LDFLAGS = -export-dynamic -module -avoid-version $(NO_UNDEFINED)
 libgda_bdb_la_LIBADD = \
 	$(top_builddir)/libgda/libgda-4.0.la \

Modified: branches/V4-branch/providers/bdb/bdb_specs_dsn.xml.in
==============================================================================
--- branches/V4-branch/providers/bdb/bdb_specs_dsn.xml.in	(original)
+++ branches/V4-branch/providers/bdb/bdb_specs_dsn.xml.in	Thu Feb 14 18:20:30 2008
@@ -1,7 +1,8 @@
 <?xml version="1.0"?>
 <data-set-spec>
   <parameters>
-    <parameter id="FILE" _name="Database file" _descr="Berkeley DB database file to be used" gdatype="gchararray" nullok="FALSE"/>
-    <parameter id="DATABASE" _name="Database name" _descr="Name of the database in the database file to be used" gdatype="gchararray"/>
+    <parameter id="DB_NAME" _name="Database file" _descr="Berkeley DB database filename to be used" gdatype="gchararray" nullok="FALSE"/>
+    <parameter id="DB_DIR" _name="Directory" _descr="Directory where the database file is stored" gdatype="gchararray" nullok="FALSE" plugin="filesel:MODE=PICKFOLDER"/>
+    <parameter id="DB_PART" _name="Database name" _descr="Name of the database in the database file to be used" gdatype="gchararray"/>
   </parameters>
 </data-set-spec>

Modified: branches/V4-branch/providers/bdb/gda-bdb-provider.c
==============================================================================
--- branches/V4-branch/providers/bdb/gda-bdb-provider.c	(original)
+++ branches/V4-branch/providers/bdb/gda-bdb-provider.c	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,5 @@
 /* GDA Berkeley-DB Provider
- * Copyright (C) 1998 - 2007 The GNOME Foundation
+ * Copyright (C) 1998 - 2008 The GNOME Foundation
  *
  * AUTHORS:
  *         Laurent Sansonetti <lrz gnome org> 
@@ -22,16 +22,20 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <glib/gi18n-lib.h>
 #include <libgda/gda-data-model-bdb.h>
 #include <virtual/gda-vconnection-data-model.h>
+#include <libgda/gda-connection-private.h>
 #include "gda-bdb.h"
 #include "gda-bdb-provider.h"
+#include <db.h> /* used only for its DB_VERSION_STRING declaration */
 
 static void gda_bdb_provider_class_init (GdaBdbProviderClass *klass);
 static void gda_bdb_provider_init       (GdaBdbProvider *provider,
 					 GdaBdbProviderClass *klass);
 static void gda_bdb_provider_finalize   (GObject *object);
 
+static const gchar *gda_bdb_provider_get_name (GdaServerProvider *provider);
 static const gchar *gda_bdb_provider_get_version (GdaServerProvider *provider);
 static gboolean gda_bdb_provider_open_connection (GdaServerProvider *provider,
 						  GdaConnection *cnc,
@@ -40,12 +44,15 @@
 						  const gchar *password);
 static const gchar *gda_bdb_provider_get_server_version (GdaServerProvider *provider,
 						         GdaConnection *cnc);
-static const gchar *gda_bdb_provider_get_database (GdaServerProvider *provider,
-						   GdaConnection *cnc);
-static GdaServerProviderInfo *gda_bdb_provider_get_info (GdaServerProvider *provider, GdaConnection *cnc);
+static const gchar *gda_bdb_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc);
 
 static GObjectClass *parent_class = NULL;
 
+/* 
+ * private connection data destroy 
+ */
+static void gda_bdb_free_cnc_data (BdbConnectionData *cdata);
+
 /*
  * GdaBdbProvider class implementation
  */
@@ -59,16 +66,11 @@
 
 	object_class->finalize = gda_bdb_provider_finalize;
 
+	provider_class->get_name = gda_bdb_provider_get_name;
 	provider_class->get_version = gda_bdb_provider_get_version;
 	provider_class->open_connection = gda_bdb_provider_open_connection;
 	provider_class->get_server_version = gda_bdb_provider_get_server_version;
 	provider_class->get_database = gda_bdb_provider_get_database;
-	provider_class->get_info = gda_bdb_provider_get_info;
-
-	provider_class->supports_operation = NULL;
-        provider_class->create_operation = NULL;
-        provider_class->render_operation = NULL;
-        provider_class->perform_operation = NULL;
 }
 
 static void
@@ -103,146 +105,158 @@
 			0,
 			(GInstanceInitFunc) gda_bdb_provider_init
 		};
-		type = g_type_register_static (PARENT_TYPE, "GdaBdbProvider", &info, 0);
+		type = g_type_register_static (GDA_TYPE_VPROVIDER_DATA_MODEL, "GdaBdbProvider", &info, 0);
 	}
 
 	return type;
 }
 
-GdaServerProvider *
-gda_bdb_provider_new (void)
+/*
+ * Get provider name request
+ */
+static const gchar *
+gda_bdb_provider_get_name (GdaServerProvider *provider)
 {
-	GdaBdbProvider *provider;
-
-	provider = g_object_new (gda_bdb_provider_get_type (), NULL);
-	return GDA_SERVER_PROVIDER (provider);
+	return BDB_PROVIDER_NAME;
 }
 
-/* get_version handler for the GdaBdbProvider class */
+/* 
+ * Get version request
+ */
 static const gchar *
 gda_bdb_provider_get_version (GdaServerProvider *provider)
 {
-	GdaBdbProvider *bdb_prv = (GdaBdbProvider *) provider;
-
-	g_return_val_if_fail (GDA_IS_BDB_PROVIDER (bdb_prv), NULL);
 	return PACKAGE_VERSION;
 }
 
-/* open_connection handler for the GdaBdbProvider class */
+/* 
+ * Open connection request
+ */
 static gboolean
-gda_bdb_provider_open_connection (GdaServerProvider *provider,
-				  GdaConnection *cnc,
+gda_bdb_provider_open_connection (GdaServerProvider *provider, GdaConnection *cnc,
 				  GdaQuarkList *params,
 				  const gchar *username,
 				  const gchar *password)
 {
-	GdaBdbConnectionData *priv_data;
-	gchar *bdb_file, *bdb_db;
-	GdaBdbProvider *bdb_prv;
+	BdbConnectionData *cdata;
+	gchar *bdb_file, *bdb_db, *dirname;
 	GdaDataModel *model;
 	GError *error = NULL;
 	gboolean retval = TRUE;
+	const GSList *clist;
 	
-	bdb_prv = (GdaBdbProvider *) provider;
-	g_return_val_if_fail (GDA_IS_BDB_PROVIDER (bdb_prv), FALSE);
+	g_return_val_if_fail (GDA_IS_BDB_PROVIDER (provider), FALSE);
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
 
-	/* open virtual connection */
-	if (! GDA_SERVER_PROVIDER_CLASS (parent_class)->open_connection (GDA_SERVER_PROVIDER (provider), cnc, params,
-									 NULL, NULL)) {
-		g_print ("Can't open BDB virtual connection\n");
-		return FALSE;
-	}
-
 	/* parse connection string */
-	bdb_file = g_strdup (gda_quark_list_find (params, "FILE"));
-	bdb_db = g_strdup (gda_quark_list_find (params, "DATABASE"));
+	dirname = g_strdup (gda_quark_list_find (params, "DB_DIR"));
+	bdb_file = g_strdup (gda_quark_list_find (params, "DB_NAME"));
+	bdb_db = g_strdup (gda_quark_list_find (params, "DB_PART"));
 	if (bdb_file == NULL || *(g_strstrip (bdb_file)) == '\0') {
-		gda_connection_add_event_string (cnc, 
-						 _("The FILE parameter is "
-						   "not defined in the " 
-						   "connection string."));
+		gda_connection_add_event_string (cnc, _("The DB_NAME parameter is not defined in the " 
+							"connection string."));
 		return FALSE;
 	}
 	if (bdb_db != NULL && *(g_strstrip (bdb_db)) == '\0')
 		bdb_db = NULL;
 
 	/* create GdaDataModelBdb object */
-	model = gda_data_model_bdb_new (bdb_file, bdb_db);
+	if (dirname) {
+		gchar *file;
+		file = g_build_filename (dirname, bdb_file, NULL);
+		model = gda_data_model_bdb_new (file, bdb_db);
+		g_free (file);
+	}
+	else
+		model = gda_data_model_bdb_new (bdb_file, bdb_db);
+
+	/* check for errors in the BDB data model */
+	if ((clist = gda_data_model_bdb_get_errors (GDA_DATA_MODEL_BDB (model)))) {
+		gboolean hasmsg = FALSE;
+		for (; clist; clist = clist->next) {
+			GError *lerror = (GError *) clist->data;
+			if (lerror && lerror->message) {
+				gda_connection_add_event_string (cnc, lerror->message);
+				hasmsg = TRUE;
+			}
+		}
+		if (!hasmsg)
+			gda_connection_add_event_string (cnc, _("An error occurred while accessing the BDB database"));
+		g_object_unref (model);
+		return FALSE;
+	}
+
+	/* open virtual connection */
+	if (! GDA_SERVER_PROVIDER_CLASS (parent_class)->open_connection (GDA_SERVER_PROVIDER (provider), cnc, params,
+									 NULL, NULL)) {
+		gda_connection_add_event_string (cnc, _("Can't open virtual connection"));
+		return FALSE;
+	}
+
+	/* add the BDB data model as table "data" */
 	if (!gda_vconnection_data_model_add_model (GDA_VCONNECTION_DATA_MODEL (cnc), model, bdb_db ? bdb_db : "data", &error)) {
 		gda_connection_add_event_string (cnc, 
 						 _("Could not add BDB data model to connection: %s"),
 						 error && error->message ? error->message : _("no detail"));
 		g_error_free (error);
 		gda_connection_close_no_warning (cnc);
+		g_object_unref (model);
 
 		retval = FALSE;
 	}
-	g_object_unref (model);
-
-	/* set associated data */
-        priv_data = g_new0 (GdaBdbConnectionData, 1);
-        priv_data->dbname = g_strdup_printf ("%s (%s)",
-                                             bdb_file,
-                                             bdb_db ? bdb_db : _("-"));
-        g_object_set_data (G_OBJECT (cnc), OBJECT_DATA_BDB_HANDLE, priv_data);
+	else {
+		/* set associated data */
+		cdata = g_new0 (BdbConnectionData, 1);
+		cdata->table_model = model;
+		cdata->dbname = g_strdup_printf ("%s (%s)", bdb_file,bdb_db ? bdb_db : _("-"));
+		gda_virtual_connection_internal_set_provider_data (GDA_VIRTUAL_CONNECTION (cnc), 
+								   cdata, (GDestroyNotify) gda_bdb_free_cnc_data);
+	}
 
 	g_free (bdb_file);
 	g_free (bdb_db);
+	g_free (dirname);
 
 	return retval;
 }
 
-/* get_server_version handler for the GdaBdbProvider class */
+/*
+ * Server version request
+ */
 static const gchar *
-gda_bdb_provider_get_server_version (GdaServerProvider *provider,
-				     GdaConnection *cnc)
+gda_bdb_provider_get_server_version (GdaServerProvider *provider, GdaConnection *cnc)
 {
-	GdaBdbProvider *bdb_prv;
-
-	bdb_prv = (GdaBdbProvider *) provider;
-	g_return_val_if_fail (GDA_IS_BDB_PROVIDER (bdb_prv), NULL);
-	if (cnc)
-		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-	else
-		return NULL;
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+        g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
 
 	return DB_VERSION_STRING;
 }
 
-/* get_database handler for the GdaBdbProvider class */
+/*
+ * Get database request
+ */
 static const gchar *
-gda_bdb_provider_get_database (GdaServerProvider *provider,
-			       GdaConnection *cnc)
+gda_bdb_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
 {
-	GdaBdbConnectionData *priv_data;
-	GdaBdbProvider *bdb_prv;
-	
-	bdb_prv = (GdaBdbProvider *) provider;
-	g_return_val_if_fail (GDA_IS_BDB_PROVIDER (bdb_prv), NULL);
+	BdbConnectionData *cdata;
+
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+        g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
 
-	priv_data = g_object_get_data (G_OBJECT (cnc), OBJECT_DATA_BDB_HANDLE);
-	if (priv_data == NULL) {
-		gda_connection_add_event_string (cnc, _("Invalid BDB handle"));
+	cdata = gda_virtual_connection_internal_get_provider_data (GDA_VIRTUAL_CONNECTION (cnc));
+	if (!cdata) 
 		return NULL;
-	}
 
-	return priv_data->dbname;
+	return cdata->dbname;
 }
 
-static GdaServerProviderInfo *
-gda_bdb_provider_get_info (GdaServerProvider *provider, GdaConnection *cnc)
+/*
+ * Free connection's specific data
+ */
+static void
+gda_bdb_free_cnc_data (BdbConnectionData *cdata)
 {
-	static GdaServerProviderInfo info = {
-		"Berkeley-DB",
-		TRUE, 
-		TRUE,
-		TRUE,
-		TRUE,
-		TRUE,
-		TRUE
-	};
-	
-	return &info;
+	g_object_unref (cdata->table_model);
+	g_free (cdata->dbname);
+	g_free (cdata);
 }

Modified: branches/V4-branch/providers/bdb/gda-bdb-provider.h
==============================================================================
--- branches/V4-branch/providers/bdb/gda-bdb-provider.h	(original)
+++ branches/V4-branch/providers/bdb/gda-bdb-provider.h	Thu Feb 14 18:20:30 2008
@@ -1,8 +1,9 @@
 /* GDA Berkeley-DB Provider
- * Copyright (C) 1998-2002 The GNOME Foundation
+ * Copyright (C) 1998 - 2008 The GNOME Foundation
  *
  * AUTHORS:
  *         Laurent Sansonetti <lrz gnome org>
+ *         Vivien Malerba <malerba gnome-db org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -30,28 +31,20 @@
 #define GDA_IS_BDB_PROVIDER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, GDA_TYPE_BDB_PROVIDER))
 #define GDA_IS_BDB_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDA_TYPE_BDB_PROVIDER))
 
-#define PARENT_TYPE 			GDA_TYPE_VPROVIDER_DATA_MODEL
-#define OBJECT_DATA_BDB_HANDLE 		"GDA_BDB_BDBHandle"
-
 typedef struct _GdaBdbProvider      GdaBdbProvider;
 typedef struct _GdaBdbProviderClass GdaBdbProviderClass;
 
 struct _GdaBdbProvider {
-	GdaVproviderDataModel provider;
+	GdaVproviderDataModel      provider;
 };
 
 struct _GdaBdbProviderClass {
 	GdaVproviderDataModelClass parent_class;
 };
 
-typedef struct {
-	gchar *dbname;
-} GdaBdbConnectionData;
-
 G_BEGIN_DECLS
 
-GType              gda_bdb_provider_get_type (void) G_GNUC_CONST;
-GdaServerProvider *gda_bdb_provider_new (void);
+GType gda_bdb_provider_get_type (void) G_GNUC_CONST;
 
 G_END_DECLS
 

Modified: branches/V4-branch/providers/bdb/gda-bdb-test.c
==============================================================================
--- branches/V4-branch/providers/bdb/gda-bdb-test.c	(original)
+++ branches/V4-branch/providers/bdb/gda-bdb-test.c	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,7 @@
 #include <libgda/libgda.h>
+#include <sql-parser/gda-sql-parser.h>
 #include <string.h>
+#include <db.h>
 
 #define DB_FILE	"bdb_test.db"
 
@@ -27,12 +29,10 @@
 	DB *dbp;
 	int ret, i;
 	
+	g_print ("Creating BDB database in '%s'\n", filename);
 	g_assert (db_create (&dbp, NULL, 0) == 0);
 
-	ret = dbp->open (dbp, 
-			 NULL,
-			 filename, NULL, DB_BTREE,
-			 DB_CREATE, 0664);
+	ret = dbp->open (dbp, NULL, filename, NULL, DB_BTREE, DB_CREATE, 0664);
 	g_assert (ret == 0);
 
 	for (i = 0; i < MAXNUMBERS; i++) {
@@ -53,6 +53,7 @@
 	}
 	
 	dbp->close (dbp, 0);
+	g_print ("End of BDB database creation\n");
 }
 
 static void
@@ -60,39 +61,43 @@
 {
 	gchar *cncstring;
 	GdaClient *client;
-	GdaConnection *conn;
+	GdaConnection *cnc;
 	GdaDataModel *model;
-	int i, j;
 	GError *error = NULL;
-	GdaCommand *command;
+
+	GdaSqlParser *parser;
+	GdaStatement *stmt;
 	
 	/* create dsn */
-	cncstring = g_strdup_printf ("FILE=%s", (gchar *) filename);
+	cncstring = g_strdup_printf ("DB_NAME=%s", (gchar *) filename);
 
 	/* connect to the db */
 	client = gda_client_new ();
 	g_assert (client != NULL);
-	conn = gda_client_open_connection_from_string (client, "Berkeley-DB", cncstring, NULL, NULL, 0, &error);
-	if (!conn) {
+	cnc = gda_client_open_connection_from_string (client, "Berkeley-DB", cncstring, NULL, NULL, 0, &error);
+	if (!cnc) {
 		g_print ("Could not open connection; %s\n", error && error->message ? error->message : "no detail");
 		exit (1);
 	}
 
 	/* get model */
-	command = gda_command_new ("SELECT * from data", GDA_COMMAND_TYPE_SQL, 0);
-	model = gda_connection_execute_select_command (conn, command, NULL, &error);
+	parser = gda_connection_create_parser (cnc);
+	stmt = gda_sql_parser_parse_string (parser, "SELECT * from data", NULL, NULL);
+	g_object_unref (parser);
+	model = gda_connection_statement_execute_select (cnc, stmt, NULL, &error);
 	if (!model) {
 		g_print ("Could execute command; %s\n", error && error->message ? error->message : "no detail");
 		exit (1);
 	}
 
-	gda_command_free (command);
+	g_object_unref (stmt);
 	g_assert (gda_data_model_get_n_rows (model) == MAXNUMBERS);
 
 	gda_data_model_dump (model, stdout);
 	g_object_unref (model);
 
 #ifdef NO
+	int i, j;
 	for (i = 0; i < MAXNUMBERS; i++) {
 		GValue *val;
 		gchar *tmp;
@@ -121,7 +126,7 @@
 #endif
 
 	/* disconnect, remove dsn & quit */
-	gda_connection_close (conn);
+	gda_connection_close (cnc);
 }
 
 int main (int argc, char **argv)

Modified: branches/V4-branch/providers/bdb/gda-bdb.h
==============================================================================
--- branches/V4-branch/providers/bdb/gda-bdb.h	(original)
+++ branches/V4-branch/providers/bdb/gda-bdb.h	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,5 @@
 /* GDA Berkeley-DB Provider
- * Copyright (C) 1998 - 2007 The GNOME Foundation
+ * Copyright (C) 1998 - 2008 The GNOME Foundation
  *
  * AUTHORS:
  *         Laurent Sansonetti <lrz gnome org>  
@@ -22,28 +22,17 @@
 #ifndef __GDA_BDB_H__
 #define __GDA_BDB_H__
 
-#if defined(HAVE_CONFIG_H)
-#endif
-
-#include <glib/gmacros.h>
-#include <glib/gi18n-lib.h>
-#include <libgda/gda-server-provider.h>
-#include <db.h>
-
-#include "gda-bdb-provider.h"
-
-#define GDA_BDB_PROVIDER_ID          "GDA Berkeley DB provider"
-
-#define BDB_VERSION  (10000*DB_VERSION_MAJOR+100*DB_VERSION_MINOR+DB_VERSION_PATCH)
-
-G_BEGIN_DECLS
-
 /*
- * Utility functions
+ * Provider name
  */
+#define BDB_PROVIDER_NAME "Berkeley-DB"
 
-GdaConnectionEvent *gda_bdb_make_error (int ret);
-
-G_END_DECLS
+/*
+ * Provider's specific connection data
+ */
+typedef struct {
+	GdaDataModel *table_model;
+	gchar        *dbname;
+} BdbConnectionData;
 
-#endif /* __gda_bdb_h__ */
+#endif

Modified: branches/V4-branch/providers/bdb/libmain.c
==============================================================================
--- branches/V4-branch/providers/bdb/libmain.c	(original)
+++ branches/V4-branch/providers/bdb/libmain.c	Thu Feb 14 18:20:30 2008
@@ -21,10 +21,10 @@
  */
 
 #include <glib/gi18n-lib.h>
-#include <libgda/gda-config.h>
-#include "gda-bdb.h"
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/binreloc/gda-binreloc.h>
+#include "gda-bdb.h"
+#include "gda-bdb-provider.h"
 
 static gchar      *module_path = NULL;
 const gchar       *plugin_get_name (void);
@@ -42,7 +42,7 @@
 const gchar *
 plugin_get_name (void)
 {
-	return "Berkeley-DB";
+	return BDB_PROVIDER_NAME;
 }
 
 const gchar *
@@ -67,8 +67,8 @@
 plugin_create_provider (void)
 {
 	GdaServerProvider *prov;
-
-        prov = gda_bdb_provider_new ();
+	
+	prov = (GdaServerProvider *) g_object_new (GDA_TYPE_BDB_PROVIDER, NULL);
         g_object_set_data ((GObject *) prov, "GDA_PROVIDER_DIR", module_path);
         return prov;
 }

Modified: branches/V4-branch/providers/mdb/gda-mdb-provider.c
==============================================================================
--- branches/V4-branch/providers/mdb/gda-mdb-provider.c	(original)
+++ branches/V4-branch/providers/mdb/gda-mdb-provider.c	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,5 @@
 /* GDA MDB provider
- * Copyright (C) 1998 - 2007 The GNOME Foundation.
+ * Copyright (C) 1998 - 2008 The GNOME Foundation.
  *
  * AUTHORS:
  *	Rodrigo Moya <rodrigo gnome-db org>
@@ -24,12 +24,12 @@
 #include <stdlib.h>
 #include <glib/gbacktrace.h>
 #include <virtual/gda-vconnection-data-model.h>
+#include <libgda/gda-server-provider-extra.h>
 #include <libgda/gda-data-model-array.h>
 #include <libgda/gda-data-model-private.h>
 #include <glib/gi18n-lib.h>
-#include <libgda/gda-server-provider-extra.h>
-#include <libgda/gda-parameter-list.h>
 #include "gda-mdb.h"
+#include "gda-mdb-provider.h"
 
 #include <libgda/handlers/gda-handler-numerical.h>
 #include <libgda/handlers/gda-handler-boolean.h>
@@ -38,49 +38,38 @@
 #include <libgda/handlers/gda-handler-type.h>
 #include <libgda/handlers/gda-handler-bin.h>
 
-#include <libgda/sql-delimiter/gda-sql-delimiter.h>
-
 #define FILE_EXTENSION ".mdb"
 
-#define OBJECT_DATA_MDB_HANDLE "GDA_Mdb_MdbHandle"
-
 static void gda_mdb_provider_class_init (GdaMdbProviderClass *klass);
 static void gda_mdb_provider_init       (GdaMdbProvider *provider,
 					   GdaMdbProviderClass *klass);
 static void gda_mdb_provider_finalize   (GObject *object);
 
+static const gchar *gda_mdb_provider_get_name (GdaServerProvider *provider);
 static const gchar *gda_mdb_provider_get_version (GdaServerProvider *provider);
 static gboolean gda_mdb_provider_open_connection (GdaServerProvider *provider,
 						    GdaConnection *cnc,
 						    GdaQuarkList *params,
 						    const gchar *username,
 						    const gchar *password);
-static gboolean gda_mdb_provider_close_connection (GdaServerProvider *provider,
-						     GdaConnection *cnc);
 static const gchar *gda_mdb_provider_get_server_version (GdaServerProvider *provider,
 							 GdaConnection *cnc);
 static const gchar *gda_mdb_provider_get_database (GdaServerProvider *provider,
 						   GdaConnection *cnc);
-static gboolean gda_mdb_provider_supports (GdaServerProvider *provider,
-					     GdaConnection *cnc,
-					     GdaConnectionFeature feature);
-
-static GdaServerProviderInfo *gda_mdb_provider_get_info (GdaServerProvider *provider,
-							 GdaConnection *cnc);
 
 
 static GObjectClass *parent_class = NULL;
 static gint loaded_providers = 0;
 char *g_input_ptr;
 
-/*
- * Private functions
+/* 
+ * private connection data destroy 
  */
+static void gda_mdb_free_cnc_data (MdbConnectionData *cdata);
 
 /*
  * GdaMdbProvider class implementation
  */
-
 static void
 gda_mdb_provider_class_init (GdaMdbProviderClass *klass)
 {
@@ -91,20 +80,11 @@
 
 	object_class->finalize = gda_mdb_provider_finalize;
 
+	provider_class->get_name = gda_mdb_provider_get_name;
 	provider_class->get_version = gda_mdb_provider_get_version;
+	provider_class->open_connection = gda_mdb_provider_open_connection;
 	provider_class->get_server_version = gda_mdb_provider_get_server_version;
-	provider_class->get_info = gda_mdb_provider_get_info;
 	provider_class->get_database = gda_mdb_provider_get_database;
-	provider_class->change_database = NULL;
-
-	provider_class->open_connection = gda_mdb_provider_open_connection;
-	provider_class->close_connection = gda_mdb_provider_close_connection;
-
-	provider_class->supports_feature = gda_mdb_provider_supports;
-	provider_class->supports_operation = NULL;
-        provider_class->create_operation = NULL;
-        provider_class->render_operation = NULL;
-        provider_class->perform_operation = NULL;
 }
 
 static void
@@ -144,7 +124,7 @@
 			0,
 			(GInstanceInitFunc) gda_mdb_provider_init
 		};
-		type = g_type_register_static (PARENT_TYPE, "GdaMdbProvider", &info, 0);
+		type = g_type_register_static (GDA_TYPE_VPROVIDER_DATA_MODEL, "GdaMdbProvider", &info, 0);
 	}
 
 	return type;
@@ -165,7 +145,18 @@
 	return GDA_SERVER_PROVIDER (provider);
 }
 
-/* get_version handler for the GdaMdbProvider class */
+/*
+ * Get provider name request
+ */
+static const gchar *
+gda_mdb_provider_get_name (GdaServerProvider *provider)
+{
+	return MDB_PROVIDER_NAME;
+}
+
+/* 
+ * Get version request
+ */
 static const gchar *
 gda_mdb_provider_get_version (GdaServerProvider *provider)
 {
@@ -204,16 +195,17 @@
 typedef struct {
         GdaVconnectionDataModelSpec spec;
 	MdbCatalogEntry *table_entry;
-	GdaMdbConnection *mdb_cnc;
+	MdbConnectionData *cdata;
 } LocalSpec;
 
 static GList *table_create_columns_func (LocalSpec *spec);
 static GdaDataModel *table_create_model_func (LocalSpec *spec);
 
-/* open_connection handler for the GdaMdbProvider class */
+/* 
+ * Open connection request
+ */
 static gboolean
-gda_mdb_provider_open_connection (GdaServerProvider *provider,
-				  GdaConnection *cnc,
+gda_mdb_provider_open_connection (GdaServerProvider *provider, GdaConnection *cnc,
 				  GdaQuarkList *params,
 				  const gchar *username,
 				  const gchar *password)
@@ -222,7 +214,7 @@
 	const gchar *dirname = NULL, *dbname = NULL;
 	gchar *dup = NULL;
 
-	GdaMdbConnection *mdb_cnc;
+	MdbConnectionData *cdata;
 	GdaMdbProvider *mdb_prv = (GdaMdbProvider *) provider;
 
 	g_return_val_if_fail (GDA_IS_MDB_PROVIDER (mdb_prv), FALSE);
@@ -289,37 +281,38 @@
 	g_free (dup);
 	g_free (tmp);
 
-	mdb_cnc = g_new0 (GdaMdbConnection, 1);
-	mdb_cnc->cnc = cnc;
-	mdb_cnc->server_version = NULL;
+	cdata = g_new0 (MdbConnectionData, 1);
+	cdata->cnc = cnc;
+	cdata->server_version = NULL;
 #ifdef MDB_WITH_WRITE_SUPPORT
-	mdb_cnc->mdb = mdb_open (filename, MDB_WRITABLE);
+	cdata->mdb = mdb_open (filename, MDB_WRITABLE);
 #else
-	mdb_cnc->mdb = mdb_open (filename);
+	cdata->mdb = mdb_open (filename);
 #endif
-	if (!mdb_cnc->mdb) {
+	if (!cdata->mdb) {
 		gda_connection_add_event_string (cnc, _("Could not open file %s"), filename);
-		g_free (mdb_cnc);
+		gda_mdb_free_cnc_data (cdata);
 		return FALSE;
 	}
 
 	/* open virtual connection */
         if (! GDA_SERVER_PROVIDER_CLASS (parent_class)->open_connection (GDA_SERVER_PROVIDER (provider), cnc, params,
                                                                          NULL, NULL)) {
-                g_print ("Can't open MDB virtual connection\n");
+		gda_connection_add_event_string (cnc, _("Can't open virtual connection"));
+		gda_mdb_free_cnc_data (cdata);
                 return FALSE;
         }
 
-	mdb_read_catalog (mdb_cnc->mdb, MDB_ANY);
-
-	g_object_set_data (G_OBJECT (cnc), OBJECT_DATA_MDB_HANDLE, mdb_cnc);
+	mdb_read_catalog (cdata->mdb, MDB_ANY);
+	gda_virtual_connection_internal_set_provider_data (GDA_VIRTUAL_CONNECTION (cnc), 
+							   cdata, (GDestroyNotify) gda_mdb_free_cnc_data);
 
 	/* declare the virtual tables */
 	gint i;
-	for (i = 0; i < mdb_cnc->mdb->num_catalog; i++) {
+	for (i = 0; i < cdata->mdb->num_catalog; i++) {
                 MdbCatalogEntry *entry;
 
-                entry = g_ptr_array_index (mdb_cnc->mdb->catalog, i);
+                entry = g_ptr_array_index (cdata->mdb->catalog, i);
 
                 /* if it's a table */
                 if (entry->object_type == MDB_TABLE) {
@@ -336,7 +329,7 @@
 				GDA_VCONNECTION_DATA_MODEL_SPEC (lspec)->create_model_func = 
 					(GdaVconnectionDataModelCreateModelFunc) table_create_model_func;
 				lspec->table_entry = entry;
-				lspec->mdb_cnc = mdb_cnc;
+				lspec->cdata = cdata;
 				tmp = sanitize_name (g_strdup (entry->object_name));
 				if (!gda_vconnection_data_model_add (GDA_VCONNECTION_DATA_MODEL (cnc), 
 								     (GdaVconnectionDataModelSpec*) lspec,
@@ -399,7 +392,7 @@
 		gda_column_set_name (gda_col, tmp);
 		g_free (tmp);
 		gda_column_set_g_type (gda_col, gda_mdb_type_to_gda (mdb_col->col_type));
-		tmp = sanitize_name (g_strdup (mdb_get_coltype_string (spec->mdb_cnc->mdb->default_backend, mdb_col->col_type)));
+		tmp = sanitize_name (g_strdup (mdb_get_coltype_string (spec->cdata->mdb->default_backend, mdb_col->col_type)));
 		gda_column_set_dbms_type (gda_col, tmp);
 		g_free (tmp);
                 gda_column_set_defined_size (gda_col, mdb_col->col_size);
@@ -458,7 +451,7 @@
 		gda_column_set_title (gda_col, tmp);
 		gda_column_set_caption (gda_col, tmp);
 		g_free (tmp);
-		tmp = sanitize_name (g_strdup (mdb_get_coltype_string (spec->mdb_cnc->mdb->default_backend, mdb_col->col_type)));
+		tmp = sanitize_name (g_strdup (mdb_get_coltype_string (spec->cdata->mdb->default_backend, mdb_col->col_type)));
 		gda_column_set_dbms_type (gda_col, tmp);
 		g_free (tmp);
                 gda_column_set_g_type (gda_col, coltypes [c]);
@@ -477,7 +470,7 @@
 			if (mdb_col->col_type == MDB_OLE) {
 				GdaBinary bin;
 				
-				bin.binary_length = mdb_ole_read (spec->mdb_cnc->mdb, mdb_col, bound_values[c], MDB_BIND_SIZE);
+				bin.binary_length = mdb_ole_read (spec->cdata->mdb, mdb_col, bound_values[c], MDB_BIND_SIZE);
 				bin.data = bound_values[c];
 				gda_value_set_binary ((tmpval = gda_value_new (coltypes [c])), &bin);
 				
@@ -511,115 +504,52 @@
 	return model;
 }
 
-
-/* close_connection handler for the GdaMdbProvider class */
-static gboolean
-gda_mdb_provider_close_connection (GdaServerProvider *provider, GdaConnection *cnc)
-{
-	GdaMdbConnection *mdb_cnc;
-	GdaMdbProvider *mdb_prv = (GdaMdbProvider *) provider;
-
-	g_return_val_if_fail (GDA_IS_MDB_PROVIDER (mdb_prv), FALSE);
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-
-	mdb_cnc = g_object_get_data (G_OBJECT (cnc), OBJECT_DATA_MDB_HANDLE);
-	if (!mdb_cnc) {
-		gda_connection_add_event_string (cnc, _("Invalid MDB handle"));
-		return FALSE;
-	}
-
-	/* close virtual connection */
-        if (! GDA_SERVER_PROVIDER_CLASS (parent_class)->close_connection (GDA_SERVER_PROVIDER (provider), cnc)) {
-                g_print ("Can't close MDB virtual connection\n");
-                return FALSE;
-        }
-
-	if (mdb_cnc->server_version != NULL) {
-		g_free (mdb_cnc->server_version);
-		mdb_cnc->server_version = NULL;
-	}
-
-	/* mdb_free_handle (mdb_cnc->mdb); */
-
-	g_free (mdb_cnc);
-	g_object_set_data (G_OBJECT (cnc), OBJECT_DATA_MDB_HANDLE, NULL);
-
-	return TRUE;
-}
-
-/* get_server_version handler for the GdaMdbProvider class */
+/*
+ * Server version request
+ */
 static const gchar *
 gda_mdb_provider_get_server_version (GdaServerProvider *provider,
 				     GdaConnection *cnc)
 {
-	GdaMdbConnection *mdb_cnc;
-	GdaMdbProvider *mdb_prv = (GdaMdbProvider *) provider;
-
-	g_return_val_if_fail (GDA_IS_MDB_PROVIDER (mdb_prv), NULL);
+	MdbConnectionData *cdata;
+	
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+        g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
 
-	mdb_cnc = g_object_get_data (G_OBJECT (cnc), OBJECT_DATA_MDB_HANDLE);
-	if (!mdb_cnc) {
-		gda_connection_add_event_string (cnc, _("Invalid MDB handle"));
+	cdata = gda_virtual_connection_internal_get_provider_data (GDA_VIRTUAL_CONNECTION (cnc));
+	if (!cdata)
 		return NULL;
-	}
 
-	if (!mdb_cnc->server_version)
-		mdb_cnc->server_version = g_strdup_printf ("Microsoft Jet %d", mdb_cnc->mdb->f->jet_version);
+	if (!cdata->server_version)
+		cdata->server_version = g_strdup_printf ("Microsoft Jet %d", cdata->mdb->f->jet_version);
 
-	return (const gchar *) mdb_cnc->server_version;
+	return (const gchar *) cdata->server_version;
 }
 
-/* get_database handler for the GdaMdbProvider class */
+/*
+ * Get database request
+ */
 static const gchar *
 gda_mdb_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
 {
-	GdaMdbConnection *mdb_cnc;
-	GdaMdbProvider *mdb_prv = (GdaMdbProvider *) provider;
+	MdbConnectionData *cdata;
 
-	g_return_val_if_fail (GDA_IS_MDB_PROVIDER (mdb_prv), NULL);
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+        g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
 
-	mdb_cnc = g_object_get_data (G_OBJECT (cnc), OBJECT_DATA_MDB_HANDLE);
-	if (!mdb_cnc) {
-		gda_connection_add_event_string (cnc, _("Invalid MDB handle"));
+	cdata = gda_virtual_connection_internal_get_provider_data (GDA_VIRTUAL_CONNECTION (cnc));
+	if (!cdata)
 		return NULL;
-	}
 
-	return (const gchar *) mdb_cnc->mdb->f->filename;
+	return (const gchar *) cdata->mdb->f->filename;
 }
 
-/* supports handler for the GdaMdbProvider class */
-static gboolean
-gda_mdb_provider_supports (GdaServerProvider *provider,
-			   GdaConnection *cnc,
-			   GdaConnectionFeature feature)
-{
-	g_return_val_if_fail (GDA_IS_MDB_PROVIDER (provider), FALSE);
-
-	switch (feature) {
-	case GDA_CONNECTION_FEATURE_SQL :
-		return TRUE;
-	default : ;
-	}
-
-	return FALSE;
-}
-
-static GdaServerProviderInfo *
-gda_mdb_provider_get_info (GdaServerProvider *provider,
-			   GdaConnection *cnc)
-{
-	static GdaServerProviderInfo info;
-	static gboolean init_done = FALSE;
-
-	if (!init_done) {
-		GdaServerProviderInfo *vinfo;
-		vinfo = GDA_SERVER_PROVIDER_CLASS (parent_class)->get_info (provider, cnc);
-		info = *vinfo;
-		info.provider_name = "MSAccess";
-		init_done = TRUE;
-	}
-	
-	return &info;
+/*
+ * Free connection's specific data
+ */
+static void
+gda_mdb_free_cnc_data (MdbConnectionData *cdata)
+{
+	g_free (cdata->server_version);
+	g_free (cdata);
 }

Modified: branches/V4-branch/providers/mdb/gda-mdb-provider.h
==============================================================================
--- branches/V4-branch/providers/mdb/gda-mdb-provider.h	(original)
+++ branches/V4-branch/providers/mdb/gda-mdb-provider.h	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,5 @@
 /* GDA MDB provider
- * Copyright (C) 1998 - 2007 The GNOME Foundation.
+ * Copyright (C) 1998 - 2008 The GNOME Foundation.
  *
  * AUTHORS:
  *	Rodrigo Moya <rodrigo gnome-db org>
@@ -26,8 +26,6 @@
 
 #include <virtual/gda-vprovider-data-model.h>
 
-G_BEGIN_DECLS
-
 #define GDA_TYPE_MDB_PROVIDER            (gda_mdb_provider_get_type())
 #define GDA_MDB_PROVIDER(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_TYPE_MDB_PROVIDER, GdaMdbProvider))
 #define GDA_MDB_PROVIDER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, GDA_TYPE_MDB_PROVIDER, GdaMdbProviderClass))
@@ -38,17 +36,18 @@
 typedef struct _GdaMdbProviderClass GdaMdbProviderClass;
 
 struct _GdaMdbProvider {
-	GdaVproviderDataModel provider;
+	GdaVproviderDataModel      provider;
 };
 
 struct _GdaMdbProviderClass {
 	GdaVproviderDataModelClass parent_class;
 };
 
+G_BEGIN_DECLS
+
 GType              gda_mdb_provider_get_type (void) G_GNUC_CONST;
 GdaServerProvider *gda_mdb_provider_new      (void);
 
-
 G_END_DECLS
 
 #endif

Modified: branches/V4-branch/providers/mdb/gda-mdb.h
==============================================================================
--- branches/V4-branch/providers/mdb/gda-mdb.h	(original)
+++ branches/V4-branch/providers/mdb/gda-mdb.h	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,5 @@
 /* GDA MDB provider
- * Copyright (C) 1998 - 2007 The GNOME Foundation.
+ * Copyright (C) 1998 - 2008 The GNOME Foundation.
  *
  * AUTHORS:
  *	Rodrigo Moya <rodrigo gnome-db org>
@@ -24,24 +24,21 @@
 #ifndef __GDA_MDB_H__
 #define __GDA_MDB_H__
 
-#include <glib/gmacros.h>
+/*
+ * Provider name
+ */
+#define MDB_PROVIDER_NAME "MSAccess"
+
 #include <libgda/gda-connection.h>
-#include <libgda/gda-server-provider.h>
-#include <glib/gi18n-lib.h>
-#include <libgda/gda-value.h>
 #include <mdbtools.h>
-#include "gda-mdb-provider.h"
-
-G_BEGIN_DECLS
 
+/*
+ * Provider's specific connection data
+ */
 typedef struct {
 	GdaConnection  *cnc;
 	MdbHandle      *mdb;
 	gchar          *server_version;
-} GdaMdbConnection;
-
-#define PARENT_TYPE GDA_TYPE_VPROVIDER_DATA_MODEL
-
-G_END_DECLS
+} MdbConnectionData;
 
 #endif

Modified: branches/V4-branch/providers/mdb/libmain.c
==============================================================================
--- branches/V4-branch/providers/mdb/libmain.c	(original)
+++ branches/V4-branch/providers/mdb/libmain.c	Thu Feb 14 18:20:30 2008
@@ -1,5 +1,5 @@
 /* GDA MDB Provider
- * Copyright (C) 1998 - 2007 The GNOME Foundation
+ * Copyright (C) 1998 - 2008 The GNOME Foundation
  *
  * AUTHORS:
  *         Rodrigo Moya <rodrigo gnome-db org>
@@ -21,8 +21,9 @@
  */
 
 #include <glib/gi18n-lib.h>
-#include "gda-mdb.h"
 #include <libgda/gda-server-provider-extra.h>
+#include "gda-mdb.h"
+#include "gda-mdb-provider.h"
 
 static gchar *module_path = NULL;
 
@@ -41,7 +42,7 @@
 const gchar *
 plugin_get_name (void)
 {
-	return "MSAccess";
+	return MDB_PROVIDER_NAME;
 }
 
 const gchar *

Modified: branches/V4-branch/providers/skel-implementation/Makefile.am
==============================================================================
--- branches/V4-branch/providers/skel-implementation/Makefile.am	(original)
+++ branches/V4-branch/providers/skel-implementation/Makefile.am	Thu Feb 14 18:20:30 2008
@@ -1,2 +1,3 @@
 SUBDIRS = \
-	capi
+	capi \
+	models

Modified: branches/V4-branch/providers/skel-implementation/capi/Makefile.am
==============================================================================
--- branches/V4-branch/providers/skel-implementation/capi/Makefile.am	(original)
+++ branches/V4-branch/providers/skel-implementation/capi/Makefile.am	Thu Feb 14 18:20:30 2008
@@ -1,54 +1,55 @@
 providerdir=$(libdir)/libgda-$(GDA_ABI_MAJOR_VERSION).$(GDA_ABI_MINOR_VERSION)/providers
 provider_LTLIBRARIES = libgda-capi.la
 
+#Rem: CAPI_CFLAGS and CAPI_LIBS are the compile and link flags necessary to use the
+# C API. It is specific to the API and should be computed in the configure.in script.
+
 AM_CPPFLAGS = \
 	-I$(top_srcdir) \
 	-I$(top_srcdir)/libgda \
 	-I$(top_builddir) \
-	$(LIBGDA_CFLAGS) \
-	$(CAPI_CFLAGS) 
+	$(LIBGDA_CFLAGS) #$(CAPI_CFLAGS) 
+
+# parser generation
+parser.c parser.h: parser.y $(top_builddir)/libgda/sql-parser/lemon$(EXEEXT_FOR_BUILD)
+	- $(top_builddir)/libgda/sql-parser/lemon$(EXEEXT_FOR_BUILD) parser.y
+
+gen_def$(EXEEXT_FOR_BUILD): gen_def.c
+	$(CC_FOR_BUILD) -o gen_def$(EXEEXT_FOR_BUILD) -DIMPOSED_HEADER=\""$(top_builddir)/libgda/sql-parser/parser_tokens.h"\" gen_def.c
+
+capi_token_types.h: gen_def$(EXEEXT_FOR_BUILD) parser.h
+	./gen_def$(EXEEXT_FOR_BUILD) > capi_token_types.h
+
+$(OBJECTS) $(libgda_capi_la_OBJECTS): capi_token_types.h
 
 libgda_capi_la_SOURCES = \
 	gda-capi-blob-op.c \
 	gda-capi-blob-op.h \
-	gda-capi-cursor-recordset.c \
-	gda-capi-cursor-recordset.h \
 	gda-capi-ddl.c \
 	gda-capi-ddl.h \
-	gda-capi-handler-bin.c \
-	gda-capi-handler-bin.h \
 	gda-capi-parser.c \
 	gda-capi-parser.h \
 	gda-capi-provider.c \
 	gda-capi-provider.h \
+	gda-capi-meta.c \
+	gda-capi-meta.h \
 	gda-capi-recordset.c \
 	gda-capi-recordset.h \
 	gda-capi.h \
 	libmain.c \
 	parser.h \
-	parser.c \
-	capi_token_types.h \
-	utils.c
+        parser.c \
+        capi_token_types.h
+
 libgda_capi_la_LDFLAGS = -export-dynamic -module -avoid-version $(NO_UNDEFINED)
 libgda_capi_la_LIBADD = \
 	$(top_builddir)/libgda/libgda-4.0.la \
-	$(LIBGDA_LIBS) \
-	$(CAPI_LIBS)
+	$(LIBGDA_LIBS) #$(CAPI_LIBS)
 
 xmldir   = $(datadir)/libgda-4.0
 xml_in_files = \
-	capi_specs_create_db.xml.in \
-	capi_specs_drop_db.xml.in \
 	capi_specs_dsn.xml.in \
-	capi_specs_create_table.xml.in \
-	capi_specs_drop_table.xml.in \
-	capi_specs_create_index.xml.in \
-	capi_specs_drop_index.xml.in \
-	capi_specs_rename_table.xml.in \
-	capi_specs_add_column.xml.in \
-	capi_specs_drop_column.xml.in \
-	capi_specs_create_view.xml.in \
-	capi_specs_drop_view.xml.in
+	capi_specs_create_table.xml.in 
 
 @INTLTOOL_XML_RULE@
 
@@ -57,5 +58,7 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgda-capi-4.0.pc
 
-EXTRA_DIST = $(xml_in_files) libgda-capi-4.0.pc.in
+EXTRA_DIST = $(xml_in_files) libgda-capi-4.0.pc.in parser.y
 DISTCLEANFILES = $(xml_DATA)
+
+CLEANFILES = parser.h parser.c parser.out capi_token_types.h gen_def$(EXEEXT_FOR_BUILD)

Added: branches/V4-branch/providers/skel-implementation/capi/capi_specs_create_table.xml.in
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/capi_specs_create_table.xml.in	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<serv_op>
+  <parameters id="TABLE_DEF_P" _name="Table's description">
+    <parameter id="TABLE_NAME" _name="Name" _descr="Table's name" gdatype="gchararray" nullok="FALSE">
+      <gda_value>table_name</gda_value>
+    </parameter>
+  </parameters>
+
+  <!-- list of fields -->
+  <gda_array id="FIELDS_A" _name="Table's columns">
+    <gda_array_field id="COLUMN_NAME" _name="Field name" gdatype="gchararray" nullok="FALSE"/>
+    <gda_array_field id="COLUMN_TYPE" _name="Data type" gdatype="gchararray" hint="datatype" nullok="FALSE"/>
+    <gda_array_field id="COLUMN_NNUL" _name="Not NULL" gdatype="gboolean"/>
+    <gda_array_field id="COLUMN_UNIQUE" _name="Unique" gdatype="gboolean"/>
+    <gda_array_field id="COLUMN_PKEY" _name="Primary key" gdatype="gboolean"/>
+    <gda_array_field id="COLUMN_DEFAULT" _name="Default" _descr="Default value" gdatype="gchararray"/>
+    <gda_array_field id="COLUMN_CHECK" _name="Check" _descr="Check constraint" gdatype="gchararray"/>
+    <gda_array_data>
+        <gda_array_row>
+            <gda_value>id</gda_value>
+            <gda_value>integer</gda_value>
+            <gda_value>TRUE</gda_value>
+            <gda_value>TRUE</gda_value>
+            <gda_value>TRUE</gda_value>
+            <gda_value></gda_value>
+            <gda_value></gda_value>
+        </gda_array_row>
+    </gda_array_data>
+  </gda_array>
+
+  <!-- other table constraints -->
+  <sequence id="TABLE_CONSTRAINTS_S" _name="Global constraints">
+    <parameter id="CONSTRAINT_STRING" name="Constraint" gdatype="gchararray">
+      <gda_value>CHECK (column &gt; 0)</gda_value>
+    </parameter>
+  </sequence>
+</serv_op>

Added: branches/V4-branch/providers/skel-implementation/capi/capi_specs_dsn.xml.in
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/capi_specs_dsn.xml.in	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<data-set-spec>
+  <parameters>
+    <parameter id="DB_NAME" _name="Database name" _descr="The name of a database to use" gdatype="gchararray" nullok="FALSE"/>
+  </parameters>
+</data-set-spec>

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-blob-op.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-blob-op.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,191 @@
+/* GDA Capi provider
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib/gi18n-lib.h>
+#include <string.h>
+#include <libgda/libgda.h>
+#include "gda-capi.h"
+#include "gda-capi-blob-op.h"
+
+struct _GdaCapiBlobOpPrivate {
+	GdaConnection *cnc;
+	/* TO_ADD: specific information describing a Blob in the C API */
+};
+
+static void gda_capi_blob_op_class_init (GdaCapiBlobOpClass *klass);
+static void gda_capi_blob_op_init       (GdaCapiBlobOp *blob,
+					 GdaCapiBlobOpClass *klass);
+static void gda_capi_blob_op_finalize   (GObject *object);
+
+static glong gda_capi_blob_op_get_length (GdaBlobOp *op);
+static glong gda_capi_blob_op_read       (GdaBlobOp *op, GdaBlob *blob, glong offset, glong size);
+static glong gda_capi_blob_op_write      (GdaBlobOp *op, GdaBlob *blob, glong offset);
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Object init and finalize
+ */
+GType
+gda_capi_blob_op_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static const GTypeInfo info = {
+			sizeof (GdaCapiBlobOpClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) gda_capi_blob_op_class_init,
+			NULL,
+			NULL,
+			sizeof (GdaCapiBlobOp),
+			0,
+			(GInstanceInitFunc) gda_capi_blob_op_init
+		};
+		type = g_type_register_static (GDA_TYPE_BLOB_OP, "GdaCapiBlobOp", &info, 0);
+	}
+	return type;
+}
+
+static void
+gda_capi_blob_op_init (GdaCapiBlobOp *op,
+			   GdaCapiBlobOpClass *klass)
+{
+	g_return_if_fail (GDA_IS_CAPI_BLOB_OP (op));
+
+	op->priv = g_new0 (GdaCapiBlobOpPrivate, 1);
+
+	/* initialize specific structure */
+	TO_IMPLEMENT;
+}
+
+static void
+gda_capi_blob_op_class_init (GdaCapiBlobOpClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	GdaBlobOpClass *blob_class = GDA_BLOB_OP_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	object_class->finalize = gda_capi_blob_op_finalize;
+	blob_class->get_length = gda_capi_blob_op_get_length;
+	blob_class->read = gda_capi_blob_op_read;
+	blob_class->write = gda_capi_blob_op_write;
+}
+
+static void
+gda_capi_blob_op_finalize (GObject * object)
+{
+	GdaCapiBlobOp *pgop = (GdaCapiBlobOp *) object;
+
+	g_return_if_fail (GDA_IS_CAPI_BLOB_OP (pgop));
+
+	/* free specific information */
+	TO_IMPLEMENT;
+
+	g_free (pgop->priv);
+	pgop->priv = NULL;
+
+	parent_class->finalize (object);
+}
+
+GdaBlobOp *
+gda_capi_blob_op_new (GdaConnection *cnc)
+{
+	GdaCapiBlobOp *pgop;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+
+	pgop = g_object_new (GDA_TYPE_CAPI_BLOB_OP, NULL);
+	pgop->priv->cnc = cnc;
+	
+	return GDA_BLOB_OP (pgop);
+}
+
+/*
+ * Get length request
+ */
+static glong
+gda_capi_blob_op_get_length (GdaBlobOp *op)
+{
+	GdaCapiBlobOp *pgop;
+
+	g_return_val_if_fail (GDA_IS_CAPI_BLOB_OP (op), -1);
+	pgop = GDA_CAPI_BLOB_OP (op);
+	g_return_val_if_fail (pgop->priv, -1);
+	g_return_val_if_fail (GDA_IS_CONNECTION (pgop->priv->cnc), -1);
+
+	TO_IMPLEMENT;
+	return -1;
+}
+
+/*
+ * Blob read request
+ */
+static glong
+gda_capi_blob_op_read (GdaBlobOp *op, GdaBlob *blob, glong offset, glong size)
+{
+	GdaCapiBlobOp *pgop;
+	GdaBinary *bin;
+
+	g_return_val_if_fail (GDA_IS_CAPI_BLOB_OP (op), -1);
+	pgop = GDA_CAPI_BLOB_OP (op);
+	g_return_val_if_fail (pgop->priv, -1);
+	g_return_val_if_fail (GDA_IS_CONNECTION (pgop->priv->cnc), -1);
+	if (offset >= G_MAXINT)
+		return -1;
+	g_return_val_if_fail (blob, -1);
+
+	bin = (GdaBinary *) blob;
+	if (bin->data) 
+		g_free (bin->data);
+	bin->data = g_new0 (gchar, size);
+	bin->binary_length = 0;
+
+	/* fetch blob data using C API into bin->data, and set bin->binary_length */
+	TO_IMPLEMENT;
+
+	return bin->binary_length;
+}
+
+/*
+ * Blob write request
+ */
+static glong
+gda_capi_blob_op_write (GdaBlobOp *op, GdaBlob *blob, glong offset)
+{
+	GdaCapiBlobOp *pgop;
+	GdaBinary *bin;
+
+	g_return_val_if_fail (GDA_IS_CAPI_BLOB_OP (op), -1);
+	pgop = GDA_CAPI_BLOB_OP (op);
+	g_return_val_if_fail (pgop->priv, -1);
+	g_return_val_if_fail (GDA_IS_CONNECTION (pgop->priv->cnc), -1);
+	g_return_val_if_fail (blob, -1);
+
+	/* write blob using bin->data and bin->binary_length */
+	bin = (GdaBinary *) blob;
+	TO_IMPLEMENT;
+
+	return -1;
+}

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-blob-op.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-blob-op.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,57 @@
+/* GDA Capi provider
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDA_CAPI_BLOB_OP_H__
+#define __GDA_CAPI_BLOB_OP_H__
+
+#include <libgda/gda-blob-op.h>
+
+G_BEGIN_DECLS
+
+#define GDA_TYPE_CAPI_BLOB_OP            (gda_capi_blob_op_get_type())
+#define GDA_CAPI_BLOB_OP(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_TYPE_CAPI_BLOB_OP, GdaCapiBlobOp))
+#define GDA_CAPI_BLOB_OP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, GDA_TYPE_CAPI_BLOB_OP, GdaCapiBlobOpClass))
+#define GDA_IS_CAPI_BLOB_OP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, GDA_TYPE_CAPI_BLOB_OP))
+#define GDA_IS_CAPI_BLOB_OP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDA_TYPE_CAPI_BLOB_OP))
+
+typedef struct _GdaCapiBlobOp        GdaCapiBlobOp;
+typedef struct _GdaCapiBlobOpClass   GdaCapiBlobOpClass;
+typedef struct _GdaCapiBlobOpPrivate GdaCapiBlobOpPrivate;
+
+struct _GdaCapiBlobOp {
+	GdaBlobOp             parent;
+	GdaCapiBlobOpPrivate *priv;
+};
+
+struct _GdaCapiBlobOpClass {
+	GdaBlobOpClass        parent_class;
+};
+
+GType         gda_capi_blob_op_get_type     (void) G_GNUC_CONST;
+GdaBlobOp    *gda_capi_blob_op_new          (GdaConnection *cnc);
+
+/* TO_ADD: more convenient API to create a GdaBlobOp with some specific information as argument */
+
+G_END_DECLS
+
+#endif
+

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-ddl.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-ddl.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,144 @@
+/* GDA Capi Provider
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib/gi18n-lib.h>
+#include <libgda/libgda.h>
+#include "gda-capi-ddl.h"
+
+gchar *
+gda_capi_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc, 
+			      GdaServerOperation *op, GError **error)
+{
+	GString *string;
+	const GValue *value;
+	gboolean allok = TRUE;
+	gboolean hasfields = FALSE;
+	gint nrows;
+	gint i;
+	gboolean first;
+	GSList *pkfields = NULL; /* list of GValue* composing the pkey */
+	gint nbpkfields = 0;
+	gchar *sql = NULL;
+
+	/* CREATE TABLE */
+	string = g_string_new ("CREATE TABLE ");
+
+	value = gda_server_operation_get_value_at (op, "/TABLE_DEF_P/TABLE_NAME");
+	g_assert (value && G_VALUE_HOLDS (value, G_TYPE_STRING));
+	g_string_append (string, g_value_get_string (value));
+	g_string_append (string, " (");
+		
+	/* FIELDS */
+	if (allok) {
+		GdaServerOperationNode *node;
+
+		node = gda_server_operation_get_node_info (op, "/FIELDS_A");
+		g_assert (node);
+
+		/* finding if there is a composed primary key */
+		nrows = gda_data_model_get_n_rows (node->model);
+		for (i = 0; i < nrows; i++) {
+			value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_PKEY/%d", i);
+			if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
+				pkfields = g_slist_append (pkfields,
+							   (GValue *) gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_NAME/%d", i));
+		}
+		nbpkfields = g_slist_length (pkfields);
+
+		/* manually defined fields */
+		first = TRUE;
+		for (i = 0; i < nrows; i++) {
+			hasfields = TRUE;
+			if (first) 
+				first = FALSE;
+			else
+				g_string_append (string, ", ");
+				
+			value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_NAME/%d", i);
+			g_string_append (string, g_value_get_string (value));
+			g_string_append_c (string, ' ');
+				
+			value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_TYPE/%d", i);
+			g_string_append (string, g_value_get_string (value));
+				
+			value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_DEFAULT/%d", i);
+			if (value && G_VALUE_HOLDS (value, G_TYPE_STRING)) {
+				const gchar *str = g_value_get_string (value);
+				if (str && *str) {
+					g_string_append (string, " DEFAULT ");
+					g_string_append (string, str);
+				}
+			}
+				
+			value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_NNUL/%d", i);
+			if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
+				g_string_append (string, " NOT NULL");
+
+			value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_UNIQUE/%d", i);
+			if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
+				g_string_append (string, " UNIQUE");
+				
+			if (nbpkfields == 1) {
+				value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_PKEY/%d", i);
+				if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
+					g_string_append (string, " PRIMARY KEY");
+			}
+				
+			value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_CHECK/%d", i);
+			if (value && G_VALUE_HOLDS (value, G_TYPE_STRING)) {
+				const gchar *str = g_value_get_string (value);
+				if (str && *str) {
+					g_string_append (string, " CHECK (");
+					g_string_append (string, str);
+					g_string_append_c (string, ')');
+				}
+			}
+		}
+	}
+
+	/* composed primary key */
+	if (nbpkfields > 1) {
+		GSList *list = pkfields;
+
+		g_string_append (string, ", PRIMARY KEY (");
+		while (list) {
+			if (list != pkfields)
+				g_string_append (string, ", ");
+			g_string_append (string, g_value_get_string ((GValue*) list->data));
+			list = list->next;
+		}
+		g_string_append_c (string, ')');
+	}
+
+	g_string_append (string, ")");
+
+	if (!hasfields) {
+		allok = FALSE;
+		g_set_error (error, 0, 0, _("Table to create must have at least one row"));
+	}
+	g_slist_free (pkfields);
+
+	sql = string->str;
+	g_string_free (string, FALSE);
+
+	return sql;
+}

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-ddl.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-ddl.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,34 @@
+/* GDA Capi provider
+ * Copyright (C) 2006 - 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __GDA_CAPI_DDL_H__
+#define __GDA_CAPI_DDL_H__
+
+#include <libgda/gda-server-provider.h>
+
+G_BEGIN_DECLS
+
+gchar *gda_capi_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc, 
+				     GdaServerOperation *op, GError **error);
+G_END_DECLS
+
+#endif
+

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-meta.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-meta.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,238 @@
+/* GDA capi provider
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include "gda-capi.h"
+#include "gda-capi-meta.h"
+#include "gda-capi-provider.h"
+#include <libgda/gda-meta-store.h>
+#include <libgda/sql-parser/gda-sql-parser.h>
+#include <glib/gi18n-lib.h>
+#include <libgda/gda-server-provider-extra.h>
+#include <libgda/gda-connection-private.h>
+#include <libgda/gda-data-model-array.h>
+#include <libgda/gda-set.h>
+
+static gboolean append_a_row (GdaDataModel *to_model, GError **error, gint nb, ...);
+
+/*
+ * predefined statements' IDs
+ */
+typedef enum {
+        I_STMT_1,
+} InternalStatementItem;
+
+
+/*
+ * predefined statements' SQL
+ */
+static gchar *internal_sql[] = {
+	"SQL for I_STMT_1"
+};
+
+/*
+ * predefined statements' GdaStatement
+ */
+static GdaStatement **internal_stmt;
+static GdaSet        *internal_params;
+
+/* 
+ * global static values
+ */
+static GdaSqlParser *internal_parser = NULL;
+/* TO_ADD: other static values */
+
+
+/*
+ * Meta initialization
+ */
+void
+_gda_capi_provider_meta_init (GdaServerProvider *provider)
+{
+	InternalStatementItem i;
+
+        internal_parser = gda_server_provider_internal_get_parser (provider);
+	internal_params = gda_set_new (NULL);
+
+        internal_stmt = g_new0 (GdaStatement *, sizeof (internal_sql) / sizeof (gchar*));
+        for (i = I_STMT_1; i < sizeof (internal_sql) / sizeof (gchar*); i++) {
+		GdaSet *set;
+                internal_stmt[i] = gda_sql_parser_parse_string (internal_parser, internal_sql[i], NULL, NULL);
+                if (!internal_stmt[i])
+                        g_error ("Could not parse internal statement: %s\n", internal_sql[i]);
+		g_assert (gda_statement_get_parameters (internal_stmt[i], &set, NULL));
+		if (set) {
+			gda_set_merge_with_set (internal_params, set);
+			g_object_unref (set);
+		}
+        }
+
+	/* initialize static values here */
+}
+
+gboolean
+_gda_capi_meta_info (GdaServerProvider *prov, GdaConnection *cnc, 
+		     GdaMetaStore *store, GdaMetaContext *context, GError **error)
+{
+	GdaDataModel *model;
+	gboolean retval = TRUE;
+
+	model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (model);
+
+	/* fill in @model */
+	TO_IMPLEMENT;
+	if (retval)
+		retval = gda_meta_store_modify (store, context->table_name, model, NULL, error, NULL);
+	g_object_unref (model);
+
+	return retval;
+}
+
+gboolean
+_gda_capi_meta_btypes (GdaServerProvider *prov, GdaConnection *cnc, 
+		       GdaMetaStore *store, GdaMetaContext *context, GError **error)
+{
+	GdaDataModel *model;
+	gboolean retval = TRUE;
+
+	model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (model);
+
+	/* fill in @model */
+	TO_IMPLEMENT;
+	if (retval)
+		retval = gda_meta_store_modify (store, context->table_name, model, NULL, error, NULL);
+	g_object_unref (model);
+
+	return retval;
+}
+
+gboolean 
+_gda_capi_meta_schemata (GdaServerProvider *prov, GdaConnection *cnc, 
+			 GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+			 const GValue *schema_name)
+{
+	GdaDataModel *model;
+	gboolean retval = TRUE;
+
+	model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (model);
+
+	/* fill in @model */
+	TO_IMPLEMENT;
+	if (retval)
+		retval = gda_meta_store_modify (store, context->table_name, model, NULL, error, NULL);
+	g_object_unref (model);
+
+	return retval;
+}
+
+
+
+gboolean
+_gda_capi_meta_tables_views (GdaServerProvider *prov, GdaConnection *cnc, 
+			     GdaMetaStore *store, GdaMetaContext *context, GError **error)
+{
+	GdaDataModel *model;
+	gboolean retval = TRUE;
+
+	model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (model);
+
+	/* fill in @model */
+	TO_IMPLEMENT;
+	if (retval)
+		retval = gda_meta_store_modify (store, context->table_name, model, NULL, error, NULL);
+	g_object_unref (model);
+
+	return retval;
+}
+
+
+
+gboolean 
+_gda_capi_meta_tables_views_s (GdaServerProvider *prov, GdaConnection *cnc, 
+			       GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+			       const GValue *table_schema, const GValue *table_name)
+{
+	GdaDataModel *model;
+	gboolean retval = TRUE;
+
+	model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (model);
+
+	/* fill in @model */
+	TO_IMPLEMENT;
+	if (retval)
+		retval = gda_meta_store_modify (store, context->table_name, model, NULL, error, NULL);
+	g_object_unref (model);
+
+	return retval;
+}
+
+gboolean
+_gda_capi_meta_columns (GdaServerProvider *prov, GdaConnection *cnc, 
+			GdaMetaStore *store, GdaMetaContext *context, GError **error)
+{
+	GdaDataModel *model;
+	gboolean retval = TRUE;
+
+	model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (model);
+
+	/* fill in @model */
+	TO_IMPLEMENT;
+	if (retval)
+		retval = gda_meta_store_modify (store, context->table_name, model, NULL, error, NULL);
+	g_object_unref (model);
+
+	return retval;
+}
+
+gboolean
+_gda_capi_meta_columns_t (GdaServerProvider *prov, GdaConnection *cnc, 
+			  GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+			  const GValue *table_schema, const GValue *table_name)
+{
+	return _gda_capi_meta_columns_c (prov, cnc, store, context, error, table_schema, table_name, NULL);
+}
+
+gboolean
+_gda_capi_meta_columns_c (GdaServerProvider *prov, GdaConnection *cnc, 
+			  GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+			  const GValue *table_schema, const GValue *table_name, const GValue *column_name)
+{
+	GdaDataModel *model;
+	gboolean retval = TRUE;
+
+	model = gda_meta_store_create_modify_data_model (store, context->table_name);
+	g_assert (model);
+
+	/* fill in @model */
+	TO_IMPLEMENT;
+	if (retval)
+		retval = gda_meta_store_modify (store, context->table_name, model, NULL, error, NULL);
+	g_object_unref (model);
+
+	return retval;
+}

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-meta.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-meta.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,56 @@
+/* GDA capi provider
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __GDA_CAPI_META_H__
+#define __GDA_CAPI_META_H__
+
+#include <libgda/gda-server-provider.h>
+
+G_BEGIN_DECLS
+
+void     _gda_capi_provider_meta_init (GdaServerProvider *provider);
+gboolean _gda_capi_meta_info          (GdaServerProvider *prov, GdaConnection *cnc, 
+				       GdaMetaStore *store, GdaMetaContext *context, GError **error);
+gboolean _gda_capi_meta_btypes        (GdaServerProvider *prov, GdaConnection *cnc, 
+				       GdaMetaStore *store, GdaMetaContext *context, GError **error);
+gboolean _gda_capi_meta_schemata      (GdaServerProvider *prov, GdaConnection *cnc, 
+				       GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+				       const GValue *schema_name);
+gboolean _gda_capi_meta_tables_views  (GdaServerProvider *prov, GdaConnection *cnc, 
+				       GdaMetaStore *store, GdaMetaContext *context, GError **error);
+gboolean _gda_capi_meta_tables_views_s(GdaServerProvider *prov, GdaConnection *cnc, 
+				       GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+				       const GValue *table_schema, const GValue *table_name);
+gboolean _gda_capi_meta_columns        (GdaServerProvider *prov, GdaConnection *cnc, 
+					GdaMetaStore *store, GdaMetaContext *context, GError **error);
+gboolean _gda_capi_meta_columns_t      (GdaServerProvider *prov, GdaConnection *cnc, 
+					GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+					const GValue *table_schema, const GValue *table_name);
+gboolean _gda_capi_meta_columns_c      (GdaServerProvider *prov, GdaConnection *cnc, 
+					GdaMetaStore *store, GdaMetaContext *context, GError **error, 
+					const GValue *table_schema, const GValue *table_name, const GValue *column_name);
+
+/* TO_ADD: more functions as defined in GdaServerProviderMeta */
+
+G_END_DECLS
+
+#endif
+

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-parser.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-parser.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,80 @@
+/* GDA Capi provider
+ *
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gda-capi-parser.h"
+#include "capi_token_types.h"
+#include <string.h>
+
+/* 
+ * Main static functions 
+ */
+static void gda_capi_parser_class_init (GdaCapiParserClass *klass);
+static void gda_capi_parser_init (GdaCapiParser *stmt);
+
+GType
+gda_capi_parser_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static const GTypeInfo info = {
+			sizeof (GdaCapiParserClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) gda_capi_parser_class_init,
+			NULL,
+			NULL,
+			sizeof (GdaCapiParser),
+			0,
+			(GInstanceInitFunc) gda_capi_parser_init
+		};
+		
+		type = g_type_register_static (GDA_TYPE_SQL_PARSER, "GdaCapiParser", &info, 0);
+	}
+	return type;
+}
+
+/*
+ * The interface to the LEMON-generated parser
+ */
+void *gda_lemon_capi_parserAlloc (void*(*)(size_t));
+void gda_lemon_capi_parserFree (void*, void(*)(void*));
+void gda_lemon_capi_parserTrace (void*, char *);
+void gda_lemon_capi_parser (void*, int, GValue *, GdaSqlParserIface *);
+
+static void
+gda_capi_parser_class_init (GdaCapiParserClass * klass)
+{
+	GdaSqlParserClass *pclass = GDA_SQL_PARSER_CLASS (klass);
+
+	pclass->parser_alloc = gda_lemon_capi_parserAlloc;
+	pclass->parser_free = gda_lemon_capi_parserFree;
+	pclass->parser_trace = gda_lemon_capi_parserTrace;
+	pclass->parser_parse = gda_lemon_capi_parser;
+	pclass->parser_tokens_trans = capi_parser_tokens;
+}
+
+static void
+gda_capi_parser_init (GdaCapiParser *parser)
+{
+}

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-parser.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-parser.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,58 @@
+/* GDA Capi provider
+ *
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GDA_CAPI_PARSER_H_
+#define __GDA_CAPI_PARSER_H_
+
+#include <sql-parser/gda-sql-parser.h>
+
+G_BEGIN_DECLS
+
+#define GDA_TYPE_CAPI_PARSER          (gda_capi_parser_get_type())
+#define GDA_CAPI_PARSER(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gda_capi_parser_get_type(), GdaCapiParser)
+#define GDA_CAPI_PARSER_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gda_capi_parser_get_type (), GdaCapiParserClass)
+#define GDA_IS_CAPI_PARSER(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gda_capi_parser_get_type ())
+
+typedef struct _GdaCapiParser GdaCapiParser;
+typedef struct _GdaCapiParserClass GdaCapiParserClass;
+typedef struct _GdaCapiParserPrivate GdaCapiParserPrivate;
+
+/* struct for the object's data */
+struct _GdaCapiParser
+{
+	GdaSqlParser          object;
+	GdaCapiParserPrivate *priv;
+};
+
+/* struct for the object's class */
+struct _GdaCapiParserClass
+{
+	GdaSqlParserClass      parent_class;
+};
+
+GType gda_capi_parser_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-provider.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-provider.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,995 @@
+/* GDA Capi provider
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <glib/gi18n-lib.h>
+#include <glib/gstdio.h>
+#include <libgda/libgda.h>
+#include <libgda/gda-data-model-private.h>
+#include <libgda/gda-server-provider-extra.h>
+#include <libgda/binreloc/gda-binreloc.h>
+#include <libgda/gda-statement-extra.h>
+#include <sql-parser/gda-sql-parser.h>
+#include "gda-capi.h"
+#include "gda-capi-provider.h"
+#include "gda-capi-recordset.h"
+#include "gda-capi-ddl.h"
+#include "gda-capi-meta.h"
+#define _GDA_PSTMT(x) ((GdaPStmt*)(x))
+
+/*
+ * GObject methods
+ */
+static void gda_capi_provider_class_init (GdaCapiProviderClass *klass);
+static void gda_capi_provider_init       (GdaCapiProvider *provider,
+					  GdaCapiProviderClass *klass);
+static GObjectClass *parent_class = NULL;
+
+/*
+ * GdaServerProvider's virtual methods
+ */
+/* connection management */
+static gboolean            gda_capi_provider_open_connection (GdaServerProvider *provider,
+								GdaConnection *cnc,
+								GdaQuarkList *params,
+								const gchar *username,
+								const gchar *password);
+static gboolean            gda_capi_provider_close_connection (GdaServerProvider *provider,
+								 GdaConnection *cnc);
+static const gchar        *gda_capi_provider_get_server_version (GdaServerProvider *provider,
+								   GdaConnection *cnc);
+static const gchar        *gda_capi_provider_get_database (GdaServerProvider *provider,
+							     GdaConnection *cnc);
+
+/* DDL operations */
+static gboolean            gda_capi_provider_supports_operation (GdaServerProvider *provider, GdaConnection *cnc,
+								   GdaServerOperationType type, GdaSet *options);
+static GdaServerOperation *gda_capi_provider_create_operation (GdaServerProvider *provider, GdaConnection *cnc,
+								 GdaServerOperationType type,
+								 GdaSet *options, GError **error);
+static gchar              *gda_capi_provider_render_operation (GdaServerProvider *provider, GdaConnection *cnc,
+								 GdaServerOperation *op, GError **error);
+
+static gboolean            gda_capi_provider_perform_operation (GdaServerProvider *provider, GdaConnection *cnc,
+								  GdaServerOperation *op, GError **error);
+/* transactions */
+static gboolean            gda_capi_provider_begin_transaction (GdaServerProvider *provider, GdaConnection *cnc,
+								  const gchar *name, GdaTransactionIsolation level, GError **error);
+static gboolean            gda_capi_provider_commit_transaction (GdaServerProvider *provider, GdaConnection *cnc,
+								 const gchar *name, GError **error);
+static gboolean            gda_capi_provider_rollback_transaction (GdaServerProvider *provider, GdaConnection * cnc,
+								   const gchar *name, GError **error);
+static gboolean            gda_capi_provider_add_savepoint (GdaServerProvider *provider, GdaConnection *cnc,
+							    const gchar *name, GError **error);
+static gboolean            gda_capi_provider_rollback_savepoint (GdaServerProvider *provider, GdaConnection *cnc,
+								 const gchar *name, GError **error);
+static gboolean            gda_capi_provider_delete_savepoint (GdaServerProvider *provider, GdaConnection *cnc,
+							       const gchar *name, GError **error);
+
+/* information retreival */
+static const gchar        *gda_capi_provider_get_version (GdaServerProvider *provider);
+static gboolean            gda_capi_provider_supports_feature (GdaServerProvider *provider,
+							       GdaConnection *cnc,
+							       GdaConnectionFeature feature);
+
+static const gchar        *gda_capi_provider_get_name (GdaServerProvider *provider);
+
+static GdaDataHandler     *gda_capi_provider_get_data_handler (GdaServerProvider *provider,
+								 GdaConnection *cnc,
+								 GType g_type,
+								 const gchar *dbms_type);
+
+static const gchar*        gda_capi_provider_get_default_dbms_type (GdaServerProvider *provider,
+								      GdaConnection *cnc,
+								      GType type);
+/* statements */
+static GdaSqlParser        *gda_capi_provider_create_parser (GdaServerProvider *provider, GdaConnection *cnc);
+static gchar               *gda_capi_provider_statement_to_sql  (GdaServerProvider *provider, GdaConnection *cnc,
+								   GdaStatement *stmt, GdaSet *params, 
+								   GdaStatementSqlFlag flags,
+								   GSList **params_used, GError **error);
+static gboolean             gda_capi_provider_statement_prepare (GdaServerProvider *provider, GdaConnection *cnc,
+								   GdaStatement *stmt, GError **error);
+static GObject             *gda_capi_provider_statement_execute (GdaServerProvider *provider, GdaConnection *cnc,
+								   GdaStatement *stmt, GdaSet *params,
+								   GdaStatementModelUsage model_usage, 
+								   GType *col_types, GdaSet **last_inserted_row, 
+								   GError **error);
+
+/* 
+ * private connection data destroy 
+ */
+static void gda_capi_free_cnc_data (CapiConnectionData *cdata);
+
+
+/*
+ * Prepared internal statements
+ * TO_ADD: any prepared statement to be used internally by the provider should be
+ *         declared here, as constants and as SQL statements
+ */
+GdaStatement **internal_stmt;
+
+typedef enum {
+	INTERNAL_STMT1
+} InternalStatementItem;
+
+gchar *internal_sql[] = {
+	"SQL for INTERNAL_STMT1"
+};
+
+/*
+ * GdaCapiProvider class implementation
+ */
+static void
+gda_capi_provider_class_init (GdaCapiProviderClass *klass)
+{
+	GdaServerProviderClass *provider_class = GDA_SERVER_PROVIDER_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	provider_class->get_version = gda_capi_provider_get_version;
+	provider_class->get_server_version = gda_capi_provider_get_server_version;
+	provider_class->get_name = gda_capi_provider_get_name;
+	provider_class->supports_feature = gda_capi_provider_supports_feature;
+
+	provider_class->get_data_handler = gda_capi_provider_get_data_handler;
+	provider_class->get_def_dbms_type = gda_capi_provider_get_default_dbms_type;
+
+	provider_class->create_connection = NULL;
+	provider_class->open_connection = gda_capi_provider_open_connection;
+	provider_class->close_connection = gda_capi_provider_close_connection;
+	provider_class->get_database = gda_capi_provider_get_database;
+
+	provider_class->supports_operation = gda_capi_provider_supports_operation;
+        provider_class->create_operation = gda_capi_provider_create_operation;
+        provider_class->render_operation = gda_capi_provider_render_operation;
+        provider_class->perform_operation = gda_capi_provider_perform_operation;
+
+	provider_class->begin_transaction = gda_capi_provider_begin_transaction;
+	provider_class->commit_transaction = gda_capi_provider_commit_transaction;
+	provider_class->rollback_transaction = gda_capi_provider_rollback_transaction;
+	provider_class->add_savepoint = gda_capi_provider_add_savepoint;
+        provider_class->rollback_savepoint = gda_capi_provider_rollback_savepoint;
+        provider_class->delete_savepoint = gda_capi_provider_delete_savepoint;
+
+	provider_class->create_parser = gda_capi_provider_create_parser;
+	provider_class->statement_to_sql = gda_capi_provider_statement_to_sql;
+	provider_class->statement_prepare = gda_capi_provider_statement_prepare;
+	provider_class->statement_execute = gda_capi_provider_statement_execute;
+
+	memset (&(provider_class->meta_funcs), 0, sizeof (GdaServerProviderMeta));
+	provider_class->meta_funcs.info = _gda_capi_meta_info;
+	provider_class->meta_funcs.btypes = _gda_capi_meta_btypes;
+	provider_class->meta_funcs.schemata = _gda_capi_meta_schemata;
+	provider_class->meta_funcs.tables_views = _gda_capi_meta_tables_views;
+	provider_class->meta_funcs.tables_views_s = _gda_capi_meta_tables_views_s;
+	provider_class->meta_funcs.columns = _gda_capi_meta_columns;
+	provider_class->meta_funcs.columns_t = _gda_capi_meta_columns_t;
+	provider_class->meta_funcs.columns_c = _gda_capi_meta_columns_c;
+}
+
+static void
+gda_capi_provider_init (GdaCapiProvider *capi_prv, GdaCapiProviderClass *klass)
+{
+	InternalStatementItem i;
+	GdaSqlParser *parser;
+
+	parser = gda_server_provider_internal_get_parser ((GdaServerProvider*) capi_prv);
+	internal_stmt = g_new0 (GdaStatement *, sizeof (internal_sql) / sizeof (gchar*));
+	for (i = INTERNAL_STMT1; i < sizeof (internal_sql) / sizeof (gchar*); i++) {
+		internal_stmt[i] = gda_sql_parser_parse_string (parser, internal_sql[i], NULL, NULL);
+		if (!internal_stmt[i]) 
+			g_error ("Could not parse internal statement: %s\n", internal_sql[i]);
+	}
+
+	/* meta data init */
+	_gda_capi_provider_meta_init ((GdaServerProvider*) capi_prv);
+
+	/* TO_ADD: any other provider's init should be added here */
+}
+
+GType
+gda_capi_provider_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static GTypeInfo info = {
+			sizeof (GdaCapiProviderClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) gda_capi_provider_class_init,
+			NULL, NULL,
+			sizeof (GdaCapiProvider),
+			0,
+			(GInstanceInitFunc) gda_capi_provider_init
+		};
+		type = g_type_register_static (GDA_TYPE_SERVER_PROVIDER, "GdaCapiProvider",
+					       &info, 0);
+	}
+
+	return type;
+}
+
+
+/*
+ * Get provider name request
+ */
+static const gchar *
+gda_capi_provider_get_name (GdaServerProvider *provider)
+{
+	return CAPI_PROVIDER_NAME;
+}
+
+/* 
+ * Get provider's version, no need to change this
+ */
+static const gchar *
+gda_capi_provider_get_version (GdaServerProvider *provider)
+{
+	return PACKAGE_VERSION;
+}
+
+/* 
+ * Open connection request
+ *
+ * In this function, the following _must_ be done:
+ *   - check for the presence and validify of the parameters required to actually open a connection,
+ *     using @params
+ *   - open the real connection to the database using the parameters previously checked
+ *   - create a CapiConnectionData structure and associate it to @cnc
+ *
+ * Returns: TRUE if no error occurred, or FALSE otherwise (and an ERROR gonnection event must be added to @cnc)
+ */
+static gboolean
+gda_capi_provider_open_connection (GdaServerProvider *provider, GdaConnection *cnc,
+				   GdaQuarkList *params,
+				   const gchar *username,
+				   const gchar *password)
+{
+	g_return_val_if_fail (GDA_IS_CAPI_PROVIDER (provider), FALSE);
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+
+	/* Check for connection parameters */
+	/* TO_ADD: your own connection parameters */
+	const gchar *db_name;
+	db_name = gda_quark_list_find (params, "DB_NAME");
+	if (!db_name) {
+		gda_connection_add_event_string (cnc,
+						 _("The connection string must contain the DB_NAME values"));
+		return FALSE;
+	}
+	
+	/* open the real connection to the database */
+	/* TO_ADD: C API specific function calls;
+	 * if it fails, add a connection event and return FALSE */
+	TO_IMPLEMENT;
+
+	/* Create a new instance of the provider specific data associated to a connection (CapiConnectionData),
+	 * and set its contents */
+	CapiConnectionData *cdata;
+	cdata = g_new0 (CapiConnectionData, 1);
+	gda_connection_internal_set_provider_data (cnc, cdata, (GDestroyNotify) gda_capi_free_cnc_data);
+	TO_IMPLEMENT; /* cdata->... = ... */
+
+	/* Optionnally set some attributes for the newly opened connection (encoding to UTF-8 for example )*/
+	TO_IMPLEMENT;
+
+	return TRUE;
+}
+
+/* 
+ * Close connection request
+ *
+ * In this function, the following _must_ be done:
+ *   - Actually close the connection to the database using @cnc's associated CapiConnectionData structure
+ *   - Free the CapiConnectionData structure and its contents
+ *
+ * Returns: TRUE if no error occurred, or FALSE otherwise (and an ERROR gonnection event must be added to @cnc)
+ */
+static gboolean
+gda_capi_provider_close_connection (GdaServerProvider *provider, GdaConnection *cnc)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+
+	/* Close the connection using the C API */
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+	TO_IMPLEMENT;
+
+	/* Free the CapiConnectionData structure and its contents*/
+	gda_capi_free_cnc_data (cdata);
+	gda_connection_internal_set_provider_data (cnc, NULL, NULL);
+
+	return TRUE;
+}
+
+/*
+ * Server version request
+ *
+ * Returns the server version as a string, which should be stored in @cnc's associated CapiConnectionData structure
+ */
+static const gchar *
+gda_capi_provider_get_server_version (GdaServerProvider *provider, GdaConnection *cnc)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+	TO_IMPLEMENT;
+	return NULL;
+}
+
+/*
+ * Get database request
+ *
+ * Returns the server version as a string, which should be stored in @cnc's associated CapiConnectionData structure
+ */
+static const gchar *
+gda_capi_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return NULL;
+	TO_IMPLEMENT;
+	return NULL;
+}
+
+/*
+ * Support operation request
+ *
+ * Tells what the implemented server operations are. To add support for an operation, the following steps are required:
+ *   - create a capi_specs_....xml.in file describing the required and optional parameters for the operation
+ *   - add it to the Makefile.am
+ *   - make this method return TRUE for the operation type
+ *   - implement the gda_capi_provider_render_operation() and gda_capi_provider_perform_operation() methods
+ *
+ * In this example, the GDA_SERVER_OPERATION_CREATE_TABLE is implemented
+ */
+static gboolean
+gda_capi_provider_supports_operation (GdaServerProvider *provider, GdaConnection *cnc,
+				      GdaServerOperationType type, GdaSet *options)
+{
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	}
+
+        switch (type) {
+        case GDA_SERVER_OPERATION_CREATE_DB:
+        case GDA_SERVER_OPERATION_DROP_DB:
+		return FALSE;
+
+        case GDA_SERVER_OPERATION_CREATE_TABLE:
+		return TRUE;
+        case GDA_SERVER_OPERATION_DROP_TABLE:
+        case GDA_SERVER_OPERATION_RENAME_TABLE:
+
+        case GDA_SERVER_OPERATION_ADD_COLUMN:
+
+        case GDA_SERVER_OPERATION_CREATE_INDEX:
+        case GDA_SERVER_OPERATION_DROP_INDEX:
+
+        case GDA_SERVER_OPERATION_CREATE_VIEW:
+        case GDA_SERVER_OPERATION_DROP_VIEW:
+        default:
+                return FALSE;
+        }
+}
+
+/*
+ * Create operation request
+ *
+ * Creates a #GdaServerOperation. The following code is generic and should only be changed
+ * if some further initialization is required, or if operation's contents is dependant on @cnc
+ */
+static GdaServerOperation *
+gda_capi_provider_create_operation (GdaServerProvider *provider, GdaConnection *cnc,
+				    GdaServerOperationType type, GdaSet *options, GError **error)
+{
+        gchar *file;
+        GdaServerOperation *op;
+        gchar *str;
+	gchar *dir;
+
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	}
+
+        file = g_utf8_strdown (gda_server_operation_op_type_to_string (type), -1);
+        str = g_strdup_printf ("capi_specs_%s.xml", file);
+        g_free (file);
+
+	dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
+        file = gda_server_provider_find_file (provider, dir, str);
+	g_free (dir);
+        g_free (str);
+
+        if (! file) {
+                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+                return NULL;
+        }
+
+        op = gda_server_operation_new (type, file);
+        g_free (file);
+
+        return op;
+}
+
+/*
+ * Render operation request
+ */
+static gchar *
+gda_capi_provider_render_operation (GdaServerProvider *provider, GdaConnection *cnc,
+				    GdaServerOperation *op, GError **error)
+{
+        gchar *sql = NULL;
+        gchar *file;
+        gchar *str;
+	gchar *dir;
+
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	}
+
+	/* test @op's validity */
+        file = g_utf8_strdown (gda_server_operation_op_type_to_string (gda_server_operation_get_op_type (op)), -1);
+        str = g_strdup_printf ("capi_specs_%s.xml", file);
+        g_free (file);
+
+	dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
+        file = gda_server_provider_find_file (provider, dir, str);
+	g_free (dir);
+        g_free (str);
+
+        if (! file) {
+                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+                return NULL;
+        }
+        if (!gda_server_operation_is_valid (op, file, error)) {
+                g_free (file);
+                return NULL;
+        }
+        g_free (file);
+
+	/* actual rendering */
+        switch (gda_server_operation_get_op_type (op)) {
+        case GDA_SERVER_OPERATION_CREATE_DB:
+        case GDA_SERVER_OPERATION_DROP_DB:
+		sql = NULL;
+                break;
+        case GDA_SERVER_OPERATION_CREATE_TABLE:
+                sql = gda_capi_render_CREATE_TABLE (provider, cnc, op, error);
+                break;
+        case GDA_SERVER_OPERATION_DROP_TABLE:
+        case GDA_SERVER_OPERATION_RENAME_TABLE:
+        case GDA_SERVER_OPERATION_ADD_COLUMN:
+        case GDA_SERVER_OPERATION_CREATE_INDEX:
+        case GDA_SERVER_OPERATION_DROP_INDEX:
+        case GDA_SERVER_OPERATION_CREATE_VIEW:
+        case GDA_SERVER_OPERATION_DROP_VIEW:
+                sql = NULL;
+                break;
+        default:
+                g_assert_not_reached ();
+        }
+        return sql;
+}
+
+/*
+ * Perform operation request
+ */
+static gboolean
+gda_capi_provider_perform_operation (GdaServerProvider *provider, GdaConnection *cnc,
+				     GdaServerOperation *op, GError **error)
+{
+        GdaServerOperationType optype;
+
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	}
+        optype = gda_server_operation_get_op_type (op);
+	switch (optype) {
+	case GDA_SERVER_OPERATION_CREATE_DB: 
+	case GDA_SERVER_OPERATION_DROP_DB: 
+        default: 
+		/* use the SQL from the provider to perform the action */
+		return gda_server_provider_perform_operation_default (provider, cnc, op, error);
+	}
+}
+
+/*
+ * Begin transaction request
+ */
+static gboolean
+gda_capi_provider_begin_transaction (GdaServerProvider *provider, GdaConnection *cnc,
+				     const gchar *name, GdaTransactionIsolation level,
+				     GError **error)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+
+	TO_IMPLEMENT;
+
+	return FALSE;
+}
+
+/*
+ * Commit transaction request
+ */
+static gboolean
+gda_capi_provider_commit_transaction (GdaServerProvider *provider,
+					GdaConnection *cnc,
+					const gchar *name, GError **error)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+
+	TO_IMPLEMENT;
+
+	return FALSE;
+}
+
+/*
+ * Rollback transaction request
+ */
+static gboolean
+gda_capi_provider_rollback_transaction (GdaServerProvider *provider,
+					  GdaConnection *cnc,
+					  const gchar *name, GError **error)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+
+	TO_IMPLEMENT;
+
+	return FALSE;
+}
+
+/*
+ * Add savepoint request
+ */
+static gboolean
+gda_capi_provider_add_savepoint (GdaServerProvider *provider, GdaConnection *cnc,
+				 const gchar *name, GError **error)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+
+	TO_IMPLEMENT;
+
+	return FALSE;
+}
+
+/*
+ * Rollback savepoint request
+ */
+static gboolean
+gda_capi_provider_rollback_savepoint (GdaServerProvider *provider, GdaConnection *cnc,
+				      const gchar *name, GError **error)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+
+	TO_IMPLEMENT;
+
+	return FALSE;
+}
+
+/*
+ * Delete savepoint request
+ */
+static gboolean
+gda_capi_provider_delete_savepoint (GdaServerProvider *provider, GdaConnection *cnc,
+				    const gchar *name, GError **error)
+{
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+
+	TO_IMPLEMENT;
+
+	return FALSE;
+}
+
+/*
+ * Feature support request
+ */
+static gboolean
+gda_capi_provider_supports_feature (GdaServerProvider *provider, GdaConnection *cnc, GdaConnectionFeature feature)
+{
+	switch (feature) {
+	case GDA_CONNECTION_FEATURE_SQL :
+		return TRUE;
+	default: 
+		return FALSE;
+	}
+}
+
+/*
+ * Get data handler request
+ *
+ * This method allows one to obtain a pointer to a #GdaDataHandler object specific to @type or @dbms_type (@dbms_type
+ * must be considered only if @type is not a valid GType).
+ *
+ * A data handler allows one to convert a value between its different representations which are a human readable string,
+ * an SQL representation and a GValue.
+ *
+ * The recommended method is to create GdaDataHandler objects only when they are needed and to keep a reference to them
+ * for further usage, using the gda_server_provider_handler_declare() method.
+ *
+ * The implementation shown here does not define any specific data handler, but there should be some for at least 
+ * binary and time related types.
+ */
+static GdaDataHandler *
+gda_capi_provider_get_data_handler (GdaServerProvider *provider, GdaConnection *cnc,
+				    GType type, const gchar *dbms_type)
+{
+	GdaDataHandler *dh;
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	}
+
+	if (type == G_TYPE_INVALID) {
+		TO_IMPLEMENT; /* use @dbms_type */
+		dh = NULL;
+	}
+	else if ((type == GDA_TYPE_BINARY) ||
+		 (type == GDA_TYPE_BLOB)) {
+		TO_IMPLEMENT; /* define data handlers for these types */
+		dh = NULL;
+	}
+	else if ((type == GDA_TYPE_TIME) ||
+		 (type == GDA_TYPE_TIMESTAMP) ||
+		 (type == G_TYPE_DATE)) {
+		TO_IMPLEMENT; /* define data handlers for these types */
+		dh = NULL;
+	}
+	else
+		dh = gda_server_provider_get_data_handler_default (provider, cnc, type, dbms_type);
+
+	return dh;
+}
+
+/*
+ * Get default DBMS type request
+ *
+ * This method returns the "preferred" DBMS type for GType
+ */
+static const gchar*
+gda_capi_provider_get_default_dbms_type (GdaServerProvider *provider, GdaConnection *cnc, GType type)
+{
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	}
+
+	TO_IMPLEMENT;
+
+	if ((type == G_TYPE_INT64) ||
+	    (type == G_TYPE_INT) ||
+	    (type == GDA_TYPE_SHORT) ||
+	    (type == GDA_TYPE_USHORT) ||
+	    (type == G_TYPE_CHAR) ||
+	    (type == G_TYPE_UCHAR) ||
+	    (type == G_TYPE_ULONG) ||
+	    (type == G_TYPE_UINT) ||
+	    (type == G_TYPE_UINT64)) 
+		return "integer";
+
+	if ((type == GDA_TYPE_BINARY) ||
+	    (type == GDA_TYPE_BLOB))
+		return "blob";
+
+	if (type == G_TYPE_BOOLEAN)
+		return "boolean";
+	
+	if ((type == G_TYPE_DATE) || 
+	    (type == GDA_TYPE_GEOMETRIC_POINT) ||
+	    (type == G_TYPE_OBJECT) ||
+	    (type == GDA_TYPE_LIST) ||
+	    (type == G_TYPE_STRING) ||
+	    (type == GDA_TYPE_TIME) ||
+	    (type == GDA_TYPE_TIMESTAMP) ||
+	    (type == G_TYPE_INVALID))
+		return "string";
+
+	if ((type == G_TYPE_DOUBLE) ||
+	    (type == GDA_TYPE_NUMERIC) ||
+	    (type == G_TYPE_FLOAT))
+		return "real";
+	
+	if (type == GDA_TYPE_TIME)
+		return "time";
+	if (type == GDA_TYPE_TIMESTAMP)
+		return "timestamp";
+	if (type == G_TYPE_DATE)
+		return "date";
+
+	return "text";
+}
+
+/*
+ * Create parser request
+ *
+ * This method is responsible for creating a #GdaSqlParser object specific to the SQL dialect used
+ * by the database. See the PostgreSQL provider implementation for an example.
+ */
+static GdaSqlParser *
+gda_capi_provider_create_parser (GdaServerProvider *provider, GdaConnection *cnc)
+{
+	TO_IMPLEMENT;
+	return NULL;
+}
+
+/*
+ * GdaStatement to SQL request
+ * 
+ * This method renders a #GdaStatement into its SQL representation.
+ *
+ * The implementation show here simply calls gda_statement_to_sql_extended() but the rendering
+ * can be specialized to the database's SQL dialect, see the implementation of gda_statement_to_sql_extended()
+ * and SQLite's specialized rendering for more details
+ */
+static gchar *
+gda_capi_provider_statement_to_sql (GdaServerProvider *provider, GdaConnection *cnc,
+				    GdaStatement *stmt, GdaSet *params, GdaStatementSqlFlag flags,
+				    GSList **params_used, GError **error)
+{
+	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL);
+	if (cnc) {
+		g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+		g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
+	}
+
+	return gda_statement_to_sql_extended (stmt, cnc, params, flags, params_used, error);
+}
+
+/*
+ * Statement prepare request
+ *
+ * This methods "converts" @stmt into a prepared statement. A prepared statement is a notion
+ * specific in its implementation details to the C API used here. If successfull, it must create
+ * a new #GdaCapiPStmt object and declare it to @cnc.
+ */
+static gboolean
+gda_capi_provider_statement_prepare (GdaServerProvider *provider, GdaConnection *cnc,
+				     GdaStatement *stmt, GError **error)
+{
+	GdaCapiPStmt *ps;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, FALSE);
+	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), FALSE);
+
+	/* fetch prepares stmt if already done */
+	ps = gda_connection_get_prepared_statement (cnc, stmt);
+	if (ps)
+		return TRUE;
+
+	/* prepare @stmt using the C API, creates @ps */
+	TO_IMPLEMENT;
+	if (!ps)
+		return FALSE;
+	else {
+		gda_connection_add_prepared_statement (cnc, stmt, ps);
+		return TRUE;
+	}
+}
+
+/*
+ * Execute statement request
+ *
+ * Executes a statement. This method should do the following:
+ *    - try to prepare the statement if not yet done
+ *    - optionnally reset the prepared statement
+ *    - bind the variables's values (which are in @params)
+ *    - add a connection event to log the execution
+ *    - execute the prepared statement
+ *
+ * If @stmt is an INSERT statement and @last_inserted_row is not NULL then additional actions must be taken to return the
+ * actual inserted row
+ */
+static GObject *
+gda_capi_provider_statement_execute (GdaServerProvider *provider, GdaConnection *cnc,
+				     GdaStatement *stmt, GdaSet *params,
+				     GdaStatementModelUsage model_usage, 
+				     GType *col_types, GdaSet **last_inserted_row, GError **error)
+{
+	GdaCapiPStmt *ps;
+	CapiConnectionData *cdata;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+	g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
+	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata) 
+		return FALSE;
+
+
+	/* get/create new prepared statement */
+	ps = gda_connection_get_prepared_statement (cnc, stmt);
+	if (!ps) {
+		if (!gda_capi_provider_statement_prepare (provider, cnc, stmt, NULL)) {
+			/* this case can appear for example if some variables are used in places
+			 * where the C API cannot allow them (for example if the variable is the table name
+			 * in a SELECT statement). The action here is to get the actual SQL code for @stmt,
+			 * and use that SQL instead of @stmt to create another GdaCapiPStmt object.
+			 */
+			TO_IMPLEMENT;
+			return NULL;
+		}
+		else
+			ps = gda_connection_get_prepared_statement (cnc, stmt);
+	}
+	g_assert (ps);
+
+	/* optionnally reset the prepared statement if required by the API */
+	TO_IMPLEMENT;
+	
+	/* bind statement's parameters */
+	GSList *list;
+	GdaConnectionEvent *event = NULL;
+	int i;
+	for (i = 1, list = _GDA_PSTMT (ps)->param_ids; list; list = list->next, i++) {
+		const gchar *pname = (gchar *) list->data;
+		GdaHolder *h;
+		
+		/* find requested parameter */
+		if (!params) {
+			event = gda_connection_event_new (GDA_CONNECTION_EVENT_ERROR);
+			gda_connection_event_set_description (event, _("Missing parameter(s) to execute query"));
+			g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+				     GDA_SERVER_PROVIDER_MISSING_PARAM_ERROR,
+				     _("Missing parameter(s) to execute query"));
+			break;
+		}
+
+		h = gda_set_get_holder (params, pname);
+		if (!h) {
+			gchar *tmp = gda_alphanum_to_text (g_strdup (pname + 1));
+			if (tmp) {
+				h = gda_set_get_holder (params, tmp);
+				g_free (tmp);
+			}
+		}
+		if (!h) {
+			gchar *str;
+			str = g_strdup_printf (_("Missing parameter '%s' to execute query"), pname);
+			event = gda_connection_event_new (GDA_CONNECTION_EVENT_ERROR);
+			gda_connection_event_set_description (event, str);
+			g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+				     GDA_SERVER_PROVIDER_MISSING_PARAM_ERROR, str);
+			g_free (str);
+			break;
+		}
+
+		/* actual binding using the C API */
+		const GValue *value = gda_holder_get_value (h);
+		TO_IMPLEMENT;
+	}
+		
+	if (event) {
+		gda_connection_add_event (cnc, event);
+		return NULL;
+	}
+	
+	/* add a connection event for the execution */
+	event = gda_connection_event_new (GDA_CONNECTION_EVENT_COMMAND);
+        gda_connection_event_set_description (event, _GDA_PSTMT (ps)->sql);
+        gda_connection_add_event (cnc, event);
+	
+	/* execute prepared statement using C API depending on its kind */
+	if (! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "SELECT", 6) ||
+            ! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "EXPLAIN", 7)) {
+		GObject *data_model;
+		GdaDataModelAccessFlags flags;
+
+		if (model_usage & GDA_STATEMENT_MODEL_RANDOM_ACCESS)
+			flags = GDA_DATA_MODEL_ACCESS_RANDOM;
+		else
+			flags = GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD;
+
+                data_model = (GObject *) gda_capi_recordset_new (cnc, ps, flags, col_types);
+		gda_connection_internal_statement_executed (cnc, stmt, NULL); /* required: help @cnc keep some stats */
+		return data_model;
+        }
+	else {
+		GdaSet *set = NULL;
+
+		TO_IMPLEMENT;
+                /* Create a #GdaSet containing "IMPACTED_ROWS" */
+		/* Create GdaConnectionEvent notice with the type of command and impacted rows */
+
+		gda_connection_internal_statement_executed (cnc, stmt, event); /* required: help @cnc keep some stats */
+		return (GObject*) set;
+	}
+}
+
+/*
+ * Free connection's specific data
+ */
+static void
+gda_capi_free_cnc_data (CapiConnectionData *cdata)
+{
+	if (!cdata)
+		return;
+
+	TO_IMPLEMENT;
+	g_free (cdata);
+}

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-provider.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-provider.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,51 @@
+/* GDA capi provider
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDA_CAPI_PROVIDER_H__
+#define __GDA_CAPI_PROVIDER_H__
+
+#include <libgda/gda-server-provider.h>
+
+#define GDA_TYPE_CAPI_PROVIDER            (gda_capi_provider_get_type())
+#define GDA_CAPI_PROVIDER(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_TYPE_CAPI_PROVIDER, GdaCapiProvider))
+#define GDA_CAPI_PROVIDER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, GDA_TYPE_CAPI_PROVIDER, GdaCapiProviderClass))
+#define GDA_IS_CAPI_PROVIDER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, GDA_TYPE_CAPI_PROVIDER))
+#define GDA_IS_CAPI_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDA_TYPE_CAPI_PROVIDER))
+
+typedef struct _GdaCapiProvider      GdaCapiProvider;
+typedef struct _GdaCapiProviderClass GdaCapiProviderClass;
+
+struct _GdaCapiProvider {
+	GdaServerProvider      provider;
+};
+
+struct _GdaCapiProviderClass {
+	GdaServerProviderClass parent_class;
+};
+
+G_BEGIN_DECLS
+
+GType gda_capi_provider_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-pstmt.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-pstmt.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,92 @@
+/* GDA Capi provider
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <glib/gi18n-lib.h>
+#include "gda-capi-pstmt.h"
+
+static void gda_capi_pstmt_class_init (GdaCapiPStmtClass *klass);
+static void gda_capi_pstmt_init       (GdaCapiPStmt *pstmt, GdaCapiPStmtClass *klass);
+static void gda_capi_pstmt_finalize    (GObject *object);
+
+static GObjectClass *parent_class = NULL;
+
+/**
+ * gda_capi_pstmt_get_type
+ *
+ * Returns: the #GType of GdaCapiPStmt.
+ */
+GType
+gda_capi_pstmt_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static const GTypeInfo info = {
+			sizeof (GdaCapiPStmtClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) gda_capi_pstmt_class_init,
+			NULL,
+			NULL,
+			sizeof (GdaCapiPStmt),
+			0,
+			(GInstanceInitFunc) gda_capi_pstmt_init
+		};
+
+		type = g_type_register_static (GDA_TYPE_PSTMT, "GdaCapiPStmt", &info, 0);
+	}
+	return type;
+}
+
+static void 
+gda_capi_pstmt_class_init (GdaCapiPStmtClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	parent_class = g_type_class_peek_parent (klass);
+
+	/* virtual functions */
+	object_class->finalize = gda_capi_pstmt_finalize;
+}
+
+static void
+gda_capi_pstmt_init (GdaCapiPStmt *pstmt, GdaCapiPStmtClass *klass)
+{
+	g_return_if_fail (GDA_IS_PSTMT (pstmt));
+	
+	/* initialize specific parts of @pstmt */
+	TO_IMPLEMENT;
+}
+
+static void
+gda_capi_pstmt_finalize (GObject *object)
+{
+	GdaCapiPStmt *pstmt = (GdaCapiPStmt *) object;
+
+	g_return_if_fail (GDA_IS_PSTMT (pstmt));
+
+	/* free memory */
+	TO_IMPLEMENT; /* free some specific parts of @pstmt */
+
+	/* chain to parent class */
+	parent_class->finalize (object);
+}

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-pstmt.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-pstmt.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,57 @@
+/* GDA Capi library
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDA_CAPI_PSTMT_H__
+#define __GDA_CAPI_PSTMT_H__
+
+#include <providers-support/gda-pstmt.h>
+#include "gda-capi.h"
+
+G_BEGIN_DECLS
+
+#define GDA_TYPE_CAPI_PSTMT            (gda_capi_pstmt_get_type())
+#define GDA_CAPI_PSTMT(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_TYPE_PSTMT, GdaCapiPStmt))
+#define GDA_CAPI_PSTMT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, GDA_TYPE_PSTMT, GdaCapiPStmtClass))
+#define GDA_IS_CAPI_PSTMT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE(obj, GDA_TYPE_PSTMT))
+#define GDA_IS_CAPI_PSTMT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GDA_TYPE_PSTMT))
+
+typedef struct _GdaCapiPStmt        GdaCapiPStmt;
+typedef struct _GdaCapiPStmtClass   GdaCapiPStmtClass;
+
+struct _GdaCapiPStmt {
+	GdaPStmt        object;
+
+	/* TO_ADD: this structure holds any information necessary to reference a prepared statement, usually a connection
+         * handle from the C or C++ API
+         */
+};
+
+struct _GdaCapiPStmtClass {
+	GdaPStmtClass  parent_class;
+};
+
+GType         gda_capi_pstmt_get_type  (void) G_GNUC_CONST;
+/* TO_ADD: helper function to create a GdaCapiPStmt such as gda_capi_pstmt_new() with some specific arguments */
+
+G_END_DECLS
+
+#endif

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-recordset.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-recordset.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,306 @@
+/* GDA Capi provider
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <stdarg.h>
+#include <string.h>
+#include <glib/gi18n-lib.h>
+#include <libgda/gda-util.h>
+#include <libgda/gda-connection-private.h>
+#include "gda-capi.h"
+#include "gda-capi-recordset.h"
+#include "gda-capi-provider.h"
+
+#define _GDA_PSTMT(x) ((GdaPStmt*)(x))
+
+static void gda_capi_recordset_class_init (GdaCapiRecordsetClass *klass);
+static void gda_capi_recordset_init       (GdaCapiRecordset *recset,
+					     GdaCapiRecordsetClass *klass);
+static void gda_capi_recordset_dispose   (GObject *object);
+
+/* virtual methods */
+static gint     gda_capi_recordset_fetch_nb_rows (GdaPModel *model);
+static GdaPRow *gda_capi_recordset_fetch_random (GdaPModel *model, gint rownum, GError **error);
+static GdaPRow *gda_capi_recordset_fetch_next (GdaPModel *model, gint rownum, GError **error);
+static GdaPRow *gda_capi_recordset_fetch_prev (GdaPModel *model, gint rownum, GError **error);
+static GdaPRow *gda_capi_recordset_fetch_at (GdaPModel *model, gint rownum, GError **error);
+
+
+struct _GdaCapiRecordsetPrivate {
+	GdaConnection *cnc;
+	/* TO_ADD: specific information */
+};
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Object init and finalize
+ */
+static void
+gda_capi_recordset_init (GdaCapiRecordset *recset,
+			   GdaCapiRecordsetClass *klass)
+{
+	g_return_if_fail (GDA_IS_CAPI_RECORDSET (recset));
+	recset->priv = g_new0 (GdaCapiRecordsetPrivate, 1);
+	recset->priv->cnc = NULL;
+
+	/* initialize specific information */
+	TO_IMPLEMENT;
+}
+
+static void
+gda_capi_recordset_class_init (GdaCapiRecordsetClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	GdaPModelClass *pmodel_class = GDA_PMODEL_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	object_class->dispose = gda_capi_recordset_dispose;
+	pmodel_class->fetch_nb_rows = gda_capi_recordset_fetch_nb_rows;
+	pmodel_class->fetch_random = gda_capi_recordset_fetch_random;
+
+	pmodel_class->fetch_next = gda_capi_recordset_fetch_next;
+	pmodel_class->fetch_prev = gda_capi_recordset_fetch_prev;
+	pmodel_class->fetch_at = gda_capi_recordset_fetch_at;
+}
+
+static void
+gda_capi_recordset_dispose (GObject *object)
+{
+	GdaCapiRecordset *recset = (GdaCapiRecordset *) object;
+
+	g_return_if_fail (GDA_IS_CAPI_RECORDSET (recset));
+
+	if (recset->priv) {
+		if (recset->priv->cnc) 
+			g_object_unref (recset->priv->cnc);
+
+		/* free specific information */
+		TO_IMPLEMENT;
+		g_free (recset->priv);
+		recset->priv = NULL;
+	}
+
+	parent_class->dispose (object);
+}
+
+/*
+ * Public functions
+ */
+
+GType
+gda_capi_recordset_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static const GTypeInfo info = {
+			sizeof (GdaCapiRecordsetClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) gda_capi_recordset_class_init,
+			NULL,
+			NULL,
+			sizeof (GdaCapiRecordset),
+			0,
+			(GInstanceInitFunc) gda_capi_recordset_init
+		};
+		type = g_type_register_static (GDA_TYPE_PMODEL, "GdaCapiRecordset", &info, 0);
+	}
+
+	return type;
+}
+
+/*
+ * the @ps struct is modified and transfered to the new data model created in
+ * this function
+ */
+GdaDataModel *
+gda_capi_recordset_new (GdaConnection *cnc, GdaCapiPStmt *ps, GdaDataModelAccessFlags flags, GType *col_types)
+{
+	GdaCapiRecordset *model;
+        CapiConnectionData *cdata;
+        gint i;
+	GdaDataModelAccessFlags rflags;
+
+        g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+        g_return_val_if_fail (ps != NULL, NULL);
+
+	cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data (cnc);
+	if (!cdata)
+		return NULL;
+
+        /* completing @ps if not yet done */
+        if (!_GDA_PSTMT (ps)->types && (_GDA_PSTMT (ps)->ncols > 0)) {
+		/* create prepared statement's columns */
+		GSList *list;
+		for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
+			_GDA_PSTMT (ps)->tmpl_columns = g_slist_prepend (_GDA_PSTMT (ps)->tmpl_columns, 
+									 gda_column_new ());
+		_GDA_PSTMT (ps)->tmpl_columns = g_slist_reverse (_GDA_PSTMT (ps)->tmpl_columns);
+
+		/* create prepared statement's types */
+		_GDA_PSTMT (ps)->types = g_new0 (GType, _GDA_PSTMT (ps)->ncols); /* all types are initialized to GDA_TYPE_NULL */
+		if (col_types) {
+			for (i = 0; ; i++) {
+				if (col_types [i] > 0) {
+					if (col_types [i] == G_TYPE_NONE)
+						break;
+					if (i >= _GDA_PSTMT (ps)->ncols)
+						g_warning (_("Column %d is out of range (0-%d), ignoring its specified type"), i,
+							   _GDA_PSTMT (ps)->ncols - 1);
+					else
+						_GDA_PSTMT (ps)->types [i] = col_types [i];
+				}
+			}
+		}
+		
+		/* fill GdaColumn's data */
+		for (i=0, list = _GDA_PSTMT (ps)->tmpl_columns; 
+		     i < GDA_PSTMT (ps)->ncols; 
+		     i++, list = list->next) {
+			GdaColumn *column;
+			
+			column = GDA_COLUMN (list->data);
+
+			/* use C API to set columns' information using gda_column_set_*() */
+			TO_IMPLEMENT;
+		}
+        }
+
+	/* determine access mode: RANDOM or CURSOR FORWARD are the only supported */
+	if (flags & GDA_DATA_MODEL_ACCESS_RANDOM)
+		rflags = GDA_DATA_MODEL_ACCESS_RANDOM;
+	else
+		rflags = GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD;
+
+	/* create data model */
+        model = g_object_new (GDA_TYPE_CAPI_RECORDSET, "prepared-stmt", ps, "model-usage", rflags, NULL);
+        model->priv->cnc = cnc;
+	g_object_ref (cnc);
+
+	/* post init specific code */
+	TO_IMPLEMENT;
+
+        return GDA_DATA_MODEL (model);
+}
+
+
+/*
+ * Get the number of rows in @model, if possible
+ */
+static gint
+gda_capi_recordset_fetch_nb_rows (GdaPModel *model)
+{
+	GdaCapiRecordset *imodel;
+
+	imodel = GDA_CAPI_RECORDSET (model);
+	if (model->advertized_nrows >= 0)
+		return model->advertized_nrows;
+
+	/* use C API to determine number of rows,if possible */
+	TO_IMPLEMENT;
+
+	return model->advertized_nrows;
+}
+
+/*
+ * Create a new filled #GdaPRow object for the row at position @rownum.
+ *
+ * Memory management for that new GdaPRow object is left to the implementation, which
+ * can use gda_pmodel_take_row().
+ */
+static GdaPRow *
+gda_capi_recordset_fetch_random (GdaPModel *model, gint rownum, GError **error)
+{
+	GdaCapiRecordset *imodel;
+	GdaPRow *prow = NULL;
+
+	imodel = GDA_CAPI_RECORDSET (model);
+
+	TO_IMPLEMENT;
+
+	return prow;
+}
+
+/*
+ * Create a new filled #GdaPRow object for the next cursor row
+ *
+ * Memory management for that new GdaPRow object is left to the implementation, which
+ * can use gda_pmodel_take_row().
+ */
+static GdaPRow *
+gda_capi_recordset_fetch_next (GdaPModel *model, gint rownum, GError **error)
+{
+	GdaPRow *prow;
+	GdaCapiRecordset *imodel = (GdaCapiRecordset*) model;
+
+	prow = gda_pmodel_get_stored_row (model, rownum);
+	if (prow)
+		return prow;
+	
+	TO_IMPLEMENT;
+
+	return prow;
+}
+
+/*
+ * Create a new filled #GdaPRow object for the previous cursor row
+ *
+ * Memory management for that new GdaPRow object is left to the implementation, which
+ * can use gda_pmodel_take_row().
+ */
+static GdaPRow *
+gda_capi_recordset_fetch_prev (GdaPModel *model, gint rownum, GError **error)
+{
+	GdaPRow *prow;
+	GdaCapiRecordset *imodel = (GdaCapiRecordset*) model;
+
+	prow = gda_pmodel_get_stored_row (model, rownum);
+	if (prow)
+		return prow;
+	
+	TO_IMPLEMENT;
+
+	return prow;
+}
+
+/*
+ * Create a new filled #GdaPRow object for the cursor row at position @rownum
+ *
+ * Memory management for that new GdaPRow object is left to the implementation, which
+ * can use gda_pmodel_take_row().
+ */
+static GdaPRow *
+gda_capi_recordset_fetch_at (GdaPModel *model, gint rownum, GError **error)
+{
+	GdaPRow *prow;
+	GdaCapiRecordset *imodel = (GdaCapiRecordset*) model;
+
+	prow = gda_pmodel_get_stored_row (model, rownum);
+	if (prow)
+		return prow;
+	
+	TO_IMPLEMENT;
+
+	return prow;
+}
+

Added: branches/V4-branch/providers/skel-implementation/capi/gda-capi-recordset.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi-recordset.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,57 @@
+/* GDA Capi provider
+ * Copyright (C) 1998 - 2006 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDA_CAPI_RECORDSET_H__
+#define __GDA_CAPI_RECORDSET_H__
+
+#include <libgda/libgda.h>
+#include <providers-support/gda-pmodel.h>
+#include "gda-capi-pstmt.h"
+
+G_BEGIN_DECLS
+
+#define GDA_TYPE_CAPI_RECORDSET            (gda_capi_recordset_get_type())
+#define GDA_CAPI_RECORDSET(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_TYPE_CAPI_RECORDSET, GdaCapiRecordset))
+#define GDA_CAPI_RECORDSET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, GDA_TYPE_CAPI_RECORDSET, GdaCapiRecordsetClass))
+#define GDA_IS_CAPI_RECORDSET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, GDA_TYPE_CAPI_RECORDSET))
+#define GDA_IS_CAPI_RECORDSET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDA_TYPE_CAPI_RECORDSET))
+
+typedef struct _GdaCapiRecordset        GdaCapiRecordset;
+typedef struct _GdaCapiRecordsetClass   GdaCapiRecordsetClass;
+typedef struct _GdaCapiRecordsetPrivate GdaCapiRecordsetPrivate;
+
+struct _GdaCapiRecordset {
+	GdaPModel                model;
+	GdaCapiRecordsetPrivate *priv;
+};
+
+struct _GdaCapiRecordsetClass {
+	GdaPModelClass             parent_class;
+};
+
+GType         gda_capi_recordset_get_type  (void) G_GNUC_CONST;
+GdaDataModel *gda_capi_recordset_new       (GdaConnection *cnc, GdaCapiPStmt *ps, GdaDataModelAccessFlags flags, 
+					    GType *col_types);
+
+G_END_DECLS
+
+#endif

Modified: branches/V4-branch/providers/skel-implementation/capi/gda-capi.h
==============================================================================
--- branches/V4-branch/providers/skel-implementation/capi/gda-capi.h	(original)
+++ branches/V4-branch/providers/skel-implementation/capi/gda-capi.h	Thu Feb 14 18:20:30 2008
@@ -2,7 +2,7 @@
  * Copyright (C) 2008 The GNOME Foundation.
  *
  * AUTHORS:
- *      Vivien Malerba <malerba gnome-db org>
+ *      TO_ADD: your name and email
  *
  * 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,17 +23,18 @@
 #ifndef __GDA_CAPI_H__
 #define __GDA_CAPI_H__
 
-#include <glib/gmacros.h>
-#include <glib/gtypes.h>
-#include <libgda/libgda.h>
+/*
+ * Provider name
+ */
+#define CAPI_PROVIDER_NAME "Capi"
 
-/*REF: include headers necessary for the C or C++ API */
+/* TO_ADD: include headers necessary for the C or C++ API */
 
 /*
  * Provider's specific connection data
  */
 typedef struct {
-	/*REF: this structure holds any information necessary to specialize the GdaConnection, usually a connection
+	/* TO_ADD: this structure holds any information necessary to specialize the GdaConnection, usually a connection
 	 * handle from the C or C++ API
 	 */
 } CapiConnectionData;

Added: branches/V4-branch/providers/skel-implementation/capi/gen_def.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/gen_def.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,194 @@
+/* 
+ * Copyright (C) 2007 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * This program generates tokens'ID transformation because the GdaSqlParser object uses 2 Lemon generated
+ * parsers at once, but with only one tokenizer (because each Lemon generated parser generates it own IDs for
+ * tokens).
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+#define MAX_SYMBOLS 500
+#define PARSER_HEADER "parser.h"
+#define FALSE 0
+#define TRUE (!FALSE)
+
+typedef struct {
+	char *key;
+	int   parser_value;
+} HashEntry;
+
+HashEntry entries[MAX_SYMBOLS];
+int nb_entries; /* must remain < MAX_SYMBOLS */
+
+typedef enum {
+	TYPE_IMPOSED,
+	TYPE_PARSER
+} SourceType;
+
+static void parse_contents (FILE *stream, SourceType type);
+static HashEntry *find_entry_for_token (char *token);
+int 
+main (int argc,char** argv)
+{
+	int i;
+	FILE *fd_imposed;
+	FILE *fd_parser;
+	HashEntry *illegal_entry;
+	HashEntry *rawstring_entry;
+
+	memset (entries, 0, sizeof (entries));
+	fd_imposed = fopen (IMPOSED_HEADER, "r");
+	if (!fd_imposed) {
+		printf ("Can't open '%s':%s\n", IMPOSED_HEADER, strerror (errno));
+		return 1;
+	}
+	fd_parser = fopen (PARSER_HEADER, "r");
+	if (!fd_parser) {
+		printf ("Can't open '%s':%s\n", PARSER_HEADER, strerror (errno));
+		return 1;
+	}
+
+	nb_entries = 0;
+	parse_contents (fd_imposed, TYPE_IMPOSED);
+	parse_contents (fd_parser, TYPE_PARSER);
+
+	fclose (fd_imposed);
+	fclose (fd_parser);
+
+	/* output notice */
+	printf ("/*\n * This file is generated by the gen_def program (see the gen_def.c file \n"
+		" * for some explanations)\n"
+		" * DO NOT EDIT MANUALLY\n */\n\n\n");
+
+	/* output */
+	for (i = 0; i < nb_entries; i++) {
+		HashEntry *entry = &(entries[i]);
+		printf ("#define L_%s \t\t %d\n", entry->key, i);
+	}
+	illegal_entry = find_entry_for_token ("ILLEGAL");
+	rawstring_entry = find_entry_for_token ("RAWSTRING");
+	printf ("gint capi_parser_tokens[] = {\n");
+	for (i = 0; i < nb_entries; i++) {
+		HashEntry *entry = &(entries[i]);
+		if (i!= 0)
+			printf (",");
+		if (entry->parser_value >= 0)
+			printf ("%d", entry->parser_value);
+		else
+			printf ("%d", illegal_entry->parser_value);
+	}
+	printf ("};\n");
+
+	return 0;
+}
+
+static HashEntry *
+find_entry_for_token (char *token) 
+{
+	int i;
+
+	for (i = 0; i < nb_entries; i++) {
+		HashEntry *e = &(entries[i]);
+		if (!strcmp (e->key, token))
+			return e;
+	}
+	return NULL;
+}
+
+
+
+static void 
+parse_line (char *line, SourceType type) 
+{
+	char *z, *token;
+	int value;
+	HashEntry *entry;
+	
+	z = line;
+	if (strncmp (z, "#define ", 8)) {
+		printf ("Expected '#define', not found");
+		exit (1);
+	}
+	z += 8;
+	token = z + 2;
+	for (; *z && *z != ' '; z++);
+	*z = 0;
+	z++;
+	for (; *z == ' '; z++);
+	value = atoi (z);
+	/*printf ("%d Token: /%s/, value=%d\n", type, token, value);*/
+
+	entry = find_entry_for_token (token);
+	if (!entry) {
+		nb_entries++;
+		entry = &(entries[nb_entries - 1]);
+		entry->key = malloc (sizeof (char) * (strlen (token) + 1));
+		memcpy (entry->key, token, strlen (token) + 1);
+		entry->parser_value = -1;
+	}
+	if (type == TYPE_PARSER)
+		entry->parser_value = value;
+}
+
+static void
+parse_contents (FILE *stream, SourceType type)
+{
+#define BUFSIZE 500
+	char buffer[BUFSIZE];
+	int read;
+	char *end;
+
+	read = fread (buffer, 1, BUFSIZE, stream);
+	end = buffer + read;
+	while (read > 0) {
+		char *ptr;
+
+		/* read all complete lines in buffer */
+		while (end > buffer) {
+			char *hold = NULL;
+			for (ptr = buffer; (ptr < end) && *ptr && (*ptr != '\n'); ptr++);
+			if (ptr == end)
+				break;
+			if (*ptr)
+				hold = ptr+1;
+			*ptr = 0;
+
+			/* treat the line */
+			parse_line (buffer, type);
+
+			if (hold) {
+				int l = end - hold;
+				end -= hold - buffer;
+				memmove (buffer, hold, l);
+			}
+			else
+				break;
+		}
+
+		read = fread (end, 1, BUFSIZE - (end - buffer), stream);
+		end += read;
+	}
+}
+

Added: branches/V4-branch/providers/skel-implementation/capi/libmain.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/libmain.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,72 @@
+/* GDA Capi Provider
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glib/gi18n-lib.h>
+#include <libgda/gda-server-provider-extra.h>
+#include <libgda/binreloc/gda-binreloc.h>
+#include "gda-capi.h"
+#include "gda-capi-provider.h"
+
+static gchar      *module_path = NULL;
+const gchar       *plugin_get_name (void);
+const gchar       *plugin_get_description (void);
+gchar             *plugin_get_dsn_spec (void);
+GdaServerProvider *plugin_create_provider (void);
+
+void
+plugin_init (const gchar *real_path)
+{
+        if (real_path)
+                module_path = g_strdup (real_path);
+}
+
+const gchar *
+plugin_get_name (void)
+{
+	return CAPI_PROVIDER_NAME;
+}
+
+const gchar *
+plugin_get_description (void)
+{
+	return _("Example provider for C API databases");
+}
+
+gchar *
+plugin_get_dsn_spec (void)
+{
+	gchar *ret, *dir;
+
+	dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
+	ret = gda_server_provider_load_file_contents (module_path, dir, "capi_specs_dsn.xml");
+	g_free (dir);
+	return ret;
+}
+
+GdaServerProvider *
+plugin_create_provider (void)
+{
+	GdaServerProvider *prov;
+
+	prov = (GdaServerProvider*) g_object_new (GDA_TYPE_CAPI_PROVIDER, NULL);
+        g_object_set_data ((GObject *) prov, "GDA_PROVIDER_DIR", module_path);
+        return prov;
+}

Added: branches/V4-branch/providers/skel-implementation/capi/parser.y
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/capi/parser.y	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,1024 @@
+// All token codes are small integers with #defines that begin with "TK_"
+%token_prefix T_
+
+// The type of the data attached to each token is GValue.  This is also the
+// default type for non-terminals.
+//
+%token_type {GValue *}
+%default_type {GValue *}
+%token_destructor {if ($$) {
+		 gchar *str = gda_sql_value_stringify ($$);
+		 DEBUG ("token destructor /%s/", str);
+		 g_free (str);
+		 g_value_unset ($$); g_free ($$);}}
+
+// The generated parser function takes a 4th argument as follows:
+%extra_argument {GdaSqlParserIface *pdata}
+
+// This code runs whenever there is a syntax error
+//
+%syntax_error {
+	gda_sql_parser_set_syntax_error (pdata->parser);
+}
+%stack_overflow {
+	gda_sql_parser_set_overflow_error (pdata->parser);
+}
+
+// The name of the generated procedure that implements the parser
+// is as follows:
+%name gda_lemon_capi_parser
+
+// The following text is included near the beginning of the C source
+// code file that implements the parser.
+//
+%include {
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <glib/gi18n-lib.h>
+#include <libgda/sql-parser/gda-sql-parser-private.h>
+#include <libgda/sql-parser/gda-statement-struct-util.h>
+#include <libgda/sql-parser/gda-statement-struct-trans.h>
+#include <libgda/sql-parser/gda-statement-struct-insert.h>
+#include <libgda/sql-parser/gda-statement-struct-update.h>
+#include <libgda/sql-parser/gda-statement-struct-delete.h>
+#include <libgda/sql-parser/gda-statement-struct-select.h>
+#include <libgda/sql-parser/gda-statement-struct-compound.h>
+#include <libgda/sql-parser/gda-statement-struct-parts.h>
+
+#ifdef GDA_DEBUG_NO
+#define DEBUG(format, ...) g_print ("___" format "\n", __VA_ARGS__)
+#else
+#define DEBUG(format, ...)
+#endif
+
+typedef struct {
+	GValue *fname;
+	GdaSqlExpr *expr;
+} UpdateSet;
+
+typedef struct {
+	gboolean    distinct;
+	GdaSqlExpr *expr;
+} Distinct;
+
+typedef struct {
+	GdaSqlExpr *count;
+	GdaSqlExpr *offset;
+} Limit;
+
+typedef struct {
+	GSList *when_list;
+	GSList *then_list;
+} CaseBody;
+
+static GdaSqlOperator
+sql_operation_string_to_operator (const gchar *op)
+{
+	switch (g_ascii_toupper (*op)) {
+	case 'A':
+		return GDA_SQL_OPERATOR_AND;
+	case 'O':
+		return GDA_SQL_OPERATOR_OR;
+	case 'N':
+		return GDA_SQL_OPERATOR_NOT;
+	case '=':
+		return GDA_SQL_OPERATOR_EQ;
+	case 'I':
+		if (op[1] == 'S')
+			return GDA_SQL_OPERATOR_IS;
+		else if (op[1] == 'N')
+			return GDA_SQL_OPERATOR_IN;
+		break;
+	case 'L':
+		return GDA_SQL_OPERATOR_LIKE;
+	case 'B':
+		return GDA_SQL_OPERATOR_BETWEEN;
+	case '>':
+		if (op[1] == '=')
+			return GDA_SQL_OPERATOR_GEQ;
+		else if (op[1] == 0)
+			return GDA_SQL_OPERATOR_GT;
+		break;
+	case '<':
+		if (op[1] == '=')
+			return GDA_SQL_OPERATOR_LEQ;
+		else if (op[1] == 0)
+			return GDA_SQL_OPERATOR_LT;
+		break;
+	case '!':
+		if (op[1] == '=')
+			return GDA_SQL_OPERATOR_DIFF;
+		else if (op[1] == '~') {
+			if (op[2] == 0)
+				return GDA_SQL_OPERATOR_NOT_REGEXP;
+			else if (op[2] == '*')
+				return GDA_SQL_OPERATOR_NOT_REGEXP_CI;
+		}
+		break;
+	case '~':
+		if (op[1] == '*')
+			return GDA_SQL_OPERATOR_REGEXP_CI;
+		else if (op[1] == 0)
+			return GDA_SQL_OPERATOR_REGEXP;
+		break;
+	case 'S':
+		return GDA_SQL_OPERATOR_SIMILAR;
+	case '|':
+		if (op[1] == '|')
+			return GDA_SQL_OPERATOR_CONCAT;
+		else
+			return GDA_SQL_OPERATOR_BITOR;
+	case '+':
+		return GDA_SQL_OPERATOR_PLUS;
+	case '-':
+		return GDA_SQL_OPERATOR_MINUS;
+	case '*':
+		return GDA_SQL_OPERATOR_STAR;
+	case '/':
+		return GDA_SQL_OPERATOR_DIV;
+	case '%':
+		return GDA_SQL_OPERATOR_REM;
+	case '&':
+		return GDA_SQL_OPERATOR_BITAND;
+	}
+	g_error ("Unhandled operator named '%s'\n", op);
+	return 0;
+}
+
+static GdaSqlOperator
+string_to_op_type (GValue *value)
+{
+	GdaSqlOperator op;
+	op = sql_operation_string_to_operator (g_value_get_string (value));
+	g_value_reset (value);
+	g_free (value);
+	return op;
+}
+
+static GdaSqlExpr *
+compose_multiple_expr (GdaSqlOperator op, GdaSqlExpr *left, GdaSqlExpr *right) {
+	GdaSqlExpr *ret;
+	if (left->cond && (left->cond->operator == op)) {
+		ret = left;
+		ret->cond->operands = g_slist_append (ret->cond->operands, right);
+	}
+	else {
+		GdaSqlOperation *cond;
+		ret = gda_sql_expr_new (NULL);
+		cond = gda_sql_operation_new (GDA_SQL_ANY_PART (ret));
+		ret->cond = cond;
+		cond->operator = op;
+		cond->operands = g_slist_prepend (NULL, right);
+		GDA_SQL_ANY_PART (right)->parent = GDA_SQL_ANY_PART (cond);
+		cond->operands = g_slist_prepend (cond->operands, left);
+		GDA_SQL_ANY_PART (left)->parent = GDA_SQL_ANY_PART (cond);
+	}
+	return ret;
+}
+
+static GdaSqlExpr *
+create_two_expr (GdaSqlOperator op, GdaSqlExpr *left, GdaSqlExpr *right) {
+	GdaSqlExpr *ret;
+	GdaSqlOperation *cond;
+	ret = gda_sql_expr_new (NULL);
+	cond = gda_sql_operation_new (GDA_SQL_ANY_PART (ret));
+	ret->cond = cond;
+	cond->operator = op;
+	cond->operands = g_slist_prepend (NULL, right);
+	GDA_SQL_ANY_PART (right)->parent = GDA_SQL_ANY_PART (cond);
+	cond->operands = g_slist_prepend (cond->operands, left);
+	GDA_SQL_ANY_PART (left)->parent = GDA_SQL_ANY_PART (cond);
+	return ret;
+}
+
+static GdaSqlExpr *
+create_uni_expr (GdaSqlOperator op, GdaSqlExpr *expr) {
+	GdaSqlExpr *ret;
+	GdaSqlOperation *cond;
+	ret = gda_sql_expr_new (NULL);
+	cond = gda_sql_operation_new (GDA_SQL_ANY_PART (ret));
+	ret->cond = cond;
+	cond->operator = op;
+	cond->operands = g_slist_prepend (NULL, expr);
+	GDA_SQL_ANY_PART (expr)->parent = GDA_SQL_ANY_PART (cond);
+	return ret;
+}
+
+static GdaSqlStatement *
+compose_multiple_compounds (GdaSqlStatementCompoundType ctype, GdaSqlStatement *left, GdaSqlStatement *right) {
+	GdaSqlStatement *ret;
+	GdaSqlStatementCompound *lc = (GdaSqlStatementCompound*) left->contents;
+	if (lc->compound_type == ctype) {
+		GdaSqlStatementCompound *rc = (GdaSqlStatementCompound*) right->contents;
+		if (!rc->stmt_list->next || rc->compound_type == ctype) {
+			GSList *list;
+			for (list = rc->stmt_list; list; list = list->next)
+				GDA_SQL_ANY_PART (((GdaSqlStatement*)list->data)->contents)->parent = GDA_SQL_ANY_PART (lc);
+
+			ret = left;
+			lc->stmt_list = g_slist_concat (lc->stmt_list, rc->stmt_list);
+			rc->stmt_list = NULL;
+			gda_sql_statement_free (right);
+		}
+	}
+	else {
+		ret = gda_sql_statement_new (GDA_SQL_STATEMENT_COMPOUND);
+		gda_sql_statement_compound_set_type (ret, ctype);
+		gda_sql_statement_compound_take_stmt (ret, left);
+		gda_sql_statement_compound_take_stmt (ret, right);
+	}
+	return ret;
+}
+
+}
+
+// The following directive causes tokens ABORT, AFTER, ASC, etc. to
+// fallback to ID if they will not parse as their original value.
+%fallback ID
+  ABORT AFTER ANALYZE ASC ATTACH BEFORE BEGIN CASCADE CAST CONFLICT
+  DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR
+  IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH PLAN
+  QUERY KEY OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW
+  TEMP TRIGGER VACUUM VIEW VIRTUAL
+  REINDEX RENAME CTIME_KW IF
+  DELIMITER COMMIT ROLLBACK ISOLATION LEVEL SERIALIZABLE READ COMMITTED 
+  UNCOMMITTED REPEATABLE WRITE ONLY SAVEPOINT RELEASE COMMENT FORCE WAIT NOWAIT BATCH.
+
+// Define operator precedence early so that this is the first occurance
+// of the operator tokens in the grammer.  Keeping the operators together
+// causes them to be assigned integer values that are close together,
+// which keeps parser tables smaller.
+%left OR.
+%left AND.
+%right NOT.
+%left IS MATCH LIKE IN ISNULL NOTNULL DIFF EQ.
+%left BETWEEN.
+%left GT LEQ LT GEQ.
+%left REGEXP REGEXP_CI NOT_REGEXP NOT_REGEXP_CI.
+%left SIMILAR.
+%right ESCAPE.
+%left BITAND BITOR LSHIFT RSHIFT.
+%left PLUS MINUS.
+%left STAR SLASH REM.
+%left CONCAT.
+%left COLLATE.
+%right UMINUS UPLUS BITNOT.
+%left LP RP.
+%left JOIN INNER NATURAL LEFT RIGHT FULL CROSS.
+%left UNION EXCEPT.
+%left INTERSECT.
+%left PGCAST.
+
+// force the declaration of the ILLEGAL and SQLCOMMENT tokens
+%nonassoc ILLEGAL.
+%nonassoc SQLCOMMENT.
+
+// Input is a single SQL command
+%type stmt {GdaSqlStatement *}
+%destructor stmt {g_print ("Statement destroyed by parser: %p\n", $$); gda_sql_statement_free ($$);}
+stmt ::= cmd(C) eos. {pdata->parsed_statement = C;}
+stmt ::= compound(C) eos. {
+	GdaSqlStatementCompound *scompound = (GdaSqlStatementCompound *) C->contents;
+	if (scompound->stmt_list->next)
+		/* real compound (multiple statements) */
+		pdata->parsed_statement = C;
+	else {
+		/* false compound (only 1 select) */
+		pdata->parsed_statement = (GdaSqlStatement*) scompound->stmt_list->data;
+		GDA_SQL_ANY_PART (pdata->parsed_statement->contents)->parent = NULL;
+		g_slist_free (scompound->stmt_list);
+		scompound->stmt_list = NULL;
+		gda_sql_statement_free (C);
+	}
+}
+cmd(C) ::= LP cmd(E) RP. {C = E;}
+compound(C) ::= LP compound(E) RP. {C = E;}
+
+eos ::= SEMI.
+eos ::= END_OF_FILE.
+
+%type cmd {GdaSqlStatement *}
+%destructor cmd {gda_sql_statement_free ($$);}
+
+//
+// Transactions
+//
+cmd(C) ::= BEGIN. {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);}
+cmd(C) ::= BEGIN TRANSACTION nm_opt(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+					 gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= BEGIN transtype(Y) TRANSACTION nm_opt(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+						      gda_sql_statement_trans_take_mode (C, Y);
+						      gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= BEGIN transtype(Y) nm_opt(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+					  gda_sql_statement_trans_take_mode (C, Y);
+					  gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= BEGIN transilev(L). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+				gda_sql_statement_trans_set_isol_level (C, L);
+}
+
+cmd(C) ::= BEGIN TRANSACTION transilev(L). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+					    gda_sql_statement_trans_set_isol_level (C, L);
+}
+
+cmd(C) ::= BEGIN TRANSACTION transtype(Y). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+					    gda_sql_statement_trans_take_mode (C, Y);
+}
+
+cmd(C) ::= BEGIN TRANSACTION transtype(Y) opt_comma transilev(L). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+								   gda_sql_statement_trans_take_mode (C, Y);
+								   gda_sql_statement_trans_set_isol_level (C, L);
+}
+
+cmd(C) ::= BEGIN TRANSACTION transilev(L) opt_comma transtype(Y). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+								   gda_sql_statement_trans_take_mode (C, Y);
+								   gda_sql_statement_trans_set_isol_level (C, L);
+}
+
+cmd(C) ::= BEGIN transtype(Y) opt_comma transilev(L). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+						       gda_sql_statement_trans_take_mode (C, Y);
+						       gda_sql_statement_trans_set_isol_level (C, L);
+}
+	
+cmd(C) ::= BEGIN transilev(L) opt_comma transtype(Y). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_BEGIN);
+						       gda_sql_statement_trans_take_mode (C, Y);
+						       gda_sql_statement_trans_set_isol_level (C, L);
+}
+
+cmd(C) ::= END trans_opt_kw nm_opt(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMMIT);
+					gda_sql_statement_trans_take_name (C, R);
+}
+	
+cmd(C) ::= COMMIT nm_opt(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMMIT);
+			      gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= COMMIT TRANSACTION nm_opt(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMMIT);
+					  gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= COMMIT FORCE STRING. {C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMMIT);}
+cmd(C) ::= COMMIT FORCE STRING COMMA INTEGER. {C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMMIT);}
+cmd(C) ::= COMMIT COMMENT STRING. {C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMMIT);}
+cmd(C) ::= COMMIT COMMENT STRING ora_commit_write. {C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMMIT);}
+cmd(C) ::= COMMIT ora_commit_write. {C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMMIT);}
+
+cmd(C) ::= ROLLBACK trans_opt_kw nm_opt(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_ROLLBACK);
+					     gda_sql_statement_trans_take_name (C, R);
+}
+
+ora_commit_write ::= WRITE IMMEDIATE.
+ora_commit_write ::= WRITE BATCH.
+ora_commit_write ::= WRITE WAIT.
+ora_commit_write ::= WRITE NOWAIT.
+ora_commit_write ::= WRITE IMMEDIATE WAIT.
+ora_commit_write ::= WRITE IMMEDIATE NOWAIT.
+ora_commit_write ::= WRITE BATCH WAIT.
+ora_commit_write ::= WRITE BATCH NOWAIT.
+
+trans_opt_kw ::= .
+trans_opt_kw ::= TRANSACTION.
+
+opt_comma ::= .
+opt_comma ::= COMMA.
+
+%type transilev {GdaTransactionIsolation}
+transilev(L) ::= ISOLATION LEVEL SERIALIZABLE. {L = GDA_TRANSACTION_ISOLATION_SERIALIZABLE;}
+transilev(L) ::= ISOLATION LEVEL REPEATABLE READ. {L = GDA_TRANSACTION_ISOLATION_REPEATABLE_READ;}
+transilev(L) ::= ISOLATION LEVEL READ COMMITTED. {L = GDA_TRANSACTION_ISOLATION_READ_COMMITTED;}
+transilev(L) ::= ISOLATION LEVEL READ UNCOMMITTED. {L = GDA_TRANSACTION_ISOLATION_READ_UNCOMMITTED;}
+
+nm_opt(R) ::= . {R = NULL;}
+nm_opt(R) ::= nm(N). {R = N;}
+
+transtype(A) ::= DEFERRED(X).  {A = X;}
+transtype(A) ::= IMMEDIATE(X). {A = X;}
+transtype(A) ::= EXCLUSIVE(X). {A = X;}
+transtype(A) ::= READ WRITE. {A = g_new0 (GValue, 1);
+			      g_value_init (A, G_TYPE_STRING);
+			      g_value_set_string (A, "READ_WRITE");
+}
+transtype(A) ::= READ ONLY. {A = g_new0 (GValue, 1);
+			     g_value_init (A, G_TYPE_STRING);
+			     g_value_set_string (A, "READ_ONLY");
+}
+
+//
+// Savepoints
+//
+cmd(C) ::= SAVEPOINT nm(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_SAVEPOINT);
+				    gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= RELEASE SAVEPOINT nm(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_DELETE_SAVEPOINT);
+				     gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= RELEASE nm(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_DELETE_SAVEPOINT);
+			   gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= ROLLBACK trans_opt_kw TO nm(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT);
+					    gda_sql_statement_trans_take_name (C, R);
+}
+
+cmd(C) ::= ROLLBACK trans_opt_kw TO SAVEPOINT nm(R). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT);
+						      gda_sql_statement_trans_take_name (C, R);
+}
+
+//
+// INSERT
+//
+cmd(C) ::= INSERT opt_on_conflict(O) INTO fullname(X) inscollist_opt(F) VALUES LP exprlist(Y) RP. {
+	C = gda_sql_statement_new (GDA_SQL_STATEMENT_INSERT);
+	gda_sql_statement_insert_take_table_name (C, X);
+	gda_sql_statement_insert_take_fields_list (C, F);
+	gda_sql_statement_insert_take_1_values_list (C, Y);
+	gda_sql_statement_insert_take_on_conflict (C, O);
+}
+
+cmd(C) ::= INSERT opt_on_conflict(O) INTO fullname(X) inscollist_opt(F) VALUES LP exprlist(Y) RP ins_extra_values(E). {
+	C = gda_sql_statement_new (GDA_SQL_STATEMENT_INSERT);
+	gda_sql_statement_insert_take_table_name (C, X);
+	gda_sql_statement_insert_take_fields_list (C, F);
+	gda_sql_statement_insert_take_1_values_list (C, Y);
+	gda_sql_statement_insert_take_extra_values_list (C, E);
+	gda_sql_statement_insert_take_on_conflict (C, O);
+}
+
+cmd(C) ::= INSERT opt_on_conflict(O) INTO fullname(X) inscollist_opt(F) compound(S). {
+        C = gda_sql_statement_new (GDA_SQL_STATEMENT_INSERT);
+        gda_sql_statement_insert_take_table_name (C, X);
+        gda_sql_statement_insert_take_fields_list (C, F);
+        gda_sql_statement_insert_take_select (C, S);
+        gda_sql_statement_insert_take_on_conflict (C, O);
+}
+
+
+opt_on_conflict(O) ::= . {O = NULL;}
+opt_on_conflict(O) ::= OR ID(V). {O = V;}
+
+%type ins_extra_values {GSList*}
+%destructor ins_extra_values {GSList *list;
+		for (list = $$; list; list = list->next) {
+			g_slist_foreach ((GSList*) list->data, (GFunc) gda_sql_field_free, NULL); 
+			g_slist_free ((GSList*) list->data);
+		}
+		g_slist_free ($$);
+}
+ins_extra_values(E) ::= ins_extra_values(A) COMMA LP exprlist(L) RP. {E = g_slist_append (A, L);}
+ins_extra_values(E) ::= COMMA LP exprlist(L) RP. {E = g_slist_append (NULL, L);}
+
+%type inscollist_opt {GSList*}
+%destructor inscollist_opt {if ($$) {g_slist_foreach ($$, (GFunc) gda_sql_field_free, NULL); g_slist_free ($$);}}
+inscollist_opt(A) ::= .                       {A = NULL;}
+inscollist_opt(A) ::= LP inscollist(X) RP.    {A = X;}
+
+%type inscollist {GSList*}
+%destructor inscollist {if ($$) {g_slist_foreach ($$, (GFunc) gda_sql_field_free, NULL); g_slist_free ($$);}}
+inscollist(A) ::= inscollist(X) COMMA fullname(Y). {GdaSqlField *field;
+						    field = gda_sql_field_new (NULL);
+						    gda_sql_field_take_name (field, Y);
+						    A = g_slist_append (X, field);
+}
+inscollist(A) ::= fullname(Y). {GdaSqlField *field = gda_sql_field_new (NULL);
+				gda_sql_field_take_name (field, Y);
+				A = g_slist_prepend (NULL, field);
+}
+
+// DELETE
+cmd(C) ::= DELETE FROM fullname(T) where_opt(X). {C = gda_sql_statement_new (GDA_SQL_STATEMENT_DELETE); 
+						  gda_sql_statement_delete_take_table_name (C, T);
+						  gda_sql_statement_delete_take_condition (C, X);}
+
+%type where_opt {GdaSqlExpr *}
+%destructor where_opt {gda_sql_expr_free ($$);}
+where_opt(A) ::= .                    {A = NULL;}
+where_opt(A) ::= WHERE expr(X).       {A = X;}
+
+// UPDATE
+cmd(C) ::= UPDATE opt_on_conflict(O) fullname(T) SET setlist(S) where_opt(X). {
+	GSList *list;
+	C = gda_sql_statement_new (GDA_SQL_STATEMENT_UPDATE);
+	gda_sql_statement_update_take_table_name (C, T);
+	gda_sql_statement_update_take_on_conflict (C, O);
+	gda_sql_statement_update_take_condition (C, X);
+	for (list = S; list; list = list->next) {
+		UpdateSet *set = (UpdateSet*) list->data;
+		gda_sql_statement_update_take_set_value (C, set->fname, set->expr);
+		g_free (set);
+	}
+	g_slist_free (S);
+}
+
+%type setlist {GSList*}
+%destructor setlist {GSList *list;
+	for (list = $$; list; list = list->next) {
+		UpdateSet *set = (UpdateSet*) list->data;
+		g_value_reset (set->fname); g_free (set->fname);
+		gda_sql_expr_free (set->expr);
+		g_free (set);
+	}
+	g_slist_free ($$);
+}
+setlist(A) ::= setlist(Z) COMMA fullname(X) EQ expr(Y). {UpdateSet *set;
+							 set = g_new (UpdateSet, 1);
+							 set->fname = X;
+							 set->expr = Y;
+							 A = g_slist_append (Z, set);
+}
+setlist(A) ::= fullname(X) EQ expr(Y). {UpdateSet *set;
+					set = g_new (UpdateSet, 1);
+					set->fname = X;
+					set->expr = Y;
+					A = g_slist_append (NULL, set);
+}
+
+// COMPOUND SELECT
+%type compound {GdaSqlStatement *}
+%destructor compound {gda_sql_statement_free ($$);}
+//compound(C) ::= LP compound(E) RP. {C = E;}
+compound(C) ::= selectcmd(S). {
+	C = gda_sql_statement_new (GDA_SQL_STATEMENT_COMPOUND);
+	gda_sql_statement_compound_take_stmt (C, S);
+}
+compound(C) ::= compound(L) UNION opt_compound_all(A) compound(R). {
+	C = compose_multiple_compounds (A ? GDA_SQL_STATEMENT_COMPOUND_UNION_ALL : GDA_SQL_STATEMENT_COMPOUND_UNION,
+					L, R);
+}
+
+compound(C) ::= compound(L) EXCEPT opt_compound_all(A) compound(R). {
+	C = compose_multiple_compounds (A ? GDA_SQL_STATEMENT_COMPOUND_EXCEPT_ALL : GDA_SQL_STATEMENT_COMPOUND_EXCEPT,
+					L, R);
+} 
+
+compound(C) ::= compound(L) INTERSECT opt_compound_all(A) compound(R). {
+	C = compose_multiple_compounds (A ? GDA_SQL_STATEMENT_COMPOUND_INTERSECT_ALL : GDA_SQL_STATEMENT_COMPOUND_INTERSECT,
+					L, R);
+} 
+
+%type opt_compound_all {gboolean}
+opt_compound_all(A) ::= .    {A = FALSE;}
+opt_compound_all(A) ::= ALL. {A = TRUE;}
+
+
+// SELECT
+%type selectcmd {GdaSqlStatement *}
+%destructor selectcmd {gda_sql_statement_free ($$);}
+selectcmd(C) ::= SELECT distinct(D) selcollist(W) from(F) where_opt(Y)
+	 groupby_opt(P) having_opt(Q) orderby_opt(Z) limit_opt(L). {
+	C = gda_sql_statement_new (GDA_SQL_STATEMENT_SELECT);
+	if (D) {
+		gda_sql_statement_select_take_distinct (C, D->distinct, D->expr);
+		g_free (D);
+	}
+	gda_sql_statement_select_take_expr_list (C, W);
+	gda_sql_statement_select_take_from (C, F);
+	gda_sql_statement_select_take_where_cond (C, Y);
+	gda_sql_statement_select_take_group_by (C, P);
+	gda_sql_statement_select_take_having_cond (C, Q);
+	gda_sql_statement_select_take_order_by (C, Z);
+	gda_sql_statement_select_take_limits (C, L.count, L.offset);
+}
+
+%type limit_opt {Limit}
+%destructor limit_opt {gda_sql_expr_free ($$.count); gda_sql_expr_free ($$.offset);}
+limit_opt(A) ::= .                     {A.count = NULL; A.offset = NULL;}
+limit_opt(A) ::= LIMIT expr(X).        {A.count = X; A.offset = NULL;}
+limit_opt(A) ::= LIMIT expr(X) OFFSET expr(Y). {A.count = X; A.offset = Y;}
+limit_opt(A) ::= LIMIT expr(X) COMMA expr(Y). {A.count = X; A.offset = Y;}
+
+%type orderby_opt {GSList *}
+%destructor orderby_opt {if ($$) {g_slist_foreach ($$, (GFunc) gda_sql_select_order_free, NULL); g_slist_free ($$);}}
+orderby_opt(A) ::= .                          {A = 0;}
+orderby_opt(A) ::= ORDER BY sortlist(X).      {A = X;}
+
+%type sortlist {GSList *}
+%destructor sortlist {if ($$) {g_slist_foreach ($$, (GFunc) gda_sql_select_order_free, NULL); g_slist_free ($$);}}
+sortlist(A) ::= sortlist(X) COMMA expr(Y) sortorder(Z). {GdaSqlSelectOrder *order;
+							 order = gda_sql_select_order_new (NULL);
+							 order->expr = Y;
+							 order->asc = Z;
+							 A = g_slist_append (X, order);
+}
+sortlist(A) ::= expr(Y) sortorder(Z). {GdaSqlSelectOrder *order;
+				       order = gda_sql_select_order_new (NULL);
+				       order->expr = Y;
+				       order->asc = Z;
+				       A = g_slist_prepend (NULL, order);
+}
+
+%type sortorder {gboolean}
+sortorder(A) ::= ASC.           {A = TRUE;}
+sortorder(A) ::= DESC.          {A = FALSE;}
+sortorder(A) ::= .              {A = TRUE;}
+
+
+%type having_opt {GdaSqlExpr *}
+%destructor having_opt {gda_sql_expr_free ($$);}
+having_opt(A) ::= .                     {A = NULL;}
+having_opt(A) ::= HAVING expr(X).       {A = X;}
+
+%type groupby_opt {GSList*}
+%destructor groupby_opt {if ($$) {g_slist_foreach ($$, (GFunc) gda_sql_expr_free, NULL); g_slist_free ($$);}}
+groupby_opt(A) ::= .                      {A = 0;}
+groupby_opt(A) ::= GROUP BY nexprlist(X). {A = X;}
+
+%type from {GdaSqlSelectFrom *}
+%destructor from {gda_sql_select_from_free ($$);}
+from(F) ::= .                   {F = NULL;}
+from(F) ::= FROM seltablist(X). {F = X;}
+
+%type seltablist {GdaSqlSelectFrom *}
+%destructor seltablist {gda_sql_select_from_free ($$);}
+%type stl_prefix {GdaSqlSelectFrom *}
+%destructor stl_prefix {gda_sql_select_from_free ($$);}
+
+seltablist(L) ::= stl_prefix(P) seltarget(T) on_cond(C) using_opt(U). {
+	GSList *last;
+	if (P)
+		L = P;
+	else 
+		L = gda_sql_select_from_new (NULL);
+	gda_sql_select_from_take_new_target (L, T);
+	last = g_slist_last (L->joins);
+	if (last) {
+		GdaSqlSelectJoin *join = (GdaSqlSelectJoin *) (last->data);
+		join->expr = C;
+		join->position = g_slist_length (L->targets) - 1;
+		join->using = U;
+	}
+}
+
+%type using_opt {GSList*}
+%destructor using_opt {if ($$) {g_slist_foreach ($$, (GFunc) gda_sql_field_free, NULL); g_slist_free ($$);}}
+using_opt(U) ::= USING LP inscollist(L) RP. {U = L;}
+using_opt(U) ::= .                          {U = NULL;}
+
+stl_prefix(P) ::= . {P = NULL;}
+stl_prefix(P) ::= seltablist(L) jointype(J). {GdaSqlSelectJoin *join;
+					      P = L;
+					      join = gda_sql_select_join_new (GDA_SQL_ANY_PART (P));
+					      join->type = J;
+					      gda_sql_select_from_take_new_join (P, join);
+}
+					      
+
+%type on_cond {GdaSqlExpr *}
+%destructor on_cond {gda_sql_expr_free ($$);}
+on_cond(N) ::= ON expr(E).  {N = E;}
+on_cond(N) ::= .            {N = NULL;}
+
+%type jointype {GdaSqlSelectJoinType}
+jointype(J) ::= COMMA. {J = GDA_SQL_SELECT_JOIN_CROSS;}
+jointype(J) ::= JOIN. {J = GDA_SQL_SELECT_JOIN_INNER;}
+jointype(J) ::= CROSS JOIN. {J = GDA_SQL_SELECT_JOIN_CROSS;}
+jointype(J) ::= INNER JOIN. {J = GDA_SQL_SELECT_JOIN_INNER;}
+jointype(J) ::= NATURAL JOIN. {J = GDA_SQL_SELECT_JOIN_NATURAL;}
+jointype(J) ::= LEFT JOIN. {J = GDA_SQL_SELECT_JOIN_LEFT;}
+jointype(J) ::= LEFT OUTER JOIN. {J = GDA_SQL_SELECT_JOIN_LEFT;}
+jointype(J) ::= RIGHT JOIN. {J = GDA_SQL_SELECT_JOIN_RIGHT;}
+jointype(J) ::= RIGHT OUTER JOIN. {J = GDA_SQL_SELECT_JOIN_RIGHT;}
+jointype(J) ::= FULL JOIN. {J = GDA_SQL_SELECT_JOIN_FULL;}
+jointype(J) ::= FULL OUTER JOIN. {J = GDA_SQL_SELECT_JOIN_FULL;}
+
+
+%type seltarget {GdaSqlSelectTarget *}
+%destructor seltarget {gda_sql_select_target_free ($$);}
+seltarget(T) ::= fullname(F) as(A). {T = gda_sql_select_target_new (NULL);
+				     gda_sql_select_target_take_alias (T, A);
+				     gda_sql_select_target_take_table_name (T, F);
+}
+seltarget(T) ::= fullname(F) ID(A). {T = gda_sql_select_target_new (NULL);
+                                     gda_sql_select_target_take_alias (T, A);
+                                     gda_sql_select_target_take_table_name (T, F);
+}
+seltarget(T) ::= LP compound(S) RP as(A). {T = gda_sql_select_target_new (NULL);
+					     gda_sql_select_target_take_alias (T, A);
+					     gda_sql_select_target_take_select (T, S);
+}
+
+%type selcollist {GSList *}
+%destructor selcollist {g_slist_foreach ($$, (GFunc) gda_sql_select_field_free, NULL); g_slist_free ($$);}
+
+%type sclp {GSList *}
+%destructor sclp {g_slist_foreach ($$, (GFunc) gda_sql_select_field_free, NULL); g_slist_free ($$);}
+sclp(A) ::= selcollist(X) COMMA.             {A = X;}
+sclp(A) ::= .                                {A = NULL;}
+
+selcollist(L) ::= sclp(E) expr(X) as(A). {GdaSqlSelectField *field;
+					  field = gda_sql_select_field_new (NULL);
+					  gda_sql_select_field_take_expr (field, X);
+					  gda_sql_select_field_take_alias (field, A); 
+					  L = g_slist_append (E, field);}
+selcollist(L) ::= sclp(E) starname(X). {GdaSqlSelectField *field;
+					field = gda_sql_select_field_new (NULL);
+					gda_sql_select_field_take_star_value (field, X);
+					L = g_slist_append (E, field);}
+
+starname(S) ::= STAR(X). {S = X;}
+starname(A) ::= nm(S) DOT STAR(X). {gchar *str;
+				  str = g_strdup_printf ("%s.%s", g_value_get_string (S), g_value_get_string (X));
+				  A = g_new0 (GValue, 1);
+				  g_value_init (A, G_TYPE_STRING);
+				  g_value_take_string (A, str);
+				  g_value_reset (S); g_free (S);
+				  g_value_reset (X); g_free (X);
+}
+
+starname(A) ::= nm(C) DOT nm(S) DOT STAR(X). {gchar *str;
+				  str = g_strdup_printf ("%s.%s.%s", g_value_get_string (C), 
+							 g_value_get_string (S), g_value_get_string (X));
+				  A = g_new0 (GValue, 1);
+				  g_value_init (A, G_TYPE_STRING);
+				  g_value_take_string (A, str);
+				  g_value_reset (C); g_free (C);
+				  g_value_reset (S); g_free (S);
+				  g_value_reset (X); g_free (X);
+}
+
+as(A) ::= AS fullname(F). {A = F;}
+as(A) ::= AS value(F). {A = F;}
+as(A) ::= . {A = NULL;}
+
+%type distinct {Distinct *}
+%destructor distinct {if ($$) {if ($$->expr) gda_sql_expr_free ($$->expr); g_free ($$);}}
+distinct(E) ::= . {E = NULL;}
+distinct(E) ::= ALL. {E = NULL;}
+distinct(E) ::= DISTINCT. {E = g_new0 (Distinct, 1); E->distinct = TRUE;}
+distinct(E) ::= DISTINCT ON expr(X). [OR] {E = g_new0 (Distinct, 1); E->distinct = TRUE; E->expr = X;}
+
+// Non empty list of expressions
+%type nexprlist {GSList *}
+%destructor nexprlist {if ($$) {g_slist_foreach ($$, (GFunc) gda_sql_expr_free, NULL); g_slist_free ($$);}}
+nexprlist(L) ::= nexprlist(E) COMMA expr(X). {L = g_slist_append (E, X);}
+nexprlist(L) ::= expr(E). {L = g_slist_append (NULL, E);}
+
+// List of expressions
+%type exprlist {GSList *}
+%destructor exprlist {if ($$) {g_slist_foreach ($$, (GFunc) gda_sql_expr_free, NULL); g_slist_free ($$);}}
+exprlist(L) ::= . {L = NULL;}
+exprlist(L) ::= exprlist(E) COMMA expr(X). {L = g_slist_append (E, X);}
+exprlist(L) ::= expr(E). {L = g_slist_append (NULL, E);}
+
+// A single expression
+%type expr {GdaSqlExpr *}
+%destructor expr {gda_sql_expr_free ($$);}
+expr(E) ::= pvalue(V). {E = V;}
+expr(E) ::= value(V). {E = gda_sql_expr_new (NULL); E->value = V;}
+expr(E) ::= LP expr(X) RP. {E = X;}
+expr(E) ::= fullname(V). {E = gda_sql_expr_new (NULL); E->value = V;}
+expr(E) ::= fullname(V) LP exprlist(A) RP. {GdaSqlFunction *func;
+					    E = gda_sql_expr_new (NULL); 
+					    func = gda_sql_function_new (GDA_SQL_ANY_PART (E)); 
+					    gda_sql_function_take_name (func, V);
+					    gda_sql_function_take_args_list (func, A);
+					    E->func = func;}
+expr(E) ::= fullname(V) LP compound(S) RP. {GdaSqlFunction *func;
+					     GdaSqlExpr *expr;
+					     E = gda_sql_expr_new (NULL); 
+					     func = gda_sql_function_new (GDA_SQL_ANY_PART (E)); 
+					     gda_sql_function_take_name (func, V);
+					     expr = gda_sql_expr_new (GDA_SQL_ANY_PART (func)); 
+					     gda_sql_expr_take_select (expr, S);
+					     gda_sql_function_take_args_list (func, g_slist_prepend (NULL, expr));
+					     E->func = func;}
+expr(E) ::= fullname(V) LP starname(A) RP. {GdaSqlFunction *func;
+					    GdaSqlExpr *expr;
+					    E = gda_sql_expr_new (NULL); 
+					    func = gda_sql_function_new (GDA_SQL_ANY_PART (E));
+					    gda_sql_function_take_name (func, V);
+					    expr = gda_sql_expr_new (GDA_SQL_ANY_PART (func)); 
+					    expr->value = A;
+					    gda_sql_function_take_args_list (func, g_slist_prepend (NULL, expr));
+					    E->func = func;}
+expr(E) ::= CAST LP expr(A) AS fullname(T) RP. {E = A;
+						A->cast_as = g_value_dup_string (T);
+						g_value_reset (T);
+						g_free (T);}
+expr(E) ::= expr(A) PGCAST fullname(T). {E = A;
+					 A->cast_as = g_value_dup_string (T);
+					 g_value_reset (T);
+					 g_free (T);}
+
+expr(C) ::= expr(L) PLUS|MINUS(O) expr(R). {C = compose_multiple_expr (string_to_op_type (O), L, R);}
+expr(C) ::= expr(L) STAR expr(R). {C = compose_multiple_expr (GDA_SQL_OPERATOR_STAR, L, R);}
+expr(C) ::= expr(L) SLASH|REM(O) expr(R). {C = create_two_expr (string_to_op_type (O), L, R);}
+expr(C) ::= expr(L) BITAND|BITOR(O) expr(R). {C = create_two_expr (string_to_op_type (O), L, R);}
+
+expr(C) ::= MINUS expr(X). [UMINUS] {C = create_uni_expr (GDA_SQL_OPERATOR_MINUS, X);}
+expr(C) ::= PLUS expr(X). [UPLUS] {C = create_uni_expr (GDA_SQL_OPERATOR_PLUS, X);}
+
+expr(C) ::= expr(L) AND expr(R). {C = compose_multiple_expr (GDA_SQL_OPERATOR_AND, L, R);}
+expr(C) ::= expr(L) OR expr(R). {C = compose_multiple_expr (GDA_SQL_OPERATOR_OR, L, R);}
+expr(C) ::= expr(L) CONCAT expr(R). {C = compose_multiple_expr (GDA_SQL_OPERATOR_CONCAT, L, R);}
+
+expr(C) ::= expr(L) GT|LEQ|GEQ|LT(O) expr(R). {C = create_two_expr (string_to_op_type (O), L, R);}
+expr(C) ::= expr(L) DIFF|EQ(O) expr(R). {C = create_two_expr (string_to_op_type (O), L, R);}
+expr(C) ::= expr(L) LIKE expr(R). {C = create_two_expr (GDA_SQL_OPERATOR_LIKE, L, R);}
+expr(C) ::= expr(L) REGEXP|REGEXP_CI|NOT_REGEXP|NOT_REGEXP_CI|SIMILAR(O) expr(R). {C = create_two_expr (string_to_op_type (O), L, R);}
+expr(C) ::= expr(L) BETWEEN expr(R) AND expr(E). {GdaSqlOperation *cond;
+						  C = gda_sql_expr_new (NULL);
+						  cond = gda_sql_operation_new (GDA_SQL_ANY_PART (C));
+						  C->cond = cond;
+						  cond->operator = GDA_SQL_OPERATOR_BETWEEN;
+						  cond->operands = g_slist_append (NULL, L);
+						  GDA_SQL_ANY_PART (L)->parent = GDA_SQL_ANY_PART (cond);
+						  cond->operands = g_slist_append (cond->operands, R);
+						  GDA_SQL_ANY_PART (R)->parent = GDA_SQL_ANY_PART (cond);
+						  cond->operands = g_slist_append (cond->operands, E);
+						  GDA_SQL_ANY_PART (E)->parent = GDA_SQL_ANY_PART (cond);
+}
+
+expr(C) ::= expr(L) NOT BETWEEN expr(R) AND expr(E). {GdaSqlOperation *cond;
+						      GdaSqlExpr *expr;
+						      expr = gda_sql_expr_new (NULL);
+						      cond = gda_sql_operation_new (GDA_SQL_ANY_PART (expr));
+						      expr->cond = cond;
+						      cond->operator = GDA_SQL_OPERATOR_BETWEEN;
+						      cond->operands = g_slist_append (NULL, L);
+						      GDA_SQL_ANY_PART (L)->parent = GDA_SQL_ANY_PART (cond);
+						      cond->operands = g_slist_append (cond->operands, R);
+						      GDA_SQL_ANY_PART (R)->parent = GDA_SQL_ANY_PART (cond);
+						      cond->operands = g_slist_append (cond->operands, E);
+						      GDA_SQL_ANY_PART (E)->parent = GDA_SQL_ANY_PART (cond);
+
+						      C = gda_sql_expr_new (NULL);
+						      cond = gda_sql_operation_new (GDA_SQL_ANY_PART (C));
+						      C->cond = cond;
+						      cond->operator = GDA_SQL_OPERATOR_NOT;
+						      cond->operands = g_slist_prepend (NULL, expr);
+						      GDA_SQL_ANY_PART (expr)->parent = GDA_SQL_ANY_PART (cond);
+}
+
+expr(C) ::= NOT expr(R). {C = create_uni_expr (GDA_SQL_OPERATOR_NOT, R);}
+expr(C) ::= BITNOT expr(R). {C = create_uni_expr (GDA_SQL_OPERATOR_BITNOT, R);}
+expr(C) ::= expr(R) uni_op(O) . {C = create_uni_expr (O, R);}
+
+expr(C) ::= expr(L) IS expr(R). {C = create_two_expr (GDA_SQL_OPERATOR_IS, L, R);}
+expr(E) ::= LP compound(S) RP. {E = gda_sql_expr_new (NULL); gda_sql_expr_take_select (E, S);}
+expr(E) ::= expr(R) IN LP exprlist(L) RP. {GdaSqlOperation *cond;
+					   GSList *list;
+					   E = gda_sql_expr_new (NULL);
+					   cond = gda_sql_operation_new (GDA_SQL_ANY_PART (E));
+					   E->cond = cond;
+					   cond->operator = GDA_SQL_OPERATOR_IN;
+					   cond->operands = g_slist_prepend (L, R);
+					   for (list = cond->operands; list; list = list->next)
+						   GDA_SQL_ANY_PART (list->data)->parent = GDA_SQL_ANY_PART (cond);
+}
+expr(E) ::= expr(R) IN LP compound(S) RP. {GdaSqlOperation *cond;
+					    GdaSqlExpr *expr;
+					    E = gda_sql_expr_new (NULL);
+					    cond = gda_sql_operation_new (GDA_SQL_ANY_PART (E));
+					    E->cond = cond;
+					    cond->operator = GDA_SQL_OPERATOR_IN;
+					    
+					    expr = gda_sql_expr_new (GDA_SQL_ANY_PART (cond));
+					    gda_sql_expr_take_select (expr, S);
+					    cond->operands = g_slist_prepend (NULL, expr);
+					    cond->operands = g_slist_prepend (cond->operands, R);
+					    GDA_SQL_ANY_PART (R)->parent = GDA_SQL_ANY_PART (cond);
+}
+expr(E) ::= expr(R) NOT IN LP exprlist(L) RP. {GdaSqlOperation *cond;
+					       GdaSqlExpr *expr;
+					       GSList *list;
+					       expr = gda_sql_expr_new (NULL);
+					       cond = gda_sql_operation_new (GDA_SQL_ANY_PART (expr));
+					       expr->cond = cond;
+					       cond->operator = GDA_SQL_OPERATOR_IN;
+					       cond->operands = g_slist_prepend (L, R);
+					       for (list = cond->operands; list; list = list->next)
+						       GDA_SQL_ANY_PART (list->data)->parent = GDA_SQL_ANY_PART (cond);
+					       
+					       E = gda_sql_expr_new (NULL);
+					       cond = gda_sql_operation_new (GDA_SQL_ANY_PART (E));
+					       E->cond = cond;
+					       cond->operator = GDA_SQL_OPERATOR_NOT;
+					       cond->operands = g_slist_prepend (NULL, expr);
+					       GDA_SQL_ANY_PART (expr)->parent = GDA_SQL_ANY_PART (cond);
+}
+expr(E) ::= expr(R) NOT IN LP compound(S) RP. {GdaSqlOperation *cond;
+						GdaSqlExpr *expr1, *expr2;
+						expr1 = gda_sql_expr_new (NULL);
+						cond = gda_sql_operation_new (GDA_SQL_ANY_PART (expr1));
+						expr1->cond = cond;
+						cond->operator = GDA_SQL_OPERATOR_IN;
+						
+						expr2 = gda_sql_expr_new (NULL);
+						gda_sql_expr_take_select (expr2, S);
+						cond->operands = g_slist_prepend (NULL, expr2);
+						GDA_SQL_ANY_PART (expr2)->parent = GDA_SQL_ANY_PART (cond);
+						cond->operands = g_slist_prepend (cond->operands, R);
+						GDA_SQL_ANY_PART (R)->parent = GDA_SQL_ANY_PART (cond);
+						
+						E = gda_sql_expr_new (NULL);
+						cond = gda_sql_operation_new (GDA_SQL_ANY_PART (E));
+						E->cond = cond;
+						cond->operator = GDA_SQL_OPERATOR_NOT;
+						cond->operands = g_slist_prepend (NULL, expr1);
+						GDA_SQL_ANY_PART (expr1)->parent = GDA_SQL_ANY_PART (cond);
+}
+expr(A) ::= CASE case_operand(X) case_exprlist(Y) case_else(Z) END. {
+	GdaSqlCase *sc;
+	GSList *list;
+	A = gda_sql_expr_new (NULL);
+	sc = gda_sql_case_new (GDA_SQL_ANY_PART (A));
+	sc->base_expr = X;
+	sc->else_expr = Z;
+	sc->when_expr_list = Y.when_list;
+	sc->then_expr_list = Y.then_list;
+	A->case_s = sc;
+	for (list = sc->when_expr_list; list; list = list->next)
+		GDA_SQL_ANY_PART (list->data)->parent = GDA_SQL_ANY_PART (sc);
+	for (list = sc->then_expr_list; list; list = list->next)
+		GDA_SQL_ANY_PART (list->data)->parent = GDA_SQL_ANY_PART (sc);
+}
+	
+%type case_operand {GdaSqlExpr*}
+%destructor case_operand {gda_sql_expr_free ($$);}
+case_operand(A) ::= expr(X).            {A = X;}
+case_operand(A) ::= .                   {A = NULL;}
+
+%type case_exprlist {CaseBody}
+%destructor case_exprlist {g_slist_foreach ($$.when_list, (GFunc) gda_sql_expr_free, NULL); g_slist_free ($$.when_list);
+	g_slist_foreach ($$.then_list, (GFunc) gda_sql_expr_free, NULL); g_slist_free ($$.then_list);}
+
+case_exprlist(A) ::= case_exprlist(X) WHEN expr(Y) THEN expr(Z). {
+	A.when_list = g_slist_append (X.when_list, Y);
+	A.then_list = g_slist_append (X.then_list, Z);
+}
+case_exprlist(A) ::= WHEN expr(Y) THEN expr(Z). {
+	A.when_list = g_slist_prepend (NULL, Y);
+	A.then_list = g_slist_prepend (NULL, Z);
+}
+
+%type case_else {GdaSqlExpr*}
+%destructor case_else {gda_sql_expr_free ($$);}
+case_else(A) ::= ELSE expr(X).       {A = X;}
+case_else(A) ::= .                   {A = NULL;}
+
+%type uni_op {GdaSqlOperator}
+uni_op(O) ::= ISNULL. {O = GDA_SQL_OPERATOR_ISNULL;}
+uni_op(O) ::= IS NOTNULL. {O = GDA_SQL_OPERATOR_ISNOTNULL;}
+
+
+// Values: for all constants (G_TYPE_STRING GValue)
+value(V) ::= NULL. {V = NULL;}
+value(V) ::= STRING(S). {V = S;}
+value(V) ::= TEXTUAL(T). {V = T;}
+value(V) ::= INTEGER(I). {V = I;}
+value(V) ::= FLOAT(F). {V = F;}
+
+// pvalue: values which are parameters (GdaSqlExpr)
+%type pvalue {GdaSqlExpr *}
+%destructor pvalue {gda_sql_expr_free ($$);}
+	pvalue(E) ::= UNSPECVAL LSBRACKET paramspec(P) RSBRACKET. {E = gda_sql_expr_new (NULL); E->param_spec = P;}
+pvalue(E) ::= value(V) LSBRACKET paramspec(P) RSBRACKET. {E = gda_sql_expr_new (NULL); E->value = V; E->param_spec = P;}
+pvalue(E) ::= SIMPLEPARAM(S). {E = gda_sql_expr_new (NULL); E->param_spec = gda_sql_param_spec_new (S);}
+
+// paramspec: parameter's specifications
+%type paramspec {GdaSqlParamSpec *}
+%destructor paramspec {gda_sql_param_spec_free ($$);}
+paramspec(P) ::= . {P = NULL;}
+paramspec(P) ::= paramspec(E) PNAME(N). {if (!E) P = gda_sql_param_spec_new (NULL); else P = E; 
+					 gda_sql_param_spec_take_name (P, N);}
+paramspec(P) ::= paramspec(E) PDESCR(N). {if (!E) P = gda_sql_param_spec_new (NULL); else P = E; 
+					 gda_sql_param_spec_take_descr (P, N);}
+paramspec(P) ::= paramspec(E) PTYPE(N). {if (!E) P = gda_sql_param_spec_new (NULL); else P = E; 
+					 gda_sql_param_spec_take_type (P, N);}
+paramspec(P) ::= paramspec(E) PNULLOK(N). {if (!E) P = gda_sql_param_spec_new (NULL); else P = E; 
+					   gda_sql_param_spec_take_nullok (P, N);}
+
+// The name of a column or table can be any of the following:
+//
+nm(A) ::= JOIN(X).       {A = X;}
+nm(A) ::= ID(X).       {A = X;}
+
+// Fully qualified name
+fullname(A) ::= nm(X). {A = X;}
+fullname(A) ::= nm(S) DOT nm(X). {gchar *str;
+				  str = g_strdup_printf ("%s.%s", g_value_get_string (S), g_value_get_string (X));
+				  A = g_new0 (GValue, 1);
+				  g_value_init (A, G_TYPE_STRING);
+				  g_value_take_string (A, str);
+				  g_value_reset (S); g_free (S);
+				  g_value_reset (X); g_free (X);
+}
+
+fullname(A) ::= nm(C) DOT nm(S) DOT nm(X). {gchar *str;
+				  str = g_strdup_printf ("%s.%s.%s", g_value_get_string (C), 
+							 g_value_get_string (S), g_value_get_string (X));
+				  A = g_new0 (GValue, 1);
+				  g_value_init (A, G_TYPE_STRING);
+				  g_value_take_string (A, str);
+				  g_value_reset (C); g_free (C);
+				  g_value_reset (S); g_free (S);
+				  g_value_reset (X); g_free (X);
+}

Added: branches/V4-branch/providers/skel-implementation/models/Makefile.am
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/models/Makefile.am	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,34 @@
+providerdir=$(libdir)/libgda-$(GDA_ABI_MAJOR_VERSION).$(GDA_ABI_MINOR_VERSION)/providers
+provider_LTLIBRARIES = libgda-models.la
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/libgda/sqlite \
+	-I$(top_srcdir)/libgda \
+	-I$(top_builddir) \
+	$(LIBGDA_CFLAGS) 
+
+libgda_models_la_SOURCES = \
+	gda-models-provider.c \
+	gda-models-provider.h \
+	gda-models.h \
+	libmain.c
+
+libgda_models_la_LDFLAGS = -export-dynamic -module -avoid-version $(NO_UNDEFINED)
+libgda_models_la_LIBADD = \
+	$(top_builddir)/libgda/libgda-4.0.la \
+	$(LIBGDA_LIBS) 
+
+xmldir   = $(datadir)/libgda-4.0
+xml_in_files = models_specs_dsn.xml.in
+
+ INTLTOOL_XML_RULE@
+
+xml_DATA = $(xml_in_files:.xml.in=.xml)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libgda-models-4.0.pc
+
+EXTRA_DIST = $(xml_in_files) libgda-models-4.0.pc.in
+DISTCLEANFILES = $(xml_DATA)
+

Added: branches/V4-branch/providers/skel-implementation/models/gda-models-provider.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/models/gda-models-provider.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,245 @@
+/* GDA Models provider
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib/gi18n-lib.h>
+#include <virtual/gda-vconnection-data-model.h>
+#include <libgda/gda-connection-private.h>
+#include "gda-models.h"
+#include "gda-models-provider.h"
+
+static void gda_models_provider_class_init (GdaModelsProviderClass *klass);
+static void gda_models_provider_init       (GdaModelsProvider *provider,
+					    GdaModelsProviderClass *klass);
+static void gda_models_provider_finalize   (GObject *object);
+
+static const gchar *gda_models_provider_get_name (GdaServerProvider *provider);
+static const gchar *gda_models_provider_get_version (GdaServerProvider *provider);
+static gboolean gda_models_provider_open_connection (GdaServerProvider *provider,
+						     GdaConnection *cnc,
+						     GdaQuarkList *params,
+						     const gchar *username,
+						     const gchar *password);
+static const gchar *gda_models_provider_get_server_version (GdaServerProvider *provider,
+							    GdaConnection *cnc);
+static const gchar *gda_models_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc);
+
+static GObjectClass *parent_class = NULL;
+
+/* 
+ * private connection data destroy 
+ */
+static void gda_models_free_cnc_data (ModelsConnectionData *cdata);
+
+/*
+ * GdaModelsProvider class implementation
+ */
+static void
+gda_models_provider_class_init (GdaModelsProviderClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	GdaServerProviderClass *provider_class = GDA_SERVER_PROVIDER_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	object_class->finalize = gda_models_provider_finalize;
+
+	provider_class->get_name = gda_models_provider_get_name;
+	provider_class->get_version = gda_models_provider_get_version;
+	provider_class->open_connection = gda_models_provider_open_connection;
+	provider_class->get_server_version = gda_models_provider_get_server_version;
+	provider_class->get_database = gda_models_provider_get_database;
+}
+
+static void
+gda_models_provider_init (GdaModelsProvider *pg_prv, GdaModelsProviderClass *klass)
+{
+	/* initialization of provider instance is to add here */
+	TO_IMPLEMENT;
+}
+
+static void
+gda_models_provider_finalize (GObject *object)
+{
+	GdaModelsProvider *pg_prv = (GdaModelsProvider *) object;
+
+	g_return_if_fail (GDA_IS_MODELS_PROVIDER (pg_prv));
+
+	/* chain to parent class */
+	parent_class->finalize(object);
+}
+
+GType
+gda_models_provider_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static GTypeInfo info = {
+			sizeof (GdaModelsProviderClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) gda_models_provider_class_init,
+			NULL, NULL,
+			sizeof (GdaModelsProvider),
+			0,
+			(GInstanceInitFunc) gda_models_provider_init
+		};
+		type = g_type_register_static (GDA_TYPE_VPROVIDER_DATA_MODEL, "GdaModelsProvider", &info, 0);
+	}
+
+	return type;
+}
+
+/*
+ * Get provider name request
+ */
+static const gchar *
+gda_models_provider_get_name (GdaServerProvider *provider)
+{
+	return MODELS_PROVIDER_NAME;
+}
+
+/* 
+ * Get version request
+ */
+static const gchar *
+gda_models_provider_get_version (GdaServerProvider *provider)
+{
+	return PACKAGE_VERSION;
+}
+
+/* 
+ * Open connection request
+ *
+ * In this function, the following _must_ be done:
+ *   - check for the presence and validify of the parameters required to actually open a connection,
+ *     using @params
+ *   - open the real connection to the database using the parameters previously checked, create one or
+ *     more GdaDataModel objects and declare them to the virtual connection with table names
+ *   - open virtual (SQLite) connection
+ *   - create a CapiConnectionData structure and associate it to @cnc
+ *
+ * Returns: TRUE if no error occurred, or FALSE otherwise (and an ERROR gonnection event must be added to @cnc)
+ */
+static gboolean
+gda_models_provider_open_connection (GdaServerProvider *provider, GdaConnection *cnc,
+				     GdaQuarkList *params,
+				     const gchar *username,
+				     const gchar *password)
+{
+	g_return_val_if_fail (GDA_IS_MODELS_PROVIDER (provider), FALSE);
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+
+	/* Check for connection parameters */
+        /* TO_ADD: your own connection parameters */
+        const gchar *db_name;
+        db_name = gda_quark_list_find (params, "DB_NAME");
+        if (!db_name) {
+                gda_connection_add_event_string (cnc,
+                                                 _("The connection string must contain the DB_NAME values"));
+                return FALSE;
+        }
+
+	/* create GdaDataModelModels object, only one show here
+	 * If the data model(s) can not be created at this time, then it is possible to still declare the
+	 * table(s) for which the data model(s) will be created only when the table(s) are accessed 
+	 */
+	GdaDataModel *model;
+	model = NULL; TO_IMPLEMENT;
+
+	/* open virtual connection */
+	if (! GDA_SERVER_PROVIDER_CLASS (parent_class)->open_connection (GDA_SERVER_PROVIDER (provider), cnc, params,
+                                                                         NULL, NULL)) {
+                gda_connection_add_event_string (cnc, _("Can't open virtual connection"));
+                return FALSE;
+        }
+
+	/* add the data model(s) as table(s) */
+	GError *error = NULL;
+	if (!gda_vconnection_data_model_add_model (GDA_VCONNECTION_DATA_MODEL (cnc), model, "a_table", &error)) {
+		gda_connection_add_event_string (cnc, 
+						 _("Could not add data model to connection: %s"),
+						 error && error->message ? error->message : _("no detail"));
+		g_error_free (error);
+		gda_connection_close_no_warning (cnc);
+		g_object_unref (model);
+
+		return FALSE;
+	}
+	else {
+		/* set associated data to the virtual connection */
+		ModelsConnectionData *cdata;
+		cdata = g_new0 (ModelsConnectionData, 1);
+		TO_IMPLEMENT;
+		gda_virtual_connection_internal_set_provider_data (GDA_VIRTUAL_CONNECTION (cnc), 
+								   cdata, (GDestroyNotify) gda_models_free_cnc_data);
+	}
+
+	return TRUE;
+}
+
+/*
+ * Server version request
+ */
+static const gchar *
+gda_models_provider_get_server_version (GdaServerProvider *provider, GdaConnection *cnc)
+{
+	ModelsConnectionData *cdata;
+
+        g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+        g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
+
+        cdata = (ModelsConnectionData*) gda_virtual_connection_internal_get_provider_data (GDA_VIRTUAL_CONNECTION (cnc));
+        if (!cdata)
+                return FALSE;
+        TO_IMPLEMENT;
+        return NULL;
+}
+
+/*
+ * Get database request
+ */
+static const gchar *
+gda_models_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
+{
+	ModelsConnectionData *cdata;
+
+        g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+        g_return_val_if_fail (gda_connection_get_provider_obj (cnc) == provider, NULL);
+
+        cdata = (ModelsConnectionData*) gda_virtual_connection_internal_get_provider_data (GDA_VIRTUAL_CONNECTION (cnc));
+        if (!cdata)
+                return NULL;
+        TO_IMPLEMENT;
+        return NULL;
+}
+
+/*
+ * Free connection's specific data
+ */
+static void
+gda_models_free_cnc_data (ModelsConnectionData *cdata)
+{
+	TO_IMPLEMENT;
+	g_free (cdata);
+}

Added: branches/V4-branch/providers/skel-implementation/models/gda-models-provider.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/models/gda-models-provider.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,50 @@
+/* GDA Models provider
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __GDA_MODELS_PROVIDER_H__
+#define __GDA_MODELS_PROVIDER_H__
+
+#include <virtual/gda-vprovider-data-model.h>
+
+#define GDA_TYPE_MODELS_PROVIDER            (gda_models_provider_get_type())
+#define GDA_MODELS_PROVIDER(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_TYPE_MODELS_PROVIDER, GdaModelsProvider))
+#define GDA_MODELS_PROVIDER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, GDA_TYPE_MODELS_PROVIDER, GdaModelsProviderClass))
+#define GDA_IS_MODELS_PROVIDER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, GDA_TYPE_MODELS_PROVIDER))
+#define GDA_IS_MODELS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDA_TYPE_MODELS_PROVIDER))
+
+typedef struct _GdaModelsProvider      GdaModelsProvider;
+typedef struct _GdaModelsProviderClass GdaModelsProviderClass;
+
+struct _GdaModelsProvider {
+	GdaVproviderDataModel      provider;
+};
+
+struct _GdaModelsProviderClass {
+	GdaVproviderDataModelClass parent_class;
+};
+
+G_BEGIN_DECLS
+
+GType gda_models_provider_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif

Added: branches/V4-branch/providers/skel-implementation/models/gda-models.h
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/models/gda-models.h	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,41 @@
+/* GDA Models provider
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __GDA_MODELS_H__
+#define __GDA_MODELS_H__
+
+/*
+ * Provider name
+ */
+#define MODELS_PROVIDER_NAME "Models"
+
+/* TO_ADD: include headers necessary for the C or C++ API */
+
+/*
+ * Provider's specific connection data
+ */
+typedef struct {
+	/* TO_ADD: this structure holds any information necessary to specialize the GdaConnection, usually a connection
+	 * handle from the C or C++ API
+	 */
+} ModelsConnectionData;
+
+#endif

Added: branches/V4-branch/providers/skel-implementation/models/libgda-models-4.0.pc.in
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/models/libgda-models-4.0.pc.in	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,9 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+Name: libgda-models- GDA_ABI_MAJOR_VERSION@  GDA_ABI_MINOR_VERSION@
+Description: GDA Models provider
+Requires: libgda- GDA_ABI_MAJOR_VERSION@  GDA_ABI_MINOR_VERSION@
+Version: @VERSION@

Added: branches/V4-branch/providers/skel-implementation/models/libmain.c
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/models/libmain.c	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,74 @@
+/* GDA Models provider
+ * Copyright (C) 2008 The GNOME Foundation
+ *
+ * AUTHORS:
+ *      TO_ADD: your name and email
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glib/gi18n-lib.h>
+#include <libgda/gda-config.h>
+#include <libgda/gda-server-provider-extra.h>
+#include <libgda/binreloc/gda-binreloc.h>
+#include "gda-models.h"
+#include "gda-models-provider.h"
+
+static gchar      *module_path = NULL;
+const gchar       *plugin_get_name (void);
+const gchar       *plugin_get_description (void);
+gchar             *plugin_get_dsn_spec (void);
+GdaServerProvider *plugin_create_provider (void);
+
+void
+plugin_init (const gchar *real_path)
+{
+        if (real_path)
+                module_path = g_strdup (real_path);
+}
+
+const gchar *
+plugin_get_name (void)
+{
+	return MODELS_PROVIDER_NAME;
+}
+
+const gchar *
+plugin_get_description (void)
+{
+	return _("Example provider for database where tables are based on data models");
+}
+
+gchar *
+plugin_get_dsn_spec (void)
+{
+	gchar *ret, *dir;
+
+	dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
+	ret = gda_server_provider_load_file_contents (module_path, dir, "models_specs_dsn.xml");
+	g_free (dir);
+	return ret;
+}
+
+
+GdaServerProvider *
+plugin_create_provider (void)
+{
+	GdaServerProvider *prov;
+
+        prov = (GdaServerProvider *) g_object_new (GDA_TYPE_MODELS_PROVIDER, NULL);
+        g_object_set_data ((GObject *) prov, "GDA_PROVIDER_DIR", module_path);
+        return prov;
+}

Added: branches/V4-branch/providers/skel-implementation/models/models_specs_dsn.xml.in
==============================================================================
--- (empty file)
+++ branches/V4-branch/providers/skel-implementation/models/models_specs_dsn.xml.in	Thu Feb 14 18:20:30 2008
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<data-set-spec>
+  <parameters>
+    <parameter id="DB_NAME" _name="Database name" _descr="The name of a database to use" gdatype="gchararray" nullok="FALSE"/>
+  </parameters>
+</data-set-spec>

Modified: branches/V4-branch/providers/sqlite/libmain.c
==============================================================================
--- branches/V4-branch/providers/sqlite/libmain.c	(original)
+++ branches/V4-branch/providers/sqlite/libmain.c	Thu Feb 14 18:20:30 2008
@@ -68,7 +68,7 @@
 {
 	GdaServerProvider *prov;
 
-        prov = gda_sqlite_provider_new ();
+	prov = (GdaServerProvider*) g_object_new (GDA_TYPE_SQLITE_PROVIDER, NULL);
         g_object_set_data ((GObject *) prov, "GDA_PROVIDER_DIR", module_path);
         return prov;
 }

Modified: branches/V4-branch/samples/BDB/access-raw.c
==============================================================================
--- branches/V4-branch/samples/BDB/access-raw.c	(original)
+++ branches/V4-branch/samples/BDB/access-raw.c	Thu Feb 14 18:20:30 2008
@@ -16,7 +16,7 @@
 
 	gda_init ("bdb test", "3.1.1", argc, argv);
 	if (! g_file_test (DATABASE, G_FILE_TEST_EXISTS)) {
-		g_print ("File '%s' done not exist\n", DATABASE);
+		g_print ("File '%s' does not exist\n", DATABASE);
 		exit (1);
 	}
 	model = gda_data_model_bdb_new (DATABASE, NULL);

Modified: branches/V4-branch/tests/meta-store/common.c
==============================================================================
--- branches/V4-branch/tests/meta-store/common.c	(original)
+++ branches/V4-branch/tests/meta-store/common.c	Thu Feb 14 18:20:30 2008
@@ -15,7 +15,7 @@
 GSList *expected_changes;
 
 static void meta_changed_cb (GdaMetaStore *store, GSList *changes, gpointer data);
-static void suggest_insert_cb (GdaMetaStore *store, GdaMetaContext *context, gpointer data);
+static void suggest_update_cb (GdaMetaStore *store, GdaMetaContext *context, gpointer data);
 
 /*
  * Declare a GdaMetaStore to test
@@ -24,7 +24,7 @@
 common_declare_meta_store (GdaMetaStore *store)
 {
 	g_signal_connect (store, "meta-changed", G_CALLBACK (meta_changed_cb), NULL);
-	g_signal_connect (store, "suggest_insert", G_CALLBACK (suggest_insert_cb), NULL);
+	g_signal_connect (store, "suggest_update", G_CALLBACK (suggest_update_cb), NULL);
 }
 
 static void
@@ -92,10 +92,10 @@
 }
 
 static void
-suggest_insert_cb (GdaMetaStore *store, GdaMetaContext *context, gpointer data)
+suggest_update_cb (GdaMetaStore *store, GdaMetaContext *context, gpointer data)
 {
 	gint i;
-	g_print ("Insertion suggested for table %s:\n", context->table_name);
+	g_print ("Update suggested for table %s:\n", context->table_name);
 	for (i = 0; i < context->size; i++) {
 		gchar *str;
 		str = gda_value_stringify (context->column_values[i]);
@@ -295,7 +295,7 @@
 		sql = g_strdup_printf ("DROP VIEW %s", view_names[i]);
 		stmt = gda_sql_parser_parse_string (parser, sql, NULL, NULL);
 		g_free (sql);
-		res = gda_connection_statement_execute_non_select (cnc, stmt, NULL, &error);
+		res = gda_connection_statement_execute_non_select (cnc, stmt, NULL, NULL, &error);
 		if (res == -1) {
 			g_print ("DROP view '%s' error: %s\n", view_names[i],
 				error && error->message ? error->message : "No detail");
@@ -314,7 +314,7 @@
 		sql = g_strdup_printf ("DROP TABLE %s", table_names[i]);
 		stmt = gda_sql_parser_parse_string (parser, sql, NULL, NULL);
 		g_free (sql);
-		res = gda_connection_statement_execute_non_select (cnc, stmt, NULL, &error);
+		res = gda_connection_statement_execute_non_select (cnc, stmt, NULL, NULL, &error);
 		if (res == -1) {
 			g_print ("DROP table '%s' error: %s\n", table_names[i],
 				error && error->message ? error->message : "No detail");
@@ -548,7 +548,7 @@
 	TEST_HEADER;
 
 	/* load CSV file */
-	import = common_load_csv_file ("data_columns.csv", 4, "gint", 6, "boolean", 8, "gint", 9, "gint", 10, "gint", 11, "gint", 12, "gint", 20, "boolean", -1);
+	import = common_load_csv_file ("data_columns.csv", 4, "gint", 6, "boolean", 9, "gint", 10, "gint", 11, "gint", 12, "gint", 13, "gint", 21, "boolean", -1);
 	common_declare_expected_insertions_from_model (TNAME, import);
 	TEST_MODIFY (store, TNAME, import, NULL, &error, NULL);
 	TEST_END (import);

Modified: branches/V4-branch/tests/meta-store/data_columns.csv
==============================================================================
--- branches/V4-branch/tests/meta-store/data_columns.csv	(original)
+++ branches/V4-branch/tests/meta-store/data_columns.csv	Thu Feb 14 18:20:30 2008
@@ -1,286 +1,286 @@
-"meta","public","_attributes","att_name","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_attributes","att_value","2","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_information_schema_catalog_name","catalog_name","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_schemata","catalog_name","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_schemata","schema_name","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_schemata","schema_owner","3","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_schemata","schema_internal","4","false",FALSE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_builtin_data_types","short_type_name","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_builtin_data_types","full_type_name","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_builtin_data_types","gtype","3","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_builtin_data_types","comments","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_builtin_data_types","synonyms","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_builtin_data_types","internal","6","false",FALSE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","udt_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","udt_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","udt_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","udt_column","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","udt_ordinal_position","5","NULL",FALSE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","data_type","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","character_maximum_length","7","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","character_octet_length","8","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","numeric_precision","9","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","numeric_scale","10","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","datetime_precision","11","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","character_set_catalog","12","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","character_set_schema","13","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","character_set_name","14","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","collation_catalog","15","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","collation_schema","16","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt_columns","collation_name","17","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_enums","udt_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_enums","udt_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_enums","udt_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_enums","label","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_gtype","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_comments","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_short_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_full_name","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_internal","8","false",FALSE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_udt","udt_owner","9","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","specific_name","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","object_catalog","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","object_schema","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","object_name","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","object_ordinal_position","5","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","object_type","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","data_type","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","min_cardinality","8","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_element_types","max_cardinality","9","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_all_types","short_type_name","1","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","gtype","2","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","full_type_name","3","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","comments","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","internal","5","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","domain_catalog","6","NULL",TRUE,"pg_catalog.text","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","domain_schema","7","NULL",TRUE,"pg_catalog.text","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","domain_name","8","NULL",TRUE,"pg_catalog.text","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","udt_catalog","9","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","udt_schema","10","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_all_types","udt_name","11","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_triggers","trigger_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","trigger_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","trigger_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","event_manipulation","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","event_object_catalog","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","event_object_schema","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","event_object_table","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","action_statement","8","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","action_orientation","9","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","condition_timing","10","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","trigger_comments","11","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","trigger_short_name","12","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_triggers","trigger_full_name","13","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","character_set_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","character_set_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","character_set_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","default_collate_catalog","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","default_collate_schema","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","default_collate_name","6","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","character_set_comments","7","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","character_set_short_name","8","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_character_sets","character_set_full_name","9","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_collations","collation_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_collations","collation_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_collations","collation_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_collations","collation_comments","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_collations","collation_short_name","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_collations","collation_full_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","constraint_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","constraint_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","constraint_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","unique_constraint_catalog","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","unique_constraint_schema","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","unique_constraint_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","match_option","7","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","update_rule","8","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_referential_constraints","delete_rule","9","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_constraints","constraint_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_constraints","constraint_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_constraints","constraint_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_constraints","constraint_real_name","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_constraints","check_clause","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_key_column_usage","constraint_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_key_column_usage","constraint_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_key_column_usage","constraint_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_key_column_usage","table_catalog","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_key_column_usage","table_schema","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_key_column_usage","table_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_key_column_usage","column_name","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_key_column_usage","ordinal_position","8","NULL",FALSE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","constraint_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","constraint_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","constraint_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","constraint_real_name","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","table_catalog","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","table_schema","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","table_name","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","constraint_type","8","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","is_deferrable","9","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_constraints","initially_deferred","10","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_column_usage","constraint_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_column_usage","constraint_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_column_usage","constraint_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_column_usage","table_catalog","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_column_usage","table_schema","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_column_usage","table_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_check_column_usage","column_name","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_constraint_column_usage","table_catalog","1","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_column_usage","table_schema","2","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_column_usage","table_name","3","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_column_usage","column_name","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_column_usage","constraint_catalog","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_column_usage","constraint_schema","6","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_column_usage","constraint_name","7","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_table_usage","table_catalog","1","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_table_usage","table_schema","2","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_table_usage","table_name","3","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_table_usage","constraint_catalog","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_table_usage","constraint_schema","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_constraint_table_usage","constraint_name","6","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_views","table_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_views","table_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_views","table_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_views","view_definition","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_views","check_option","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_views","is_updatable","6","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_view_column_usage","view_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_view_column_usage","view_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_view_column_usage","view_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_view_column_usage","table_catalog","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_view_column_usage","table_schema","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_view_column_usage","table_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_view_column_usage","column_name","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_view_table_usage","view_catalog","1","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_view_table_usage","view_schema","2","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_view_table_usage","view_name","3","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_view_table_usage","table_catalog","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_view_table_usage","table_schema","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_view_table_usage","table_name","6","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_domain_constraints","constraint_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domain_constraints","constraint_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domain_constraints","constraint_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domain_constraints","domain_catalog","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domain_constraints","domain_schema","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domain_constraints","domain_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domain_constraints","is_deferrable","7","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domain_constraints","initially_deferred","8","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","data_type","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","character_maximum_length","5","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","character_octet_length","6","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","collation_catalog","7","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","collation_schema","8","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","collation_name","9","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","character_set_catalog","10","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","character_set_schema","11","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","character_set_name","12","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","numeric_precision","13","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","numeric_scale","14","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_default","15","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_gtype","16","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_comments","17","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_short_name","18","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_full_name","19","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_internal","20","false",FALSE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domains","domain_owner","21","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_domain_column_usage","domain_catalog","1","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_domain_column_usage","domain_schema","2","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_domain_column_usage","domain_name","3","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_domain_column_usage","table_catalog","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_domain_column_usage","table_schema","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_domain_column_usage","table_name","6","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_domain_column_usage","column_name","7","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",FALSE,"NULL"
-"meta","public","_parameters","specific_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_parameters","specific_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_parameters","specific_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_parameters","ordinal_position","4","NULL",FALSE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_parameters","parameter_mode","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_parameters","parameter_name","6","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_parameters","data_type","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routine_columns","specific_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routine_columns","specific_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routine_columns","specific_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routine_columns","column_name","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routine_columns","ordinal_position","5","NULL",FALSE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routine_columns","data_type","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","specific_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","specific_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","specific_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_catalog","4","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_schema","5","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_type","7","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","return_type","8","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","returns_set","9","false",FALSE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_body","10","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_definition","11","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","external_name","12","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","external_language","13","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","parameter_style","14","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","is_deterministic","15","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","sql_data_access","16","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","is_null_call","17","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_comments","18","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_short_name","19","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_full_name","20","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_routines","routine_owner","21","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_privileges","grantor","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_privileges","grantee","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_privileges","table_catalog","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_privileges","table_schema","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_privileges","table_name","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_privileges","privilege_type","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_table_privileges","is_grantable","7","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","table_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","table_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","table_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","table_type","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","is_insertable_into","5","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","table_comments","6","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","table_short_name","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","table_full_name","8","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_tables","table_owner","9","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_column_privileges","grantor","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_column_privileges","grantee","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_column_privileges","table_catalog","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_column_privileges","table_schema","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_column_privileges","table_name","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_column_privileges","column_name","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_column_privileges","privilege_type","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_column_privileges","is_grantable","8","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","table_catalog","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","table_schema","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","table_name","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","column_name","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","ordinal_position","5","NULL",FALSE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","column_default","6","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","is_nullable","7","NULL",FALSE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","data_type","8","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","character_maximum_length","9","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","character_octet_length","10","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","numeric_precision","11","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","numeric_scale","12","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","datetime_precision","13","NULL",TRUE,"pg_catalog.int4","NULL","NULL","32","0","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","character_set_catalog","14","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","character_set_schema","15","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","character_set_name","16","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","collation_catalog","17","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","collation_schema","18","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","collation_name","19","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","extra","20","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","is_updatable","21","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_columns","column_comments","22","NULL",TRUE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_usage_privileges","grantor","1","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_usage_privileges","grantee","2","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_usage_privileges","object_catalog","3","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_usage_privileges","object_schema","4","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_usage_privileges","object_name","5","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_usage_privileges","object_type","6","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_usage_privileges","privilege_type","7","NULL",FALSE,"pg_catalog.varchar","NULL","1073741824","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
-"meta","public","_usage_privileges","is_grantable","8","NULL",TRUE,"pg_catalog.bool","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL",TRUE,"NULL"
+meta,public,_attributes,att_name,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_attributes,att_value,2,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_information_schema_catalog_name,catalog_name,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_schemata,catalog_name,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_schemata,schema_name,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_schemata,schema_owner,3,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_schemata,schema_internal,4,false,FALSE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_builtin_data_types,short_type_name,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_builtin_data_types,full_type_name,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_builtin_data_types,gtype,3,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_builtin_data_types,comments,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_builtin_data_types,synonyms,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_builtin_data_types,internal,6,false,FALSE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,udt_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,udt_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,udt_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,udt_column,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,udt_ordinal_position,5,NULL,FALSE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,data_type,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,character_maximum_length,7,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,character_octet_length,8,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,numeric_precision,9,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,numeric_scale,10,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,datetime_precision,11,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,character_set_catalog,12,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,character_set_schema,13,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,character_set_name,14,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,collation_catalog,15,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,collation_schema,16,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt_columns,collation_name,17,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_enums,udt_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_enums,udt_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_enums,udt_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_enums,label,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_gtype,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_comments,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_short_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_full_name,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_internal,8,false,FALSE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_udt,udt_owner,9,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,specific_name,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,object_catalog,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,object_schema,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,object_name,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,object_ordinal_position,5,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,object_type,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,data_type,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,min_cardinality,8,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_element_types,max_cardinality,9,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_all_types,short_type_name,1,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,gtype,2,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,full_type_name,3,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,comments,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,internal,5,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,domain_catalog,6,NULL,TRUE,pg_catalog.text,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,domain_schema,7,NULL,TRUE,pg_catalog.text,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,domain_name,8,NULL,TRUE,pg_catalog.text,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,udt_catalog,9,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,udt_schema,10,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_all_types,udt_name,11,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_triggers,trigger_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,trigger_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,trigger_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,event_manipulation,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,event_object_catalog,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,event_object_schema,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,event_object_table,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,action_statement,8,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,action_orientation,9,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,condition_timing,10,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,trigger_comments,11,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,trigger_short_name,12,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_triggers,trigger_full_name,13,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,character_set_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,character_set_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,character_set_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,default_collate_catalog,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,default_collate_schema,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,default_collate_name,6,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,character_set_comments,7,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,character_set_short_name,8,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_character_sets,character_set_full_name,9,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_collations,collation_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_collations,collation_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_collations,collation_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_collations,collation_comments,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_collations,collation_short_name,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_collations,collation_full_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,constraint_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,constraint_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,constraint_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,unique_constraint_catalog,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,unique_constraint_schema,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,unique_constraint_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,match_option,7,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,update_rule,8,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_referential_constraints,delete_rule,9,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_constraints,constraint_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_constraints,constraint_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_constraints,constraint_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_constraints,constraint_real_name,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_constraints,check_clause,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_key_column_usage,constraint_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_key_column_usage,constraint_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_key_column_usage,constraint_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_key_column_usage,table_catalog,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_key_column_usage,table_schema,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_key_column_usage,table_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_key_column_usage,column_name,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_key_column_usage,ordinal_position,8,NULL,FALSE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,constraint_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,constraint_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,constraint_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,constraint_real_name,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,table_catalog,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,table_schema,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,table_name,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,constraint_type,8,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,is_deferrable,9,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_constraints,initially_deferred,10,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_column_usage,constraint_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_column_usage,constraint_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_column_usage,constraint_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_column_usage,table_catalog,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_column_usage,table_schema,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_column_usage,table_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_check_column_usage,column_name,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_constraint_column_usage,table_catalog,1,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_column_usage,table_schema,2,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_column_usage,table_name,3,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_column_usage,column_name,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_column_usage,constraint_catalog,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_column_usage,constraint_schema,6,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_column_usage,constraint_name,7,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_table_usage,table_catalog,1,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_table_usage,table_schema,2,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_table_usage,table_name,3,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_table_usage,constraint_catalog,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_table_usage,constraint_schema,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_constraint_table_usage,constraint_name,6,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_views,table_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_views,table_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_views,table_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_views,view_definition,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_views,check_option,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_views,is_updatable,6,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_view_column_usage,view_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_view_column_usage,view_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_view_column_usage,view_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_view_column_usage,table_catalog,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_view_column_usage,table_schema,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_view_column_usage,table_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_view_column_usage,column_name,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_view_table_usage,view_catalog,1,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_view_table_usage,view_schema,2,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_view_table_usage,view_name,3,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_view_table_usage,table_catalog,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_view_table_usage,table_schema,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_view_table_usage,table_name,6,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_domain_constraints,constraint_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domain_constraints,constraint_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domain_constraints,constraint_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domain_constraints,domain_catalog,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domain_constraints,domain_schema,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domain_constraints,domain_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domain_constraints,is_deferrable,7,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domain_constraints,initially_deferred,8,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,data_type,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,character_maximum_length,5,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,character_octet_length,6,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,collation_catalog,7,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,collation_schema,8,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,collation_name,9,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,character_set_catalog,10,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,character_set_schema,11,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,character_set_name,12,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,numeric_precision,13,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,numeric_scale,14,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_default,15,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_gtype,16,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_comments,17,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_short_name,18,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_full_name,19,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_internal,20,false,FALSE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domains,domain_owner,21,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_domain_column_usage,domain_catalog,1,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_domain_column_usage,domain_schema,2,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_domain_column_usage,domain_name,3,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_domain_column_usage,table_catalog,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_domain_column_usage,table_schema,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_domain_column_usage,table_name,6,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_domain_column_usage,column_name,7,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE,NULL
+meta,public,_parameters,specific_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_parameters,specific_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_parameters,specific_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_parameters,ordinal_position,4,NULL,FALSE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_parameters,parameter_mode,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_parameters,parameter_name,6,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_parameters,data_type,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routine_columns,specific_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routine_columns,specific_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routine_columns,specific_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routine_columns,column_name,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routine_columns,ordinal_position,5,NULL,FALSE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routine_columns,data_type,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,specific_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,specific_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,specific_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_catalog,4,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_schema,5,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_type,7,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,return_type,8,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,returns_set,9,false,FALSE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_body,10,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_definition,11,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,external_name,12,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,external_language,13,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,parameter_style,14,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,is_deterministic,15,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,sql_data_access,16,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,is_null_call,17,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_comments,18,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_short_name,19,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_full_name,20,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_routines,routine_owner,21,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_privileges,grantor,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_privileges,grantee,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_privileges,table_catalog,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_privileges,table_schema,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_privileges,table_name,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_privileges,privilege_type,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_table_privileges,is_grantable,7,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,table_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,table_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,table_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,table_type,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,is_insertable_into,5,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,table_comments,6,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,table_short_name,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,table_full_name,8,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_tables,table_owner,9,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_column_privileges,grantor,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_column_privileges,grantee,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_column_privileges,table_catalog,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_column_privileges,table_schema,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_column_privileges,table_name,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_column_privileges,column_name,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_column_privileges,privilege_type,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_column_privileges,is_grantable,8,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,table_catalog,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,table_schema,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,table_name,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,column_name,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,ordinal_position,5,NULL,FALSE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,column_default,6,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,is_nullable,7,NULL,FALSE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,data_type,8,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,character_maximum_length,9,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,character_octet_length,10,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,numeric_precision,11,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,numeric_scale,12,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,datetime_precision,13,NULL,TRUE,pg_catalog.int4,gchararray,NULL,NULL,32,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,character_set_catalog,14,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,character_set_schema,15,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,character_set_name,16,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,collation_catalog,17,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,collation_schema,18,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,collation_name,19,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,extra,20,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,is_updatable,21,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_columns,column_comments,22,NULL,TRUE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_usage_privileges,grantor,1,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_usage_privileges,grantee,2,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_usage_privileges,object_catalog,3,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_usage_privileges,object_schema,4,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_usage_privileges,object_name,5,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_usage_privileges,object_type,6,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_usage_privileges,privilege_type,7,NULL,FALSE,pg_catalog.varchar,gchararray,NULL,1073741824,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL
+meta,public,_usage_privileges,is_grantable,8,NULL,TRUE,pg_catalog.bool,gchararray,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,TRUE,NULL

Modified: branches/V4-branch/tests/providers/prov-test-util.c
==============================================================================
--- branches/V4-branch/tests/providers/prov-test-util.c	(original)
+++ branches/V4-branch/tests/providers/prov-test-util.c	Thu Feb 14 18:20:30 2008
@@ -11,7 +11,6 @@
 
 #define DB_NAME "gda_check_db"
 #define CREATE_FILES 0
-GdaDict *dict = NULL;
 GdaSqlParser *parser = NULL;
 
 /*
@@ -284,7 +283,7 @@
 	gchar *str, *upname;
 
 	client = gda_connection_get_client (cnc);
-	prov_id = g_strdup (gda_connection_get_provider (cnc));
+	prov_id = g_strdup (gda_connection_get_provider_name (cnc));
 	gda_connection_close (cnc);
 	g_object_unref (cnc);
 
@@ -343,44 +342,45 @@
 	const gchar *prov_id;
 	gchar *tmp, *filename;
 	gboolean retval = TRUE;
-	gchar *contents;
-        gsize size;
 	GError *error = NULL;
+	const GSList *list;
 
-	prov_id = gda_connection_get_provider (cnc);
+	prov_id = gda_connection_get_provider_name (cnc);
 
 	tmp = g_strdup_printf ("%s_create_tables.sql", prov_id);
 	filename = g_build_filename (CHECK_SQL_FILES, "tests", "providers", tmp, NULL);
 	g_free (tmp);
 
-	/* read the contents of the file */
-        if (! g_file_get_contents (filename, &contents, &size, &error)) {
+	if (!parser) 
+		parser = gda_sql_parser_new ();
+
+	GdaBatch *batch;
+	batch = gda_sql_parser_parse_file_as_batch (parser, filename, &error);
+	if (!batch) {
 #ifdef CHECK_EXTRA_INFO
-                g_warning ("Could not read file '%s': %s", filename,
+                g_warning ("Could not parser file '%s': %s", filename,
 			   error && error->message ? error->message : "No detail");
 #endif
 		g_error_free (error);
 		error = NULL;
-		retval = FALSE;
-        }
-	else {
-		GdaCommand *command;
-		command = gda_command_new (contents, GDA_COMMAND_TYPE_SQL,
-					   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
-		g_free (contents);
-		if (gda_connection_execute_non_select_command (cnc, command, NULL, &error) < 0) {
+		g_free (filename);
+		return FALSE;
+	}
+
+	for (list = gda_batch_get_statements (batch); list; list = list->next) {
+		if (gda_connection_statement_execute_non_select (cnc, GDA_STATEMENT (list->data),
+								 NULL, NULL, &error) == -1) {
 #ifdef CHECK_EXTRA_INFO
-			g_warning ("Could execute SQL in file '%s': %s", filename,
+			g_warning ("Could execute statement: %s",
 				   error && error->message ? error->message : "No detail");
-#endif
 			g_error_free (error);
-			error = NULL;
+#endif
 			retval = FALSE;
+			break;
 		}
-		gda_command_free (command);
 	}
-	g_free (filename);
 
+	g_object_unref (batch);
 	return retval;
 }
 
@@ -399,19 +399,16 @@
 		return FALSE;
 	}
 
-	if (!dict)
-		dict = gda_dict_new ();
-
 	GdaServerProvider *prov;
 	GdaDataModel *schema_m;
 	GError *error = NULL;
-	GdaParameterList *plist;
 	gchar *str;
+	GValue *v;
 	
 	prov = gda_connection_get_provider_obj (cnc);
-	plist = gda_parameter_list_new_inline (dict, "name", G_TYPE_STRING, table, NULL);
-	schema_m = gda_server_provider_get_schema (prov, cnc, GDA_CONNECTION_SCHEMA_FIELDS, plist, &error);
-	g_object_unref (plist);
+	g_value_set_string (v = gda_value_new (G_TYPE_STRING), table);
+	schema_m = gda_connection_get_meta_store_data (cnc, GDA_CONNECTION_META_FIELDS, &error, 1, "name", v);
+	gda_value_free (v);
 	if (!schema_m) {
 #ifdef CHECK_EXTRA_INFO
 		g_warning ("Could not get FIELDS schema for table '%s': %s", table,
@@ -420,10 +417,11 @@
 		return FALSE;
 	}
 
-	str = g_strdup_printf ("FIELDS_SCHEMA_%s_%s.xml", gda_connection_get_provider (cnc), table);
+	str = g_strdup_printf ("FIELDS_SCHEMA_%s_%s.xml", gda_connection_get_provider_name (cnc), table);
 	if (CREATE_FILES) {
+		GdaSet *plist;
 		/* export schema model to a file, to create first version of the files, not to be used in actual checks */
-		plist = gda_parameter_list_new_inline (dict, "OVERWRITE", G_TYPE_BOOLEAN, TRUE, NULL);
+		plist = gda_set_new_inline (1, "OVERWRITE", G_TYPE_BOOLEAN, TRUE);
 		if (! (gda_data_model_export_to_file (schema_m, GDA_DATA_MODEL_IO_DATA_ARRAY_XML, str, 
 						      NULL, 0, NULL, 0, plist, &error))) {
 #ifdef CHECK_EXTRA_INFO
@@ -435,15 +433,6 @@
 		g_object_unref (plist);
 	}
 	else {
-		/* test schema validity */
-		if (!gda_server_provider_test_schema_model (schema_m, GDA_CONNECTION_SCHEMA_FIELDS, &error)) {
-#ifdef CHECK_EXTRA_INFO
-			g_warning ("Reported schema does not conform to GDA's requirements: %s", 
-				   error && error->message ? error->message : "No detail");
-#endif
-			return FALSE;
-		}
-
 		/* compare schema with what's expected */
 		gchar *file = g_build_filename (CHECK_SQL_FILES, "tests", "providers", str, NULL);
 		if (!compare_data_model_with_expected (schema_m, file))
@@ -478,7 +467,7 @@
 	gchar *str;
 	
 	prov = gda_connection_get_provider_obj (cnc);
-	schema_m = gda_server_provider_get_schema (prov, cnc, GDA_CONNECTION_SCHEMA_TYPES, NULL, &error);
+	schema_m = gda_connection_get_meta_store_data (cnc, GDA_CONNECTION_META_TYPES, &error, 0);
 	if (!schema_m) {
 #ifdef CHECK_EXTRA_INFO
 		g_warning ("Could not get the TYPES schema: %s",
@@ -487,11 +476,11 @@
 		return FALSE;
 	}
 
-	str = g_strdup_printf ("TYPES_SCHEMA_%s.xml", gda_connection_get_provider (cnc));
+	str = g_strdup_printf ("TYPES_SCHEMA_%s.xml", gda_connection_get_provider_name (cnc));
 	if (CREATE_FILES) {
 		/* export schema model to a file, to create first version of the files, not to be used in actual checks */
-		GdaParameterList *plist;
-		plist = gda_parameter_list_new_inline (dict, "OVERWRITE", G_TYPE_BOOLEAN, TRUE, NULL);
+		GdaSet *plist;
+		plist = gda_set_new_inline (1, "OVERWRITE", G_TYPE_BOOLEAN, TRUE);
 		if (! (gda_data_model_export_to_file (schema_m, GDA_DATA_MODEL_IO_DATA_ARRAY_XML, str, 
 						      NULL, 0, NULL, 0, plist, &error))) {
 #ifdef CHECK_EXTRA_INFO
@@ -503,15 +492,6 @@
 		g_object_unref (plist);
 	}
 	else {
-		/* test schema validity */
-		if (!gda_server_provider_test_schema_model (schema_m, GDA_CONNECTION_SCHEMA_TYPES, &error)) {
-#ifdef CHECK_EXTRA_INFO
-			g_warning ("Reported schema does not conform to GDA's requirements: %s", 
-				   error && error->message ? error->message : "No detail");
-#endif
-			return FALSE;
-		}
-
 		/* compare schema with what's expected */
 		gchar *file = g_build_filename (CHECK_SQL_FILES, "tests", "providers", str, NULL);
 		if (!compare_data_model_with_expected (schema_m, file))
@@ -620,15 +600,15 @@
         g_object_get (G_OBJECT (iter), "current-row", &rownum, NULL);
 
         cols = gda_data_model_get_n_columns (ref_model);
-        if (cols != g_slist_length (GDA_PARAMETER_LIST (iter)->parameters)) {
+        if (cols != g_slist_length (GDA_SET (iter)->holders)) {
 #ifdef CHECK_EXTRA_INFO
                 g_warning ("Number of columns in iter is not the same as for the referenced data model\n");
 #endif
                 return FALSE;
         }
-        for (i = 0, list = GDA_PARAMETER_LIST (iter)->parameters; i < cols; i++, list = list->next) {
+        for (i = 0, list = GDA_SET (iter)->holders; i < cols; i++, list = list->next) {
                 const GValue *v1, *v2;
-                v1 = gda_parameter_get_value (GDA_PARAMETER (list->data));
+                v1 = gda_holder_get_value (GDA_HOLDER (list->data));
                 v2 = gda_data_model_get_value_at (ref_model, i, rownum);
                 if (gda_value_compare_ext (v1, v2)) {
 #ifdef CHECK_EXTRA_INFO
@@ -757,7 +737,7 @@
 			g_free (tmp);			
 		}
 
-		if (gda_connection_statement_execute_non_select (cnc, insert, set, &error) == -1) {
+		if (gda_connection_statement_execute_non_select (cnc, insert, set, NULL, &error) == -1) {
 #ifdef CHECK_EXTRA_INFO
 			g_warning ("Could not execute the INSERT statement for row %d: %s",
 				   row,

Modified: branches/V4-branch/tests/value-holders/check_set.c
==============================================================================
--- branches/V4-branch/tests/value-holders/check_set.c	(original)
+++ branches/V4-branch/tests/value-holders/check_set.c	Thu Feb 14 18:20:30 2008
@@ -98,7 +98,7 @@
 	gchar *model_data="1,John\n2,Jack";
 
 	model = gda_data_model_import_new_mem (model_data, TRUE, NULL);
-	gda_object_set_id (GDA_OBJECT (model), "model1");
+	g_object_set_data (G_OBJECT (model), "name", "model1");
 	
 	set = gda_set_new_inline (3, 
 				  "H1", G_TYPE_STRING, "A string",

Modified: branches/V4-branch/tests/value-holders/common.c
==============================================================================
--- branches/V4-branch/tests/value-holders/common.c	(original)
+++ branches/V4-branch/tests/value-holders/common.c	Thu Feb 14 18:20:30 2008
@@ -144,8 +144,8 @@
 
 			if (node->source_model) {
 				g_string_append (string, ",\"source_model\":");
-				if (gda_object_get_id (GDA_OBJECT (node->source_model)))
-					json = _json_quote_string (gda_object_get_id (GDA_OBJECT (node->source_model)));
+				if (g_object_get_data (G_OBJECT (node->source_model), "name"))
+					json = _json_quote_string (g_object_get_data (G_OBJECT (node->source_model), "name"));
 				else {
 					str = gda_data_model_export_to_string (node->source_model, 
 									       GDA_DATA_MODEL_IO_TEXT_SEPARATED,
@@ -173,8 +173,8 @@
 				g_string_append_c (string, ',');
 			g_string_append_c (string, '{');
 			g_string_append (string, "\"model\":");
-			if (gda_object_get_id (GDA_OBJECT (source->data_model)))
-				json = _json_quote_string (gda_object_get_id (GDA_OBJECT (source->data_model)));
+			if (g_object_get_data (G_OBJECT (source->data_model), "name"))
+				json = _json_quote_string (g_object_get_data (G_OBJECT (source->data_model), "name"));
 			else {
 				str = gda_data_model_export_to_string (source->data_model, 
 								       GDA_DATA_MODEL_IO_TEXT_SEPARATED,



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