Package: libdbi-ruby1.9.1
Version: 0.4.3-2
Severity: important
Tags: upstream
select_all without block returns incorrect data -- array whose elements are the
(reference to the) last element. ( [ rowN, rowN, ... , rowN ] )
Example:
echo 'select * from role;' | psql -U samizdat -d samizdat
samizdat=> select * from role;
member | role
--------+-----------
22 | moderator
2 | moderator
(2 rows)
echo 'select * from role;' | sqlite3 test-sqlite.db
2|moderator
22|moderator
Now run very simple test program:
Ruby version: 1.9.2
DBI driver: Pg
[[2, "moderator"], [2, "moderator"]]
DBI driver: SQLite3
[[22, "moderator"], [22, "moderator"]]
But for 1.8 everything is okay:
Ruby version: 1.8.7
DBI driver: Pg
[[22, "moderator"], [2, "moderator"]]
DBI driver: SQLite3
[[2, "moderator"], [22, "moderator"]]
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (50, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.38-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=be_BY.UTF-8, LC_CTYPE=be_BY.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libdbi-ruby1.9.1 depends on:
ii libdeprecated-ruby1.9.1 2.0.1-2 Library for handling deprecated co
ii libruby1.9.1 1.9.2.180-4 Libraries necessary to run Ruby 1.
libdbi-ruby1.9.1 recommends no packages.
Versions of packages libdbi-ruby1.9.1 suggests:
pn libdbi-ruby <none> (no description available)
-- no debconf information
require 'dbi'
puts "Ruby version: #{RUBY_VERSION}"
db = [
[
'DBI:Pg:samizdat:test.local',
'samizdat',
'test'
],
[
'DBI:SQLite3:/var/lib/lxc/vm0/rootfs/var/lib/samizdat/test/test-sqlite.db',
nil,
nil
]
]
re = %r{\ADBI:([a-zA-Z0-9]+):}
db.each do |dsn, user, pwd|
DBI.connect(dsn, user, pwd) do |db|
puts "DBI driver: #{re.match(dsn)[1]}"
puts db.select_all('SELECT * FROM role').inspect
end
end