-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbInfo.pl
More file actions
executable file
·31 lines (28 loc) · 889 Bytes
/
dbInfo.pl
File metadata and controls
executable file
·31 lines (28 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl
use CGI qw(:all);
use DBI;
use DateTime;
use DateTime::Format::MySQL;
$q = CGI->new();
my $driver = "SQLite";
my $database = "backgammon.db";
my $dsn = "DBI:$driver:dbname=$database";
my $userid = "";
my $password = "";
my $dbh = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) or die $DBI::errstr;
print $q->header('text/plain');
print "DB version: ", `sqlite3 backgammon.db ".version"`;
print "\n";
print "DB name:";
print "\n";
print "", `sqlite3 backgammon.db ".database"`;
print "\n";
print "Schema:";
print "\n";
print "", `sqlite3 backgammon.db ".schema"`;
print "\n";
print "Number of games played: ", `sqlite3 backgammon.db "select count(*) from results"`;
print "\n";
print "Last game played: ", `sqlite3 backgammon.db "select max(DATETIME) from results"`;
print "\n";
print "Results so far:\n", `sqlite3 backgammon.db "select * from results"`;