But this is a really bad approach and a bad solution. Hopefully this can be addressed to make it more efficient then closing and opening the connection.
$sql =
"UPDATE `{$this->dbName}`.`Item` SET `InProgress` = 1 WHERE `DepartureTime` <= NOW();".
"UPDATE `{$this->dbName}`.`Item` SET `Active` = 0, `InProgress` = 0 WHERE `ArrivalTime` <= NOW();"
;
(Performance is not an issue. Most probably I’ve also tried a single SQL statement.)
I unsuccessfully tried to find the older post mentioning an uncaught second exception might be throwed with no visible error message. IIRC something like "unbuffered queries". Perhaps relevant in this case too?
I checked again and it seems like my problem was caused by the two SQL statements in a row. I guess this is not the expected usage in the general case since SQL syntax may vary.
Anyway, I got this exception on the subsequent AR access unless I disactivated the connection first.
Description
The table "Item" for active record class "Item" cannot be found in the database.
Source File
/srv/www/htdocs/Yii/framework/db/ar/CActiveRecord.php(2244)
...
Strangely I don’t see an error message if I have a syntax error in the second SQL statement in a call to execute(). The statement just seemingly don’t run.