Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] SQLite3 Error
#1

(This post was last modified: 11-20-2023, 01:58 PM by grimpirate. Edit Reason: Switching title to [SOLVED] )

Code:
/var/www/localhost/htdocs/sub # php spark db:seed FormulaSeeder

CodeIgniter v4.4.3 Command Line Tool - Server Time: 2023-11-20 12:55:59 UTC-05:00


[CodeIgniter\Database\Exceptions\DatabaseException]

SQLite3::exec(): near ")": syntax error

at SYSTEMPATH/Database/BaseConnection.php:647

This exception is thrown via CLI which appears to be prompted by my use of insertBatch method and the inclusion of 'content_4_id' into the third row (the column exists in the table and is nullable). I know this because I ran the seeder without the third row and it processed successfully. However, when I change my code (as a workaround) with individual insert methods, no exception is thrown. Is this a bug in the CodeIgniter system code?

MALFUNCTIONING FormulaSeeder.php
PHP Code:
<?php

namespace App\Database\Seeds;

use 
CodeIgniter\Database\Seeder;

class 
FormulaSeeder extends Seeder
{
public function 
run()
{
$this->db->table('formula')->insertBatch([
[
'url_id' => 1'source_id' => 1'medium_id' => 1'content_1_id' => 1'content_2_id' => 1],
[
'url_id' => 1'source_id' => 2'medium_id' => 1'content_1_id' => 2'content_2_id' => 2],
[
'url_id' => 1'source_id' => 2'medium_id' => 1'content_1_id' => 2'content_2_id' => 2'content_4_id' => 1],
]);
}


WORKAROUND FormulaSeeder.php
PHP Code:
<?php

namespace App\Database\Seeds;

use 
CodeIgniter\Database\Seeder;

class 
FormulaSeeder extends Seeder
{
 public function 
run()
 {
 
$this->db->table('formula')->insert(['url_id' => 1'source_id' => 1'medium_id' => 1'content_1_id' => 1'content_2_id' => 1]);
 
$this->db->table('formula')->insert(['url_id' => 1'source_id' => 2'medium_id' => 1'content_1_id' => 2'content_2_id' => 2]);
 
$this->db->table('formula')->insert(['url_id' => 1'source_id' => 2'medium_id' => 1'content_1_id' => 2'content_2_id' => 2'content_4_id' => 1]);
 }

Reply


Messages In This Thread
[SOLVED] SQLite3 Error - by grimpirate - 11-20-2023, 11:01 AM
RE: SQLite3 Error - by sclubricants - 11-20-2023, 01:01 PM
RE: SQLite3 Error - by sclubricants - 11-20-2023, 01:08 PM
RE: SQLite3 Error - by grimpirate - 11-20-2023, 01:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB