Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow quotes around 'TableName' in sqlite schema #204

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

agrare
Copy link
Member

@agrare agrare commented Nov 4, 2024

The regex from the current schema parser doesn't allow for e.g. CREATE TABLE 'Packages' like we see with the rpmdb.sqlite file.

This would lead to an exception when listing the tables

     Failure/Error: tname = m[1].to_s.chomp
     
     NoMethodError:
       undefined method `[]' for nil
     # ./lib/db/MiqSqlite/MiqSqlite3Table.rb:68:in `decodeSchema'
     # ./lib/db/MiqSqlite/MiqSqlite3Table.rb:59:in `initialize'
     # ./lib/db/MiqSqlite/MiqSqlite3Table.rb:38:in `new'
     # ./lib/db/MiqSqlite/MiqSqlite3Table.rb:38:in `block (2 levels) in each'
     # ./lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `block in each_cell'
     # ./lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each'
     # ./lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each_cell'
     # ./lib/db/MiqSqlite/MiqSqlite3Table.rb:37:in `block in each'
     # ./lib/db/MiqSqlite/MiqSqlite3Page.rb:84:in `block in each_child'
     # ./lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `block in each_cell'
     # ./lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each'
     # ./lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each_cell'
     # ./lib/db/MiqSqlite/MiqSqlite3Page.rb:83:in `each_child'
     # ./lib/db/MiqSqlite/MiqSqlite3Table.rb:35:in `each'
     # ./lib/db/MiqSqlite/MiqSqlite3Table.rb:11:in `table_names'
     # ./lib/db/MiqSqlite/MiqSqlite3.rb:307:in `table_names'
     # ./spec/db/MiqSqlite/rpmdb_spec.rb:35:in `block (2 levels) in <top (required)>'

Fixes #205

@agrare agrare added the bug label Nov 4, 2024
@agrare agrare mentioned this pull request Nov 4, 2024
2 tasks
@agrare agrare force-pushed the fix_sqlite3_table_quotes branch from 89c1f13 to 5f0c394 Compare November 4, 2024 17:02
@Fryguy Fryguy self-assigned this Nov 4, 2024
@Fryguy Fryguy merged commit 9b61a19 into ManageIQ:master Nov 4, 2024
5 of 6 checks passed
@agrare agrare deleted the fix_sqlite3_table_quotes branch November 4, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MiqSqlite3DB::MiqSqlite3#table_names raises an exception
2 participants