avoid use of 'RETURNING' sql clause
continuous-integration/drone/push Build is passing Details

pull/8/head
maxime.batista 1 year ago committed by maxime.batista
parent 06abc31067
commit 1f261fe4fe

1
.gitignore vendored

@ -1,6 +1,7 @@
.vs
.idea
.code
.vite
vendor

@ -7,10 +7,14 @@ function get_public_path() {
// find the server path of the index.php file
$basePath = substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT']));
$c = $basePath[strlen($basePath) - 1];
$basePathLen = strlen($basePath);
if ($basePathLen == 0)
return "";
$c = $basePath[$basePathLen - 1];
if ($c == "/" || $c == "\\") {
$basePath = substr($basePath, 0, strlen($basePath) - 1);
$basePath = substr($basePath, 0, $basePathLen - 1);
}
return $basePath;
}

@ -26,10 +26,11 @@ class TacticInfoGateway {
}
public function insert(string $name): TacticInfo {
$row = $this->con->fetch(
"INSERT INTO TacticInfo(name, creation_date) VALUES(:name, CURRENT_TIMESTAMP) RETURNING id, creation_date",
$this->con->exec(
"INSERT INTO TacticInfo(name, creation_date) VALUES(:name, CURRENT_TIMESTAMP)",
[":name" => [$name, PDO::PARAM_STR]]
)[0];
);
$row = $this->con->fetch("SELECT id, creation_date FROM TacticInfo ORDER BY id DESC LIMIT 1", [])[0];
return new TacticInfo(intval($row["id"]), $name, strtotime($row["creation_date"]));
}

Loading…
Cancel
Save