Re: Shell Scripting SQLite
Re: Shell Scripting SQLite
- Subject: Re: Shell Scripting SQLite
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 30 May 2008 17:04:51 -0400
Applescript has its own memory. Sqlite has its own memory. They are
separate. Neither can access the internals of the other. Walled off.
Also, the sqlite process doesn't even exist before or after your "do
shell script" command. It is relaunched from scratch every time.
If you want to store a database in AS memory and have sqlite
manipulate it, you've got to pass it through an i/o channel. It
doesn't have to physically go to disk; it can go from AS's memory to
the opeating system's memory to sqlite's memory and back. But it's
still i/o.
On 5/30/08, Bruce Robertson <email@hidden> wrote:
>> On Fri, May 30, 2008 at 1:58 PM, Bruce Robertson <email@hidden> wrote:
>>> The following works to take a sql statement stored in a text field,
>>> convert
>>> the single quotes to double quotes, get it into the clipboard and use
>> pbpaste to send it to sqlite3.
>>
>>> Set Variable [ $$out; Value:"echo '" & Substitute(text::Text; "'"; "\"")
>>> &"'|pbcopy|pbpaste|sqlite3 /newfm.db" ]
>>
>> ?!? Ok, pbcopy generates no output and pbpaste takes no input, so the
>> pipe does nothing. I think you mean this:
>>
>> echo blah | pbcopy
>> pbpaste | sqlite3
>>
>> But pbcopy and pbpaste are doing nothing for you there. You can do
>>
>> echo blah | sqlite3
>>
>> directly. That's nothing special - that's just feeding the contents of
>> an AS variable as standard input to sqlite3. If that's all you want,
>> then I don't know what you've been talking about.
>
> First of all, in my previous attempts, I must have messed up quoting and
> escaping and corrected it while playing with the pbpaste thing got that to
> work.
>
> But I still don't have what I want, which is to hold the database itself in
> a variable.
>
> The above technique works with a "dump" verion of a database. A set of SQL
> instructions.
>
> Send all the instructions to sqlite and make it regenerate the entire
> database and then query it when done. But why do I have to bother with all
> that regeneration?
>
> If I create a memory database, why can't I just store that in a variable?
>
> For that matter there doesn't seem to be a way to even capture a dump of an
> in memory database.
>
>
--
Sent from Gmail for mobile | mobile.google.com
Mark J. Reed <email@hidden>
_______________________________________________
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