Difference between revisions of "OpenDBX/C API/odbx rows affected"

From Linuxnetworks
< OpenDBX‎ | C API
Jump to: navigation, search
(header hierarchy)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''#include <odbx.h>'''
+
'''Returns the number of changed records'''
+
 
 +
#include <opendbx/api.h>
 +
 
 
  uint64_t '''odbx_rows_affected'''(
 
  uint64_t '''odbx_rows_affected'''(
     odbx_result_t* '''result''' )
+
     odbx_result_t* '''''result''''' )
  
 
== Description ==
 
== Description ==
  
Returns the number of rows that have been changed by the current statement whose result was retrieved by [[OpenDBX result|odbx_result()]]. Affected rows are only returned for DELETE, INSERT or UPDATE statements and their number depends on the database implementation. Instead returning the number of rows which are matched by the WHERE clause, MySQL does only count the rows whose values have really been changed.
+
Returns the number of rows that have been changed by the current statement whose result set was retrieved by [[OpenDBX/API/odbx_result|odbx_result]](). Affected rows are only returned for DELETE, INSERT or UPDATE statements and their concrete number depends on the database implementation. Instead returning the number of rows which are matched by the WHERE clause, MySQL for example does only count the rows whose values have really been changed.
  
The '''result''' parameter required by this function must be a valid result set returned by [[OpenDBX result|odbx_result()]] and must not have been feed to [[OpenDBX result_free|odbx_result_free()]] before.
+
The '''''result''''' parameter required by this function must be a valid result set returned by [[OpenDBX/API/odbx_result|odbx_result]]() and must not has been feed to [[OpenDBX/API/odbx_result_finish|odbx_result_finish]]() before.
  
== Return values ==
+
== Return value ==
  
'''odbx_rows_affected()''' returns the number of changed rows on success and zero if the database server didn't alter any rows. A value of zero can be returned due to the conditions in the WHERE clause of the statement which doesn't match any rows.
+
[[OpenDBX/API/odbx_rows_affected|odbx_rows_affected]]() returns the number of changed rows on success and zero if the database server didn't alter any rows. A value of zero can be returned if the statement doesn't match any rows. Some database server like MySQL may return a lower number than expected because they doesn't modify records whose values wouldn't change.
  
 
== Errors ==
 
== Errors ==
  
This function will also return zero if the '''result''' parameter is invalid.
+
This function will also return zero if the '''''result''''' parameter is invalid.
  
 
== See also ==
 
== See also ==
  
* [[OpenDBX result|odbx_result()]]
+
* [[OpenDBX/API/odbx_result|odbx_result]]()
* [[OpenDBX result_free|odbx_result_free()]]
+
* [[OpenDBX/API/odbx_result_finish|odbx_result_finish]]()
 
+
 
+
----
+
Back to [[OpenDBX API|Overview]]
+

Latest revision as of 23:14, 28 April 2009

Returns the number of changed records

#include <opendbx/api.h>
uint64_t odbx_rows_affected(
    odbx_result_t* result )

Description

Returns the number of rows that have been changed by the current statement whose result set was retrieved by odbx_result(). Affected rows are only returned for DELETE, INSERT or UPDATE statements and their concrete number depends on the database implementation. Instead returning the number of rows which are matched by the WHERE clause, MySQL for example does only count the rows whose values have really been changed.

The result parameter required by this function must be a valid result set returned by odbx_result() and must not has been feed to odbx_result_finish() before.

Return value

odbx_rows_affected() returns the number of changed rows on success and zero if the database server didn't alter any rows. A value of zero can be returned if the statement doesn't match any rows. Some database server like MySQL may return a lower number than expected because they doesn't modify records whose values wouldn't change.

Errors

This function will also return zero if the result parameter is invalid.

See also