summaryrefslogtreecommitdiffstats
path: root/bin/add_book.pl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/add_book.pl')
-rwxr-xr-xbin/add_book.pl15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/add_book.pl b/bin/add_book.pl
new file mode 100755
index 0000000..13cf934
--- /dev/null
+++ b/bin/add_book.pl
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use strict 'vars';
+
+use DBI;
+
+my $dbfile = 'ksiazki.db';
+my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "");
+
+my$sth=$dbh->prepare("select * from ksiazki where id=(select max(id) from ksiazki)");
+$sth->execute;
+(my @dupa)=$sth->fetchall_arrayref;
+my $max_id = ${$dupa[0]}[0][0];