Database: fixed Sqlite3 bug in getForeignKeys [Closes #935]