Skip Menu |

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 41631
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: janus [...] errornet.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Dot doesn't work in quoted column aliases
Hi, easy to reproduce that one: SELECT bar AS "foo.bar" FROM foo; ... the column name will be "bar" instead of "foo.bar". To compare, do the same on the sql shell: $ sqlite test.db SQLite version 2.8.17 Enter ".help" for instructions Show quoted text
sqlite> create table foo (bar text); sqlite> insert into foo (bar) values ('moo'); sqlite> .headers on sqlite> select bar as "foo.bar" from foo;
foo.bar moo Show quoted text
sqlite>
Other ``special'' chars seem to work fine. I've copied t/04select.t to t/04select_quoted.t and adjusted it accordingly; file attached. As i have got no fix yet i think i'll work around it for now. Regards, Simon
Subject: 04select_quoted.t
use Test; BEGIN { plan tests => 30 } use DBI; my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", "", { RaiseError => 1 }); ok($dbh); # $dbh->trace(4); my $sth = $dbh->prepare('SELECT f1 AS "f.f1", f2 AS "f.f2", f3 AS "f.f3" FROM f'); ok($sth); ok($sth->execute); my $row = $sth->fetch; ok($row); ok(@$row, 3); print join(", ", @$row), "\n"; my $rows = $sth->execute; # NEW my $cols = $sth->{'NAME_lc'}; ok($cols->[0], 'f.f1', 'dot in column alias name'); ok($cols->[1], 'f.f2', 'dot in column alias name'); ok($cols->[2], 'f.f3', 'dot in column alias name'); ok($rows); ok($sth->fetch); $sth->finish; $sth = $dbh->prepare("INSERT INTO f (f1, f2, f3) VALUES (?, ?, ?)"); ok($sth); ok($sth->execute("test", "test", 1)); $sth->finish; $sth = $dbh->prepare("DELETE FROM f WHERE f3 = ?"); ok($sth); ok($sth->execute("1")); $sth->finish; $sth = $dbh->prepare('SELECT f1 AS "f;f1", f2 AS "f|f2", f3 AS "f?f3" FROM f'); ok($sth); ok($sth->execute()); $cols = $sth->{'NAME_lc'}; ok($cols->[0], 'f;f1', 'special char in column alias name'); ok($cols->[1], 'f|f2', 'special char in column alias name'); ok($cols->[2], 'f?f3', 'special char in column alias name'); my $num_rows = 0; while ($row = $sth->fetch) { $num_rows++; } ok($num_rows, 1, "Check num_rows ($num_rows) == 1"); $sth->finish; $dbh->do("delete from f where f1='test'"); $sth = $dbh->prepare("INSERT INTO f (f1, f2, f3) VALUES (?, ?, ?)"); ok($sth); ok($sth->execute("test", "test", 1.05)); $sth = $dbh->prepare("DELETE FROM f WHERE f3 = ?"); ok($sth); ok($sth->execute("1.05")); $sth->finish; $sth = $dbh->prepare('SELECT f1 AS "f=f1", f2 AS "f^f2", f3 AS "f$f3" FROM f'); ok($sth); ok($sth->execute()); $cols = $sth->{'NAME_lc'}; ok($cols->[0], 'f=f1', 'special char in column alias name'); ok($cols->[1], 'f^f2', 'special char in column alias name'); ok($cols->[2], 'f$f3', 'special char in column alias name'); $num_rows = 0; while ($row = $sth->fetch) { $num_rows++; } ok($num_rows == 1); $sth->finish; undef $sth; $dbh->do("delete from f where f1='test'"); $dbh->disconnect;
This is a duplicate of #31324, and has been resolved by the same patch that resolved it. Fix should appear in 1.19_08