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

MiqSqlite3DB::MiqSqlite3Table#each_row raises an exception #206

Open
agrare opened this issue Nov 4, 2024 · 0 comments
Open

MiqSqlite3DB::MiqSqlite3Table#each_row raises an exception #206

agrare opened this issue Nov 4, 2024 · 0 comments
Labels

Comments

@agrare
Copy link
Member

agrare commented Nov 4, 2024

>> require 'db/MiqSqlite/MiqSqlite3'
=> true
>> db = MiqSqlite3DB::MiqSqlite3.new('/var/lib/rpm/rpmdb.sqlite')
=> 
#<MiqSqlite3DB::MiqSqlite3:0x00007fe1d7587080
...
>> db.getTable('Basenames')
=> 
#<MiqSqlite3DB::MiqSqlite3Table:0x00007fe1d74bafa8
 @columns=[{"name"=>"key", "type"=>"'text'"}, {"name"=>"hnum", "type"=>"integer"}, {"name"=>"idx", "type"=>"integer"}],
 @data=6,
 @db=
  #<MiqSqlite3DB::MiqSqlite3:0x00007fe1d7587080
   @file=#<File:spec/metadata/linux/data/rpm/rpmdb.sqlite>,
   @filename="spec/metadata/linux/data/rpm/rpmdb.sqlite",
   @header=
    #<OpenStruct magic="SQLite format 3\x00", page_size=4096, write_version=2, read_version=2, unused_space=0, max_payload_node_fraction=64, min_payload_node_fraction=32, min_payload_leaf_fraction=32, file_change_counter=14, reserved="\x00\x00\x98\x03", first_freelist_page=5469, number_freelist_pages=25376, meta_values=49>,
   @maxEmbedFrac=64,
   @maxLeaf=4061,
   @maxLocal=1002,
   @minEmbedFrac=32,
   @minLeaf=489,
   @minLeafFrac=32,
   @minLocal=489,
   @nReserve=0,
   @npages=38915,
   @pageSize=4096,
   @pageSizeFixed=true,
   @usableSize=4096>,
 @desc="Basenames",
 @fields=
  [{"len"=>5, "type"=>"text", "data"=>"table"},
   {"len"=>9, "type"=>"text", "data"=>"Basenames"},
   {"len"=>9, "type"=>"text", "data"=>"Basenames"},
   {"len"=>1, "type"=>"integer", "data"=>6},
   {"len"=>139, "type"=>"text", "data"=>"CREATE TABLE 'Basenames' (key 'TEXT' NOT NULL, hnum INTEGER NOT NULL, idx INTEGER NOT NULL, FOREIGN KEY (hnum) REFERENCES 'Packages'(hnum))"}],
 @key="FOREIGN",
 @name="Basenames",
 @pagenum=33,
 @sql="CREATE TABLE 'Basenames' (key 'TEXT' NOT NULL, hnum INTEGER NOT NULL, idx INTEGER NOT NULL, FOREIGN KEY (hnum) REFERENCES 'Packages'(hnum))",
 @type="table">
>> db.getTable('Basenames').each_row {}
/home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Table.rb:93:in `block (3 levels) in each_row': undefined method `[]' for nil (NoMethodError)

            row[col['name']] = cell.fields[i]['data']
                                             ^^^^^^^^
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Table.rb:102:in `block in each_column'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Table.rb:102:in `each'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Table.rb:102:in `each_column'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Table.rb:92:in `block (2 levels) in each_row'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `block in each_cell'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each_cell'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Table.rb:88:in `block in each_row'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:96:in `block (2 levels) in leaves'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:96:in `block (2 levels) in leaves'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:98:in `leaves'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:96:in `block in leaves'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:84:in `block in each_child'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `block in each_cell'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each_cell'
	... 13 levels...
>> 
@agrare agrare added the bug label Nov 4, 2024
@agrare agrare changed the title MiqSqlite3DB::MiqSqlite3Table.each_row raises an exception MiqSqlite3DB::MiqSqlite3Table#each_row raises an exception Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant