[asterisk-dev] Return values for ast_update_realtime and ast_store_realtime
Russell Bryant
russell at digium.com
Wed Feb 18 10:50:26 CST 2009
Tilghman Lesher wrote:
> On Wednesday 18 February 2009 03:56:23 Johansson Olle E wrote:
>> Doing some work with the realtime system I note that the return values
>> for ast_update_realtime and ast_store_realtime doesn't seem to be
>> defined in config.h
>>
>> With mysql, ast_update_realtime returns the number of rows affected,
>> so 0 is an error and 1 is good. -1 is an error.
>
> 0 is not necessarily an error. For example, if you update a value for a
> particular row, and the column already contained that value, then 0 will be
> returned.
>
>> ast_store_realtime returns 0 if everyting is good and -1 for a problem.
>
> That is incorrect. The store method on most realtime drivers returns the
> same as the update method. The MySQL driver is the exception, as it returns
> something called the insertid. As noted in the source, this value is
> nonportable and cannot be easily implemented in any other driver.
>
> So, in the general case, non-negative is good, negative is an error.
Tilghman, could you please update the API documentation with this
information?
--
Russell Bryant
Digium, Inc. | Senior Software Engineer, Open Source Team Lead
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
More information about the asterisk-dev
mailing list