• 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: sqlite question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sqlite question


  • Subject: Re: sqlite question
  • From: Andrew Oliver <email@hidden>
  • Date: Tue, 27 Oct 2015 17:01:39 -0700
  • X_v_e_cd: 92dc897815464dca33baa03b5d008022
  • X_v_r_cd: 5ab8bf60bc496b4885ab8ffd19885a0b


On Oct 27, 2015, at 12:56 PM, Jim Weisbin <email@hidden> wrote:

Next, in order to get the other two pieces I need, I cycle through a repeat loop:

repeat with i from 1 to the theDBCount
set directory_name to do shell script “sqlite3 'select dir FROM theTable where ID=" & i & ";’ "
set filename to do shell script “sqlite3 'select filename FROM theTable where ID=" & i & ";’ “
— process stuff here…
end repeat

Again, is there a more efficient way to do this? Perhaps import all the data at once into some sort of dictionary array?

There’s a far more efficient way of doing this. Much of your time here will be spent in spawning 28,000 shell processes, which could be reduced to one:

set theData to do shell script “sqlite3 ‘select ID, dir, filename from theTable’”

This will return all the requested data in a single blob which should be easy to parse via standard AppleScript text parsing.

Andrew
:)
 _______________________________________________
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

References: 
 >sqlite question (From: Jim Weisbin <email@hidden>)

  • Prev by Date: Re: PDF Search
  • Next by Date: Re: PDF Search
  • Previous by thread: Re: sqlite question
  • Next by thread: PDF Search
  • Index(es):
    • Date
    • Thread