mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
fix update query
This commit is contained in:
parent
ee9391fd97
commit
e07798e3b6
|
|
@ -1027,7 +1027,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Update columns.
|
||||
*
|
||||
* @param mixed ...$columns Column names to update
|
||||
* @param string $table Column names to update
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -1036,23 +1036,14 @@ class Builder extends BuilderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function update(mixed ...$columns) : self
|
||||
public function update(string $table) : self
|
||||
{
|
||||
if ($this->isReadOnly) {
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
$this->type = QueryType::UPDATE;
|
||||
|
||||
/** @var mixed[] $columns */
|
||||
/** @var mixed $table */
|
||||
foreach ($columns as $column) {
|
||||
if (\is_string($column) || $column instanceof self) {
|
||||
$this->updates[] = $column;
|
||||
} else {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
}
|
||||
$this->type = QueryType::UPDATE;
|
||||
$this->updates[] = $table;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class CsvDatabaseMapper implements IODatabaseMapper
|
|||
// update data
|
||||
while (($cells = \fgetcsv($fp)) !== false) {
|
||||
$query = new Builder($this->con);
|
||||
$query->update(...$titles)->into($table);
|
||||
$query->update($table);
|
||||
|
||||
for ($j = 2; $j <= $columns; ++$j) {
|
||||
$query->sets((string) $titles[$j - 2], $cells[$j - 1]);
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class SpreadsheetDatabaseMapper implements IODatabaseMapper
|
|||
$line = 2;
|
||||
while (!empty($workSheet->getCell('A' . $line)->getCalculatedValue())) {
|
||||
$query = new Builder($this->con);
|
||||
$query->update(...$titles)->into($table);
|
||||
$query->update($table);
|
||||
|
||||
for ($j = 2; $j <= $columns; ++$j) {
|
||||
$query->sets((string) $titles[$j - 2], $workSheet->getCell(StringUtils::intToAlphabet($j) . $line)->getCalculatedValue());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user