fixed: More permissive DSN checking to allow use of SQLite (thanks pathma)
This commit is contained in:
parent
a48827553c
commit
46f6104d43
3 changed files with 15 additions and 10 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
7.5.16
|
7.5.16
|
||||||
- Created a migration from 7.4.40 directly to 7.5.16.
|
- Created a migration from 7.4.40 directly to 7.5.16.
|
||||||
|
- fixed: More permissive DSN checking to allow use of SQLite (thanks pathma)
|
||||||
|
|
||||||
7.5.15
|
7.5.15
|
||||||
- fixed: Colorpicker window would not open (Martin Kamerbeek / Oqapi)
|
- fixed: Colorpicker window would not open (Martin Kamerbeek / Oqapi)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ use Tie::CPHash;
|
||||||
use WebGUI::SQL;
|
use WebGUI::SQL;
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
|
use DBI;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
@ -238,16 +239,19 @@ sub db {
|
||||||
if ($self->getId eq "0") {
|
if ($self->getId eq "0") {
|
||||||
$self->{_dbh} = $self->session->db;
|
$self->{_dbh} = $self->session->db;
|
||||||
return $self->{_dbh};
|
return $self->{_dbh};
|
||||||
} elsif ($dsn =~ /\DBI\:\w+\:\w+/i) {
|
|
||||||
my $dbh = WebGUI::SQL->connect($self->session,$dsn,$username,$identifier,$parameters);
|
|
||||||
unless (defined $dbh) {
|
|
||||||
$self->session->errorHandler->warn("Cannot connect to DatabaseLink [".$self->getId."]");
|
|
||||||
}
|
|
||||||
$self->{_dbh} = $dbh;
|
|
||||||
return $self->{_dbh};
|
|
||||||
} else {
|
|
||||||
$self->session->errorHandler->warn("DatabaseLink [".$self->getId."] The DSN specified is of an improper format.");
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
my ($scheme, $driver, $attr_string, $attr_hash, $driver_dsn) = DBI->parse_dsn($dsn);
|
||||||
|
if ($driver) {
|
||||||
|
my $dbh = WebGUI::SQL->connect($self->session,$dsn,$username,$identifier,$parameters);
|
||||||
|
unless (defined $dbh) {
|
||||||
|
$self->session->errorHandler->warn("Cannot connect to DatabaseLink [".$self->getId."]");
|
||||||
|
}
|
||||||
|
$self->{_dbh} = $dbh;
|
||||||
|
return $self->{_dbh};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$self->session->errorHandler->warn("DatabaseLink [".$self->getId."] The DSN specified is of an improper format.");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ sub _setDataByQuery {
|
||||||
$sth = $dbh->read($sql,$placeholders);
|
$sth = $dbh->read($sql,$placeholders);
|
||||||
}
|
}
|
||||||
my $defaultPageNumber = $self->getPageNumber;
|
my $defaultPageNumber = $self->getPageNumber;
|
||||||
$self->{_totalRows} = $sth->rows;
|
|
||||||
$self->{_columnNames} = [ $sth->getColumnNames ];
|
$self->{_columnNames} = [ $sth->getColumnNames ];
|
||||||
my $pageCount = 1;
|
my $pageCount = 1;
|
||||||
while (my $data = $sth->hashRef) {
|
while (my $data = $sth->hashRef) {
|
||||||
|
|
@ -125,6 +124,7 @@ sub _setDataByQuery {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$self->{_totalRows} = $sth->rows;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$self->{_rowRef} = \@row;
|
$self->{_rowRef} = \@row;
|
||||||
#Purposely do not set $self->{_setByQuery} = 1 so the data is processed appropriately
|
#Purposely do not set $self->{_setByQuery} = 1 so the data is processed appropriately
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue