Replies: 1 comment 2 replies
-
Because MySQL 3.x is so old and likely that anyone still using it is also using an old PHP, IMO we should be asking the PHP folks to change the default flags so that this compatibility is now turned off. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When using SQLite as database for Laravel framework, queries are generated using double quotes for identifiers, which can have unexpected results when you query for non existing columns.
For example, an Eloquent query like this
gets converted to
The problem is that, as stated at here:
So, the above query, instead of generating an error as I would have expected, simply returns no result; similarly, a query like
will return all rows from the table.
Steps To Reproduce
It'll return
null
instead of generating an error/exception, whereaswill return the seeded record.
Possible solutions
I do understand that this is not directly tied to Laravel framework itself, and that, from what I understand, it could be resolved by recompiling PHP with some specific flags; however, it seems that in the standard PHP versions you download from repository, those flags were not used.
Given the above, I think that the framework could/should give a mean to its users to work around this problem.
From what I have seen, the possible solutions might be:
[]
or backticks to quote identifiers; orMaybe is there a way to easily do one of the above that I missed? I am indeed quite new to the framework.
Beta Was this translation helpful? Give feedback.
All reactions