Thanks, that makes it clear. > SQLite implements the command "DELETE FROM table" without a WHERE clause > by dropping and recreating the table.
Interesting, didn't know that. Maybe I should re-create when the majority or a lot of rows are deleted. RBS -----Original Message----- From: Trey Mack [mailto:[EMAIL PROTECTED] Sent: 24 January 2007 21:20 To: sqlite-users@sqlite.org Subject: Re: [sqlite] SQLite3VB.dll > I have just one question. > What exactly does this function do: > > Private Declare Function sqlite3_changes _ > Lib "SQLite3VB.dll" (ByVal DB_Handle As Long) As Long > > It looks it will always give one, unless you have just created a database > and done nil with it. Is this how it is? It returns the number of rows affected by a delete, update, or insert (not updated by selects). It's not the number _changed_, but the number of rows addressed by the WHERE clause, whether an update actually changes a value or not. One special case is when you DELETE FROM table with no where clause.. explained below. >From sqlite3.h: /* ** This function returns the number of database rows that were changed ** (or inserted or deleted) by the most recent called sqlite3_exec(). ** ** All changes are counted, even if they were later undone by a ** ROLLBACK or ABORT. Except, changes associated with creating and ** dropping tables are not counted. ** ** If a callback invokes sqlite3_exec() recursively, then the changes ** in the inner, recursive call are counted together with the changes ** in the outer call. ** ** SQLite implements the command "DELETE FROM table" without a WHERE clause ** by dropping and recreating the table. (This is much faster than going ** through and deleting individual elements form the table.) Because of ** this optimization, the change count for "DELETE FROM table" will be ** zero regardless of the number of elements that were originally in the ** table. To get an accurate count of the number of rows deleted, use ** "DELETE FROM table WHERE 1" instead. */ - Trey ---------------------------------------------------------------------------- - To unsubscribe, send email to [EMAIL PROTECTED] ---------------------------------------------------------------------------- - ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------