From: Georgios Petasis on 10 Jun 2010 05:17 στις 10/6/2010 04:33, O/H Kevin Kenny έγραψε: > George Petasis wrote: >> TDBC is cool :-) > > Good to hear. > I really liked the usage of tcl variables through the :varname syntax. This was something that sqlite had, and I missed it in other databases, i.e. postgres through pgintcl, which you had to do conversions from tcl to postgres strings... George
From: Donal K. Fellows on 10 Jun 2010 08:19 On 10 June, 10:17, Georgios Petasis <peta...(a)iit.demokritos.gr> wrote: > I really liked the usage of tcl variables through the :varname syntax. > This was something that sqlite had, and I missed it in other databases, > i.e. postgres through pgintcl, which you had to do conversions from tcl > to postgres strings... This sort of best-practice is one of the reasons we did TDBC. (Or rather, one reason why we encouraged Kevin to do TDBC. ;-)) Donal.
From: Georgios Petasis on 10 Jun 2010 12:34 στις 10/6/2010 04:33, O/H Kevin Kenny έγραψε: > George Petasis wrote: >> TDBC is cool :-) > > Good to hear. > Is there a array or a dict involved in foreach? Because the order rows are examined seems different than in database: http://www.ellogon.org/~petasis/tcl/Images/TDBC-foreach.png My code is: set list [list] my foreach -as lists -- row \ {SELECT event_id, primary_event, title FROM events WHERE\ set_id = :default_set_id} { lappend list $row } set events $list (variable events is used as a list variable in a tablelist widget). And method foreach, just calls tdbc::foreach: method foreach {args} { my variable db my connect catch { uplevel 1 [list $db foreach {*}$args] } result options catch {my disconnect} return -options $options $result };# foreach George
From: drscrypt on 10 Jun 2010 13:00 On 6/10/2010 12:34 PM, Georgios Petasis wrote: > Is there a array or a dict involved in foreach? Because the order rows > are examined seems different than in database: > I have not used TDBC but in general, a select from a database is not guaranteed to return data in any particular order and may also differ in subsequent runs. If you want a particular order, you can use an order by clause. DrS
From: tom.rmadilo on 10 Jun 2010 18:54 On Jun 10, 10:00 am, drscr...(a)gmail.com wrote: > On 6/10/2010 12:34 PM, Georgios Petasis wrote: > > > Is there a array or a dict involved in foreach? Because the order rows > > are examined seems different than in database: > > I have not used TDBC but in general, a select from a database is not > guaranteed to return data in any particular order and may also differ in > subsequent runs. If you want a particular order, you can use an order > by clause. Absolutely essential that you use an order-by clause in every query. For instance, postgreSQL is known to append updated rows to the bottom of a table, so each update query changes the subsequent order of rows returned without an order-by clause.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: namespace which -variable and array elements Next: interp alias vs proc... |