mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
Better exception description and better recognize of boolean type when database doesn't know boolean field types
This commit is contained in:
parent
c201c916cb
commit
0053885bc1
@ -1330,7 +1330,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if [eaCreate, eaUpdate, eaDelete] * lTableMap.fEntityAllowedActions <> [] then
|
if [eaCreate, eaUpdate, eaDelete] * lTableMap.fEntityAllowedActions <> [] then
|
||||||
begin
|
begin
|
||||||
raise Exception.Create('Cannot find TableNameAttribute');
|
raise Exception.Create('Cannot find TableNameAttribute on class ' + ClassName + ' - [HINT] Is this class decorated with MVCTable and its fields with MVCTableField?');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1390,7 +1390,7 @@ begin
|
|||||||
lTableMap.fMap.EndUpdates;
|
lTableMap.fMap.EndUpdates;
|
||||||
if (lPKCount + lTableMap.fMap.WritableFieldsCount + lTableMap.fMap.ReadableFieldsCount) = 0 then
|
if (lPKCount + lTableMap.fMap.WritableFieldsCount + lTableMap.fMap.ReadableFieldsCount) = 0 then
|
||||||
raise EMVCActiveRecord.Create(
|
raise EMVCActiveRecord.Create(
|
||||||
'No fields nor PKs defined. [HINT] Use MVCTableField in private fields');
|
'No fields nor PKs defined in class ' + ClassName + '. [HINT] Use MVCTableField in private fields');
|
||||||
lTableMap.fPartitionInfoInternal := nil;
|
lTableMap.fPartitionInfoInternal := nil;
|
||||||
|
|
||||||
ActiveRecordTableMapRegistry.AddTableMap(Self, lTableMap);
|
ActiveRecordTableMapRegistry.AddTableMap(Self, lTableMap);
|
||||||
|
@ -1141,7 +1141,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// sqlite doesn't support boolean, so are identified as integers
|
// sqlite doesn't support boolean, so are identified as integers
|
||||||
// so we need to do some more checks...
|
// so we need to do some more checks...
|
||||||
if (aRTTIField.FieldType.TypeKind = tkEnumeration) and (aRTTIField.Name.ToLower.Contains('bool')) then
|
if (aRTTIField.FieldType.TypeKind = tkEnumeration) and (aRTTIField.FieldType.Handle = TypeInfo(Boolean)) then
|
||||||
begin
|
begin
|
||||||
aRTTIField.SetValue(AObject, AField.AsInteger = 1);
|
aRTTIField.SetValue(AObject, AField.AsInteger = 1);
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user