note 109254 added to ref.sqlite
| From: | jeffphp at NO_SPAMjeff-h dot com | Date: | Fri, 29 Jun 2012 18:01:40 +0000 |
| Subject: | note 109254 added to ref.sqlite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188974@lists.php.net to get a copy of this message | ||
csaba at alum dot mit dot edu 14-Apr-2004 08:16, says when using SQLite's DATABASE ATTACH,
"you should supply the complete database filename."
Plain filenames for the current directory do not work, they must have the full path.
This is how I get around this:
<?php
if (pathinfo ($adbn, PATHINFO_DIRNAME) == ".")
$adbn = pathinfo (realpath(__FILE__), PATHINFO_DIRNAME) . "/" . $adbn;
$sql = "ATTACH DATABASE '$adbn' AS attached_db";
$r = $d->exec($sql);
?>
I have not found a good way to handle relative paths.
----
Server IP: 208.69.120.55
Probable Submitter: 24.235.75.160
----
Manual Page -- http://www.php.net/manual/en/ref.sqlite.php
Edit -- https://master.php.net/note/edit/109254
Del: integrated -- https://master.php.net/note/delete/109254/integrated
Del: useless -- https://master.php.net/note/delete/109254/useless
Del: bad code -- https://master.php.net/note/delete/109254/bad+code
Del: spam -- https://master.php.net/note/delete/109254/spam
Del: non-english -- https://master.php.net/note/delete/109254/non-english
Del: in docs -- https://master.php.net/note/delete/109254/in+docs
Del: other reasons-- https://master.php.net/note/delete/109254
Reject -- https://master.php.net/note/reject/109254
Search -- https://master.php.net/manage/user-notes.php