Hi, I am building a C wrapper for sqlite that can abstract away the sqlite API and I am trying to work out the best way to deal with updating records using a cursor. So I want the API to look something like this when it is used:
Cursor = Query("select foo from bar"); while (Cursor.MoreRecords()) { int oldfoo = Cursor.GetInt("foo"); Cursor.SetInt("foo", oldfoo + 10); Cursor.UpdateRow(); } The idea is that I can iterate through a set of records with the cursor, updating as I go. The challenge is working out how to implement the UpdateRow() function. I am happy to accept the costraint that the query must only have one table in the from clause. Ideally in the Cursor.MoreRecords() call the cusor can know the rowid and table of the current row. Then in UpdateRow() it generates a update like: update <table> set <column> = <value> where rowid = <rowid> My problem is finding out the name of the table, and current rowid. The best mechanism I can come up with is to modify the original query internally so that "select foo from bar" becomes something like: select "bar", rowid, foo from bar Implementing another layer of SQL parsing is less than ideal since I have found that the parser already dominates sqlite performance for my tests (in-memory DB with many different queries using indexes). I am currently investigating sqlite internals to see if I can extract this information in a better way. Any ideas would be welcomed. BTW, performance is my primary goal, ease of use is second. Regards, Chris Waters --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]