Ooops.. Resending, didn't realize this didn't go to the list.. my
apologies.

On Tue, 2009-06-16 at 21:44 -0600, Shawn Ferris wrote:
> Man.. I'm so close I can smell it.. I actually have the bindings working
> to the point were I am fetching a value from a table. Unfortunately, the
> way it sits, I'm stuck with ints alone.. as soon as I try to return a
> string, the code aborts.. there's actually two cases where the results
> are the same and I'm assuming the fix for one will fix the other, so
> I'll ask for help on the easier one. In this case, it's the ErrorGet
> function defined as:
> 
> sword OCIErrorGet ( void      *hndlp, 
>                   ub4        recordno,
>                   OraText       *sqlstate,
>                   ub4        *errcodep, 
>                   OraText       *bufp,
>                   ub4        bufsiz,
>                   ub4        type );
> 
> My vapi definition:
> 
>   [CCode (cname = "OCIErrorGet")]
>   public int ErrorGet (
>     Error*       error,
>     int          record,
>     out string*  sqlstate,
>     out int*     errcode,
>     out string*  buffer,
>     int          buffersz,
>     HType        type
>   );
> 
> And a C example:
> 
>   text errbuf[512];
>   OCIErrorGet ((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode,
>             errbuf, (ub4) sizeof(errbuf), (ub4) OCI_HTYPE_ERROR);
> 
> If I leave off errbuf (which should be the physical message string
> assoctiate to errcode) everything works fine. EG:
> 
>     int*    errno;
>     OCI.ErrorGet ( err, 1, null, out errno, null, 0, HType.ERROR);
>     stdout.printf("Error - ORA-%5.5d (%s)\n", (int)errno, action);
> 
> I absolutely get the right error code (i can force which error I gen)
> but as soon as I try to touch errbuf the program aborts.. I can not for
> the life of me find the correct way to do this. Can someone point me in
> the right direction? And then, I'll warn you that I'll have at least one
> more email.. but more critique and style.. I'm assuming I haven't
> followed the vala way, but I'm more interested in getting it to work and
> addressing style later.
> 
> Thanks for the help!
> SMF
> 

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to