[fpc-pascal] How to clear the value of a field in a table using parameters?

silvioprog silvioprog at gmail.com
Fri Aug 30 15:42:06 CEST 2013

2013/8/29 Michael Van Canneyt <michael at freepascal.org>

> On Thu, 29 Aug 2013, silvioprog wrote:
>> Other interesting feature is the property EmptyAsNull:
>> http://docwiki.embarcadero.**com/VCL/XE/en/IBCustomDataSet.**
>> TIBStringField.EmptyAsNull<http://docwiki.embarcadero.com/VCL/XE/en/IBCustomDataSet.TIBStringField.EmptyAsNull>
>> It tests if field (ftString) is empty (f = ''), if yes, it set the field
>> value to null (f.Clear).
> Apparently a IBX specific extension.
> I don't see the value of this. empty and null are different things.
> Michael.

Some Delphi components (Zeos, JvDBEdit) have this option.

Assuming this table:

  id integer,
  name varchar(10) not null unique

You can:

1| <null>
2| <null>


1| <empty>
2| <empty> << error, unique key

I implemented "EmptyAsNull" directly in my project. It is very useful. In
my webpages, if the user clear a input, I send a null value to the table.

Silvio Cl├ęcio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130830/dc727486/attachment.html>

More information about the fpc-pascal mailing list