• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shell Scripting Sqlite
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell Scripting Sqlite


  • Subject: Re: Shell Scripting Sqlite
  • From: BareFeet <email@hidden>
  • Date: Fri, 30 May 2008 11:24:10 +1000

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
  • Follow-Ups:
    • Re: Shell Scripting Sqlite
      • From: Bruce Robertson <email@hidden>
References: 
 >Re: Shell Scripting Sqlite (From: Bruce Robertson <email@hidden>)

  • Prev by Date: AppleMods Loader : The Next Generation
  • Next by Date: Re: Shell Scripting Sqlite
  • Previous by thread: Re: Shell Scripting Sqlite
  • Next by thread: Re: Shell Scripting Sqlite
  • Index(es):
    • Date
    • Thread