[orm-devel] select problem
Werner F. Bruhin
orm-devel@mailman.tux4web.de
Sat, 01 Mar 2003 12:13:38 +0100
Hi Diedrich,
I figured out the cause of the select problem.
- Column names in the db are in capital letters.
- Column names in the class definition are in lower case
During the select ORM compares the column description returned by
kinterbasdb to the class definition and fails and fills the value with
None (see around line 175 of orm.dbclass.
I see in the code that there is a column name and an attribute name -
does this mean I can define column name as "WINENAME" and attribute as
"winename" to solve this problem?
If yes, can you give me a sample class definition to do this, so I can
update fbgen.
If no, what do you suggest to get over this (using lower case in db does
not work, as somewhere along the line they get converted to upper).
BTW - just noticed, looking for doc on the class def format, the spell
error on the web page - Sing up .... mailinglist should be "Sign up".
See you
Werner
Werner F. Bruhin wrote:
> Hi Diedrich,
>
> I checked if I get the correct result using kinterbasdb directly with
> the following little script.
> import kinterbasdb
>
> con =
> kinterbasdb.connect(dsn="c:\\dev\mywinecb\\data\\mywinecb.gdb",user="sysdba",password="masterkey",charset="ISO8859_1")
>
>
> cur = con.cursor()
>
> cur.execute("SELECT test.id,test.winename FROM test WHERE id=45")
> #cur.execute("SELECT* FROM test")
> print cur.fetchall()
>
> The select with the where clause returns the right column.
>
> Debugging ORM I do not see when the fetchxxx (one or all is called).
>
> Will go and make myself a tea, maybe that will clear up my vision!
>
> Have fun with Firebird on Linux.
>
> See you
> Werner
>
> Diedrich Vorberg wrote:
>
>> Hi Werner,
>>
>>
>>
>>> debug output is: SELECT test.id,test.winename FROM test WHERE id=45
>>> Any hints/help would be appreciated.
>>>
>>
>>
>> Try running the query on a plain cursor to see if it returns the
>> dataset you'd expect. Use the selectone() method of the cursor and
>> check the tuple that's returned. That's exactly what orm does just a
>> couple more functioncalls involved..:-)
>>
>> I'll set up firebird on Linux today and try it myself. Untill than I
>> can't say much more.
>>
>> Diedrich
>>
>>
>>
>
>
> _______________________________________________
> orm-devel mailing list
> orm-devel@mailman.tux4web.de
> http://mailman.tux4web.de/mailman/listinfo/orm-devel
>
>