Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Update: DBD::SQLite 1.14 now uses sqlite3_prepare_v2 and this problem has gone away. MattSargeant++

I just dist-upgraded my system and have since encountered the SQLite "database schema has changed" error in an application that worked prior to the upgrade.

The "change" involved is running ANALYZE which invalidates prepared statement handles (see the SQLite FAQ). Unfortunately, I don't control what is prepared where as I use Class::DBI so I'm looking to either revert to a working set of modules or work around the problem at a lower level.

Does the code below reproduce the problem for other people?
Any tips on same versions or work-arounds?
#!/usr/bin/perl use strict; use warnings; use DBI; unlink "a.db"; my $dbh = DBI->connect("dbi:SQLite:dbname=a.db") or die; print '$DBI::VERSION ',$DBI::VERSION, "\n"; print '$DBD::SQLite::VERSION ',$DBD::SQLite::VERSION, "\n"; $dbh->do("create table a as select 123 as b"); my $sth = $dbh->prepare('select "hello" from a'); $dbh->do("analyze"); print "got ", $dbh->selectrow_array($sth), "\n"; $sth->finish; #undef $sth; # to stop "closing dbh with active statement handles" # $dbh->disconnect; __END__ $ perl $DBI::VERSION 1.53 $DBD::SQLite::VERSION 1.13 DBD::SQLite::db selectrow_array failed: database schema has changed(1) + at dbdimp.c line 421 at line 16. got
Update: I'm starting to think that the changes during the upgrade causing this problem to manifest were at the Class::DBI/Ima::DBI level. On my laptop I get an error for the above but an older version is the application (using ANALYZE) is fine. I'll compare versions tomorrow.
$DBI::VERSION 1.51 $DBD::SQLite::VERSION 1.12 DBD::SQLite::db selectrow_array failed: database schema has changed(1) + at dbdimp.c line 416 at - line 16. got

In reply to Upgraded SQLite: "database changed" error by bsb

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2023-12-01 03:50 GMT
Find Nodes?
    Voting Booth?

    No recent polls found