Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Ivan Shmakov
> Pete Helgren writes: > I may end up going this direction, at the moment I am not having much > luck with the conditional copy in Busybox. Your suggestion: > cp -n newdatabase.db /data/newdatabase.db > Isn't supported in the version of Busybox that I am running. Also > the script

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Simon Slavin
On 31 Aug 2011, at 3:53am, Pete Helgren wrote: > I may end up going this direction, at the moment I am not having much luck > with the conditional copy in Busybox. Your suggestion: > > cp -n newdatabase.db /data/newdatabase.db > > Isn't supported in the version of Busybox that I am running.

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Jay A. Kreibich
On Tue, Aug 30, 2011 at 08:29:06PM -0600, Pete Helgren scratched on the wall: > The only issue I had was finding an example of how I could do all of > what you describe below in bash script. For example, if I put this > in a script: > > sqlite3 newdatabase.db > > and save that as createdb.sh

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Pete Helgren
I may end up going this direction, at the moment I am not having much luck with the conditional copy in Busybox. Your suggestion: cp -n newdatabase.db /data/newdatabase.db Isn't supported in the version of Busybox that I am running. Also the script example I tried: if [ -f

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Pete Helgren
The only issue I had was finding an example of how I could do all of what you describe below in bash script. For example, if I put this in a script: sqlite3 newdatabase.db and save that as createdb.sh and execute it then the script never completes because SQLite is at the sqlite> prompt,

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Jay A. Kreibich
On Tue, Aug 30, 2011 at 09:54:21PM -0400, Igor Tandetnik scratched on the wall: > 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

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Simon Slavin
Forgot to mention: copying an existing database file also lets you set up the file the way you want without having to issue separate commands. For instance, you could create blank tables. Or set a specific page size. Or include some sort of DRM or security check in the 'blank' file. Simon.

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Simon Slavin
On 31 Aug 2011, at 2:53am, Pete Helgren wrote: > 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

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Igor Tandetnik
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. I am running this from a script so I want

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Pete Helgren
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

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Simon Slavin
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