Page 1 of 1

TData.TrimVarChar

Posted: Thu 08 May 2008 14:50
by anordlun
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 )

Posted: Mon 12 May 2008 06:57
by Antaeus
It is set in the DBAccess unit. Have you discovered any problem with this option?

Posted: Mon 12 May 2008 07:54
by anordlun
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';

Posted: Mon 12 May 2008 11:20
by Antaeus
The TrimVarChar option is not supported in DbxSda.
If you have sources of DbxSda, you can enable it similarly to TrimFixedChar.

Posted: Mon 12 May 2008 11:30
by anordlun
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?

Posted: Tue 13 May 2008 06:48
by Antaeus
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.