Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Projection names and MySQL backslash encoding #31

Unanswered
drsdre asked this question in Q&A
Discussion options

I've run into a tricky issue with encoding backslashes in the projection_name where queries. In certain MySQL conditions, probably governed by https://dev.mysql.com/doc/refman/8.4/en/sql-mode.html#sqlmode_no_backslash_escapes, the projections don't get found because of the backslashes in the namespaced model names.

Storage seems to be fine, however in the queries the backslashes need to be doubled up (App\Models\Projections\MailStatsProjection needs to be transformed into App\\Models\\Projections\\MailStatsProjection). Within Laravel Eloquent there is a similar case with the MorphTo queries. Not sure yet how they have solved it.

You must be logged in to vote

Replies: 2 comments

Comment options

The NO_BACKSLASH_ESCAPES SQL option is highly discouraged as that will cause issues when escaping of content is required for storage.

You must be logged in to vote
0 replies
Comment options

The fix for this issue is to use explicit parameter binding and have the database figure out character escaping. The pull request for this fix is #32

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /