Re: Parameterized SQL "WHERE IN" clause?
Posted in 2005
Topics: Connectivity: ODBC / JDBC / .NET
Thanks. Kind of figured that was what I'd need to do.
--
William Fields
MCSD - Microsoft Visual FoxPro
US Bankruptcy Court
Phoenix, AZ
"I have no special talents, I am only passionately curious"
- Albert Einstein
"Andrew Hamm" <ahamm@mail.com> wrote in message
news:382940F5jg8i8U1@individual.net...
> William Fields wrote:
>> Hello,
>>
>> I'm trying to come up with a way to pass a variable from Visual
>> FoxPro to Informix via the current ODBC driver that looks something
>> like this:
>>
>> SELECT * FROM MyTable WHERE MyField IN (?MyListOfValues)>>
>> ?MyListOfValues is a variable holding my list I want to filter on.
>> Like: 'a', 'b', 'c', 'd', 'e'.
>
> I don't know FoxPro, so I can only assume what sort of variable you are
> using to store the 'a','b','c' part. Is it a string? I'll assume so.
>
> When it binds MyListOfValues during execution of the statement, it will
> probably make it look like this:
>
> ... WHERE MyField IN ("'a', 'b', 'c', 'd', 'e'")
>
> in other words, one specific string complete with letters, commas, spaces
> and quotes.
>
> No dynamic SQL binding system I've ever seen does what you are asking for.
> You might be able to exploit Informix's ROW types IF you can bind an array
> to a ? but I doubt it, especially through ODBC.
>
> On the bright side, these sorts of cases are precisely why it's acceptable
> to prepare and re-prepare a statement on the fly. Manually build the
> string and submit that without the use of ?
>
>
And here's the solution to my ODBC Trace problems:
Make sure tracing is turned on before the application starts (tracing is in
part of odbc driver manager, it needs to be enabled before odbc32.dll is
loaded by the app that the customer wants to trace). The log location can be
changed as long as the app has the permission to write to the new location,
the default path is always user specific, so the log file is secure.
The "machine wide tracing" button is useful for tracing a windows service
which is running under a different user account than the current window
logon
user, e.g. a service is running under domain\\user_a, but you log on as
user_b
to modify tracing option, the only way the service can see the tracing
setting modified by user_b is by user_b using the "machine wide tracing"
option.
--
William Fields
MCSD - Microsoft Visual FoxPro
US Bankruptcy Court
Phoenix, AZ
"I have no special talents, I am only passionately curious"
- Albert Einstein
"William Fields" <Bill_Fields@azb.uscourts.gov> wrote in message
news:cvi8ci$8q3$1@apollo.nyed.circ2.dcn...
> Thanks. Kind of figured that was what I'd need to do.
>
> --
> William Fields
> MCSD - Microsoft Visual FoxPro
> US Bankruptcy Court
> Phoenix, AZ
>
> "I have no special talents, I am only passionately curious"
>
> - Albert Einstein
>
>
>
> "Andrew Hamm" <ahamm@mail.com> wrote in message
> news:382940F5jg8i8U1@individual.net...
>> William Fields wrote:
>>> Hello,
>>>
>>> I'm trying to come up with a way to pass a variable from Visual
>>> FoxPro to Informix via the current ODBC driver that looks something
>>> like this:
>>>
>>> SELECT * FROM MyTable WHERE MyField IN (?MyListOfValues)>>>
>>> ?MyListOfValues is a variable holding my list I want to filter on.
>>> Like: 'a', 'b', 'c', 'd', 'e'.
>>
>> I don't know FoxPro, so I can only assume what sort of variable you are
>> using to store the 'a','b','c' part. Is it a string? I'll assume so.
>>
>> When it binds MyListOfValues during execution of the statement, it will
>> probably make it look like this:
>>
>> ... WHERE MyField IN ("'a', 'b', 'c', 'd', 'e'")
>>
>> in other words, one specific string complete with letters, commas, spaces
>> and quotes.
>>
>> No dynamic SQL binding system I've ever seen does what you are asking
>> for.
>> You might be able to exploit Informix's ROW types IF you can bind an
>> array
>> to a ? but I doubt it, especially through ODBC.
>>
>> On the bright side, these sorts of cases are precisely why it's
>> acceptable
>> to prepare and re-prepare a statement on the fly. Manually build the
>> string and submit that without the use of ?
>>
>>
>
>