On 01/03/11 14:27, Doan Viet Dung wrote:
> Thanks you very much for your reply, Julian, quite useful
> 
> However, in case of update, it seems that indicator does not work as
> well. I can not handle an exception thrown from such update query.
> 
> sql << "UPDATE my_table  SET "
> << "name =: first_name '"
> << " WHERE UsrId = :user_id ", use(first_name,ind), use(user_id);
> For example when user_id does not exist, of course the row is not
> updated but I got no message using 
> switch (ind)
> {
> case i_ok:
>                                 message here
> break;
> case i_null:
>                                 message here
> break;
> case i_truncated:
>                                 message here
> break;
> }
> Any idea how to catch such exception from an update query ???
> 
> Regards
> VDung
> 
> 

you could check the number of affected rows:
statement st = (sql.prepare <<
                "UPDATE t1 SET x=5 WHERE b = 5");
st1.execute(false);
cout << "affected " << st.get_affected_rows() << endl;

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to