Skip to content

Comments

Replace SQLiteWriter d_columns with metadata call#10

Open
wandernauta wants to merge 2 commits intoberthubert:mainfrom
wandernauta:metadata
Open

Replace SQLiteWriter d_columns with metadata call#10
wandernauta wants to merge 2 commits intoberthubert:mainfrom
wandernauta:metadata

Conversation

@wandernauta
Copy link

The d_columns field is removed. Instead, to find out whether some column or table exists, the sqlite3_table_column_metadata function is called.

This resolves an issue where multiple connections are open to the SQLite database and calls to addValue cause columns to be added to a table that is also used by others. Before, these new columns would only be added to the d_columns list of the connection that created them, meaning that all others would be out of sync, and stay that way. If they added a row that had the new column, they would attempt an ALTER TABLE, which would fail.

This change also means that we automatically follow SQLite when it comes to case sensitivity, so this should also fix #9.

Finally, the code is slightly simpler.

The getSchema method on MiniSQLite is now unused by the code itself, but since the method is public it is kept in case it is used by API users.

The d_columns field is removed. Instead, to find out whether some column
or table exists, the sqlite3_table_column_metadata function is called.

This resolves an issue where multiple connections are open to the SQLite
database and calls to addValue cause columns to be added to a table that
is also used by others. Before, these new columns would only be added to
the d_columns list of the connection that created them, meaning that all
others would be out of sync, and stay that way. If they added a row that
had the new column, they would attempt an ALTER TABLE, which would fail.

This change also means that we automatically follow SQLite when it comes
to case sensitivity, so this should also fix berthubert#9.

Finally, the code is slightly simpler.

The getSchema method on MiniSQLite is now unused by the code itself, but
since the method is public it is kept in case it is used by API users.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Case sensitivity of column and table names is inconsistent with SQLite

1 participant