Search code examples
c#devforce

DevForce enclosing database objects on queries with quotes


I noticed that database queries executed by DevForce encloses database objects in the query with quotes (e.g. select * from "SCHEMA_NAME"."TABLE_NAME"). I'd just like to ask if there is a way for DevForce not to do this.

I'm currently using DevForce Classic 3.7.5.1.

Thanks.


Solution

  • DevForce Classic uses a "provider helper" to determine formatting for a SQL statement. The default helper in use is determined by your connection string, but is usually an instance of OleDbProviderHelper. To change default logic you can subclass either the OleDbProviderHelper, or another of the helpers based on your needs.

    In this case, to change formatting for identifiers you can use something similar to the following:

    public class CustomProviderHelper : IdeaBlade.Rdb.OleDbProviderHelper {
    
      public override string FormatIdentifier(string identifier) {
        return identifier;
      }
    }
    

    The default logic for this method wraps the identifier with base.IdentifierPrefix and base.IdentifierSuffix values, which you can also override. In the sample above I'm only removing all use of prefixes and suffixes, but you can do whatever works best for you.

    DevForce will find your custom implementation if you place the class in an assembly on the server specified as one of the probe assemblies for the RdbKey.