Re: -- Re: RE: How do I pass a collection type to a prepared statement
Posted in 2003
Jean Sagi wrote:
>> " and field_color in (?, ?, ?, ?, ?, ?, ?, ?)",
>
> I dind't like this approach 'cause if the list of colors grows I have to
modify the query... I prefer the temporary table solution some mentioned
instead...
Thanks.
>>Why? How many colours are you likely to need to pass?
>
> It's user configurable... so some time could be 3, other times 7... etc, the
user decides...
Yes, but they can only enter a finite number. That's the number of question
marks you need.
>>Except that you will have to PREPARE this every time
>>you run a new query.
>>It would be better for performance to PREPARE the
>>cursor using one of the
>>solutions mentioned before, then EXECUTE it as many
>>times as you need.
>
> You're rigth, but this time I have the luck on my side... the program I'm
doing is a deamon (it never finish), and when it starts to execute the list of
colors is fixed; so I managed to do what you describe... prepare it once one
executing many times... wich have improved the response time ;) ;)
Oh good.
>>>Anyway I think it is a fault that a collection
>>>cannot be passed to preapred statement with Using.
>
>>I guess there's not a lot of call for it. :-)
>
> Yeah, it would be nicer... that's my problem with 4gl: Sometimes it doesn't
do what I'm telling to do, even when it is supposed that it is somethig that
work ;(
>
> (For example didn't you know that you can´t use the concatenation operator
in a select inside a 4gl program... it is really funny it works on dbaccess
but not in 4gl 7.30... luckyly i managed to workarround this)
Well if you PREPARE all your SQL you shouldn't run into problems like that. :-)
Cheers,
--
Mark.
+----------------------------------------------------------+-----------+
| Mark D. Stock mailto:mdstock@MydasSolutions.com |//////// /|
| Mydas Solutions Ltd http://MydasSolutions.com |///// / //|
| +-----------------------------------+//// / ///|
| |We value your comments, which have |/// / ////|
| |been recorded and automatically |// / /////|
| |emailed back to us for our records.|/ ////////|
+----------------------+-----------------------------------+-----------+