Strange thing happening with array (old fashioned)

jbv jbv.silences at club-internet.fr
Sun Nov 9 14:20:39 EST 2008


Hi folks,

Just for the anecdote, here's a strange behaviour (probably a bug) that
wasted almost
1 hour of my coding time to find its origin (I'm using an old Rev cgi
engine 2.5 on a
linux server).
When I was running the following code :

         repeat for each word w in myList_of_words

            put "SELECT Col1, Col2, Col3, Col4 FROM myTable WHERE Col5
LIKE " &quote& "%S$" & w &" %"&quote into myREQUEST
            put revDataFromQuery(,,theID,myREQUEST,) into myVar

            --    lots of processing here, not relevant for the anecdote

            repeat for each line j in myVar
                put item 1 of j &tab& item 3 to 6 of j &cr after
myNew_list[w]
            end repeat

        end repeat

some entries of myNew_list array were spoiled / mixed with some binary
crap...

I finally found the solution as follows : :

         repeat for each word w in myList_of_words

            put "SELECT Col1, Col2, Col3, Col4 FROM myTable WHERE Col5
LIKE " &quote& "%S$" & w &" %"&quote into myREQUEST
            put revDataFromQuery(,,theID,myREQUEST,) into myVar

            --    lots of processing here, not relevant for the anecdote

            put "" into myNew_list[w]

            repeat for each line j in myVar
                put item 1 of j &tab& item 3 to 6 of j &cr after
myNew_list[w]
            end repeat

        end repeat

So, it looks like keys in old-style arrays weren't created properly
on-the-fly, but had to be initialized forst...
I wonder is it"s the same with the new arrays in 3.0

Best,
JB




More information about the use-livecode mailing list