Hi,On a project converted from v2020 to v2023 I get the following error on the default list page shown after logging in:vendor/doctrine/dbal/src/Driver/PDO/Connection.php(70): PDO::query(): Argument #1 ($query) cannot be emptyError message points to this function:
public function query(string $sql): ResultInterface
{
try {
$stmt = $this->connection->query($sql); // Line 70
assert($stmt instanceof PDOStatement);
return new Result($stmt);
} catch (PDOException $exception) {
throw Exception::new($exception);
}
}
I have enabled debug, but that does not reveal anything usefull (to me).I have other projects on this server that converted without any problems.Any hints most welcome./Poul
This is from IsmHavariList.php:
// skib
$curVal = strval($this->skib->CurrentValue);
if ($curVal != "") {
$this->skib->ViewValue = $this->skib->lookupCacheOption($curVal);
if ($this->skib->ViewValue === null) { // Lookup from database
$filterWrk = SearchFilter("`afdeling_skib`", "=", $curVal, DATATYPE_STRING, "");
$sqlWrk = $this->skib->Lookup->getSql(false, $filterWrk, '', $this, true, true);
$conn = Conn();
$config = $conn->getConfiguration();
$config->setResultCacheImpl($this->Cache);
//Below line is no 2637:
$rswrk = $conn->executeCacheQuery($sqlWrk, [], [], $this->CacheProfile)->fetchAll();
$ari = count($rswrk);
if ($ari > 0) { // Lookup values found
$arwrk = $this->skib->Lookup->renderViewRow($rswrk[0]);
$this->skib->ViewValue = $this->skib->displayValue($arwrk);
} else {
$this->skib->ViewValue = $this->skib->CurrentValue;
}
}
} else {
$this->skib->ViewValue = null;
}
Here is the log file:
[2023-02-17T13:12:02.194194+00:00] log.DEBUG: SHOW TABLE STATUS WHERE Engine = 'MyISAM' AND Name = 'mols_brugere' {"params":[],"types":[],"executionMS":0.0042781829833984375} []
[2023-02-17T13:12:05.401687+00:00] log.DEBUG: SELECT * FROM mols_brugere WHERE (`brugernavn` = 'PoulJ') {"params":[],"types":[],"executionMS":0.0008871555328369140625} []
[2023-02-17T13:12:05.505204+00:00] log.DEBUG: SHOW TABLE STATUS WHERE Engine = 'MyISAM' AND Name = 'ism_havari' {"params":[],"types":[],"executionMS":0.0010769367218017578125} []
[2023-02-17T13:12:05.520853+00:00] log.DEBUG: SELECT * FROM mols_brugere WHERE `se_havarirap` = 1 {"params":[],"types":[],"executionMS":0.0015180110931396484375} []
[2023-02-17T13:12:05.541956+00:00] log.DEBUG: SELECT COUNT(*) FROM ism_havari WHERE `se_post` IN (1) {"params":[],"types":[],"executionMS":0.00096607208251953125} []
[2023-02-17T13:12:05.558350+00:00] log.DEBUG: SELECT * FROM ism_havari WHERE `se_post` IN (1) ORDER BY `dato` DESC, `status` ASC LIMIT 20 {"params":[],"types":[],"executionMS":0.00187206268310546875} []
[2023-02-17T13:12:05.580281+00:00] log.DEBUG: {"params":[],"types":[],"executionMS":3.60012054443359375e-5} []
[2023-02-17T13:12:05.580985+00:00] log.DEBUG: Slim Application Error Type: ValueError Code: 0 Message: PDO::query(): Argument #1 ($query) cannot be empty File: /nearmiss_hav23/vendor/doctrine/dbal/src/Driver/PDO/Connection.php Line: 70 Trace:
#0 /nearmiss_hav23/vendor/doctrine/dbal/src/Driver/PDO/Connection.php(70): PDO->query('')
#1 /nearmiss_hav23/vendor/doctrine/dbal/src/Connection.php(1094): Doctrine\DBAL\Driver\PDO\Connection->query('')
#2 /nearmiss_hav23/vendor/doctrine/dbal/src/Connection.php(895): Doctrine\DBAL\Connection->executeQuery('', Array, Array)
#3 /nearmiss_hav23/vendor/doctrine/dbal/src/Connection.php(1141): Doctrine\DBAL\Connection->fetchAllAssociative('', Array, Array)
#4 /nearmiss_hav23/models/IsmHavariList.php(2637): Doctrine\DBAL\Connection->executeCacheQuery('', Array, Array, Object(Doctrine\DBAL\Cache\QueryCacheProfile))
#5 /nearmiss_hav23/models/IsmHavariList.php(2199): PHPMaker2023\SR_navrapporter\IsmHavariList->renderRow()
#6 /nearmiss_hav23/views/IsmHavariList.php(173): PHPMaker2023\SR_navrapporter\IsmHavariList->setupRow()
...
arbei
February 18, 2023, 3:55am
3
marisoft wrote:
$sqlWrk = $this->skib->Lookup->getSql(false, $filterWrk, ‘’, $this, true, true);
The error meant $sqlWrk is empty. You may double check your lookup table settings for the field “skib”. Make sure the selected table and field exist.
Thank you very much,The table did exist, but was unticked in the list of tables and therefore not generated !