I encountered a problem about how to limit a sql query "in" condition to 1000 elements at most, hence i decided to solve this by assign each 1000 element to a variable and then use "or" to put those strings together to form this query.

This was my first codes:



Now the problem is that coldfusion just can't convert the #x# in #evaluate("key_id_#x#")#.
So my idea of getting dynamic variables such like "key_id_1", "key_id_2" vanished into the void.

Here is my final solution of this problem:



I assigned every 1000 elements to the same variables and restored it after outputting.
Reusing one single variable seems the only way out in the case.

swangs 發表在 痞客邦 PIXNET 留言(0) 人氣()