[asterisk-dev] Return values for ast_update_realtime and ast_store_realtime

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Feb 18 10:27:32 CST 2009


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



More information about the asterisk-dev mailing list