Re: [Vala] sqlite needs more love



Oh I see .. the NoArrayLength attribute :)

I have pushed your example into the wiki:

  http://live.gnome.org/Vala/SqliteSample

one lil question...is there any doc about all the available (or at least the
most used) attributes?

We should probably put the documentation into the wiki, instead of a static
page (http://www.vala-project.org/doc/vala/)

Thanks

On Fri, Nov 09, 2007 at 02:14:32AM -0300, Marcelo Lira wrote:
Hello pancake,

I was stuck with the same exec-callback problem that you have, I even think
that was a bug and filled it[1]. But while looking in the Cairo bindings I
found the missing part: you have to use one of these before the callback
function declaration

[NoArrayLength ()]
public static int callback(pointer data, int n_columns, string[] values,
string[] column_names)

It will generate the correct C code (it was inside the Demo class):

gint demo_callback (gpointer data, gint n_columns, char** values, char**
column_names)

[1] http://bugzilla.gnome.org/show_bug.cgi?id=487612

On Nov 9, 2007 1:35 AM, pancake <pancake youterm com> wrote:

So...the arguments are not shifted...but i don't know where they are :)

I saw the problem here...it's about the c conversion of string[] which is
not
converted to char**...it is "int n, char **".

Vala code:

 public static int foo(pointer data, int ncols, string[] values, string[]
colnames) {
   ...
 }

Generated C code:

 gint foo_bar_foo(gpointer data, gint ncols, int values_length1, char
**values, int column_names_length1, char **column_names)
   ...
 }

And the one defined in sqlite3.h

 typedef int (*sqlite3_callback)(void *, int, char **, char **);

Can this be defined as a Vala attribute in the vapi? or should the valac
be fixed to
handle arrays in this way?

--pancake
_______________________________________________
Vala mailing list
Vala paldo org
http://www.paldo.org/mailman/listinfo/vala




-- 
Marcelo Lira dos Santos
http://setanta.wordpress.com
@CInLUG: http://www.cin.ufpe.br/~cinlug
@Ci?ncia Livre: http://www.ciencialivre.pro.br
@INdT: http://www.indt.org.br



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