Subject | Re: [firebird-support] info |
---|---|
Author | Slavomir Skopalik |
Post date | 2017-01-05T10:16:35Z |
We have another tables that contain definition of each relation and each
field.
Data for this tables are automatically generated from case tool like this:
EXECUTE BLOCK AS BEGIN
--definition fields for entity: USERFUNCTIONS
IF (EXISTS(SELECT 1 FROM rdb$relations where rdb$relation_name =
'USERFUNCTIONS')) THEN
UPDATE OR INSERT INTO S_DefinitionTables (RDB$RELATION_NAME, Caption,
Description, Cacheable, EntityName, DetailCaption)
VALUES('USERFUNCTIONS', NULL, 'Pracovni zarazeni cloveka', 0,
'UserFunctions', NULL);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME = 'ID')) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, priority, enabled, visualtype, FieldType, sqlexpression,
caption, description, required, readonly, showingrid, showindetail,
sortable, defaultvalue, defaultformat, defaultunits, lengthmin,
lengthmax, rangemin, rangemax, horizontalalign, widthvisual,
heightvisual, vieweropt, editoropt, EntityPropertyName, GeneratorName,
FTPriority)
VALUES('USERFUNCTIONS', 'ID', 1, 1, 0, 0, NULL,'id', NULL, 0, 0, 1,
1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL,
NULL, 'id', 'GenUserFunctionsID', NULL) MATCHING(rdb$relation_name,
rdb$field_name, priority);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME = 'TEXT')) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, priority, enabled, visualtype, FieldType, sqlexpression,
caption, description, required, readonly, showingrid, showindetail,
sortable, defaultvalue, defaultformat, defaultunits, lengthmin,
lengthmax, rangemin, rangemax, horizontalalign, widthvisual,
heightvisual, vieweropt, editoropt, EntityPropertyName, GeneratorName,
FTPriority)
VALUES('USERFUNCTIONS', 'TEXT', 1, 1, 0, 0, NULL,'Text', NULL, 0, 0,
1, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL,
NULL, 'Text', NULL, NULL) MATCHING(rdb$relation_name, rdb$field_name,
priority);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME =
'DESCRIPTION')) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, priority, enabled, visualtype, FieldType, sqlexpression,
caption, description, required, readonly, showingrid, showindetail,
sortable, defaultvalue, defaultformat, defaultunits, lengthmin,
lengthmax, rangemin, rangemax, horizontalalign, widthvisual,
heightvisual, vieweropt, editoropt, EntityPropertyName, GeneratorName,
FTPriority)
VALUES('USERFUNCTIONS', 'DESCRIPTION', 1, 1, 0, 0,
NULL,'Description', NULL, 0, 0, 1, 1, 1, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, 0, NULL, NULL, NULL, NULL, 'Description', NULL, NULL)
MATCHING(rdb$relation_name, rdb$field_name, priority);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME =
UPPER('tDateUTC'))) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, EntityPropertyName, Priority, Enabled, Caption,
Description, Readonly, Showingrid, Showindetail)
VALUES('USERFUNCTIONS', 'TDATEUTC', 'tDateUTC', 1, 1, 'Created',
'Timestamp of record creation', 1, 0, 1) MATCHING(rdb$relation_name,
rdb$field_name, Priority);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME =
UPPER('lDateUTC'))) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, EntityPropertyName, Priority, Enabled, Caption,
Description, Readonly, Showingrid, Showindetail)
VALUES('USERFUNCTIONS', 'LDATEUTC', 'lDateUTC', 1, 1, 'Modified',
'Timestamp of last record modification', 1, 0, 1)
MATCHING(rdb$relation_name, rdb$field_name, Priority);
END^
Delphi generated class look like this:
{$REGION 'TFB_UserFunction'}
(* Pracovni zarazeni cloveka *)
TFB_UserFunction=class(TMasaObject)
private
Fid:SmallInt;
FText:String;
FDescription:String;
FtDateUTC:TDateTime;
FlDateUTC:TDateTime;
public
constructor Create(AOwner:TComponent);override;
constructor CreateAndSetPK(AOwner:TComponent; const id:SmallInt);
procedure Clear;override;
procedure Assign(Source:TPersistent);override;
function IsEquivalent(const entity:
TFB_UserFunction):Boolean;virtual;
function DBFetch: boolean;override;
procedure DBInsert;override;
procedure DBUpdate;override;
procedure DBDelete;override;
class function EntityInfo: TEntityInfo;
published
property id:SmallInt read Fid write Fid; (* *)
property Text:String read FText write FText; (* *)
property Description:String read FDescription write
FDescription; (* *)
property tDateUTC:TDateTime read FtDateUTC write FtDateUTC;
(* UTC timestamp of record insertion *)
property lDateUTC:TDateTime read FlDateUTC write FlDateUTC;
(* UTC timestamp of last record modification *)
end;
TUSERFUNCTIONSClass=class of TFB_UserFunction;
{$ENDREGION}
Slavek
Ing. Slavomir Skopalik
Executive Head
Elekt Labs s.r.o.
Collection and evaluation of data from machines and laboratories
by means of system MASA (http://www.elektlabs.cz/m2demo)
-----------------------------------------------------------------
Address:
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
---------------------------------------------------------------
Mobile: +420 724 207 851
icq:199 118 333
skype:skopaliks
e-mail:skopalik@...
http://www.elektlabs.cz
On 5.1.2017 10:36, Nico Speleers - Carfac BVBA nico.speleers@...
[firebird-support] wrote:
field.
Data for this tables are automatically generated from case tool like this:
EXECUTE BLOCK AS BEGIN
--definition fields for entity: USERFUNCTIONS
IF (EXISTS(SELECT 1 FROM rdb$relations where rdb$relation_name =
'USERFUNCTIONS')) THEN
UPDATE OR INSERT INTO S_DefinitionTables (RDB$RELATION_NAME, Caption,
Description, Cacheable, EntityName, DetailCaption)
VALUES('USERFUNCTIONS', NULL, 'Pracovni zarazeni cloveka', 0,
'UserFunctions', NULL);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME = 'ID')) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, priority, enabled, visualtype, FieldType, sqlexpression,
caption, description, required, readonly, showingrid, showindetail,
sortable, defaultvalue, defaultformat, defaultunits, lengthmin,
lengthmax, rangemin, rangemax, horizontalalign, widthvisual,
heightvisual, vieweropt, editoropt, EntityPropertyName, GeneratorName,
FTPriority)
VALUES('USERFUNCTIONS', 'ID', 1, 1, 0, 0, NULL,'id', NULL, 0, 0, 1,
1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL,
NULL, 'id', 'GenUserFunctionsID', NULL) MATCHING(rdb$relation_name,
rdb$field_name, priority);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME = 'TEXT')) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, priority, enabled, visualtype, FieldType, sqlexpression,
caption, description, required, readonly, showingrid, showindetail,
sortable, defaultvalue, defaultformat, defaultunits, lengthmin,
lengthmax, rangemin, rangemax, horizontalalign, widthvisual,
heightvisual, vieweropt, editoropt, EntityPropertyName, GeneratorName,
FTPriority)
VALUES('USERFUNCTIONS', 'TEXT', 1, 1, 0, 0, NULL,'Text', NULL, 0, 0,
1, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL,
NULL, 'Text', NULL, NULL) MATCHING(rdb$relation_name, rdb$field_name,
priority);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME =
'DESCRIPTION')) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, priority, enabled, visualtype, FieldType, sqlexpression,
caption, description, required, readonly, showingrid, showindetail,
sortable, defaultvalue, defaultformat, defaultunits, lengthmin,
lengthmax, rangemin, rangemax, horizontalalign, widthvisual,
heightvisual, vieweropt, editoropt, EntityPropertyName, GeneratorName,
FTPriority)
VALUES('USERFUNCTIONS', 'DESCRIPTION', 1, 1, 0, 0,
NULL,'Description', NULL, 0, 0, 1, 1, 1, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, 0, NULL, NULL, NULL, NULL, 'Description', NULL, NULL)
MATCHING(rdb$relation_name, rdb$field_name, priority);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME =
UPPER('tDateUTC'))) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, EntityPropertyName, Priority, Enabled, Caption,
Description, Readonly, Showingrid, Showindetail)
VALUES('USERFUNCTIONS', 'TDATEUTC', 'tDateUTC', 1, 1, 'Created',
'Timestamp of record creation', 1, 0, 1) MATCHING(rdb$relation_name,
rdb$field_name, Priority);
IF (EXISTS(SELECT 1 from RDB$RELATION_FIELDS rf where
rf.RDB$RELATION_NAME = 'USERFUNCTIONS' and rf.RDB$FIELD_NAME =
UPPER('lDateUTC'))) THEN
UPDATE OR INSERT INTO S_DefinitionFields (rdb$relation_name,
rdb$field_name, EntityPropertyName, Priority, Enabled, Caption,
Description, Readonly, Showingrid, Showindetail)
VALUES('USERFUNCTIONS', 'LDATEUTC', 'lDateUTC', 1, 1, 'Modified',
'Timestamp of last record modification', 1, 0, 1)
MATCHING(rdb$relation_name, rdb$field_name, Priority);
END^
Delphi generated class look like this:
{$REGION 'TFB_UserFunction'}
(* Pracovni zarazeni cloveka *)
TFB_UserFunction=class(TMasaObject)
private
Fid:SmallInt;
FText:String;
FDescription:String;
FtDateUTC:TDateTime;
FlDateUTC:TDateTime;
public
constructor Create(AOwner:TComponent);override;
constructor CreateAndSetPK(AOwner:TComponent; const id:SmallInt);
procedure Clear;override;
procedure Assign(Source:TPersistent);override;
function IsEquivalent(const entity:
TFB_UserFunction):Boolean;virtual;
function DBFetch: boolean;override;
procedure DBInsert;override;
procedure DBUpdate;override;
procedure DBDelete;override;
class function EntityInfo: TEntityInfo;
published
property id:SmallInt read Fid write Fid; (* *)
property Text:String read FText write FText; (* *)
property Description:String read FDescription write
FDescription; (* *)
property tDateUTC:TDateTime read FtDateUTC write FtDateUTC;
(* UTC timestamp of record insertion *)
property lDateUTC:TDateTime read FlDateUTC write FlDateUTC;
(* UTC timestamp of last record modification *)
end;
TUSERFUNCTIONSClass=class of TFB_UserFunction;
{$ENDREGION}
Slavek
Ing. Slavomir Skopalik
Executive Head
Elekt Labs s.r.o.
Collection and evaluation of data from machines and laboratories
by means of system MASA (http://www.elektlabs.cz/m2demo)
-----------------------------------------------------------------
Address:
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
---------------------------------------------------------------
Mobile: +420 724 207 851
icq:199 118 333
skype:skopaliks
e-mail:skopalik@...
http://www.elektlabs.cz
On 5.1.2017 10:36, Nico Speleers - Carfac BVBA nico.speleers@...
[firebird-support] wrote:
> Based on table- and columnnames in camelcase our programmers can automatic create their objects and classes. Therefore we need to create our table- and columnnames in camelcase. Another reason is readability. We found camelcase more readable then UPPERCASE.
>
> Have you got a solution for my problem ?
>
> Nico Speleers
> Analyst
>
>
>
> Carfac bvba
> Driving on experience
>
> Rijksweg 53
> 9680 Maarkedal
> Tel. +32 55 23 00 00
> Fax +32 55 31 00 95
> nico.speleers@...
> www.carfac.be
>
>
>
>
>
> -----Oorspronkelijk bericht-----
> Van: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
> Verzonden: donderdag 5 januari 2017 10:23
> Aan: firebird-support@yahoogroups.com
> Onderwerp: Re: [firebird-support] info
>
> 05.01.2017 8:51, Nico Speleers - Carfac BVBA nico.speleers@... [firebird-support]
> wrote:
>> If I execute Create table MyTable(aField integer) then the tablename is saved as MYTABLE.
> Why do you care how it is saved? Just don't look into system tables when writing your
> queries.
>
>