Thanks.  I'll add a little more info....

This script is used to set up the initial DB in a programmable device that will then record data to the database and the database should never be replaced. So I just figured there would be a simple way to issue the sqlite commands in script. Even found an example using a createdb command, although I could never see where that was an SQLite command....

So, you suggest I script it like so:

if [ -f /data/newdatabase.db];
then
echo "Nothing to do, database exists"
else
cp newdatabase.db /data/newdatabase.db
fi

I am not much of a Linux guy so the scripting might be wrong.....

Pete Helgren
Value Added Software, Inc
www.asaap.com
www.opensource4i.com


On 8/30/2011 7:38 PM, Simon Slavin wrote:
On 31 Aug 2011, at 2:36am, Pete Helgren wrote:

I have a need to create a database if it doesn't already exist.  The obvious 
solution is to just use:

sqlite3 newdatabase.db

Except that it not only creates the db but also opens that db for commands.
Make yourself an empty database file and keep it somewhere safe.  When you need 
a new one just copy this existing file, and rename and/or move it to the right 
folder.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to