This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a database table in SQL Server 2005 called User. I get this error when I get an entity from the database:
This is the SQL generated: I am considering renaming the table but I thought automatically escaping reserved words is something you might want to fix. |
|
|
Thanks James, the ability to quote identifiers has always been there. Please enable it on your LightSpeedContext by setting the QuoteIdentifiers to true. I hope this helps, John-Daniel Trask |
|
|
It would be nice if this was enabled by default rather than having to turn it on by hand. That would have saved me 1/2 hour of gawping at at "Incorrect syntax near the keyword 'Key'" error. Is there any downside to generating safer SQL by default?
|
|
|
There are a couple of potential downsides: 1. It makes the SQL more cluttered and hard to read. On the other hand, by default, you're not reading the SQL, so it's reasonable to say that the solution to this is to quote identifiers by default and let people turn it off if it annoys them. 2. On some databases, quoting seems to have a dual role: it escapes reserved words, but it also turns on case sensitivity. This could result in confusing behaviour on these databases and would be a breaking change for users of those databases. We could make the default behaviour depend on the database provider (e.g. default to quoting for SQL Server, but to not quoting for Oracle or PostgreSQL), but that makes LightSpeed's behaviour harder for users to understand and predict. I feel your pain though because I've been bitten by the same issue! I'll raise this with the Mindscape brains trust and see if we can come up with anything. |
|