I read this guys post on the yahoo groups site,
http://groups.yahoo.com/group/sqlite/message/4528

He said this: 

I've solved the "no such table: " problem.
I had a filename that was sometimes not properly NULL terminated.
Along with /path/databasename there were a few
/path/databasenameplusjunk files.

The problem is, my 4 line test script works fine, and when I try to do
the same thing in another larger script it blows up..

Help me please before I am forced to install mysql...

-----Original Message-----
From: Freeman, Michael 
Sent: Friday, October 08, 2004 1:03 PM
To: [EMAIL PROTECTED]
Subject: [sqlite] still having problems with DBD::SQLite2

I am still having problems with a script trying to use SQLite2. My 4
line test script works fine, but my other code keeps giving me DBI
errors saying it can't find the table. Here is what I get in the DBI
trace.

 

    !! ERROR: 1 'no such table: trapdlog(1) at dbdimp.c line 412'
(err#0)

    <- execute('1094662322' '3' ...)= undef at logwiz.pl line 377

DBD::SQLite2::st execute failed: no such table: trapdlog(1) at dbdimp.c
line 412 at ./logwiz.pl line 377.

no such table: trapdlog(1) at dbdimp.c line 412 at ./logwiz.pl line 377.

    <- disconnect_all= '' at DBI.pm line 674

       ERROR: 1 'no such table: trapdlog(1) at dbdimp.c line 412'
(err#0)

!   <- DESTROY(DBI::st=HASH(79dd10))= undef during global destruction

 

The code I'm using:

 

my $lite_dbh = &sqlite_connect();

 

# prepare the update statement

my $lite_sth_update = $lite_dbh->prepare( q{ UPDATE trapdlog SET status
= ? WHERE node = ? } )

    or syslog_die($DBI::errstr);

 

# prepare the insert statement

my $lite_sth_insert = $lite_dbh->prepare( q{ INSERT INTO trapdlog
(epochtime, trap_category,

                                                trap_create_time,
ip_hostname, trap_source,

                                                description, status)
VALUES (?,?,?,?,?,?,?) } )

    or syslog_die($DBI::errstr);

 

# prepare the select statement

my $lite_sth_select = $lite_dbh->prepare( q{ SELECT status FROM trapdlog
WHERE node = ? } )

    or syslog_die($DBI::errstr);

 

 

       $lite_sth_select->execute($node) or die $DBI::errstr;

        my $status = $lite_sth_select->fetchrow;

 

 

            $lite_sth_update->execute("$node","CLEAR") or die
$DBI::errstr;

 

              $lite_sth_insert->execute("$epochtime","$trap_category",
"$t_date",

                                            "$node", "$trap_source",
"$ndescription",

                                            "DOWN") or die $DBI::errstr;

 

sub sqlite_connect {

    # need to add code in here to check that the database exists. if it
does not we

    # will create it. *thought*.

        my $sqlite_dbh =
DBI->connect("dbi:SQLite2:dbname=trapdlog.db","","")

            or die $DBI::errstr;

 

    return $sqlite_dbh;

}

 

*** Note new e-mail address

--

Michael J. Freeman

Netco Government Services

[EMAIL PROTECTED]

--

 


Reply via email to