views:

101

answers:

1

With Delphi 2006, I was using a library of User Defined Functions that was based on tbudf.pas and some functions that I added on my own. Since I am working on a payroll program, this functionality is very helpful for some common payroll concepts that might otherwise require some complex SQL. I have kept my Delphi 2006 installation and I found out yesterday that compiling my udf library in Delphi 2010 was going to take some work.

While I did come to some understanding as to how data passing worked between my dll and the Firebird server, I mostly just set up my own functions using the functions that existed in tbudf. Unfortunately, none of the functions used unicode character encoding. Maybe that is not too big a deal because I have set up all my Delphi 2010 I/O with the database to use AnsiStrings, so maybe I can just change any of the Delphi 2010 functions to use something like PAnsiChar. But I will be pretty much blazing a new trail here.

Are there any open udf libraries that have been updated to Delphi 2010? If you have any tips on what to watch out for, maybe I can use them to update my own library and post it for someone else who needs it.

+2  A: 

Hi,

I moved an entire project with a firebird database in unicode.

About udfs, if you want to keep the encoding of your database as is, you can use AnsiString/PAnsiChar instead of string/PChar.

But if you want to use UTF8 to encode your database and take advantage of Unicode in Delphi, you should use the type UTF8String instead.

Be careful, the encoding of the database connection is different from the encoding of the database itself. You should also pay attention to the length of strings in UTF8.

To convert a database to UTF8, this tool will be useful to you: http://code.google.com/p/fbclone/

Henri Gourvest
Thanks Henri. After reading your response, I went back and went through the dll code to make the changes. It seems to work as expected now. At the moment, converting the database to work with unicode character encoding will not produce any benefits and may be disruptive in deployed databases, I will stay with 8 bit characters in the database.