mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 22:28:47 -04:00
Minor tweaks
This commit is contained in:
parent
44e971c64b
commit
5e7f3ea9a6
1 changed files with 9 additions and 6 deletions
|
@ -6,10 +6,12 @@ use DBI 1.43 ();
|
||||||
use DynaLoader ();
|
use DynaLoader ();
|
||||||
|
|
||||||
use vars qw($VERSION @ISA);
|
use vars qw($VERSION @ISA);
|
||||||
use vars qw{$err $errstr $state $drh $sqlite_version};
|
use vars qw{$err $errstr $drh $sqlite_version};
|
||||||
BEGIN {
|
BEGIN {
|
||||||
$VERSION = '1.19_08';
|
$VERSION = '1.19_08';
|
||||||
@ISA = ('DynaLoader');
|
@ISA = ('DynaLoader');
|
||||||
|
|
||||||
|
# Driver singleton
|
||||||
$drh = undef;
|
$drh = undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,19 +45,19 @@ sub connect {
|
||||||
Name => $dbname,
|
Name => $dbname,
|
||||||
} );
|
} );
|
||||||
|
|
||||||
my $real_dbname = $dbname;
|
my $real = $dbname;
|
||||||
if ( $dbname =~ /=/ ) {
|
if ( $dbname =~ /=/ ) {
|
||||||
foreach my $attrib ( split(/;/, $dbname ) ) {
|
foreach my $attrib ( split(/;/, $dbname ) ) {
|
||||||
my ($k, $v) = split(/=/, $attrib, 2);
|
my ($k, $v) = split(/=/, $attrib, 2);
|
||||||
if ($k eq 'dbname') {
|
if ($k eq 'dbname') {
|
||||||
$real_dbname = $v;
|
$real = $v;
|
||||||
} else {
|
} else {
|
||||||
# TODO: add to attribs
|
# TODO: add to attribs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBD::SQLite::db::_login($dbh, $real_dbname, $user, $auth)
|
|
||||||
or return undef;
|
DBD::SQLite::db::_login($dbh, $real, $user, $auth) or return undef;
|
||||||
|
|
||||||
# install perl collations
|
# install perl collations
|
||||||
my $perl_collation = sub {$_[0] cmp $_[1]};
|
my $perl_collation = sub {$_[0] cmp $_[1]};
|
||||||
|
@ -442,6 +444,7 @@ updates:
|
||||||
use DBI qw(:sql_types);
|
use DBI qw(:sql_types);
|
||||||
$dbh->{unicode} = 1;
|
$dbh->{unicode} = 1;
|
||||||
my $sth = $dbh->prepare("INSERT INTO mytable (blobcolumn) VALUES (?)");
|
my $sth = $dbh->prepare("INSERT INTO mytable (blobcolumn) VALUES (?)");
|
||||||
|
|
||||||
# Binary_data will be stored as is.
|
# Binary_data will be stored as is.
|
||||||
$sth->bind_param(1, $binary_data, SQL_BLOB);
|
$sth->bind_param(1, $binary_data, SQL_BLOB);
|
||||||
|
|
||||||
|
@ -649,7 +652,7 @@ but what surprised me most of all was:
|
||||||
ORDER BY count desc
|
ORDER BY count desc
|
||||||
LIMIT 20
|
LIMIT 20
|
||||||
|
|
||||||
To discover the top 20 hit URLs on the site (http://axkit.org), and it
|
To discover the top 20 hit URLs on the site (L<http://axkit.org>), and it
|
||||||
returned within 2 seconds. I'm seriously considering switching my log
|
returned within 2 seconds. I'm seriously considering switching my log
|
||||||
analysis code to use this little speed demon!
|
analysis code to use this little speed demon!
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue