modifs.mineures sans commentaires
This commit is contained in:
parent
4dc4b97974
commit
ac94ddc345
|
@ -157,9 +157,9 @@ class Capacitor implements ITransactor {
|
||||||
return $this->storage->_all($this->channel, $filter, $mergeQuery);
|
return $this->storage->_all($this->channel, $filter, $mergeQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
function each($filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$updated=null): int {
|
function each($filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$nbUpdated=null): int {
|
||||||
if ($this->subChannels !== null) $this->beginTransaction();
|
if ($this->subChannels !== null) $this->beginTransaction();
|
||||||
return $this->storage->_each($this->channel, $filter, $func, $args, $mergeQuery, $updated);
|
return $this->storage->_each($this->channel, $filter, $func, $args, $mergeQuery, $nbUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete($filter, $func=null, ?array $args=null): int {
|
function delete($filter, $func=null, ?array $args=null): int {
|
||||||
|
|
|
@ -397,8 +397,8 @@ class CapacitorChannel {
|
||||||
return $this->capacitor->all($filter, $mergeQuery);
|
return $this->capacitor->all($filter, $mergeQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
function each($filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$updated=null): int {
|
function each($filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$nbUpdated=null): int {
|
||||||
return $this->capacitor->each($filter, $func, $args, $mergeQuery, $updated);
|
return $this->capacitor->each($filter, $func, $args, $mergeQuery, $nbUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete($filter, $func=null, ?array $args=null): int {
|
function delete($filter, $func=null, ?array $args=null): int {
|
||||||
|
|
|
@ -496,10 +496,10 @@ EOT;
|
||||||
* si la fonction retourne un tableau, il est utilisé pour mettre à jour la
|
* si la fonction retourne un tableau, il est utilisé pour mettre à jour la
|
||||||
* ligne
|
* ligne
|
||||||
*
|
*
|
||||||
* @param int $updated reçoit le nombre de lignes mises à jour
|
* @param int $nbUpdated reçoit le nombre de lignes mises à jour
|
||||||
* @return int le nombre de lignes parcourues
|
* @return int le nombre de lignes parcourues
|
||||||
*/
|
*/
|
||||||
function _each(CapacitorChannel $channel, $filter, $func, ?array $args, ?array $mergeQuery=null, ?int &$updated=null): int {
|
function _each(CapacitorChannel $channel, $filter, $func, ?array $args, ?array $mergeQuery=null, ?int &$nbUpdated=null): int {
|
||||||
$this->_create($channel);
|
$this->_create($channel);
|
||||||
if ($func === null) $func = CapacitorChannel::onEach;
|
if ($func === null) $func = CapacitorChannel::onEach;
|
||||||
func::ensure_func($func, $channel, $args);
|
func::ensure_func($func, $channel, $args);
|
||||||
|
@ -513,7 +513,7 @@ EOT;
|
||||||
$commitThreshold = $channel->getEachCommitThreshold();
|
$commitThreshold = $channel->getEachCommitThreshold();
|
||||||
}
|
}
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$updated = 0;
|
$nbUpdated = 0;
|
||||||
$tableName = $channel->getTableName();
|
$tableName = $channel->getTableName();
|
||||||
try {
|
try {
|
||||||
$args ??= [];
|
$args ??= [];
|
||||||
|
@ -525,7 +525,7 @@ EOT;
|
||||||
if (!array_key_exists("modified_", $updates)) {
|
if (!array_key_exists("modified_", $updates)) {
|
||||||
$updates["modified_"] = date("Y-m-d H:i:s");
|
$updates["modified_"] = date("Y-m-d H:i:s");
|
||||||
}
|
}
|
||||||
$updated += $db->exec([
|
$nbUpdated += $db->exec([
|
||||||
"update",
|
"update",
|
||||||
"table" => $tableName,
|
"table" => $tableName,
|
||||||
"values" => $this->serialize($channel, $updates),
|
"values" => $this->serialize($channel, $updates),
|
||||||
|
@ -552,8 +552,8 @@ EOT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function each(?string $channel, $filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$updated=null): int {
|
function each(?string $channel, $filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$nbUpdated=null): int {
|
||||||
return $this->_each($this->getChannel($channel), $filter, $func, $args, $mergeQuery, $updated);
|
return $this->_each($this->getChannel($channel), $filter, $func, $args, $mergeQuery, $nbUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,7 +86,7 @@ class Sqlite implements IDatabase {
|
||||||
##schéma
|
##schéma
|
||||||
$defaultFile = self::params_SCHEMA["file"][1];
|
$defaultFile = self::params_SCHEMA["file"][1];
|
||||||
$this->file = $file = strval($params["file"] ?? $defaultFile);
|
$this->file = $file = strval($params["file"] ?? $defaultFile);
|
||||||
$inMemory = $file === ":memory:";
|
$inMemory = $file === ":memory:" || $file === "";
|
||||||
#
|
#
|
||||||
$defaultFlags = self::params_SCHEMA["flags"][1];
|
$defaultFlags = self::params_SCHEMA["flags"][1];
|
||||||
$this->flags = intval($params["flags"] ?? $defaultFlags);
|
$this->flags = intval($params["flags"] ?? $defaultFlags);
|
||||||
|
|
Loading…
Reference in New Issue