[fpc-pascal] TMemoField saving empty strings as '' (double quote)

silvioprog silvioprog at gmail.com
Wed Sep 11 14:21:00 CEST 2013


2013/9/11 LacaK <lacak at zoznam.sk>

> **
> silvioprog  wrote / napísal(a): Now doing more tests. I see, that in
> pgAdmin when I use right click on table and use "View Data" then '' (two
> single quotes) are shown in TEXT column, but when I use SQL and type:
> select * from <table name> then empty fields are shown ... so it seems to
> me, that bug is in pgAdmin, does not ?
> -Laco.
>

The bug is in FCL. Please see the steps in my comparison:

1. first I inserted a record via pgAdmin: insert into test (id, fieldtext)
values (1, null);
2. after, I executed this demo: http://pastebin.com/HS8DZkDV;
3. finally, I made this selection in pgAdmin:
  select * from test
  where fieldtext is null;

And the result is:

id | fieldtext
-----------------
1  |

But, when I select so:

select * from test
where fieldtext = ''

The result is:

id | fieldtext
-----------------
2  |

Then SQLdb is saving an empty string instead of null. :o

I tried it:

q.FieldByName('fieldtext').Value := Null;

Instead of:

q.FieldByName('fieldtext').Clear;

Same result, it is saving an empty string instead of null.

-- 
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/20130911/9f6e42d6/attachment.html>


More information about the fpc-pascal mailing list