![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| ||||||
| ||||||
|
|
Well, I come to a conclusion that Informix 4gl 7.30 could not pass dinamucally a list of strings to a prepared query for use in an IN filter in the WHERE clause... (odd). |
|
The caveat is not pass the string of colors at all with USING. |
|
Instead I statically construct the query adding the string of colors which is variable ans pass dinamically the other parameters: let c_col = "'blue','red','color'" let c_sel = " select count(*) ", " from some_table", " where field_code = ? ", --dynamic " and field_color in (", c_col, ") ", --static-dynamic " into temp tx ", " with no log; " prepare st_sel from c_sel execute c_sel using 10 |
|
Is very simple... which of course is not what I was trying to do originally but achieves the same result... |
|
Anyway I think it is a fault that a collection cannot be passed to preapred statement with Using. |
|
Mark D. Stock mailto:mdstock (AT) MydasSolutions (DOT) com |//////// /| Mydas Solutions Ltd http://MydasSolutions.com |///// / //| +-----------------------------------+//// / ///| |We value your comments, which have |/// / ////| |been recorded and automatically |// / /////| |emailed back to us for our records.|/ ////////| +----------------------+-----------------------------------+-----------+ |
#2
| ||||||
| ||||||
|
|
" 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 |
|
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... |
|
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 |

|
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 |
|
(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 |
|
Mark D. Stock mailto:mdstock (AT) MydasSolutions (DOT) com |//////// /| Mydas Solutions Ltd http://MydasSolutions.com |///// / //| +-----------------------------------+//// / ///| |We value your comments, which have |/// / ////| |been recorded and automatically |// / /////| |emailed back to us for our records.|/ ////////| +----------------------+-----------------------------------+-----------+ |
![]() |
| Thread Tools | |
| Display Modes | |
| |