Ed Leafe wrote:
>
> Bizobjs make accessing data simple, but given that you're used to
> writing queries and handling data, they certainly aren't necessary.
>
> Check out the FAQ on database stuff, starting with
> http://dabodev.com/wiki/FAQs#connect
> , and let me know if you have more questions.
>
Thanks Ed. I actually have a couple.
I am using this code (example) :
---------------------------------------------------------------------------------------
ci = dabo.db.dConnectInfo(DbType='SQLite')
ci.Database = 'MultiMenu.db'
conn = dabo.db.dConnection(ci)
crsr = conn.getDaboCursor()
menu = 'MBar1'
crsr.execute("select distinct menu.name "
"from menu "
"inner join path "
"on path.Id = menu.MenuId "
"left join (select MenuId as 'xId' "
"from menu "
"where name = '" + menu + "')
Parent "
"where Id in (select Id "
"from path "
"where AncestorId =
Parent.xId) "
"and Id not in (select Id "
"from path "
"where Id in
(select Id "
"from path "
"where AncestorId = Parent.xId) "
"and
AncestorId not in (select AncestorId "
"from path "
"where Id = Parent.xId) "
"and
AncestorId != Parent.xId) ") # get the children of a menu
---------------------------------------------------------------------------------------
Now AFAIK this is a dabo cursor, but when I do crsr.fetchall() or
crsr.fetchone() or crsr.fetchmany() empty lists are returned. OTOH with
crsr.getDataSet() I get a dictionary. I'm actually extracting the keys
from the dictionary into a list. My question is if there is any cursor
method I have missed that returns the result set in a list like
fetchall() in python cursors.
My second question is (if you have the time) how would you have solved
this with a Bizobj, I'd like to be able to compare both methods (on a
non trivial query) so as to better be able to choose according to
circumstances.
Finally I'd like to report that crsr.getDataSet() is not as comfortable
as it might be. Sometimes the key will be only 'Name' (in the example
above), some other times it will be 'menu.name' (notice in the previous
case 'Name' was cased) but some other times I use menu.name in the query
and the key will be 'Name'. So I haven't found a rule for the naming of
keys and I have to previously test the queries in order to know the key
names and get the data I need into a list.
TIA
Ricardo.
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]