Re: Problem wrapping libdbi for Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:
> 
> I need access to both PostgreSQL and MySQL. I was hoping to wrap libdbi.
> Euphoria
> makes 
> wrapping C libraries so easy. I am, however, having problems with this one.
> Here's the error:
> 
> libdbi.e:191 in function dbi_conn_set_option() 
> A machine-level exception occurred during execution of this statement 
> 
> ... called from libdbi.e:266 
> 
> Now, like 266 is:
> 
> VOID = dbi_conn_set_option(conn, "username", "jeremy")
> 
> Weird thing is, if I change "jeremy" to "john" all works fine. In fact, any
> 4 letter word works,
> but any 6 letter word does not work. 
> 
> I have created this same example in C and it works w/o problem, so I doubt
> it's
> something
> in libdbi, but I may be wrong.
> 
> I have placed my code at: <a
> href="http://jeremy.cowgar.com/files/libdbi.e">http://jeremy.cowgar.com/files/libdbi.e</a>
> 
> That contains the wrapper (as it stands now, cannot do anything but connect.
> It also has
> the example program at the bottom. I am wondering if anyone has any insight?
> In short, the
> code for dbi_conn_set_option is:
> 
> }}}
<eucode>
> atom LDbi_conn_set_option
> LDbi_conn_set_option = define_c_func(libdbi, "dbi_conn_set_option", 
> 	{C_POINTER, C_POINTER, C_POINTER}, C_INT)
> global function dbi_conn_set_option(atom conn, sequence key, sequence value)
> 	atom Akey, Avalue
> 	integer res
> 	
> 	Akey   = allocate_string(key)
> 	Avalue = allocate_string(value)
> 	res = c_func(LDbi_conn_set_option, {conn, Akey, Avalue})
> 	free(Akey)
> 	free(Avalue)
> 	
> 	return res
> end function
> </eucode>
{{{

> 
> Once finished, I will be placing all the code in The Archive so others can
> benefit
> as well.
> 
> Thanks for any help,
> 

Jeremy:

Try using }}}
<eucode> atom res' </eucode>
{{{
 instead of }}}
<eucode> integer res
   </eucode>
{{{


Bernie

My files in archive:
WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu