Re: AppleScript access to databases
Re: AppleScript access to databases
- Subject: Re: AppleScript access to databases
- From: Axel Luttgens <email@hidden>
- Date: Mon, 22 Mar 2010 14:52:46 +0100
Le 22 mars 2010 à 11:32:01, BareFeet a écrit :
> [...]
>
> Thanks for the feedback.
>
> Unfortunately, no, that won't work all commands. I used to do it that way, but soon found it didn't work for all. I think the problem was with those commands that run over multiple lines.
By "multiple lines", you sure must be thinking about something else than this one:
do shell script "/usr/bin/sqlite3 ~/Desktop/test.db " & quoted form of "
create table test(
col1 text,
col2 text
);
insert into test values(
'aaa',
'bbb'
);
select *
from test;
"
--> "aaa|bbb"
Could you remember an example of <sql statements> requiring echo in place of providing it directly as an argument to sqlite3?
>> It may be expected to be slightly more efficient
>
> I doubt that the speed difference would actually be significant.
"Slightly", Sir, I wrote "slightly"... :-)
Never mind, it must just be an inclination of mine.
>> one also should avoid the various prompts from an interactive session
>
> Piping the commands into the sqlite3 command doesn't start an interactive session.
Fine, I didn't know it. Thanks.
>> as well as the possible transformation of <sql statements> by the echo command.
>
> The "quoted form" AppleScript operator seems to take care of that.
Well, this may depend on defaults liable to be too easily overlooked.
For example, assuming the above test.db has been correctly created, I get here:
do shell script "echo " & (quoted form of "
insert into test values(
'c\\x32c',
'ddd'
);
select *
from test;") & " | /usr/bin/sqlite3 ~/Desktop/test.db"
--> "aaa|bbb
cAc|ddd"
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden