[fpc-pascal] code example where AnsiString used in FCL (SqlDB) causes data loss

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed May 11 14:23:50 CEST 2016


On 2016-05-11 13:07, Michael Van Canneyt wrote:
> 
> But what does your program prove ?

See below...

> You're only proving that a conversion happens when you do
> s := fieldByName('somefield').asString;

I'm proving that using the String type anywhere in the RTL and FCL is
now terrible. If the FPC team did a search and replace (String ->
UnicodeString) all over the RTL and FCL, then such data corrupts
probably would not have occurred because UnicodeString is not affected
by the running environment. Probably the exact reason why Delphi now
using String = UnicodeString on all platforms.

> AFAIK 3.0 is no different in this matter from 2.6.4, Jonas can confirm/deny. 
> Unlike 2.6.4, 3.0.0 offers us the possibility to fix it by allowing to specify

See my reply to Jonas. There is a massive difference between FPC 2.6.4
and 3.0.0 using the exact same program and test environment.

I can't see how anybody can currently switch to FPC 3.0.0 - it simply
isn't ready for prime usage. As my test shows, you can't simply
recompile your application with FPC 3.0.0 and think it is going to work
like it did in FPC 2.6.4 - it doesn't.

Yes some parts in FPC 3.0 are now in place going forward, but there is
still too much that can go wrong (in the RTL and FCL) due to the
dynamically changing AnsiString type being used everywhere.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list