Re: Shell Scripting Sqlite
Re: Shell Scripting Sqlite
- Subject: Re: Shell Scripting Sqlite
- From: Bruce Robertson <email@hidden>
- Date: Thu, 29 May 2008 18:46:23 -0700
That's the problem with simplified examples.
I don't want any disk files at all.
I want to do it because I want to hold sqlite databases in Filemaker
variables for reporting purposes.
So I might manipulate a found set or otherwise generate a dataset, store it
in a variable, then perform SQL extractions and manipulations.
> Hi Bruce,
>
>> set cmd to "cat /a.db"
>> Do shell script cmd
>> Set myDB to result
>>
>> MyDB now contains the text of the sqlite database.
>>
>> I want to figure out how to do something this:
>>
>> Do shell script "Echo 'select * from people;' | sqlite3 " & myDB
>
> Why do you want to do that? I don't think you'll get any greater
> efficiency.
>
> You can, of course, just pass it the path in a variable:
>
> set myDBPath to "/a.db"
> do shell script "echo 'select * from people;' | sqlite3 " & quoted
> form of myDBPath
>
> or you can copy the whole database into a memory database in SQLite,
> which SQLite does using the reserved ":memory:" database name:
>
> set myDBPath to "/a.db"
> do shell script "echo 'attach \":memory:\" as MemoryDB; create table
> MemoryDB.People_Copy as select * from people; select * from
> MemoryDB.People_Copy;' | sqlite3 " & quoted form of myDBPath
>
>> That is, how do I pass an a variable to a shell command that is
>> expecting a
>> file?
>
> I don't know if there's a general way to do that, but it doesn't seem
> necessary.
>
> Tom
> BareFeet
> Comparison of SQLite applications for Mac OS X:
> http://www.tandb.com.au/sqlite/compare/?ml
> _______________________________________________
> 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
>
_______________________________________________
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