works only when the database is initialized.
If you start the program and read a database and run SELECT last_insert_rowid() then you get 0.
Then after having added an entry and you call SELECT last_insert_rowid() then you get the right value.
If you have a column with the type of INTEGER PRIMARY KEY you can get the max value of this column with SELECT max(RowID) FROM DBTableName
I know this is a little late posting... but for anyone else who's searching for this, check the documentation of this function Last Insert Rowid
See ya!