Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 6, 2017

Conversation

mathieutu
Copy link
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 string $sequence
* @return string
*/
public function compileInsertGetId(Builder $query, $values, $sequence)
Copy link
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
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
@taylorotwell
Copy link
Member

@themsaid can you test this?

@themsaid
Copy link
Member

themsaid commented Aug 6, 2017

@taylorotwell Tested it and it seems to work.

@taylorotwell taylorotwell merged commit b664dd0 into laravel:5.4 Aug 6, 2017
@mathieutu
Copy link
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