How to use option TRIM CHAR?

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
mgraziosi
Posts: 2
Joined: Mon 03 Jan 2005 14:24
Location: Italy

How to use option TRIM CHAR?

Post by mgraziosi » Mon 03 Jan 2005 14:38

I'm using version 1.86 of dbExpress driver with C++ Builder 6.

I read in the revision history that an option to automatically trim trailing chars from CHAR fields is supported. However, I couldn't find any help on how to use thi option. I tried, before connecting, both of these:
sqlConnection->Params->Add("TRIM CHAR=1");
sqlConnection->Params->Add("TRIM CHAR=true");

However, none have worked.

I did also read, in README, about a SetOption() method in TSQLConnection. However, at least in C++, I wasn't able to find any method, oon TSQLCOnnection, named SetOption().

Thanks in advance for any help.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Re: How to use option TRIM CHAR?

Post by Ikar » Wed 05 Jan 2005 09:57

If you use TCRSQLConnection, then you should use

sqlConnection->Params->Values["TrimFixedChar"] := "True";

Otherwise,

sqlConnection->SQLConnection->SetOption(TSQLConnectionOption(103), Integer(True));

mgraziosi
Posts: 2
Joined: Mon 03 Jan 2005 14:24
Location: Italy

Re: How to use option TRIM CHAR?

Post by mgraziosi » Sat 08 Jan 2005 18:39

It worked, thanks very much. I tried it with BCB 6 and I had no problem.

I'd only add a note which might maybe helpful to someone reading this newsgroup in the future: the Connection must be opened before issuing the above command, otherwise the program crashes. Thus, the safe way to set the automatiic TRIM of chars is:

Code: Select all

sqlConnection->Connected = true;
sqlConnection->SQLConnection->SetOption(TSQLConnectionOption(103),
        Integer(True));

flat

for interbase

Post by flat » Tue 03 May 2005 04:00

hey guys nice code there just wondering where ya can find that information i have a app same thing that works great for my sql server database but i also have a interbase database i need to support just wondering where that information on set option can be found ( couldnt find past TSQLConnectionOption(20)

Flat

103 in words

Post by Flat » Wed 04 May 2005 00:12

hey guys what is the connection option 103 in words? just tryin to find the same thing for interbase if i can

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 04 May 2005 10:57

We don't dbExpress driver with Interbase support.

Post Reply