Re: [sqlite] How to invoke successive SQLite script files
On Thu, 15 Jul 2010 19:14:20 + (UTC), c...@comcast.net wrote: > > >Thanks Kees for your response. > >I tried embedding the ".read" command into my sql script files and it appears >to work fine. > > > >One thing I don't like is having to specify the >full path (relative to where I'm invoking SQLite3 from) >to each file I reference in the scripts I invoke with ".read". > >Is there a way to set a temp variable in a script file that I can use to >specify a file path? >Then I could use that temp var in the file path. No. But you can make your script directory the current directory, first: cd /path/to/scriptdir sqlite3 /path/to/database/dbfile /path/to/outfile scriptA: : .read script-B etcetera -- ( Kees Nuyt ) c[_] ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to invoke successive SQLite script files
Thanks Kees for your response. I tried embedding the ".read" command into my sql script files and it appears to work fine. One thing I don't like is having to specify the full path (relative to where I'm invoking SQLite3 from) to each file I reference in the scripts I invoke with ".read". Is there a way to set a temp variable in a script file that I can use to specify a file path? Then I could use that temp var in the file path. Thanks Chris - Original Message - From: "Kees Nuyt" To: sqlite-users@sqlite.org Sent: Thursday, July 15, 2010 11:29:48 AM Subject: Re: [sqlite] How to invoke successive SQLite script files On Thu, 15 Jul 2010 17:54:38 + (UTC), c...@comcast.net wrote: > > > >I have a file which contains SQLite and SQLite/SQL commands. > >I can invoke that file and successfully execute all >of the commands in that file by starting a SQLite cmd >line session and using the ".read" command. > >I'll refer to that as script-C. > > >What I would like to do is create a higher level command file (script-A) >which not only contains SQLite and SQLite/SQL commands , but will also >invoke script-C; and script-B, and other yet-to-be created scripts >(in the future). > >My question is, what command do I use in script-A to >invoke script-C, script-B, etc? Invoke script-A this way: sqlite3 yourdbfile outputfile and in script-A, use : .read script-C : .read script-B : You can even change the output file on the fly with: .output FILENAME and back to the redirection with: .output stdout -- ( Kees Nuyt ) c[_] ___ 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
Re: [sqlite] How to invoke successive SQLite script files
On Thu, 15 Jul 2010 17:54:38 + (UTC), c...@comcast.net wrote: > > > >I have a file which contains SQLite and SQLite/SQL commands. > >I can invoke that file and successfully execute all >of the commands in that file by starting a SQLite cmd >line session and using the ".read" command. > >I'll refer to that as script-C. > > >What I would like to do is create a higher level command file (script-A) >which not only contains SQLite and SQLite/SQL commands , but will also >invoke script-C; and script-B, and other yet-to-be created scripts >(in the future). > >My question is, what command do I use in script-A to >invoke script-C, script-B, etc? Invoke script-A this way: sqlite3 yourdbfile outputfile and in script-A, use : .read script-C : .read script-B : You can even change the output file on the fly with: .output FILENAME and back to the redirection with: .output stdout -- ( Kees Nuyt ) c[_] ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to invoke successive SQLite script files
Regarding: "My question is, what command do I use in script-A to invoke script-C, script-B, etc? Is it the same ".read" command? " I believe it does work that way. What did you get when you tried it? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to invoke successive SQLite script files
I have a file which contains SQLite and SQLite/SQL commands. I can invoke that file and successfully execute all of the commands in that file by starting a SQLite cmd line session and using the ".read" command. I'll refer to that as script-C. What I would like to do is create a higher level command file (script-A) which not only contains SQLite and SQLite/SQL commands , but will also invoke script-C; and script-B, and other yet-to-be created scripts (in the future). My question is, what command do I use in script-A to invoke script-C, script-B, etc? Is it the same ".read" command? Thank you in advance to anyone who responds. -Chris ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users