Re: [Sqlrelay-discussion] loose type checking in the Python API's setBind
Brought to you by:
mused
|
From: Firstworks/4access <dav...@fi...> - 2005-11-16 16:57:26
|
I recently noticed this too. It should do something other than silently
ignore the error. I'll make sure to fix this one way or another for
0.37. For now though, yeah, you'll just have to be more careful what
you pass in.
Dave
dav...@fi...
On Thu, 2005-11-10 at 13:46 -0500, Andrew Langmead wrote:
> In my code, object to PySQLRClient.sqlrcursor.inputBind that I
> thought was a simple string, but had accidentally been upgraded to a
> unicode string. To my surprise, there were no errors reported, but
> the bind just was ignored entirely.
>
> Looking at the C code for the Python CSQLRelay extension, I see that
> inputBind is a long if/else if sequence with no default else clause.
>
> if (value==Py_None) {
> ((sqlrcursor *)sqlrcur)->inputBind(variable, (char *)NULL);
> } else if (PyString_Check(value)) {
> ((sqlrcursor *)sqlrcur)->inputBind(variable, PyString_AsString
> (value));
> } else if (PyInt_Check(value)) {
> ((sqlrcursor *)sqlrcur)->inputBind(variable, (long)PyInt_AsLong
> (value));
> } else if (PyFloat_Check(value)) {
> ((sqlrcursor *)sqlrcur)->inputBind(variable, (double)
> PyFloat_AsDouble(value)
> , (unsigned short)precision, (unsigned short)scale);
> }
>
>
> Should .inputBind return a status to say in bound correctly? Should
> it through a TypeError? Should it try to coerce its input into one of
> the four simple types it knows about?
>
> Or should I just be more careful what I pass into it?
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
|