summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/CPANPLUS/Internals/Source/SQLite.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CPANPLUS/Internals/Source/SQLite.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/CPANPLUS/Internals/Source/SQLite.pm62
1 files changed, 55 insertions, 7 deletions
diff --git a/Master/tlpkg/tlperl/lib/CPANPLUS/Internals/Source/SQLite.pm b/Master/tlpkg/tlperl/lib/CPANPLUS/Internals/Source/SQLite.pm
index a0ddf499bf6..556be6456d5 100644
--- a/Master/tlpkg/tlperl/lib/CPANPLUS/Internals/Source/SQLite.pm
+++ b/Master/tlpkg/tlperl/lib/CPANPLUS/Internals/Source/SQLite.pm
@@ -51,9 +51,17 @@ CPANPLUS::Internals::Source::SQLite - SQLite implementation
{ AutoCommit => 1 }
);
#$Dbh->dbh->trace(1);
+ $Dbh->query(qq{PRAGMA synchronous = OFF});
return $Dbh;
};
+
+ sub __sqlite_disconnect {
+ return unless $Dbh;
+ $Dbh->disconnect;
+ $Dbh = undef;
+ return;
+ }
}
{ my $used_old_copy = 0;
@@ -79,6 +87,7 @@ CPANPLUS::Internals::Source::SQLite - SQLite implementation
$used_old_copy = 0;
### chuck the file
+ $self->__sqlite_disconnect;
1 while unlink $self->__sqlite_file;
### and create a new one
@@ -118,7 +127,7 @@ CPANPLUS::Internals::Source::SQLite - SQLite implementation
sub _standard_trees_completed { return $used_old_copy }
sub _custom_trees_completed { return }
### finish transaction
- sub _finalize_trees { $_[0]->__sqlite_dbh->query('COMMIT'); return 1 }
+ sub _finalize_trees { $_[0]->__sqlite_dbh->commit; return 1 }
### saves current memory state, but not implemented in sqlite
sub _save_state {
@@ -155,8 +164,8 @@ CPANPLUS::Internals::Source::SQLite - SQLite implementation
### keep counting how many we inserted
unless( ++$txn_count % TXN_COMMIT ) {
#warn "Committing transaction $txn_count";
- $dbh->query('COMMIT') or error( $dbh->error ); # commit previous transaction
- $dbh->query('BEGIN') or error( $dbh->error ); # and start a new one
+ $dbh->commit or error( $dbh->error ); # commit previous transaction
+ $dbh->begin_work or error( $dbh->error ); # and start a new one
}
$dbh->query(
@@ -201,8 +210,8 @@ CPANPLUS::Internals::Source::SQLite - SQLite implementation
### keep counting how many we inserted
unless( ++$txn_count % TXN_COMMIT ) {
#warn "Committing transaction $txn_count";
- $dbh->query('COMMIT') or error( $dbh->error ); # commit previous transaction
- $dbh->query('BEGIN') or error( $dbh->error ); # and start a new one
+ $dbh->commit or error( $dbh->error ); # commit previous transaction
+ $dbh->begin_work or error( $dbh->error ); # and start a new one
}
$dbh->query(
@@ -264,7 +273,7 @@ sub __sqlite_create_db {
my $self = shift;
my $dbh = $self->__sqlite_dbh;
- ### we can ignore the result/error; not all sqlite implemantation
+ ### we can ignore the result/error; not all sqlite implementations
### support this
$dbh->query( qq[
DROP TABLE IF EXISTS author;
@@ -319,7 +328,46 @@ sub __sqlite_create_db {
error( $dbh->error );
return;
};
-
+
+ $dbh->query( qq[
+ /* the module index */
+ CREATE INDEX IX_module_module ON module (
+ module
+ );
+
+ \n]
+
+ ) or do {
+ error( $dbh->error );
+ return;
+ };
+
+ $dbh->query( qq[
+ /* the version index */
+ CREATE INDEX IX_module_version ON module (
+ version
+ );
+
+ \n]
+
+ ) or do {
+ error( $dbh->error );
+ return;
+ };
+
+ $dbh->query( qq[
+ /* the module-version index */
+ CREATE INDEX IX_module_module_version ON module (
+ module, version
+ );
+
+ \n]
+
+ ) or do {
+ error( $dbh->error );
+ return;
+ };
+
return 1;
}