Closed pietos closed 1 year ago
Some output contains characters which result into MySQL errors: [mysqli_sql_exception] Operand should contain 1 column(s)
I have this issue when I try to insert the shell output of php -v
I figured out that I can solve it by wrapping the output in a json_encode.
app\ThirdParty\vendor\daycry\cronjob\src\JobRunner.php line 187
Running Tasks...
2023-04-03 12:00:00[2023-05-03 12:44:40] Processing: Daily [2023-05-03 12:44:40] Executed: Daily
[mysqli_sql_exception]
Operand should contain 1 column(s)
at SYSTEMPATH\Database\MySQLi\Connection.php:295
Backtrace: 1 SYSTEMPATH\Database\MySQLi\Connection.php:295 mysqli()->query('INSERT INTO task_scheduler_logs (name, type, action, environment, start_at, end_at, duration, output, error, test_time, created_at, updated_at) VALUES (\'Daily\', \'shell\', \'php -v\', \'[]\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\', \'00:00:00\', (\'PHP 8.0.12 (cli) (built: Oct 19 2021 11:21:05) ( ZTS Visual C++ 2019 x64 )\',\'Copyright (c) The PHP Group\',\'Zend Engine v4.0.12, Copyright (c) Zend Technologies\'), \'null\', \'2023-04-01 17:25:00\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\')', 0)
task_scheduler_logs
name
type
action
environment
start_at
end_at
duration
output
error
test_time
created_at
updated_at
2 SYSTEMPATH\Database\BaseConnection.php:692 CodeIgniter\Database\MySQLi\Connection()->execute('INSERT INTO task_scheduler_logs (name, type, action, environment, start_at, end_at, duration, output, error, test_time, created_at, updated_at) VALUES (\'Daily\', \'shell\', \'php -v\', \'[]\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\', \'00:00:00\', (\'PHP 8.0.12 (cli) (built: Oct 19 2021 11:21:05) ( ZTS Visual C++ 2019 x64 )\',\'Copyright (c) The PHP Group\',\'Zend Engine v4.0.12, Copyright (c) Zend Technologies\'), \'null\', \'2023-04-01 17:25:00\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\')')
3 SYSTEMPATH\Database\BaseConnection.php:606 CodeIgniter\Database\BaseConnection()->simpleQuery('INSERT INTO task_scheduler_logs (name, type, action, environment, start_at, end_at, duration, output, error, test_time, created_at, updated_at) VALUES (\'Daily\', \'shell\', \'php -v\', \'[]\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\', \'00:00:00\', (\'PHP 8.0.12 (cli) (built: Oct 19 2021 11:21:05) ( ZTS Visual C++ 2019 x64 )\',\'Copyright (c) The PHP Group\',\'Zend Engine v4.0.12, Copyright (c) Zend Technologies\'), \'null\', \'2023-04-01 17:25:00\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\')')
4 SYSTEMPATH\Database\BaseBuilder.php:2309 CodeIgniter\Database\BaseConnection()->query('INSERT INTO task_scheduler_logs (name, type, action, environment, start_at, end_at, duration, output, error, test_time, created_at, updated_at) VALUES (:name:, :type:, :action:, :environment:, :start_at:, :end_at:, :duration:, :output:, :error:, :test_time:, :created_at:, :updated_at:)', [...], false)
5 SYSTEMPATH\Model.php:330 CodeIgniter\Database\BaseBuilder()->insert()
6 SYSTEMPATH\BaseModel.php:782 CodeIgniter\Model()->doInsert([...])
7 SYSTEMPATH\Model.php:730 CodeIgniter\BaseModel()->insert([...], true)
8 APPPATH\ThirdParty\vendor\daycry\cronjob\src\JobRunner.php:207 CodeIgniter\Model()->insert([...])
9 APPPATH\ThirdParty\vendor\daycry\cronjob\src\JobRunner.php:99 Daycry\CronJob\JobRunner()->storePerformanceLog(Object(Daycry\CronJob\JobLog))
10 APPPATH\ThirdParty\vendor\daycry\cronjob\src\Commands\Run.php:80 Daycry\CronJob\JobRunner()->run()
11 SYSTEMPATH\CLI\Commands.php:65 Daycry\CronJob\Commands\Run()->run([...])
12 SYSTEMPATH\CLI\Console.php:37 CodeIgniter\CLI\Commands()->run('cronjob:run', [...])
13 ROOTPATH\spark:97 CodeIgniter\CLI\Console()->run()
Possible solution: 'output' => $jobLog->output? json_encode($jobLog->output) : NULL,
I imagine that the result is an array, maybe it is a good idea.
Thank you
Some output contains characters which result into MySQL errors: [mysqli_sql_exception] Operand should contain 1 column(s)
I have this issue when I try to insert the shell output of php -v
I figured out that I can solve it by wrapping the output in a json_encode.
app\ThirdParty\vendor\daycry\cronjob\src\JobRunner.php line 187
Running Tasks...
2023-04-03 12:00:00[2023-05-03 12:44:40] Processing: Daily [2023-05-03 12:44:40] Executed: Daily
[mysqli_sql_exception]
Operand should contain 1 column(s)
at SYSTEMPATH\Database\MySQLi\Connection.php:295
Backtrace: 1 SYSTEMPATH\Database\MySQLi\Connection.php:295 mysqli()->query('INSERT INTO
task_scheduler_logs
(name
,type
,action
,environment
,start_at
,end_at
,duration
,output
,error
,test_time
,created_at
,updated_at
) VALUES (\'Daily\', \'shell\', \'php -v\', \'[]\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\', \'00:00:00\', (\'PHP 8.0.12 (cli) (built: Oct 19 2021 11:21:05) ( ZTS Visual C++ 2019 x64 )\',\'Copyright (c) The PHP Group\',\'Zend Engine v4.0.12, Copyright (c) Zend Technologies\'), \'null\', \'2023-04-01 17:25:00\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\')', 0)2 SYSTEMPATH\Database\BaseConnection.php:692 CodeIgniter\Database\MySQLi\Connection()->execute('INSERT INTO
task_scheduler_logs
(name
,type
,action
,environment
,start_at
,end_at
,duration
,output
,error
,test_time
,created_at
,updated_at
) VALUES (\'Daily\', \'shell\', \'php -v\', \'[]\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\', \'00:00:00\', (\'PHP 8.0.12 (cli) (built: Oct 19 2021 11:21:05) ( ZTS Visual C++ 2019 x64 )\',\'Copyright (c) The PHP Group\',\'Zend Engine v4.0.12, Copyright (c) Zend Technologies\'), \'null\', \'2023-04-01 17:25:00\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\')')3 SYSTEMPATH\Database\BaseConnection.php:606 CodeIgniter\Database\BaseConnection()->simpleQuery('INSERT INTO
task_scheduler_logs
(name
,type
,action
,environment
,start_at
,end_at
,duration
,output
,error
,test_time
,created_at
,updated_at
) VALUES (\'Daily\', \'shell\', \'php -v\', \'[]\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\', \'00:00:00\', (\'PHP 8.0.12 (cli) (built: Oct 19 2021 11:21:05) ( ZTS Visual C++ 2019 x64 )\',\'Copyright (c) The PHP Group\',\'Zend Engine v4.0.12, Copyright (c) Zend Technologies\'), \'null\', \'2023-04-01 17:25:00\', \'2023-05-03 12:44:40\', \'2023-05-03 12:44:40\')')4 SYSTEMPATH\Database\BaseBuilder.php:2309 CodeIgniter\Database\BaseConnection()->query('INSERT INTO
task_scheduler_logs
(name
,type
,action
,environment
,start_at
,end_at
,duration
,output
,error
,test_time
,created_at
,updated_at
) VALUES (:name:, :type:, :action:, :environment:, :start_at:, :end_at:, :duration:, :output:, :error:, :test_time:, :created_at:, :updated_at:)', [...], false)5 SYSTEMPATH\Model.php:330 CodeIgniter\Database\BaseBuilder()->insert()
6 SYSTEMPATH\BaseModel.php:782 CodeIgniter\Model()->doInsert([...])
7 SYSTEMPATH\Model.php:730 CodeIgniter\BaseModel()->insert([...], true)
8 APPPATH\ThirdParty\vendor\daycry\cronjob\src\JobRunner.php:207 CodeIgniter\Model()->insert([...])
9 APPPATH\ThirdParty\vendor\daycry\cronjob\src\JobRunner.php:99 Daycry\CronJob\JobRunner()->storePerformanceLog(Object(Daycry\CronJob\JobLog))
10 APPPATH\ThirdParty\vendor\daycry\cronjob\src\Commands\Run.php:80 Daycry\CronJob\JobRunner()->run()
11 SYSTEMPATH\CLI\Commands.php:65 Daycry\CronJob\Commands\Run()->run([...])
12 SYSTEMPATH\CLI\Console.php:37 CodeIgniter\CLI\Commands()->run('cronjob:run', [...])
13 ROOTPATH\spark:97 CodeIgniter\CLI\Console()->run()