Skip to content

[5.4] Fix bug in compileInsert with empty values with SQLite. - #20424

Merged
taylorotwell merged 1 commit into
laravel:5.4from
mathieutu:fix/5.4/sqlite-grammar
Aug 6, 2017
Merged

[5.4] Fix bug in compileInsert with empty values with SQLite.#20424
taylorotwell merged 1 commit into
laravel:5.4from
mathieutu:fix/5.4/sqlite-grammar

Conversation

@mathieutu

Copy link
Copy Markdown
Contributor

Hi,
When you're trying to perform an insert with empty values with SQLite, a QueryException is thrown, with message SQLSTATE[HY000]: General error: 1 near ")": syntax error (SQL: insert into "foos" () values ()).

Indeed, the syntax for inserting an empty row is different between SQLite and MySQL.

You can reproduce that with $model->create(); (with $timestamps = false of course to have a perfect empty model).

With Mysql it works, with SQLite it fails.

* @param array $values
* @param string $sequence
* @return string
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you override this method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, no reason for that. It's removed.

@tillkruss tillkruss changed the title Fix bug in compileInsert with empty values with SQLite. [5.4] Fix bug in compileInsert with empty values with SQLite. Aug 4, 2017
@mathieutu
mathieutu force-pushed the fix/5.4/sqlite-grammar branch from 9bbd4d3 to b664dd0 Compare August 5, 2017 11:04
@taylorotwell

Copy link
Copy Markdown
Member

@themsaid can you test this?

@themsaid

themsaid commented Aug 6, 2017

Copy link
Copy Markdown
Member

@taylorotwell Tested it and it seems to work.

@taylorotwell
taylorotwell merged commit b664dd0 into laravel:5.4 Aug 6, 2017
@mathieutu

Copy link
Copy Markdown
Contributor Author

You're welcome...
😑

@mathieutu
mathieutu deleted the fix/5.4/sqlite-grammar branch September 1, 2017 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants