Re: [sqlite] Automating the build of a sqlite database

2011-04-23 Thread Mihai Militaru
On Sat, 23 Apr 2011 19:06:02 +0200
Roger Andersson  wrote:

> > On Unices I use: "sqlite3.exe default.db3<  schema.sql" as exemplified by 
> > DRH (IIRC), but I guess
> > there's no way to do something similar on Windows cmd?
> >
> Have you tried exactly the same on Windows cmd?

I'm sorry for the typo, my executable is "sqlite3", not "sqlite3.exe".

To answer your question: no, I haven't had tried that on plain cmd at the time 
I wrote the
message. Being intrigued by your question, I discovered it actually works...
(I normally use MSYS when I need something done in command-line on Windows)

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


Re: [sqlite] Automating the build of a sqlite database

2011-04-23 Thread Random Coder
On Fri, Apr 22, 2011 at 8:18 AM, Maurice Marinus
 wrote:
> On a windows platform I have the following:
> schema.sql (contains the sql scripts)
> sqlite3.exe (command shell for sqlite -> downloaded from sqlite.org)
> build.bat : A batch file containing the line : sqlite3.exe -init
> schema.sql default.db3

I use something like the following to create a sqlite database as part
of a larger build system:

sqlite3.exe output.sqlite ".read output.sql"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Automating the build of a sqlite database

2011-04-23 Thread Roger Andersson
  On 04/23/11 06:50 PM, Mihai Militaru wrote:
> On Sat, 23 Apr 2011 12:17:54 -0400
> Tom Holden  wrote:
>
> On Unices I use: "sqlite3.exe default.db3<  schema.sql" as exemplified by DRH 
> (IIRC), but I guess
> there's no way to do something similar on Windows cmd?
>
Have you tried exactly the same on Windows cmd?
/Roger
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Automating the build of a sqlite database

2011-04-23 Thread Simon Slavin

On 22 Apr 2011, at 4:18pm, Maurice Marinus wrote:

> When I run build.bat, the database is created as expected, however, the 
> sqlite shell doesn't automatically terminate. So how would I get the 
> batch file to run and terminate the sqlite command shell automatically?
> 
> Output shown on the dos command prompt after executing build.bat
> 
> C:\Work\X\Database>sqlite3.exe -init schema.sql default.db3

Rather than use '-init', which is intended for what you describe -- initial 
commands -- you should be able to pipe those commands into the shell tool.  Try 
something like

sqlite3 default.db3 < schema.sql

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


Re: [sqlite] Automating the build of a sqlite database

2011-04-23 Thread Mihai Militaru
On Sat, 23 Apr 2011 12:17:54 -0400
Tom Holden  wrote:

> Perhaps by adding 
> .quit
> to your schema.sql
I tried this and it does not work, no error but it enters interactive mode once 
more. Also, the
necessity to add sqlite shell commands to the file would pervert the pure SQL 
schema if it worked.
But quit can (should?) be appended to each batch command as an argument for 
sqlite3.exe:

sqlite3.exe -init schema.sql default.db3 ".quit"

On Unices I use: "sqlite3.exe default.db3 < schema.sql" as exemplified by DRH 
(IIRC), but I guess
there's no way to do something similar on Windows cmd?

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


Re: [sqlite] Automating the build of a sqlite database

2011-04-23 Thread Tom Holden
Perhaps by adding 
.quit
to your schema.sql

Tom

-Original Message- 
From: Maurice Marinus 
Sent: Friday, April 22, 2011 11:18 AM 
To: sqlite-users@sqlite.org 
Subject: [sqlite] Automating the build of a sqlite database 

So how would I get the 
batch file to run and terminate the sqlite command shell automatically?

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


Re: [sqlite] Automating the build of a sqlite database

2011-04-23 Thread Igor Tandetnik
Maurice Marinus  wrote:
> On a windows platform I have the following:
> schema.sql (contains the sql scripts)
> sqlite3.exe (command shell for sqlite -> downloaded from sqlite.org)
> build.bat : A batch file containing the line : sqlite3.exe -init
> schema.sql default.db3
> 
> When I run build.bat, the database is created as expected, however, the
> sqlite shell doesn't automatically terminate.

Put ".exit" (without quotes, and with a period in front) as the last line of 
the script.
-- 
Igor Tandetnik

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


[sqlite] Automating the build of a sqlite database

2011-04-23 Thread Maurice Marinus
On a windows platform I have the following:
schema.sql (contains the sql scripts)
sqlite3.exe (command shell for sqlite -> downloaded from sqlite.org)
build.bat : A batch file containing the line : sqlite3.exe -init 
schema.sql default.db3

When I run build.bat, the database is created as expected, however, the 
sqlite shell doesn't automatically terminate. So how would I get the 
batch file to run and terminate the sqlite command shell automatically?

Output shown on the dos command prompt after executing build.bat

C:\Work\X\Database>sqlite3.exe -init schema.sql default.db3
-- Loading resources from schema.sql
SQLite version 3.7.4
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>


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