mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
"extra where condition, eg. to check etag on writing"
This commit is contained in:
parent
c906d34880
commit
163b795d45
@ -422,9 +422,10 @@ class so_sql
|
||||
* saves the content of data to the db
|
||||
*
|
||||
* @param array $keys if given $keys are copied to data before saveing => allows a save as
|
||||
* @param string|array $extra_where=null extra where clause, eg. to check the etag, returns 'nothing_affected' if not affected rows
|
||||
* @return int 0 on success and errno != 0 else
|
||||
*/
|
||||
function save($keys=null)
|
||||
function save($keys=null,$extra_where=null)
|
||||
{
|
||||
if (is_array($keys) && count($keys)) $this->data_merge($keys);
|
||||
|
||||
@ -478,7 +479,7 @@ class so_sql
|
||||
$data[] = $keys[$n];
|
||||
}
|
||||
}
|
||||
$keys = '';
|
||||
$keys = $extra_where;
|
||||
foreach($this->db_key_cols as $db_col => $col)
|
||||
{
|
||||
$keys[$db_col] = $this->data[$col];
|
||||
@ -499,7 +500,7 @@ class so_sql
|
||||
}
|
||||
$this->db2data();
|
||||
|
||||
return $this->db->Errno;
|
||||
return $this->db->Errno ? $this->db->Errno : ($extra_where && !$this->db->affected_rows() ? true : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user