[gnome-db] Gda# and API Changes?



2005/10/11, Dan Winship <danw novell com>:
> Daniel Espinosa wrote:
> > I'm trying to use the Gda namespace, could you help me how to add the
> > new libraries: gda-sharp-2.0.pc to my project using MonoDevelop or any
> > other utility?
>
> I'm not sure how you'd do it in MonoDevelop. It uses the system
> described at
> http://www.mono-project.com/Assemblies_and_the_GAC#Libraries_with_Unstable_APIs
>
> So you will need to eventually end up copying gda-sharp.dll into the
> same directory as your .exe file.
>
> -- Dan
>
I manage all the stuf for MonoDevelop can work with gda-shar.dll
(using Edit References -> .Net Assembly -> Browse ->
/usr/lib/libgda/gda-sharp.dll).

At this point, I think that the gda-sharp-2.0.pc file is missing the 
${pkglibdir}, in the line?:
          Libs: -r:gda-sharp.dll

Now the connection to a data base works well (with out errors), but I
have a problem using GetValueAt, when I create a new Gda.DataModel,
using a Gda.Client, Gda.Connection, and Gda.Command, I have a valid (I
thing) Gda.DataModel, but when I try to get a GLIb.Value (GValue or
GdaValue), I get a message like:

** (<unknown>:26203): CRITICAL **: gda_data_model_get_value_at:
assertion `GDA_IS_DATA_MODEL (model)' failed

Attached you'll find the code as a example using Gda#.

Questions about LibGDA:

1. In C, I can cast from GdaDataModel to GdaDataArray, then I use it
to get a GdaDataArray from gda_connection_execute_single_command; but
in C# I can't cast and is a runtime error; is there a reason of
GdaDataArray is not directly derived object from GdaDataModel?

2. But in C#, I can "see" all the methods to work with a
Gda.DataModelArray or a Gda.Select as they are Gda.DataModel, but I
can't cast. Any Idea?

Sugestion:

In C#, don't try to use Gda.Value.New* functions, becouse it doesn't
work; use instead GLib.Value val = new GLib.Value().

At This point, may be is NOT necesary the functions: gda_value_new_*
and gda_value_get/set_*, becouse you can use g_new0(GValue,0), to
create a new GdaValue, and the g_value_get/set_* functions to work
with GdaValue's.

To do so, you'll need to use G_VALUE_TYPE_* defined in gda-value.h,
file to work with out problems. That is becouse the types used are
GType derived from the fundamental (like smallint is derived from
gchar and gshort is derived from gint), and the GLib library work with
out alter the type set/get values using the standart GValue API, and
you can use gda_value_convert_gdatype_to_gtype and
gda_value_convert_gtype_to_gdatype to handle to identify the diferent
kind of value.



Nsome kinds of types like TinyInt (gchar derived type), and Smallint
(gint derived type), doesn't work with the g_value_set/get_gchar for
TinyInt and g_value_get/set_int for SmallInt.






--
Trabajar, la mejor arma para tu superación



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