Re: [Cppcms-users] cppdb::statement.affected() usage?
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2011-02-15 15:11:58
|
> Hello! > > The following SELECT gets one tuple: > > cppdb::statement st=session << "SELECT 1 FROM t1"; > cppdb::result r=st.row(); > > Now, r.empty() returns false, which is correct, but st.affected() returns > 0. > > cppdb::statement.affected() is supposed to return the selected number of > tuples, which is 1 in this case, not 0. > > Do I misunderstand its usage? > Yes, number of affected rows is number of rows affected by statements like DELETE or UPDATE, the behavior of affected() when using queries (like SELECT) is undefined and may cause exceptions. Artyom ____________________________________________________________________________________ Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 |