Well, I've ran the following test code with tracing enabled. The code is:

#!/usr/bin/perl -w package TEST; BEGIN { $|=1; use CGI::Carp('fatalsToBrowser'); } ### Load Required Modules ### use strict; use DBI; use CGI qw/:standard/; ### Variable init. ### $TEST::CGI = new CGI; print $TEST::CGI->header; my $db = "/hsphere/local/home/katom/bnei-yehuda.co.il/texts/SheepWool/ +test.db"; my $log = "/hsphere/local/home/katom/bnei-yehuda.co.il/texts/SheepWool +/test.log"; unlink $log if -e $log; my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","", { RaiseError => +1 }) or die $DBI::errstr; DBI->trace(6, $log); print "Preparing and executing CREATE TABLE statement.<br>"; my $sth = $dbh->prepare(" CREATE TABLE users ( id INTEGER NOT NULL, name VARCHAR(128) ) " ); $sth->execute; print "Preparing and executing INSERT statement.<br>"; my $username = $dbh->quote("ido50"); $sth = $dbh->prepare(" INSERT INTO users VALUES (1, $username) "); $sth->execute; print "Preparing and executing a SELECT statement.<br>"; $sth = $dbh->prepare(" SELECT * FROM users WHERE id = 1 "); $sth->execute; my @row = $sth->fetchrow_array; $sth->finish; $dbh->disconnect; exit;
The output from trace() is as follows (I don't see nothing out of order, though I don't have any experience with tracing):

DBI 1.28-nothread dispatch trace level set to 6 -> prepare for DBD::SQLite::db (DBI::db=HASH(0x81e8f78)~0x81e89a4 +' CREATE TABLE users ( id INTEGER NOT NULL, name VARCHAR(128) ) ') New DBI::st (for DBD::SQLite::st, parent=DBI::db=HASH(0x81e89a4), +id=) dbih_setup_handle(DBI::st=HASH(0x81d7478)=>DBI::st=HASH(0x805b270) +, DBD::SQLite::st, 81d7484, Null!) dbih_make_com(DBI::db=HASH(0x81e89a4), DBD::SQLite::st, 124) dbih_setup_attrib(DBI::st=HASH(0x805b270), Err, DBI::db=HASH(0x81e +89a4)) SCALAR(0x80fc7b4) (already defined) dbih_setup_attrib(DBI::st=HASH(0x805b270), State, DBI::db=HASH(0x8 +1e89a4)) SCALAR(0x80fc79c) (already defined) dbih_setup_attrib(DBI::st=HASH(0x805b270), Errstr, DBI::db=HASH(0x +81e89a4)) SCALAR(0x80fc7cc) (already defined) dbih_setup_attrib(DBI::st=HASH(0x805b270), Debug, DBI::db=HASH(0x8 +1e89a4)) 0 (already defined) dbih_setup_attrib(DBI::st=HASH(0x805b270), FetchHashKeyName, DBI:: +db=HASH(0x81e89a4)) 'NAME' (already defined) dbih_setup_attrib(DBI::st=HASH(0x805b270), HandleError, DBI::db=HA +SH(0x81e89a4)) undef (not defined) sqlite trace: prepare statement: CREATE TABLE users ( id INTEGER NOT NULL, name VARCHAR(128) ) <- prepare= DBI::st=HASH(0x81d7478) at /path/to/testadmin.pl line +29 -> execute for DBD::SQLite::st (DBI::st=HASH(0x81d7478)~0x805b270) sqlite trace: Execute returned 0 cols <- execute= '0E0' at /path/to/testadmin.pl line 36 -> quote in DBD::_::db for DBD::SQLite::db (DBI::db=HASH(0x81e8f78 +)~0x81e89a4 'ido50') <- quote= ''ido50'' at /path/to/testadmin.pl line 39 -> prepare for DBD::SQLite::db (DBI::db=HASH(0x81e8f78)~0x81e89a4 +' INSERT INTO users VALUES (1, 'ido50') ') New DBI::st (for DBD::SQLite::st, parent=DBI::db=HASH(0x81e89a4), +id=) dbih_setup_handle(DBI::st=HASH(0x8151ae8)=>DBI::st=HASH(0x81d74fc) +, DBD::SQLite::st, 8151ad0, Null!) dbih_make_com(DBI::db=HASH(0x81e89a4), DBD::SQLite::st, 124) dbih_setup_attrib(DBI::st=HASH(0x81d74fc), Err, DBI::db=HASH(0x81e +89a4)) SCALAR(0x80fc7b4) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d74fc), State, DBI::db=HASH(0x8 +1e89a4)) SCALAR(0x80fc79c) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d74fc), Errstr, DBI::db=HASH(0x +81e89a4)) SCALAR(0x80fc7cc) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d74fc), Debug, DBI::db=HASH(0x8 +1e89a4)) 0 (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d74fc), FetchHashKeyName, DBI:: +db=HASH(0x81e89a4)) 'NAME' (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d74fc), HandleError, DBI::db=HA +SH(0x81e89a4)) undef (not defined) sqlite trace: prepare statement: INSERT INTO users VALUES (1, 'ido50') <- prepare= DBI::st=HASH(0x8151ae8) at /path/to/testadmin.pl line +40 <> DESTROY ignored for outer handle DBI::st=HASH(0x81d7478) (inner + DBI::st=HASH(0x805b270)) -> DESTROY for DBD::SQLite::st (DBI::st=HASH(0x805b270)~INNER) <- DESTROY= undef at /path/to/testadmin.pl line 43 dbih_clearcom (h 0x81d7478, com 0x81ce180): FLAGS 0x191: COMSET Warn RaiseError PrintError TYPE 3 PARENT DBI::db=HASH(0x81e89a4) KIDS 0 (0 Active) IMP_DATA undef in 'DBD::SQLite::st' NUM_OF_FIELDS 0 NUM_OF_PARAMS 0 dbih_clearcom 0x81d7478 (com 0x81ce180, type 3) done. -> execute for DBD::SQLite::st (DBI::st=HASH(0x8151ae8)~0x81d74fc) sqlite trace: Execute returned 0 cols <- execute= 1 at /path/to/testadmin.pl line 43 -> prepare for DBD::SQLite::db (DBI::db=HASH(0x81e8f78)~0x81e89a4 +' SELECT * FROM users WHERE id = 1 ') New DBI::st (for DBD::SQLite::st, parent=DBI::db=HASH(0x81e89a4), +id=) dbih_setup_handle(DBI::st=HASH(0x81d7544)=>DBI::st=HASH(0x81d7538) +, DBD::SQLite::st, 81d7550, Null!) dbih_make_com(DBI::db=HASH(0x81e89a4), DBD::SQLite::st, 124) dbih_setup_attrib(DBI::st=HASH(0x81d7538), Err, DBI::db=HASH(0x81e +89a4)) SCALAR(0x80fc7b4) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d7538), State, DBI::db=HASH(0x8 +1e89a4)) SCALAR(0x80fc79c) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d7538), Errstr, DBI::db=HASH(0x +81e89a4)) SCALAR(0x80fc7cc) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d7538), Debug, DBI::db=HASH(0x8 +1e89a4)) 0 (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d7538), FetchHashKeyName, DBI:: +db=HASH(0x81e89a4)) 'NAME' (already defined) dbih_setup_attrib(DBI::st=HASH(0x81d7538), HandleError, DBI::db=HA +SH(0x81e89a4)) undef (not defined) sqlite trace: prepare statement: SELECT * FROM users WHERE id = 1 <- prepare= DBI::st=HASH(0x81d7544) at /path/to/testadmin.pl line +46 <> DESTROY ignored for outer handle DBI::st=HASH(0x8151ae8) (inner + DBI::st=HASH(0x81d74fc)) -> DESTROY for DBD::SQLite::st (DBI::st=HASH(0x81d74fc)~INNER) <- DESTROY= undef at /path/to/testadmin.pl line 50 dbih_clearcom (h 0x8151ae8, com 0x81cce80): FLAGS 0x191: COMSET Warn RaiseError PrintError TYPE 3 PARENT DBI::db=HASH(0x81e89a4) KIDS 0 (0 Active) IMP_DATA undef in 'DBD::SQLite::st' NUM_OF_FIELDS 0 NUM_OF_PARAMS 0 dbih_clearcom 0x8151ae8 (com 0x81cce80, type 3) done. -> execute for DBD::SQLite::st (DBI::st=HASH(0x81d7544)~0x81d7538) sqlite trace: Execute returned 2 cols sqlite trace: exec ok - 0 rows, 2 cols <- execute= '0E0' at /path/to/testadmin.pl line 50 -> fetchrow_array for DBD::SQLite::st (DBI::st=HASH(0x81d7544)~0x8 +1d7538) sqlite trace: numFields == 2, nrow == 0 dbih_setup_fbav for 2 fields => 0x81d74f0
Any thoughts?
Thanks.

-------------------------
Live fat, die young

In reply to Re^4: DBI Fetches don't work by ido50
in thread DBI Fetches don't work by ido50

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.