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 driver
Exec() callback, and one valid value should be -1 or
DBI_NUM_ROWS_UNKNOWN.

The sqlite driver would set -1 for a normal query, but would set it
correctly for DML. The other drivers could always set this correctly,
but the higher level code would treat it as a hint only, to for
example pre-allocate a Tcl list of the correct size for results. The
counting code needs to be maintained for sqlite.

I don't think it existed at the time (hence the FIXME in tclcmds.c)
but sqlite3_changes() now gives you rows-affected for DML.



On Thu, Feb 6, 2014 at 9:56 PM, Gustaf Neumann <neum...@wu.ac.at> wrote:
> 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 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 dbi_dml does the Exec() and nothing after that to
>> retrieve the result (which is in pg: PQcmdTuples(res)).
>>
>> What is your suggestion to fix this?
>> - extend the record of Dbi_DriverProc? (new function)
>> - mangle NextRow() to return the result in the dml case
>> - extend the Dbi_Handle structure such that Exec()
>>   can return this value directly?
>> others?
>>
>> -gustaf
>>
>
>
> --
> Univ.Prof. Dr. Gustaf Neumann
> WU Vienna
> Institute of Information Systems and New Media
> Welthandelsplatz 1, A-1020 Vienna, Austria
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
> _______________________________________________
> naviserver-devel mailing list
> naviserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/naviserver-devel

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to