Default value when reading field

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Default value when reading field

Post by oz8hp » Sun 05 Aug 2012 09:44

Is there any way to have a read operation that fails to return a default value?
If I read a field and for some reason this fails I would like to have the option to return a default value like when readin from an INI file (ReadString(Section, 'Key', 'Default');

I could of course build my own unit for this, but if there was a built in way that was not needed.

AndreyZ

Re: Default value when reading field

Post by AndreyZ » Mon 06 Aug 2012 12:59

Hello,

Please specify in details the functionality you need. What do you mean by the read operation, fetching data from the server? Please provide some examples of the needed functionality.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: Default value when reading field

Post by oz8hp » Sun 19 Aug 2012 08:48

I have made a sample unit for my own use and I would be happy to show it to you, but I can't find a way to attach it to a message here in the forum.

AndreyZ

Re: Default value when reading field

Post by AndreyZ » Mon 20 Aug 2012 07:20

You can send your sample to andreyz*devart*com .

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: Default value when reading field

Post by oz8hp » Mon 20 Aug 2012 17:43

It is in the mail

AndreyZ

Re: Default value when reading field

Post by AndreyZ » Tue 21 Aug 2012 09:50

I have examined your unit. You can achieve the functionality you want by executing a query (to system tables, etc.) to a server, that returns the default value for the specified field. After this, you can pass the returned value to your read functions.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: Default value when reading field

Post by oz8hp » Tue 21 Aug 2012 18:33

OK - I will have to investigate a bit to figure out how this can be done

Post Reply