in reply to Re: SQLite select wont' return records
in thread SQLite select won't return SELECTed records

I can't use die because all errors need to be logged to a file. My writeerr() routine usually logs errors to a file but I simplified it for this post to only do a print.

Also, the table was not created with a username or password. So why would I need them? This is a table stored in a file in the same dir as the Perl program.

And I thought the docs said that RaiseError was on by default.

Ok I added the RaiseError and PrintError options where you suggested. I got no errors printed and the same thing happens: In doaddsqlite() no records are selected so dupe records are added to the table. dbish still shows there are records in the table. I double checked.

  • Comment on Re^2: SQLite select wont' return records

Replies are listed 'Best First'.
Re^3: SQLite select wont' return records
by Corion (Patriarch) on Oct 16, 2014 at 13:16 UTC

    Either reopen STDERR to the file or use File::Tee to duplicate the output to a file if you want errors to (also) go to a file.

    If you don't need a username, don't pass one in. Also note that SQLite has no concept of permissions at all.

      I didn't mean SQLite permissions, I meant unix permissions for the test.db file.
Re^3: SQLite select wont' return records
by GrandFather (Saint) on Oct 16, 2014 at 19:24 UTC
    I can't use die because all errors need to be logged to a file.

    Actually, no. Think of die as though it were an exception throw and use eval to catch errors:

    eval { ... return 1; } or do { my $err = $@; WriteErr("$err"); };
    Perl is the programming world's equivalent of English