Re: [Cppcms-users] statement::bind can be deceptive/dangerous
Brought to you by:
artyom-beilis
|
From: Marcel H. <ke...@co...> - 2012-05-07 08:02:37
|
Am 07.05.2012 09:57, schrieb ele...@ex...:
> > sql<< "INSERT ..."<< ...<< r.get<string>("date_action"))<< ...<<
>> cppdb::exec;
>>
>> This would be valid as the return value remains withing the statement.
>>
>> Artyom Beilis.
> I understand that however what if you need to do something like this -
>
> cppdb::statement st;
> st = sql.prepare(...)
>
> st<< one<< two;
>
> if (condition is true)
> st<< three<< four
> else
> st<< five<< six
> end
>
> st.exec()
>
> In this case do I have to store all the variables on the function stack
> before passing them to statement?
if you have your elements in a vector/array/json::array(is a vector
itself) you can do this:
http://cppcms.com/sql/cppdb/stat.html#stat_reset
> Petr
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
|