Array Looping to Insert into Database

Peter Haworth pete at lcsql.com
Wed May 8 12:01:33 EDT 2013


Can't help with the XML stuff but it doesn't seem to difficult to use the
array.

put the keys of gAvailableMarketDataArray[AvailableMarkets] into tKeys
sort tKeys -- if you care
repeat for each line L in tKeys
   <do stuff with gAvailableMarketDataArray[AvailableMarkets] [L]>
end repeat

If you're inserting/updating stuff into an sqlite database, don;t forget to
issue a BEGIN before the repeat loop, a COMMIT after the repeat loop, and
ROLLBACK if any errors occur within the repeat loop.  Everything will work
much faster that way.

Pete
lcSQL Software <http://www.lcsql.com>


On Wed, May 8, 2013 at 6:38 AM, Graham Pearson <gspearson at gmail.com> wrote:

> Array Experts
>
> In my application that I am converting from Adobe Air, I have come to a
> section where Google has let me down. I have converted my XML File to an
> Array and can see it within the Debugger and parts of the array is
> listed below.
>
> gAvailableMarketDataArray
>     AvailableMarkets
>         Market[1]
>             BTALatitude   27-29-40.1-N
>             BTALongitude  81-24-59.3-W
>             CallSign      WNC905
>             City          Sebring
>             State         FL
>             @attributes
>               ID          1
>        Market[2] etc.
>
>
> The application pulls the XML File from a Web Service that generates it
> on the fly. The application on first run checks to make sure the
> database exists and records are within it. At this point no records are
> retrieved from the database so I am struggling with how to take this
> array and insert each record of the array into the database.
>
>
> Or is their a command/function that I can use after
>
> put revCreateXMLTree(gClientAvailableMarketsXMLData, false, true, false)
> into tAvailableMarketData
>
> that will give me just the Market part of the XML data so then I can
> create the array which will simply list the Market[1] directly under the
> gAvailableMarketDataArray which will make it easier to insert the array
> into the sqlite database.
>
>
>
>
>
>
>
> _______________________________________________
> 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