>> On 3 Feb 2011, at 1:03am, BareFeetWare wrote: >> >> How can I attach to a local file in the same directory, without specifying >> the full absolute path?
> On 03/02/2011, at 12:17 PM, Simon Slavin wrote: > > No easy way. Argh. That's kind of mental, that SQLite, a file based database system, can't in SQL either tell you the path to the main database (eg via a function) or let you open a secondary file in the same directory. > Instead use operating system commands to retrieve the full path to the first > file, then construct a full path to the second file. But if a I have an arbitrary SQL script/procedure to perform, that starts with an attach statement, I don't have creation control over the path specified in the script. For the moment, I've actually had to use a regex to change the SQL script to insert a path if it's missing, but that is unscrambling the egg and will only help my app, not if the database files and script are opened in another app. I am replacing occurrences of: attach\s+'([^/].*?)' with: attach '<directoryPath>/$1' Thanks, Tom BareFeetWare -- Comparison of SQLite GUI tools: http://www.barefeetware.com/sqlite/compare/?ml _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users