[naviserver-devel] dbi_dml

2014-02-06 Thread Gustaf Neumann
Hi Stephen, in contrary to the documentation, dbi_dml does not return the number of rows affected by the query. Typically the dbi_* tcl commands are implemented via Exec() followed by a retrieving cmd, like in dbi_1row does an Exec() + NextRow() dbi_rows does an Exec() + many NextRow(), etc. but

Re: [naviserver-devel] ns_dbi

2014-02-06 Thread Wolfgang Winkler
Hello! I've added a datatype "dict" to the list of possible DbiResults. "dicts" returns a list of dicts, whereas "dict" returns a dict. The keys for the first level is a simple counter. So instead of {user_id 1 user_name Max} {user_id 2 user_name Lisa} 1 {user_id 1 user_name Max} 2 {user_id 2

Re: [naviserver-devel] ns_dbi

2014-02-06 Thread Gustaf Neumann
Am 06.02.14 18:17, schrieb Wolfgang Winkler: > I've added a datatype "dict" to the list of possible DbiResults. ... > dict for {k v} $result { > set user_id [dict get $v user_id] > dict set result $k user_url "user?user_id=$user_id" > } ah, nice... updating the dict as result set is co

Re: [naviserver-devel] dbi_dml

2014-02-06 Thread Gustaf Neumann
For the time being, i've used (abused?) the public Dbi_Handle->rowIdx to return in the DML case the number of affected rows. This has the advantage, that all data-structures are unchanged, and the modifications are quite local. -g Am 06.02.14 14:12, schrieb Gustaf Neumann: > Hi Stephen, > > in co

Re: [naviserver-devel] ns_dbi

2014-02-06 Thread Stephen
On Thu, Feb 6, 2014 at 5:17 PM, Wolfgang Winkler wrote: > Hello! > > I've added a datatype "dict" to the list of possible DbiResults. "dicts" > returns a list of dicts, whereas "dict" returns a dict. The keys for the first > level is a simple counter. So instead of > > {user_id 1 user_name Max} {u

Re: [naviserver-devel] dbi_dml

2014-02-06 Thread Stephen
This used to work. I *think* what happened is it got overlooked when I implemented the sqlite driver and had to change the driver interface to accommodate it (sqlite doesn't return nrows - you have to step the state machine yourself). Maybe numRows should be added back as a *numRowsHint arg in the

Re: [naviserver-devel] dbi_dml

2014-02-06 Thread Stephen
Well, that doesn't make it available to the code that needs it... So add numRowsHint to the public portion of Dbi_Handle. Set it to DBI_NUM_ROWS_UNKNOWN before passing it to the driver in Exec. Driver may fill it in. Upper layers use it if available, but don't rely on it. On Fri, Feb 7, 2014 at 1