Merge pull request #5 from FredericoFalcao/experimental

Experimental
This commit is contained in:
FredericoFalcao 2025-06-07 17:09:47 +03:00 committed by GitHub
commit 28f6467bb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -14,10 +14,13 @@ function handleTriggerExecutionResult($result, $stdout, $stderr, $originalRow, $
if ($result !== 0) {
// Update table error status and notify via Telegram if execution failed
updateTriggerError($tableName, $stderr);
} else {
} else {
// Decode the output from JSON to array
$newRowValue = json_decode($stdout, true);
// Ignore the hydrate columns
$newRowValue = array_filter($newRowValue, fn($k) => !str_ends_with($k, '_ref'), ARRAY_FILTER_USE_KEY);
if ($newRowValue === null) {
updateTriggerError($tableName, 'Invalid JSON output from sandboxed execution.');
return;

View File

@ -85,7 +85,7 @@ function processActiveTable($activeTable) {
ensureLastUpdatedColumnExists($Name);
$rowsToProcess = sql("SELECT * FROM $Name WHERE LastUpdated > '$LastUpdated'");
$rowsToProcess = sql_read_and_hydrate("SELECT * FROM $Name WHERE LastUpdated > '$LastUpdated'");
foreach ($rowsToProcess as $unprocessedRow) {
processTableRow($activeTable, $unprocessedRow);