Use cursor.lastrowid for SQLite and MySQL.
Merge pull request #4 from chevah/2371-lastrowid

[2371] Use cursor.lastrowid instead of SELECT query for SQLite/MySQL.