You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever a table has a column that contains a dot, it's escaped in way I don't want it to be escaped. Note: I am using the SqlServerCompiler class and have not tested it for other drivers.
Example, your table is products and it contains the column product.id and you use the query builder to build an insert query like this.
It will generate a SQL query like: INSERT INTO products ([product].[id]) VALUES (5) instead of the (in my case) desired INSERT INTO products ([product.id]) VALUES (5). The escaping happens in the Wrap method of the compiler.
It's a difficult issue, because in some cases you actually want the generated query and in some cases the desired query. I've added a workaround like this.
This way I can prevent the behaviour when I want it to by changing the property EscapeDots. However it's quite a dirty solution (if a table would have the ___'s in their table it would do unexpected things). Does anyone know a better approach? And are there plans to implement a 'fix' in the project itself?
The text was updated successfully, but these errors were encountered:
jordy758
changed the title
Columns that contain dots are escaped
Columns that contain dots are unexpectedly escaped
Aug 17, 2022
Whenever a table has a column that contains a dot, it's escaped in way I don't want it to be escaped. Note: I am using the
SqlServerCompiler
class and have not tested it for other drivers.Example, your table is
products
and it contains the columnproduct.id
and you use the query builder to build an insert query like this.It will generate a SQL query like:
INSERT INTO products ([product].[id]) VALUES (5)
instead of the (in my case) desiredINSERT INTO products ([product.id]) VALUES (5)
. The escaping happens in the Wrap method of the compiler.It's a difficult issue, because in some cases you actually want the generated query and in some cases the desired query. I've added a workaround like this.
This way I can prevent the behaviour when I want it to by changing the property EscapeDots. However it's quite a dirty solution (if a table would have the ___'s in their table it would do unexpected things). Does anyone know a better approach? And are there plans to implement a 'fix' in the project itself?
The text was updated successfully, but these errors were encountered: