1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-09 07:08:07 -04:00

Fixed column_info ORDINAL_POSITION starts at 1

This commit is contained in:
Vernon Lyon 2009-10-01 12:44:18 +00:00
parent 0c5dbbf467
commit 923f031682

View file

@ -354,7 +354,7 @@ sub primary_key_info {
my $sponge = DBI->connect("DBI:Sponge:", '','')
or return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr");
my @names = qw(TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME KEY_SEQ PK_NAME);
my $sth = $sponge->prepare( "column_info $table", {
my $sth = $sponge->prepare( "primary_key_info $table", {
rows => [ map { [ @{$_}{@names} ] } @pk_info ],
NUM_OF_FIELDS => scalar @names,
NAME => \@names,
@ -482,7 +482,7 @@ END_SQL
my $sth_columns = $dbh->prepare(qq{PRAGMA "$schema".table_info("$table")});
$sth_columns->execute;
for ( my $position = 0; my $col_info = $sth_columns->fetchrow_hashref; $position++ ) {
for ( my $position = 1; my $col_info = $sth_columns->fetchrow_hashref; $position++ ) {
if ( defined $col_val ) {
# This must do a LIKE comparison
my $sth = $dbh->prepare("SELECT '$col_info->{name}' LIKE '$col_val'") or return undef;