sqlYoga: best way to import lots of data
Trevor DeVore
lists at mangomultimedia.com
Wed Mar 24 15:34:06 EDT 2010
On Mar 24, 2010, at 3:27 PM, David Bovill wrote:
> I'm working on a database for rev handlers using sql yoga. I want to
> import
> a few thousand hander references into the db. So far I've got
> something
> like:
>
> put sqlrecord_CreateObject ("handler") into theRecordA
>>
>> sqlrecord_set theRecordA, "name", "menu_CreateTable"
>> sqlrecord_set theRecordA, "type", "c"
>> sqlrecord_set theRecordA, "object", scriptObject
>> sqlrecord_set theRecordA, "number", 1
>>
>> sqlrecord_create theRecordA
>
> I'm thinking it would be better / faster to create one big numerically
> indexed array and then update - any ideas on the syntax for that?
sqlrecord_create will take a numerically indexed array.
theRecordsA[1] = a record array
theRecordsA[2] = another record array
So you could update your code to stuff each record you create into an
index of a theRecordsA array and then pass the theRecordsA array to
sqlrecord_create.
...
put sqlrecord_CreateObject ("handler") into theRecordA
sqlrecord_set theRecordA, "name", "menu_CreateTable"
sqlrecord_set theRecordA, "type", "c"
sqlrecord_set theRecordA, "object", scriptObject
sqlrecord_set theRecordA, "number", 1
put theRecordA into theRecordsA[the number of elements of theRecordsA
+ 1]
...
sqlrecord_create theRecordsA
--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com
More information about the use-livecode
mailing list