Jeff Flowers wrote:
> On Tue, 7 Dec 2004 18:57:18 -0800, "Scott Leighton"
> <[EMAIL PROTECTED]> said:
>> On Tuesday 07 December 2004 10:28 am, Jeff Flowers wrote:
>>> Is it possible to set the .width option when calling the sqlite
>>> frontend? I was surprised that there wasn't a options to do this,
>>> something like:
>>>
>>> sqlite3 -column -header -width '30 30 5 5' dbname
>>>
>>>
>>
>> You didn't mention your OS, but I know on Linux you
>> can set whatever defaults you want in .sqliterc
>> and the commandline utility uses them.
>>
>> Not sure if this is also true on the Win platform tho.
>>
>>   Scott
>
> I'm using Mac OS X, which means I am basically running on Unix. Are
> the commands in the .sqliterc the same as I would type them in
> interactively?

Jeff,

Yes, you use the same commands.

You should be aware that .sqliterc is executed everytime sqlite is started.
You may not always want the columns set to these widths.

For your pruposes the -init filename option may be more suitable. You can
use this to read and execute the commands in the specified file before
executing the SQL on the command line (or entering interactive mode).

You could use a command like:

sqlite3 -init setup dbname "select * from ..."

to execute the commands in the file setup before executing the SQL statement
on the command line. Of course, if you always execute the same query (or
queries) they could be moved into the command file.

You can also execute commands in a file using the .read meta command on the
command line, or by redirecting input from a command file.

sqlite3 dbname ".read cmdfile"
sqlite3 dbname <cmdfile

All the commands with SQL statements (or meta commands like .read) specified
on the command line will run sqlite, execute that one command and then exit.
Command lines without an SQL statement will start sqlite, execute the
initialization commands, then enter interactive mode.

Reply via email to