Hello,
I'm experiencing a problem with the Jobe server when trying to run an SQLite task with a support file.
I have created a custom task (SqliteTask.php
) in the application/libraries
directory of my Jobe server to enable SQLite functionality. Here is the structure of my task class:
namespace Jobe;
class SqliteTask extends LanguageTask {
public string $databaseFileName;
public function __construct($filename, $input, $params) {
parent::__construct($filename, $input, $params);
$this->databaseFileName = ':memory:';
}
public function compile()
{
// SQLite non richiede compilazione
$this->cmpinfo = '';
}
public static function getVersionCommand()
{
return array('sqlite3 --version', '/([0-9.]+)/');
}
public function defaultFileName($sourcecode)
{
return 'query.sql';
}
public function getExecutablePath()
{ return '/usr/bin/sqlite3'; } public function getTargetFile() { return $this->databaseFileName; } public function execute() { $cmd = $this->getExecutablePath() . ' ' . $this->databaseFileName . ' < ' . escapeshellarg($this->sourceFileName); list($this->stdout, $this->stderr) = $this->runInSandbox($cmd, false, $this->input); if (!empty($this->stderr)) { $this->cmpinfo = $this->stderr; } } } }
Despite adding the SqliteTask.php
correctly, I am encountering the following error when trying to load my database file (prova.db
) as a support file:
ERROR - [Date/Time] --> runs_post: File missing/unavailable: prova.db (FileId: 22484f8f8a5fe85db13c2d063ec82293, Destination: /home/jobe/runs/jobe_ZcAl4U/prova.db)
I print this error in the LanguageTask.php, precisely in this method:
public function loadFiles($fileList)
{
foreach ($fileList as $file) {
$fileId = $file[0];
$filename = $file[1];
$destPath = $this->workdir . '/' . $filename;
if (!FileCache::fileExists($fileId) ||
($contents = FileCache::fileGetContents($fileId)) === false ||
(file_put_contents($destPath, $contents)) === false) {
throw new JobException(
"File missing/unavailable: " . $filename . " (FileId: " . $fileId . ", Destination: " . $destPath . ")", 404
);
}
}
}
Obviously test's won't run because they doesn't find the db file.
Additional Information:
- Jobe seems to recognize the
SqliteTask
, assqlite
shows up in the list of supported languages:
curl http://coderun.myserver.it/jobe/index.php/restapi/languages:
[["c","11.4.0"],["cpp","11.4.0"],["java","11.0.24"],["nodejs","16.20.2"],["octave","6.4.0"],["pascal","3.2.2"],["php","8.1.2"],["python3","3.10.12"],["sqlite","3.37.2"]] - The file
prova.db
is missing in the working directory during execution, even though it has been added as a support file in the CodeRunner question.
Question:
Has anyone tried manually adding SQLite3 support to Jobe? If so, could you provide any insights on how to correctly set it up or any configurations that need special attention?
Thank you!