synopse / mORMot

Synopse mORMot 1 ORM/SOA/MVC framework - Please upgrade to mORMot 2 !
https://synopse.info
785 stars 323 forks source link

Fix for setting ParenthesisAfter property value in TSynTableStatement… #437

Closed ASiwon closed 1 year ago

ASiwon commented 1 year ago

… class while parsing SQL with complex condition like:

select field from table where id=? and (column1<>? or column1 is null)

Before correction this query is not correctly parsed in the class TSynTableStatement - closing parenthesis is missing. This causes SQL execution error in my case in Oracle, but probably also in any other database engines.

synopse commented 1 year ago

Note that I won't port it to mORMot 2 because it is very specific, and handles your workcase as you expect, but is likely to fail in a more general usecase, e.g. when fields are renamed.

ASiwon commented 1 year ago

Ok. But it will be possible to support similar conditions in mORMot 2? Null values occurs very often in the Oracle database - empty string is always treated as null, which makes that conditions must be created in specific way to take into account the specificity of the database system.

synopse commented 1 year ago

Parenthesis are currently not supported for the custom storage engine. Use direct SQL execution for such complex statements, not the ORM.