Re: [Cppcms-users] CppDB: SQL Parameter for IN clause
Brought to you by:
artyom-beilis
From: CN <cn...@fa...> - 2016-03-16 10:07:46
|
On Wed, Mar 16, 2016, at 01:47 PM, Artyom Beilis wrote: > First of all sorry for delayed reply - was offline for a while. I am much grateful for your kind helps and marvelous CppCMS products. > What I did in such a case I build manually a query with several > placeholders > according to number of iterms in IN clause and binded prameters later i. > > > sql << "SELECT 1 FROM t WHERE c IN (?)" << 1 ; > sql << "SELECT 1 FROM t WHERE c IN (?,?)" << 1 << 2; > > and so on. > > Currently there is no special placeholder for a variable number of > parameters in CppDB Your approach makes me think that there actually is no one-size-fit-all solution for such use case. It looks like that the best I can do now is to run time generate SQL text with variable number of question marks in "IN ()" clause if I want the SQL to accept random number of values from end users and then loop to bind these values to these question marks. Thanks for the comments! Best Regards, CN -- http://www.fastmail.com - The professional email service |