Re: sqlite question
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