TData.TrimVarChar

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
anordlun
Posts: 15
Joined: Thu 24 Feb 2005 08:09

TData.TrimVarChar

Post by anordlun » Thu 08 May 2008 14:50

Hi.
We have some strange "trailing spaces " errors in our databases. The error seems to occur not always, but very often.

In MemData.pas there is a property called TrimVarChar.
There is no setters to this property, only getters.
Could this be a bug?

( I'm using version 4.25.8 )

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 12 May 2008 06:57

It is set in the DBAccess unit. Have you discovered any problem with this option?

anordlun
Posts: 15
Joined: Thu 24 Feb 2005 08:09

Post by anordlun » Mon 12 May 2008 07:54

Hi. I have no DBAccess file, do you mean OLEDBAccess.pas?

The only this regarding Trim is the following sequence:

Code: Select all

                if Field.Fixed then
                  t := TrimFixedChar
                else
                  t := TrimVarChar;

at row 9827 in mentioned file.

My problem is that I get a lot of trailing spaces on my VarChar fields in the database and I cannot find the problem (other than this, perhaps)
I do declare to trim fixed char, but I cannot fins the option to trim varchar.

I'm using this:

Code: Select all

    Params.Values['TrimFixedChar'] := 'TRUE';

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 12 May 2008 11:20

The TrimVarChar option is not supported in DbxSda.
If you have sources of DbxSda, you can enable it similarly to TrimFixedChar.

anordlun
Posts: 15
Joined: Thu 24 Feb 2005 08:09

Post by anordlun » Mon 12 May 2008 11:30

Hmmm...
Review the codeexample again...

Code: Select all

                if Field.Fixed then 
                  t := TrimFixedChar 
                else 
                  t := TrimVarChar;
What state does the variable t get if the field-variable isn't fixed.

Because the TrimVarChar property are never set which mens that it get whatever is in memory when the application allocates the memoryspace.
I would say this might be a bug.

I did an example and added

Code: Select all

TrimVarChar := true
in the TData constructor, and then the Varchar fields was trimmed.

Where is the variable TrimVarchar being set to true or false?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 13 May 2008 06:48

This code is also used in another our product (SDAC). But TrimVarChar is not available from connection parameters in DbxSda (like TrimFixedChar). If you want to enable it, you should change sources of DbxSda like you described in your previous post.

Post Reply