Re: TIP#308 Published: Tcl Database Connectivity (TDBC)
- From: "Wojciech Kocjan" <wojciechka@xxxxxxxxx>
- Date: Fri, 16 Nov 2007 23:04:59 +0100
Dnia 16-11-2007 o 17:00:52 Donal K. Fellows
<donal.k.fellows@xxxxxxxxxxxxxxxx> napisał(a):
(5) The primitive function to retrieve a row needs to retrieve it asNo. That *really* screws with Tcl's value system.
a list, IM(NS)HO. This is the natural structure to represent ordered
data as retrieved from a DBMS, and avoids a bunch of overhead
involved in creating and then parsing out a dict.
I have to say I disagree here. A lot.
First of all, I think SQLite's syntax (flat list) really rocks:
foreach {id name value} [$db eval {SELECT id,name,value FROM table}] {
...
}
Also, a list of lists is a really useful construction. For example you can
pass that directly to tablelist widget, so all you do is call delete 0 end
and do an insertlist $result on it.
Also, I'm not sure if that changed in 8.5, but [lsort] doesn't talk to
dicts nicely - so sorting a list of lists would work much better than
getting dictionaries.
While I know dicts would be the most elegant way, I don't think they're
the fastest (in terms of performance) and most powerful ones.
I think that query results should be returned as:
- flat list
- list of lists
- list of dicts
--
Wojciech Kocjan
.
- Follow-Ups:
- Re: TIP#308 Published: Tcl Database Connectivity (TDBC)
- From: tom.rmadilo
- Re: TIP#308 Published: Tcl Database Connectivity (TDBC)
- References:
- TIP#308 Published: Tcl Database Connectivity (TDBC)
- From: Donal K. Fellows
- Re: TIP#308 Published: Tcl Database Connectivity (TDBC)
- From: Twylite
- Re: TIP#308 Published: Tcl Database Connectivity (TDBC)
- From: Donal K. Fellows
- TIP#308 Published: Tcl Database Connectivity (TDBC)
- Prev by Date: Re: TIP#308 Published: Tcl Database Connectivity (TDBC)
- Next by Date: Re: Making groups
- Previous by thread: Re: TIP#308 Published: Tcl Database Connectivity (TDBC)
- Next by thread: Re: TIP#308 Published: Tcl Database Connectivity (TDBC)
- Index(es):
Relevant Pages
|