View Issue Details

IDProjectCategoryView StatusLast Update
0007177OXID eShop (all versions)4.01. Database handlingpublic2020-09-25 09:35
Reporterwael golli 
Status closedResolutionopen 
Product Version6.2.2 
Target VersionFixed in Version 
Summary0007177: Doctrine QueryBuilder INSERT
DescriptionUsing Doctrine QuerBuilder to insert a new row using an array of values,fails and throws Syntax error,
Values should be treated and checked
Steps To Reproduce1/create a new Array() contains different values of int/date/strings, it can be empty values
2/ use query builder as described below
            ->insert( ' TableName ' )
Additional Information3/ generated SQL :
INSERT INTO Table name (Name1,Name2,Name3...) VALUES(94, ,Val3 ... )
4/ this SQL throws error
empty string should be ' '
TagsDatabase, doctrine, MySQL, QueryBuilder
ThemeNot defined
BrowserNot defined
PHP Version7.1
Database VersionMySQL 5.5



2020-09-24 15:19

administrator   ~0013305

Dear Wael Golli,

i cannot reproduce the same failure msg.
I created querys according to

Could you please provide your query in a whole?

Best Regards

QA - SG -

wael golli

2020-09-24 22:33

reporter   ~0013306

Dear QA,
Ill write for you some testing data and steps to reproduce it:
$var1=' ';$var2='2020-01-02 18:30:00';$var3='(45)test(23)';
"columnA" => $var1,
"columnB"=> $var2,
            ->insert( ' TableTest ' )

3) the query generated would be = INSERT INTO TableTest( ColumnA,ColumnB,ColumnC) VALUES ( ,2020-01-02 18:30:00, (45)test(23))
executing this query would give an exception,


2020-09-25 08:40

manager   ~0013307

Hey Wael Golli,

this is expected behaviour from Doctrine DBAL. If you'd like to insert the values via the call to values() directly, you need to prepare those values on your own, alternatively bind those values via calls to setParameter(). Your code could look like this:

$var1 = ' ';
$var2 = '2020-01-02 18:30:00';
$var3 = '(45)test(23)';

$list= [
    "columnA" => "?",
    "columnB" => "?",
    "columnC" => "?"

    ->setParameter(0, $var1)
    ->setParameter(1, $var2)
    ->setParameter(2, $var3);

You can find out more on this topic in the official Doctrine documentation at

Hope I could help



2020-09-25 09:35

administrator   ~0013308

Dear Wael Golli,

as Florian explained:
We use the original syntax of doctrine, please check the references.

Best Regards