Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Extension for EDB 2 Components
Tue, Mar 20 2018 1:29 PMPermanent Link

Rolf Frei

eicom GmbH

Here are some extended EDB 2 components with the following additons:

- Property EmptyStringsAsNull: Boolean default True.
This will clear empty strings to NULL on posting a record. So no empty strings should be in the table after a post.

- Handling of a new special DB Table/View/Procedure attribute CURRENCY=Field1;Field2;... which controls, if a Float/BCD Field should be handled as a currency field. If this attribute is found on opening the Table, it will automaticly set the Field.Currency property to True. The new property AutoCurrencyFromAttributes: Boolean default True, will controll if this should be done automaticly. There is also a new CurrencyFieldNames property in which the fields can manually be set at design time. In this case the CURRENCY attribute is not used.

Sample table create SQL:
CREATE TABLE "Payment"
(
"ID" INTEGER NOT NULL,
"Price" DECIMAL(19,4) DEFAULT 0.0 NOT NULL,
"MaxOrderSum" DECIMAL(19,4) DEFAULT 0.0,
"Discount" FLOAT DEFAULT 0.0 NOT NULL,
CONSTRAINT "PrimaryKey" UNIQUE ("ID")
)
ATTRIBUTES 'CURRENCY=Price;MaxOrderSum'

- All Active and Connected properties gets not storerd anymore in the DFM. So if you still have a table open at design time, the Active = True property will not be stored and must be manually be activated at runtime.


Usage:
If you want the property editor for the new CurrencyFieldNames or if you want this new components at runtime anyway, then you can install the DPK into the IDE. Actually only the XE4 package is included, but it would not be a big deal to make it working in other IDE versions.

As an alternative you DONT need to install anything and just inlcude the RFEDBComps unit after the EDBComps unit in the Uses list. This will make all your TEDBxxx comps into TRFEDBxxx components at runtime and you get all the functionality without to install anything.

Hope anyone will find this additions helpfull. Smile

Regards
Rolf



Attachments: RFEDBComps.zip
Tue, Mar 20 2018 5:06 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Rolf.

<< Here are some extended EDB 2 components with the following additons: >>

Nice, thank you very much.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Mar 21 2018 4:22 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Rolf


Currency fields is an interesting one. I'll have to compare how you've done the emptystring = null bit and see if its any better than mine. I decided to just go with it because I personally will never want to post empty strings. One other thing I did was to trim fields since I, again personally, don't want trailing or leading spaces. If you want to have a loo at my code its in this NG.

Roy Lambert
Wed, Mar 21 2018 8:11 AMPermanent Link

Rolf Frei

eicom GmbH

WARNING

The TRFEDBScript component interface is/was wrong in the first Upload! It was a copy/paste isue. I didn't use that component myself yet, so I didn't notice its wrong proptery visibility.

Also there are no CURRENCY Attributes uses for this component. So if you want use this feature, you must set the CurrencyFieldNames property to get currency fields. And of course it will only work, if the script returns a cursor.

The interface should correctly look like this:

 TRFEDBScript = class(TEDBScript)
 private
   FCurrencyFieldNames: String;
   FEmptyStringsAsNull: Boolean;
 protected
   procedure InternalOpen; override;
   procedure InternalPost; override;
 public
   constructor Create(AOwner: TComponent); override;
 published
   property Active stored False;
   property CurrencyFieldNames: String read FCurrencyFieldNames write FCurrencyFieldNames;
   property EmptyStringsAsNull: Boolean read FEmptyStringsAsNull write FEmptyStringsAsNull default True;
 end;

Regards
Rolf



Attachments: RFEDBComps.zip
Mon, Mar 26 2018 9:44 AMPermanent Link

Rolf Frei

eicom GmbH

New Verison with the Interceptor class included. This unit was missing in the old ZIP file. Frown

The interceptor class unit RFEDBCompsInterceptor.pas can be used, if you don't want install the new TRFxxx comps in the IDE or you don't want replace them in all your existing applications. So you have just to add this Unit after the EDBComps in the uses list and all is done. So is no need to change any existing DFM's and just let the TEDBxxx untouched in there. By recompiling your application your forms will uses the new TRFEDBxxx comps instead the old TEDBxxx comps as of the intercepted classes in this new unit.

Regrads
Rolf



Attachments: RFEDBComps.zip
Sun, Jun 3 2018 10:10 PMPermanent Link

Ian Branch

Avatar

Hi Rolf,
Like playing on the 'Bleeding Edge' Smile
Will give them a try under DTokyo 10.2.3.

Regards,
Ian
Tue, Jun 5 2018 3:57 AMPermanent Link

Ian Branch

Avatar

Hi Rolf,
Said I'd have a play. Smile
I am using D10.2.3, EDB v 2.28 Build 1.
Issue with RFEDBQuery - If I put a RFEDBQuery & a EDBQuery component on a form that has the Engine, Session & Database set up.  Set the Session, DatabaseName & SQL for each of the Querys.
In desigb time, if I now Set Active true on EDBQuery, no problem.
If I then do it with RFEDBQuery, I get a "Database name is missing." error.  Frown
This makes testing in Design time a little difficult.
If I hook them to a table and build/run the app, Both work fine.

Is this error occurrence by design?  Have I missed some action/setting?

Regards,
Ian
Tue, Jun 5 2018 5:55 AMPermanent Link

Ian Branch

Avatar

"If I hook them to a table and build/run the app, Both work fine."

Should have said..

"If I hook them to a datasource and grid and build/run the app, Both work fine."

Ian
Mon, Jul 9 2018 6:37 PMPermanent Link

Ian Branch

Avatar

FWIW I prefer NULLs to empty strings.
Image