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