To all,
I have written (in COBOL) an SQLite3 interface for GnuCOBOL and would
like to add a routine that will return the number of rows that were
selected, updated or deleted by the last executed SQL statement.
I currently have a routine, named DBSQL, that calls sqlite3_prepare_v2,
sqlite3_step and sqlite3_finalize. I am using this routine for SQL
statements (INSERT, UPDATE, DELETE, etc.) where any returned data is not
required. Any data returned by sqlite3_step (SQLITE-ROW is true) is
being ignored, although I do output a message indicating this has happened.
For SELECT statements I am doing the following (error checking not shown):
set rowcount to zero
call sqlite3_prepare_v2
call sqlite3_step
if sqlite-row then
call sqlite3_column_count
loop for each column
call sqlite3_column_type *> save value in an array
end-loop
loop while sqlite-row
add 1to rowcount
loop for each column
call sqlite3_column_x *> where x = int or text
*> save value in avariable
end-loop
call routine to process the returned data
call sqlite3_step
end-loop
end-if
sqlite3_finalize
Using this method I am able to return the number of rows selected and
with the addition of some code around the DBSQL routine I can keep a
count of the number of INSERTS.
But how do I get the number of rows UPDATEd or DELETEd?
Please note that I am NOT a C programmer.
regards,
Robert