process data in steps of 50 lines

Matthias Rebbe matthias_livecode at me.com
Tue Jun 7 17:04:54 EDT 2011


Hi Bob,

in my case data contains sql update commands in each line.
I want to open the DB connection, send 50 (maybe more if that works) sql commands one after one and then close the db connection.
And want to repeat that with the other lines.

I just want to avoid that there are timeouts, if i send 9000 command in one session to the db. So i thought it might be a good idea to
close db after a specific numger of lines and reopen again.

Regards,

Matthias
Am 07.06.2011 um 17:42 schrieb Bob Sneidar:

> If you are not planning to change anything in the data itself, then you can use the repeat for each line theLine of theData form in your inner loop. 
> 
> But I do not see the advantage of doing it in blocks of 50, unless there is something about the data that requires it. 
> 
> Bob
> 
> 
> On Jun 7, 2011, at 6:05 AM, Matthias Rebbe wrote:
> 
>> Hi,
>> 
>> i have a variable which contains data with unspecified number of lines. It can be 3 but it can also be 9000 or whatever.
>> 
>> I need to do some calculations with each line of that data, but want to do it in steps of e.g. 50 lines.
>> 
>> I thought i would do that with 2 repeat loops ( one within the other). 
>> 
>> Something like this
>> 
>> 
>> repeat with i = 1 to the number of lines of DATA step 50
>> 
>>     repeat with k = 0 to 49
>>          do what ever with line (i+k) of DATA
>>    end repeat
>> 
>> end repeat
>> 
>> 
>> I could access  each line then in the repeat loop with line (i+k), but how do i take care if the number of lines are not a multiple of 50?
>> 
>> Is my solution the right one or is there a better way?
>> 
>> Regards,
>> 
>> Matthias
>> 
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list