Added a NOTE field in all ActiveRecordDB - the sample has been updated as well

This commit is contained in:
Daniele Teti 2019-12-23 10:35:36 +01:00
parent fdcb617801
commit 519d607b90
11 changed files with 15 additions and 1 deletions

View File

@ -68,6 +68,9 @@
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
<SanitizedProjectName>dmvcframeworkRT</SanitizedProjectName>
<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
<VerInfo_Locale>1040</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<DCC_Description>DMVCFramework - CopyRight (2010-2020) Daniele Teti and the DMVCFramework Team</DCC_Description>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<DCC_CBuilderOutput>None</DCC_CBuilderOutput>

View File

@ -70,6 +70,8 @@ type
fCompanyName: string;
[MVCTableField('city')]
fCity: string;
[MVCTableField('note')]
fNote: String;
public
constructor Create; override;
destructor Destroy; override;
@ -77,6 +79,7 @@ type
property Code: string read fCode write fCode;
property CompanyName: string read fCompanyName write fCompanyName;
property City: string read fCity write fCity;
property Note: String read fNote write fNote;
end;
[MVCNameCase(ncLowerCase)]

View File

@ -82,6 +82,7 @@ begin
lCustomer.Code := '1234';
lCustomer.CompanyName := 'Google Inc.';
lCustomer.City := 'Montain View, CA';
lCustomer.Note := 'Hello there!';
lCustomer.Insert;
lID := lCustomer.ID;
Log('Just inserted Customer ' + lID.ToString);
@ -92,6 +93,7 @@ begin
lCustomer := TMVCActiveRecord.GetByPK<TCustomer>(lID);
try
lCustomer.Code := '5678';
lCustomer.Note := lCustomer.Note + sLineBreak + 'Code changed to 5678';
lCustomer.Update;
Log('Just updated Customer ' + lID.ToString);
finally
@ -163,6 +165,7 @@ begin
lCustomer.City := Cities[Random(high(Cities) + 1)];
lCustomer.CompanyName := Format('%s %s %s', [lCustomer.City, Stuff[Random(High(Stuff) + 1)],
CompanySuffix[Random(High(CompanySuffix) + 1)]]);
lCustomer.Note := lCustomer.CompanyName + ' is from ' + lCustomer.City;
lCustomer.Insert;
finally
lCustomer.Free;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,6 +10,7 @@ CREATE TABLE customers (
code varchar(20) NOT NULL,
description varchar(200),
city varchar(200),
NOTE BLOB SUB_TYPE 1,
CONSTRAINT customers_pk PRIMARY KEY (id)
);

View File

@ -10,6 +10,7 @@ CREATE TABLE customers (
code varchar(20) NOT NULL,
description varchar(200),
city varchar(200),
note text DEFAULT NULL,
CONSTRAINT customers_pk PRIMARY KEY (id)
);

View File

@ -18,6 +18,7 @@ CREATE TABLE customers (
code varchar(20) NULL,
description varchar(200) NULL,
city varchar(200) NULL,
note text NULL,
CONSTRAINT customers_pk PRIMARY KEY (id)
);

View File

@ -1447,7 +1447,9 @@ begin
end
else
begin
raise EMVCJSONRPCException.Create('Response message must have ''result'' or ''error''');
raise EMVCJSONRPCException.Create('Response message must have ''result'' or ''error''.' + sLineBreak +
'Raw message is: ' + sLineBreak +
JSON.ToJSON());
end;
end;
end;