Skip to content
Browse files

implemented rpmQuoteFieldName new mapping option

  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Sep 9, 2019
1 parent 8beb6fd commit f199b2fcb3820cd11f455b9247095dc646458d49
Showing with 11 additions and 4 deletions.
  1. +7 −1 SQLite3/mORMot.pas
  2. +3 −2 SQLite3/mORMotDB.pas
  3. +1 −1
// to circumvent some specific DB provider or case sensitivity issue on fields
// - by default, check of missing field name will be case insensitive, unless
// the rpmMissingFieldNameCaseSensitive option is set
// - rpmQuoteFieldName will quote the field names - to be used e.g. with
// FireBird in its Dialect 3
TSQLRecordPropertiesMappingOptions = set of (
rpmNoCreateMissingTable, rpmNoCreateMissingField,
rpmMissingFieldNameCaseSensitive, rpmQuoteFieldName);

/// pointer to external database properties for ORM
// - is used e.g. to allow a "fluent" interface for MapField() method
/// the external field names, following fProps.Props.Field[] order
// - excluding ID/RowID field, which is stored in RowIDFieldName
property ExtFieldNames: TRawUTF8DynArray read fExtFieldNames;
/// the unquoted external field names, following fProps.Props.Field[] order
// - excluding ID/RowID field, which is stored in RowIDFieldName
// - in respect to ExtFieldNames[], this array will never quote the field name
property ExtFieldNamesUnQuotedSQL: TRawUTF8DynArray read fExtFieldNamesUnQuotedSQL;
/// each bit set, following fProps.Props.Field[]+1 order (i.e. 0=ID,
// 1=Field[0], ...), indicates that this external field name
// has not been mapped
@@ -805,7 +805,8 @@ constructor TSQLRestStorageExternal.Create(aClass: TSQLRecordClass;
end else
log.Log(sllWarning,'-> you should better use MapAutoKeywordFields',self);
end else if rpmQuoteFieldName in options then
// create corresponding external table if necessary, and retrieve its fields info
@@ -847,7 +848,7 @@ constructor TSQLRestStorageExternal.Create(aClass: TSQLRecordClass;
for f := 0 to Fields.Count-1 do
if Fields.List[f].SQLFieldType in COPIABLE_FIELDS then // ignore sftMany
/// real database columns exist for Simple + Blob fields (not Many)
if FieldsExternalIndexOf(fStoredClassProps.ExternalDB.ExtFieldNames[f])<0 then begin
if FieldsExternalIndexOf(fStoredClassProps.ExternalDB.ExtFieldNamesUnQuotedSQL[f])<0 then begin
// add new missing Field
@@ -1 +1 @@

0 comments on commit f199b2f

Please sign in to comment.
You can’t perform that action at this time.