drizzle-discuss team mailing list archive
Mailing list archive
Re: PROPOSAL: Change to the Cursor interface
On Fri, Apr 23, 2010 at 11:57 AM, Brian Aker <brian@xxxxxxxxxxx> wrote:
> This ties into a bigger question of how to return error/information from callers. Stewart and I spent a bit of time talking about this at the conference (though with no conclusion). The basic idea is to return an object that is minimal copy upon return (aka... no memory allocation and the hit cost is low).
Which is precisely why I proposed using std::pair<>'s (or
boost::tuple). There is no copy overhead in most situations (due to
all modern compilers implementing the return value optimization.
Please see: http://en.wikipedia.org/wiki/Return_value_optimization).
This is the reason that the STL's std::map<>::insert() method returns
a std::pair<iterator, bool> as do other STL algorithms.
> I wouldn't get wrapped up too much in the current design of it.
I'm really not sure what the above means. Could you explain?
> On Apr 23, 2010, at 8:09 AM, Jay Pipes wrote:
>> Cursor::InsertRecordResult result= cursor->insertRecord(table);
>> if (result.first == 0) /* successful result */
>> inserted_rows= result.second.first;
>> replaced_rows= result.second.second;