Re: [gnome-db] Gda# Changes - Gda API review





2006/9/27, Vivien Malerba <vmalerba gmail com>:
On 9/26/06, Daniel Espinosa <esodan gmail com> wrote:
> I had to modify the Gda.metada in order to compile the Gda# binding, this
> becouse there are conflicts with _get_type and get_g_type, functions.
>
> The changes are the following:
>
> In GdaColumn Rename the method  SetGType to SetValueType
>   In libgda the function is gda_column_set_g_type
>
> In GdaColumn Rename method GetGType to GetValueType
>   In libgda the function is gda_column_get_g_type
>
> In GdaDictType Rename method SetGType to SetValueType
>   In libgda the function is gda_dict_type_set_g_type
>
> In GdaDictType Rename the method GetGType to GetValueType
>   In libgda the function is gda_dict_type_get_g_type
>
> GdaServerProviderHandlerInfo Rename the member GType to ValueType
>   In libgda the member is GType g_type
>
> What's the Point? You may want to change the name of that functions from
> g_type to value_type, in order to have more consistency and clarify the
> function action.
>

I'm absolutely no expert in C#, but I don't understand why there is a
naming conflict in C# when there is none in C.  Anyway I'll do the
Gda# modifications as suggested above, and keep the C API as it's now:
...get_g_type() to get the GType of something and ...get_dict_type()
to get the GdaDictType of something, and get_dbms_type() to get the
DBMS type as a string.

The point was that if you could consider change the name of the function, not for the Gda# implementation, but just for API consistency and a good understand of what the function does.

You must consider that the Gda# implementation is created using automatic tools provided by the Gtk# project. This tools detect automatically the API and generate code for that. The API is save in the gda-api.raw file and using the roules in the file Gda.metadata it modify that API to create a "corrected" or "addapted" API that correct some errors in the automatic process, then generate the gda-api.xml and then the code in C#.

With that in mind, consider that when you modify the API I just delete the gda-api.raw in leave the tools to automatically created it and check if the code compiles, if not I made modifications in the file called Gda.metadata and try to compile again; attached you'll find the patch for that file and the gda-api.raw one.

The modifications commented is made in Gda.metadata to change the name of  the variables that, when generate the code, are considered as a function to get the GType of the Object or struct (the last I don't know why is considered as an GObject)
 

As an attachment, see the DIFF file I plan to commit and tell me if
there is anything wrong with it.

The attached file make Gda# addapt to the current API.

When you change the API again I'll need to leave the tools to regenerate the gda-api.raw and check if Gda# compiles, if not I need to review the Gda.metadata; then send a patch to keep sync with the current API; you can't consider that Gda# works if you change the API, you must regenerate the gda-api.raw and check the Gda.metadata.
 

Thanks,

Vivien





--
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (entrámite, pero para los cuates: LIBRE)
Sólo en ./libgda: aclocal.m4
Sólo en ./libgda: autom4te.cache
Sólo en ./libgda: config.guess
Sólo en ./libgda: config.sub
Sólo en ./libgda: configure
Sólo en ./libgda/data: Makefile.in
Sólo en ./libgda: depcomp
Sólo en ./libgda/doc/C: Makefile.in
Sólo en ./libgda/doc: Makefile.in
diff -u -r ./libgda/gda-sharp/gda-api.raw ./cvs/libgda/gda-sharp/gda-api.raw
--- ./libgda/gda-sharp/gda-api.raw	2006-09-25 16:40:27.000000000 -0500
+++ ./cvs/libgda/gda-sharp/gda-api.raw	2006-09-24 13:23:36.000000000 -0500
@@ -198,6 +198,14 @@
       <member cname="GDA_QUERY_JOIN_TYPE_CROSS" name="Cross" />
       <member cname="GDA_QUERY_JOIN_TYPE_LAST" name="Last" />
     </enum>
+    <enum name="QueryTargetType" cname="GdaQueryTargetType" gtype="gda_query_target_type_get_type" type="enum">
+      <member cname="GDA_QUERY_TARGET_TYPE_INNER" name="Inner" />
+      <member cname="GDA_QUERY_TARGET_TYPE_LEFT_OUTER" name="LeftOuter" />
+      <member cname="GDA_QUERY_TARGET_TYPE_RIGHT_OUTER" name="RightOuter" />
+      <member cname="GDA_QUERY_TARGET_TYPE_FULL_OUTER" name="FullOuter" />
+      <member cname="GDA_QUERY_TARGET_TYPE_CROSS" name="Cross" />
+      <member cname="GDA_QUERY_TARGET_TYPE_LAST" name="Last" />
+    </enum>
     <enum name="QueryType" cname="GdaQueryType" gtype="gda_query_type_get_type" type="enum">
       <member cname="GDA_QUERY_TYPE_SELECT" name="Select" />
       <member cname="GDA_QUERY_TYPE_INSERT" name="Insert" />
@@ -576,8 +584,6 @@
           <parameter type="const-gchar*" name="file" />
           <parameter type="const-gint*" name="cols" />
           <parameter type="gint" name="nb_cols" />
-          <parameter type="const-gint*" name="rows" />
-          <parameter type="gint" name="nb_rows" />
           <parameter type="GdaParameterList*" name="options" />
           <parameter type="GError**" name="error" />
         </parameters>
@@ -588,8 +594,6 @@
           <parameter type="GdaDataModelIOFormat" name="format" />
           <parameter type="const-gint*" name="cols" />
           <parameter type="gint" name="nb_cols" />
-          <parameter type="const-gint*" name="rows" />
-          <parameter type="gint" name="nb_rows" />
           <parameter type="GdaParameterList*" name="options" />
         </parameters>
       </method>
@@ -1645,23 +1649,15 @@
         <return-type type="GdaBlob*" />
       </method>
       <method name="ExecuteCommand" cname="gda_connection_execute_command">
-        <return-type type="GList*" />
-        <parameters>
-          <parameter type="GdaCommand*" name="cmd" />
-          <parameter type="GdaParameterList*" name="params" />
-          <parameter type="GError**" name="error" />
-        </parameters>
-      </method>
-      <method name="ExecuteNonSelectCommand" cname="gda_connection_execute_non_select_command">
-        <return-type type="gint" />
+        <return-type type="GdaDataModel*" />
         <parameters>
           <parameter type="GdaCommand*" name="cmd" />
           <parameter type="GdaParameterList*" name="params" />
           <parameter type="GError**" name="error" />
         </parameters>
       </method>
-      <method name="ExecuteSelectCommand" cname="gda_connection_execute_select_command">
-        <return-type type="GdaDataModel*" />
+      <method name="ExecuteCommandL" cname="gda_connection_execute_command_l">
+        <return-type type="GList*" />
         <parameters>
           <parameter type="GdaCommand*" name="cmd" />
           <parameter type="GdaParameterList*" name="params" />
@@ -2102,11 +2098,10 @@
       <property name="InsertQuery" cname="insert_query" type="gpointer" readable="true" writeable="true" />
       <property name="UpdateQuery" cname="update_query" type="gpointer" readable="true" writeable="true" />
       <property name="DeleteQuery" cname="delete_query" type="gpointer" readable="true" writeable="true" />
-      <property name="AutoCompute" cname="auto_compute" type="gboolean" readable="true" writeable="true" />
       <implements>
         <interface cname="GdaDataModel" />
       </implements>
-      <method name="GetParameterList" cname="gda_data_model_query_get_parameter_list">
+      <method name="GetParamList" cname="gda_data_model_query_get_param_list">
         <return-type type="GdaParameterList*" />
       </method>
       <method name="GetType" cname="gda_data_model_query_get_type" shared="true">
@@ -2604,12 +2599,6 @@
         </parameters>
       </method>
       <constructor cname="gda_dict_new" />
-      <method name="ObjectIsAssumed" cname="gda_dict_object_is_assumed">
-        <return-type type="gboolean" />
-        <parameters>
-          <parameter type="GdaObject*" name="object" />
-        </parameters>
-      </method>
       <method name="Save" cname="gda_dict_save">
         <return-type type="gboolean" />
         <parameters>
@@ -2635,7 +2624,7 @@
           <parameter type="const-gchar*" name="xmlfile" />
         </parameters>
       </method>
-      <method name="StopUpdateDbmsMetaData" cname="gda_dict_stop_update_dbms_meta_data">
+      <method name="StopUpdateDbmsData" cname="gda_dict_stop_update_dbms_meta_data">
         <return-type type="void" />
       </method>
       <method name="UnassumeObject" cname="gda_dict_unassume_object">
@@ -2644,7 +2633,7 @@
           <parameter type="GdaObject*" name="object" />
         </parameters>
       </method>
-      <method name="UpdateDbmsMetaData" cname="gda_dict_update_dbms_meta_data">
+      <method name="UpdateDbmsData" cname="gda_dict_update_dbms_meta_data">
         <return-type type="gboolean" />
         <parameters>
           <parameter type="GType" name="limit_to_type" />
@@ -2659,13 +2648,13 @@
       <implements>
         <interface cname="GdaXmlStorage" />
       </implements>
-      <method name="GetArgDictType" cname="gda_dict_aggregate_get_arg_dict_type">
+      <method name="GetArgType" cname="gda_dict_aggregate_get_arg_dict_type">
         <return-type type="GdaDictType*" />
       </method>
       <method name="GetDbmsId" cname="gda_dict_aggregate_get_dbms_id">
         <return-type type="gchar*" />
       </method>
-      <method name="GetRetDictType" cname="gda_dict_aggregate_get_ret_dict_type">
+      <method name="GetRetType" cname="gda_dict_aggregate_get_ret_dict_type">
         <return-type type="GdaDictType*" />
       </method>
       <method name="GetSqlname" cname="gda_dict_aggregate_get_sqlname">
@@ -2679,7 +2668,7 @@
           <parameter type="GdaDict*" name="dict" />
         </parameters>
       </constructor>
-      <method name="SetArgDictType" cname="gda_dict_aggregate_set_arg_dict_type">
+      <method name="SetArgType" cname="gda_dict_aggregate_set_arg_dict_type">
         <return-type type="void" />
         <parameters>
           <parameter type="GdaDictType*" name="dt" />
@@ -2691,7 +2680,7 @@
           <parameter type="const-gchar*" name="id" />
         </parameters>
       </method>
-      <method name="SetRetDictType" cname="gda_dict_aggregate_set_ret_dict_type">
+      <method name="SetRetType" cname="gda_dict_aggregate_set_ret_dict_type">
         <return-type type="void" />
         <parameters>
           <parameter type="GdaDictType*" name="dt" />
@@ -3046,19 +3035,19 @@
       <implements>
         <interface cname="GdaXmlStorage" />
       </implements>
-      <method name="AcceptsArgDictTypes" cname="gda_dict_function_accepts_arg_dict_types">
+      <method name="AcceptsArgs" cname="gda_dict_function_accepts_arg_dict_types">
         <return-type type="gboolean" />
         <parameters>
           <parameter type="const-GSList*" name="arg_types" />
         </parameters>
       </method>
-      <method name="GetArgDictTypes" cname="gda_dict_function_get_arg_dict_types">
+      <method name="GetArgTypes" cname="gda_dict_function_get_arg_dict_types">
         <return-type type="const-GSList*" />
       </method>
       <method name="GetDbmsId" cname="gda_dict_function_get_dbms_id">
         <return-type type="gchar*" />
       </method>
-      <method name="GetRetDictType" cname="gda_dict_function_get_ret_dict_type">
+      <method name="GetRetType" cname="gda_dict_function_get_ret_dict_type">
         <return-type type="GdaDictType*" />
       </method>
       <method name="GetSqlname" cname="gda_dict_function_get_sqlname">
@@ -3072,7 +3061,7 @@
           <parameter type="GdaDict*" name="dict" />
         </parameters>
       </constructor>
-      <method name="SetArgDictTypes" cname="gda_dict_function_set_arg_dict_types">
+      <method name="SetArgTypes" cname="gda_dict_function_set_arg_dict_types">
         <return-type type="void" />
         <parameters>
           <parameter type="const-GSList*" name="arg_types" />
@@ -3084,7 +3073,7 @@
           <parameter type="const-gchar*" name="id" />
         </parameters>
       </method>
-      <method name="SetRetDictType" cname="gda_dict_function_set_ret_dict_type">
+      <method name="SetRetType" cname="gda_dict_function_set_ret_dict_type">
         <return-type type="void" />
         <parameters>
           <parameter type="GdaDictType*" name="dt" />
@@ -3669,12 +3658,6 @@
           <parameter type="GError**" name="error" />
         </parameters>
       </constructor>
-      <constructor cname="gda_parameter_list_new_inline">
-        <parameters>
-          <parameter type="GdaDict*" name="dict" />
-          <parameter ellipsis="true" />
-        </parameters>
-      </constructor>
       <method name="SetParamDefaultAlias" cname="gda_parameter_list_set_param_default_alias">
         <return-type type="void" />
         <parameters>
@@ -3865,12 +3848,6 @@
       <method name="GetCondition" cname="gda_query_get_condition">
         <return-type type="GdaQueryCondition*" />
       </method>
-      <method name="GetFieldByParamName" cname="gda_query_get_field_by_param_name">
-        <return-type type="GdaQueryField*" />
-        <parameters>
-          <parameter type="const-gchar*" name="param_name" />
-        </parameters>
-      </method>
       <method name="GetFieldByRefField" cname="gda_query_get_field_by_ref_field">
         <return-type type="GdaQueryField*" />
         <parameters>
@@ -3928,12 +3905,12 @@
       <method name="GetParamSources" cname="gda_query_get_param_sources">
         <return-type type="const-GSList*" />
       </method>
-      <method name="GetParameterList" cname="gda_query_get_parameter_list">
-        <return-type type="GdaParameterList*" />
-      </method>
       <method name="GetParameters" cname="gda_query_get_parameters">
         <return-type type="GSList*" />
       </method>
+      <method name="GetParametersBoxed" cname="gda_query_get_parameters_boxed">
+        <return-type type="GdaParameterList*" />
+      </method>
       <method name="GetParentQuery" cname="gda_query_get_parent_query">
         <return-type type="GdaQuery*" />
       </method>
@@ -4853,15 +4830,6 @@
           <parameter type="GError**" name="error" />
         </parameters>
       </method>
-      <method name="SetValueAt" cname="gda_server_operation_set_value_at">
-        <return-type type="gboolean" />
-        <parameters>
-          <parameter type="const-gchar*" name="value" />
-          <parameter type="GError**" name="error" />
-          <parameter type="const-gchar*" name="path_format" />
-          <parameter ellipsis="true" />
-        </parameters>
-      </method>
     </object>
     <object name="ServerProvider" cname="GdaServerProvider" parent="GObject">
       <field name="Priv" cname="priv" type="GdaServerProviderPrivate*" />
@@ -6018,6 +5986,13 @@
       <method name="ShortGetType" cname="gda_short_get_type" shared="true">
         <return-type type="GType" />
       </method>
+      <method name="SqlReplacePlaceholders" cname="gda_sql_replace_placeholders" shared="true">
+        <return-type type="gchar*" />
+        <parameters>
+          <parameter type="const-gchar*" name="sql" />
+          <parameter type="GdaParameterList*" name="params" />
+        </parameters>
+      </method>
       <method name="StringHashToList" cname="gda_string_hash_to_list" shared="true">
         <return-type type="GList*" />
         <parameters>
@@ -6031,6 +6006,9 @@
           <parameter type="GdaBinary*" name="bin" />
         </parameters>
       </method>
+      <method name="TypesGetRegister" cname="g_types_get_register" shared="true">
+        <return-type type="GdaDictRegisterStruct*" />
+      </method>
       <method name="UshortGetType" cname="gda_ushort_get_type" shared="true">
         <return-type type="GType" />
       </method>
@@ -6065,6 +6043,20 @@
         </parameters>
       </method>
     </class>
+    <class name="Type" cname="GType_">
+      <method name="FromString" cname="g_type_from_string" shared="true">
+        <return-type type="GType" />
+        <parameters>
+          <parameter type="const-gchar*" name="str" />
+        </parameters>
+      </method>
+      <method name="ToString" cname="g_type_to_string" shared="true">
+        <return-type type="const-gchar*" />
+        <parameters>
+          <parameter type="GType" name="type" />
+        </parameters>
+      </method>
+    </class>
     <class name="Value" cname="GdaValue_">
       <method name="Compare" cname="gda_value_compare" shared="true">
         <return-type type="gint" />
diff -u -r ./libgda/gda-sharp/Gda.metadata ./cvs/libgda/gda-sharp/Gda.metadata
--- ./libgda/gda-sharp/Gda.metadata	2006-09-26 11:03:47.000000000 -0500
+++ ./cvs/libgda/gda-sharp/Gda.metadata	2006-09-24 13:23:36.000000000 -0500
@@ -13,10 +13,5 @@
   <attr path="/api/namespace/object[ cname='GdaParameter']/constructor[ cname='gda_parameter_new']" name="hidden">1</attr>
   <attr path="/api/namespace/enum[ cname='GdaDataModelAccessFlags']/member[ name='Write']" name="value">Insert | Update | Delete</attr>
   <attr path="/api/namespace/enum[ cname='GdaQueryFieldState']/member[ name='Any']" name="value">Visible | Invisible</attr>
-  <attr path="/api/namespace/object[ cname='GdaColumn']/method[ name='SetGType']" name="name">SetValueType</attr>
-  <attr path="/api/namespace/object[ cname='GdaColumn']/method[ name='GetGType']" name="name">GetValueType</attr>
-  <attr path="/api/namespace/object[ cname='GdaDictType']/method[ name='SetGType']" name="name">SetValueType</attr>
-  <attr path="/api/namespace/object[ cname='GdaDictType']/method[ name='GetGType']" name="name">GetValueType</attr>
-  <attr path="/api/namespace/struct[ cname='GdaServerProviderHandlerInfo']/field[ name='GType']" name="name">ValueType</attr>
 </metadata>
 
Sólo en ./libgda/gda-sharp: generated
Sólo en ./libgda/gda-sharp: Makefile.in
Sólo en ./libgda: INSTALL
Sólo en ./libgda: install-sh
Sólo en ./libgda: intltool-extract.in
Sólo en ./libgda: intltool-merge.in
Sólo en ./libgda: intltool-update.in
Sólo en ./libgda/libgda/graph: Makefile.in
Sólo en ./libgda/libgda/handlers: Makefile.in
Sólo en ./libgda/libgda: Makefile.in
Sólo en ./libgda/libgda/sql-delimiter: Makefile.in
Sólo en ./libgda/libsql: Makefile.in
Sólo en ./libgda: ltmain.sh
Sólo en ./libgda: Makefile.in
Sólo en ./libgda: missing
Sólo en ./libgda: mkinstalldirs
Sólo en ./libgda/po: Makefile.in.in
Sólo en ./libgda/providers/bdb: Makefile.in
Sólo en ./libgda/providers/firebird: Makefile.in
Sólo en ./libgda/providers/freetds: Makefile.in
Sólo en ./libgda/providers/ibmdb2: Makefile.in
Sólo en ./libgda/providers/ldap: Makefile.in
Sólo en ./libgda/providers: Makefile.in
Sólo en ./libgda/providers/mdb: Makefile.in
Sólo en ./libgda/providers/msql: Makefile.in
Sólo en ./libgda/providers/mysql: Makefile.in
Sólo en ./libgda/providers/odbc: Makefile.in
Sólo en ./libgda/providers/oracle: Makefile.in
Sólo en ./libgda/providers/postgres: Makefile.in
Sólo en ./libgda/providers/sqlite: Makefile.in
Sólo en ./libgda/providers/sqlite/sqlite-src: Makefile.in
Sólo en ./libgda/providers/sybase: Makefile.in
Sólo en ./libgda/providers/xbase: Makefile.in
Sólo en ./libgda/report/libgda-report: Makefile.in
Sólo en ./libgda/report: Makefile.in
Sólo en ./libgda/report/testing: Makefile.in
Sólo en ./libgda/testing: Makefile.in
Sólo en ./libgda/tools: Makefile.in


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