Today I started the porting of a medium-sized application (~100 kloc) from D7 with CLX to Lazarus (used the 2005-12-05 snapshot). I was wondering if a diary of this could be useful - I do not want to forget what I'm doing. Right now I'm porting the Object Persistence Framework (OPF), and managed to get a working test program already (on Windows XP). The main changes were:

- DB Express has a TStringList named Params; all databases use it, so to access PostgreSQL (the DB I use) there were a line DriverName := 'PostgreSQL'. Using SqlDB, I used the TPQConnectin component;

- My OPF has an option to trim the strings it gets from (or write to) the DB. It used Trim(X) where X is a Variant. FPC did not like that, and I had to change it to Trim(VarToStr(X)). There's hundreds of files that use that construct in my project, but thanks God it's all code that is automagically generated by a custom made tool.

- Bug 4323: http://www.freepascal.org/bugs/showrec.php3?ID=4323 - the workaround was use ShortDateFormat and others instead of the thread safe TFormatSettings.

- Instead of TTransactionDesc, there is TSQLTransaction. It led to a lot of changes, including this one that I'm afraid is not a good one (the condition seems to be different):
if Transaction.Active {FdscTrans.InTransaction} then ...
My OPF controls the transactions, throwing its own errors when you try to start a transaction when there's one started, or try to commit when there's no transaction. Is the TSQLTransaction is always active when the connection is open?

- A weird thing was an error using the LIMIT clause of some SQL queries. I removed them by now, but these LIMIT clauses are needed for the correct operation of the OPF. I will get back to this later.

Thats it. Also, there was a lot of strange behaviours of the IDE (remember I'm using Windows XP), but nothing that can be considered a showstopper. It includes wrong syntax highlight, some weird things with Ctrl-Space and ghost carets. Are these known bugs?

--
Atenciosamente,

Alexsander da Rosa

Reply via email to