CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
dbd:sqlite and WAL files


New User

Sep 11, 2013, 4:52 PM

Post #1 of 1 (1230 views)
dbd:sqlite and WAL files Can't Post

Hello, I am trying to write a simple perl program (perl version 5.16.3). I am accessing a SQLite db using WAL. It took me a while but I learned that my connection is only looking at the DB file and not the WAL file. As a result, my queries are not returning the full data set.

the SQLite firefox addon shows 10 invoices in the invoice table. the following program is returning only 8...

use DBD::SQLite;
use DBI;
use Tkx;
use File::Copy;
use PDF::API2;

use constant mm => 25.4 / 72
use constant in => 1 / 72
use constant pt => 1;

# Prompt user for database file location

$dbfile = Tkx::tk___getOpenFile(-

initialdir=>'C:/events_p', -title=>'Please select your current events database file (event.sqlite)');

$dbfile =~ s/\//\\/g;

# Initialiatize path variables
# parse out the db filename and path

# Error and exit if incorrect DB filename was selected

if ($DbFilename ne 'event.sqlite')
print "\n**** ERROR ****, Invalid Database Filename Selected\n";

print " You MUST select the filename called event.sqlite\n";


# Connect to the Database
my $dbh2 = DBI->connect("dbi:SQLite:$dbfile", "", "",{RaiseError => 1, AutoCommit => 1}) or die $DBI::errstr;;

$dbh2->do('PRAGMA journal_mode=WAL');

my $sth = $dbh2->prepare("SELECT count(*) from Invoice");

while (@data = $sth->fetchrow_array())

print "count=$data[0]\n";



If I go into the firefox add on and run a checkpoint , the 2 new invoices get flushed from the WL to the db file and then my program sees them

what am I doing wrong where my script is only looking at the db file and not the WAL file?



(This post was edited by johnp12 on Sep 11, 2013, 4:53 PM)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives