TDBXError malformed string (Delphi 2010, Firebird, UTF8)

Currently doing some tests with Delphi 2010 trial and firebird with the express driver from  http://groups.google.com/group/dbxfirebird/


I ran into the following problem at first :
I had a username and a password that is encrypted from inside my applicatio with AES. Encrypting, decrypting works fine. The moment i sent it to the database it got screwed up since it was not in UTF8. I created a new database UTF8, problem fixed. But the next problem  came up.

Whenever i try to save an empty string into a field i get TDBXError malformed string. When there is 1 character in my string everything works fine. I also did some testing with DB tools and manually inserting strings etc. No problems at all. So it definitely is not a firebird problem


I'll give a small example on how i setup everything:
 - TSQLConnection with normal parameters like
 - username, password
 - dbx ini file, where all info is stored about my connection
 - a firebird database file .dbf (UTF8)
 - 1 table test
    PK_ID primary key varchar(40)   - a guid      NOT NULL 
    F_NAME 	      varchar(50)
    F_DESCRIPTION     varchar(1000) - something
 - i create a insert statement and use the parameters

   INSERT INTO test (PK_ID, F_NAME, F_DESCRIPTION) values (:AID, :ANAME, :ADESC);
   
   ParamByName('AID').AsString := myobject.id;
   ParamByName('ANAME').AsString := myobject.name;
   ParamByName('ADESC').AsString := myobject.description;

When name or description is empty i will get "TDBXError malformed string". When both have at least 1 character in it, it works like a charm. Does anyone have an idea on how to fix, circumvent this problem


I also tried some UTF8Encode functions etc on myobject.name etc. Why do i use the parameters you might ask ... We have a factory which allows you to bind an object to a dataobject and by using that, we have to write alot less code, since same parameters are being used in update/insert


SideNote : The company i am currently freelancing is upgrading to Delphi 2007 in about a month, but i am trying to push for 2010 :). And i also went to get rid of Visual Source Disaster and access.
0
Kristof
10/9/2009 9:21:37 AM
embarcadero.delphi.win32 2183 articles. 0 followers. Follow

3 Replies
1520 Views

Similar Articles

[PageSpeed] 29

Do you get the same error with the CodeGear Firebird driver?


-- 
Bill Todd (TeamB)
0
Bill
10/9/2009 2:46:39 PM
> {quote:title=Bill Todd wrote:}{quote}
> Do you get the same error with the CodeGear Firebird driver?
> 
> 
> -- 
> Bill Todd (TeamB)

I just got home and tested my simple example and i do not have the error with the CodeGear Firebird driver. Even did a test with the firebird embedded dll. 
So the problem lies in the driver. Anyway any ideas what the difference is between those 2 :)
0
Kristof
10/9/2009 3:28:51 PM
Kristof Degros wrote:

> Anyway any ideas what the difference is between those 2 :)

I am not sure what you mean. The two drivers were written
at different times by different people. I am sure there are
many differences in the code.

-- 
Bill Todd (TeamB)
0
Bill
10/9/2009 5:09:52 PM
Reply: