Add SQL bridge, support functions, cron jobs, error handling, and PyPI version pinning so Python triggers match PHP capabilities. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
701 B
PHP
18 lines
701 B
PHP
<?php
|
|
/**
|
|
* Builds Python support function definitions from SYS_PRD_BND.SupportFunctions.
|
|
*/
|
|
function getPythonSupportFunctionsDefinition() {
|
|
$functions = "";
|
|
|
|
foreach (sql("SELECT Name, InputArgs_json, PythonCode FROM SYS_PRD_BND.SupportFunctions WHERE PythonCode IS NOT NULL") as $f) {
|
|
$inputArgs = json_decode($f['InputArgs_json'], true);
|
|
$argNames = is_array($inputArgs) ? array_keys($inputArgs) : [];
|
|
$argsString = implode(', ', $argNames);
|
|
$indentedBody = implode("\n", array_map(fn($line) => ' ' . $line, explode("\n", $f['PythonCode'])));
|
|
$functions .= "def {$f['Name']}($argsString):\n{$indentedBody}\n\n";
|
|
}
|
|
|
|
return $functions;
|
|
}
|