SQLite 3 ----> Table View

hey guys,

I’m trying to find the most efficient way of bring a column of a SQLite3 database into Table View using Magic Bindings.
What I’m currently doing works but there must be a faster way of doing it.


script EncoderReportAppDelegate
	property parent : class "NSObject"
	property theData : missing value
	
	
	on applicationWillFinishLaunching_(aNotification)
		
		set head to "sqlite3 ~/desktop/MasterList.db " & "\""
		set tail to "\""
		set selectIt to "select Movie from MasterList where DeliveryDate = '' Order by Movie; "
		set itt to paragraphs of (do shell script head & selectIt & tail)
		
		set repTimes to number of items of itt
		
		set x to 1
		set my theData to {}
		
		repeat repTimes times
			
			set my theData to {{filmTitle:item x of itt as text}} & my theData
			set x to x + 1
		end repeat
		
		
		
		
	end applicationWillFinishLaunching_
	
	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits 
		return current application's NSTerminateNow
	end applicationShouldTerminate_
	
end script

Thanks Yo

Try building a temporary list first, something like:

   set x to 1
   set tempData to {}
   
   repeat with x from 1 to repTimes
       set end of tempData to {filmTitle:item x of itt as text}
   end repeat

   set my theData to tempData

Its the recursive nature of the repeat loop that causes it to take a long time.
I’m looking to avoid it all together

Have you tried the code I posted? There’s nothing recursive there.