Bill Hernandez <[EMAIL PROTECTED]> writes:
> I tried finding a pragma command for .headers on, but didn't have any luck.
>
> sqlite> .headers on | .mode column customers | select * from customers ;
> I also tried :
>
> sqlite> select * from customers ; < .headers off
>
> and that didn't work either
>
You're mixing (incorrect use of) shell pipe commands with commands to the
sqlite shell in these examples.
> The reason I am trying to do this in one call rather than using multiple
> lines is that one "do shell script" call is totally independent from the
> next, unlike scripting to a shell window which I don't want to do.
>
> sqlite> .headers on
> sqlite> .mode column customers
> sqlite> select * from customers ;
>
> is that I am calling it from Applescript, and one "do shell script" to
> sqlite doesn't have a clue what the previous one did.
I don't know what capability Applescript has. The easy way to do it with a
script in the various Linux shell languages is with a "HERE" document, where
the input to the command is redirected from the block of lines which follows
the command. In your case, you'd do something like:
sqlite3 filename.db <<'EOF'
.headers on
.mode column customers
select * from customers ;
EOF
If Applcscript doesn't support HERE documents (it's unlikely it does), you can
accomplish something similar with redirecting from a separate file. I would
hope it has that capability. You'd then do something like this to create a
"commands" file:
echo '.headers on' > commands
echo '.mode column customers' >> commands
echo 'select * from customers;' >> commands
and then run sqlite using that command file for input:
sqlite3 filename.db < commands
Hope that helps.
Derrell
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------