When an ORM generates the SQL for a certain database back-end, it needs to use the right quoting.
Normally, the Spring4D Marshmallow project derives that from the back-end specific adapter used.
But if you use a generic TDriverConnectionAdapter
, then you need to manually set the QueryLanguage
property in your IDBConnection
using a valid value from Spring.Persistence.SQL.Interfaces
. This then uses the correct SQLGenerator
from the TSQLGeneratorRegister
to generate the SQL including correct quotes.
To quote identifiers, most back-ends use a double quote, but MySQL uses a backtick.
via:
- [WayBack] I try to use ORM marshmallow from Spring4d framework. It’s awesome! But I have trouble when work with different databases: mysql and firebird… – Аров Марат (Coolmarat) – Google+
- [Archive.is] MARSHMALLOW errors on some databases (firebird) – Google Groups
You obviously already modified that code as the commented out code is the correct one.
I guess you already got that mistake when you started using MySQL via ADO as MySQL needs the backtick.Set QueryLanguage of your IDBConnection properly (the valid values are in Spring.Persistence.SQL.Interfaces). Then the correct SQLGenerator will be used.
If you are using an adapter that is specific to a certain database then it sets the QueryLanguage properly but if you are using an adapter for components that can connect to multiple databases (like ADO or FireDAC) it does not, hence the need you specify it.
–jeroen