Re: [Vala] Gda.DataModel.get_value_at C generated code is incorrect
- From: Daniel Espinosa <esodan gmail com>
- To: Vala-list <vala-list gnome org>
- Subject: Re: [Vala] Gda.DataModel.get_value_at C generated code is incorrect
- Date: Tue, 25 Oct 2011 10:47:33 -0500
I've created an example, but no errors is generated, even C code is as
expected. Please help me!
namespace Example {
errordomain InError {
GENERAL
}
public interface In {
[CCode (vfunc_name = "i_fun")]
public abstract void fun (int a, int b) throws Error;
[CCode (vfunc_name = "i_fo")]
public abstract void fo ();
}
class App : Object, In {
public void fun (int a, int b) throws Error {
stdout.printf("a=%i; b=%i\n", a, b);
throw new InError.GENERAL("Fake error");
}
public void fo () {
stdout.printf("Fo....\n");
}
public static int main (string[] args) {
var a = new App();
a.fo();
try {
a.fun(4,5);
}
catch (Error e) {
stdout.printf("Error: %s\n", e.message);
}
return 0;
}
}
}
2011/10/24 Daniel Espinosa <esodan gmail com>:
Vala autogenerated bindings of GDA (master) shows that:
[CCode (vfunc_name = "i_get_value_at")]
public abstract GLib.Value get_value_at (int col, int row) throws GLib.Error;
/* i_get_value_at is a virtual function in GdaDataModel Interface */
And GDA bindings in Vala 0.14 shows:
public unowned GLib.Value? get_value_at (int col, int row) throws GLib.Error;
Why the following code doesn't compile under libgda-5.0 (master)
bindings, but only using libgda-4.0 (Vala):
namespace Bug {
public static int main (string[] args) {
var c = Gda.Connection.open_from_string("Sqlite",
"SQLite://DB_DIR=.;DB_NAME=test", null,
Gda.ConnectionOptions.READ_ONLY);
if (c.is_opened()) {
var m = c.execute_select_command("SELECT MAX(n) FROM val");
stdout.printf("Rows and columns: %i, %i\n", m.get_n_rows(),
m.get_n_columns());
Value v = m.get_value_at(0,0);
stdout.printf("Value is type: %s\n", v.type_name());
}
return 0;
}
}
The error messages are:
bug-DataModel-get-value-at.vala:3.11-3.124: warning: unhandled error
`GLib.Error'
var c = Gda.Connection.open_from_string("Sqlite",
"SQLite://DB_DIR=.;DB_NAME=test", null,
Gda.ConnectionOptions.READ_ONLY);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bug-DataModel-get-value-at.vala:5.12-5.61: warning: unhandled error `GLib.Error'
var m = c.execute_select_command("SELECT MAX(n) FROM val");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bug-DataModel-get-value-at.vala:7.14-7.32: warning: unhandled error `GLib.Error'
Value v = m.get_value_at(0,0);
^^^^^^^^^^^^^^^^^^^
/home/esodan/Proyectos/bug-DataModel-get-value-at.vala.c: In function
'bug_main':
/home/esodan/Proyectos/bug-DataModel-get-value-at.vala.c:65:3:
warning: passing argument 4 of 'gda_data_model_get_value_at' from
incompatible pointer type [enabled by default]
/usr/include/libgda-5.0/libgda/gda-data-model.h:184:21: note: expected
'struct GError **' but argument is of type 'struct GValue *'
/home/esodan/Proyectos/bug-DataModel-get-value-at.vala.c:65:3: error:
too many arguments to function 'gda_data_model_get_value_at'
/usr/include/libgda-5.0/libgda/gda-data-model.h:184:21: note: declared here
error: cc exited with status 256
Compilation failed: 1 error(s), 3 warning(s)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]