> I was under the impression that sqlite2 was supported widely by PHP,
> but sqlite3 seems only to be enabled on php 5.3.0 by default.
>
> My concern now is actually that users may find that their hosting
> service providers don't provide sqlite3 out of the box.

PDO seems to support both versions:
http://us.php.net/manual/en/ref.pdo-sqlite.connection.php

So if it's practical to restrict yourself to features that are
available in both versions, you could probably do something like this:

$db_file = '<filename>';
$dbh = null;

try {
  // prefer sqlite3 if available
  $dbh = new PDO('sqlite:$db_file');
} catch (PDOException $e) {
   // verify that error occurred because sqlite3 is not supported
   try {
       $dbh = new PDO('sqlite2:$db_file');
   } catch (PDOException $e) {
       // bail out gracefully
   }
}

Ben

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to