Select a fixed string, is adding whitespace

Select a fixed string, is adding whitespace

Postby edsonluispletsch » Thu 24 Jul 2014 17:38

I'm using driver version 4.8 dbexpoda40 until recently. Just decided to renew the license and update to version 6.4.7 (latest available).
However, with this update, which began to occur in selects fixed string, is returning a space at the end. Here's an example:
ClientDataSetAuxiliar.Close;
ClientDataSetAuxiliar.CommadText: = 'select ''A'' field1 from dual';
ClientDataSetAuxiliar.Open;
if ClientDataSetAuxiliar.FieldByName ('field1'). AsString = 'A' then
   ShowMessage('There goes here');
if ClientDataSetAuxiliar.FieldByName ('field1'). AsString = 'A ' then
   ShowMessage('Come here');

Does anyone know why this is happening?

The parameter SQLConnection "TrimFixedChar = True" to solve this problem, but it can bring other problems.

Grateful for the assistance.

Edson Luis Pletsch
edsonluispletsch
 
Posts: 1
Joined: Thu 24 Jul 2014 17:00

Re: Select a fixed string, is adding whitespace

Postby AlexP » Mon 28 Jul 2014 08:40

Hello,

If you are using Delphi 2006 or higher, you should set the UseUnicode option to True. Otherwise, set the CharLength option to 1. However, if in the field multi-byte symbols are used, they will be displayed incorrectly.
AlexP
Devart Team
 
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Select a fixed string, is adding whitespace

Postby synnet » Tue 28 Jun 2016 08:40

Hi,
we have this problem with Delhi 7 and Oracle 12c. Is There also a workaround for Delphi 7?
The solutions above dont't work with our version:
SQLConnection.Params.Clear;
SQLConnection.Params.Add('BlobSize=-1');
SQLConnection.Params.Add('DriverName=DevartOracle');
SQLConnection.Params.Add('ErrorResourceFile=');
SQLConnection.Params.Add('LocaleCode=0000');
SQLConnection.Params.Add('Oracle TransIsolation=ReadCommited');
SQLConnection.Params.Add('Multiple Transaction=True');
SQLConnection.Params.Add('DataBase=' + SettingsHandler.GetSetting('database'));
SQLConnection.Params.Add('User_Name=' + SettingsHandler.GetSetting('username'));
SQLConnection.Params.Add('Password=' + SettingsHandler.GetSetting('password'));

SQLConnection.Params.Add('UseUnicode=True');
SQLConnection.Params.Add('TrimFixedChar=True');
SQLConnection.Params.Add('CharLength=1');
synnet
 
Posts: 1
Joined: Tue 28 Jun 2016 08:34

Re: Select a fixed string, is adding whitespace

Postby AlexP » Fri 01 Jul 2016 07:13

To display a correct string in Delphi 7, you should set the TrimFixedChar property to True as shown below:

Code: Select all
procedure TForm1.SQLConnection1AfterConnect(DataSet: TDataSet);
const
  coTrimFixedChar = TSQLConnectionOption(103); // boolean
begin
  SQLConnection1.SQLConnection.SetOption(coTrimFixedChar, Integer(True));
end;
AlexP
Devart Team
 
Posts: 5530
Joined: Tue 10 Aug 2010 11:35


Return to dbExpress driver for Oracle