Page 1 of 1

TMSLoader 6.2.8 Trial save wrong string parameters

Posted: Fri 27 Jul 2012 19:50
by Tarifer
Hello, I install SDAC 6.2.8 Trial on Delphi XE2 Update 4 Hotfix 1.

I use TMSLoader, and PutColumnData(...) save only first character of string or saved it in wrong encoding.
I use this code:

FConnection: TMSConnection;
FLoader: TMSLoader;
..
FConnection.Authentication := auWindows
FConnection.LoginPrompt := False;
FConnection.Server := ConnectionString;
FConnection.Database := SchemaName;
FConnection.Open;

FLoader := TMSLoader.Create(nil);
FLoader.Connection := Connection;
FLoader.TableName := TableName;
FLoader.CreateColumns;


Table definition is:
CREATE TABLE TABLE_FOR_LOADING (
CALLER_NUMBER varchar(100),
SERVICE_DATE_TIME DATETIME,
CALLED_NUMBER varchar(100),
...

SQL Server 2008 R2 Express.

Before I use ODAC, and it works fine.

Please help me.

Dmitry.

Re: TMSLoader 6.2.8 Trial save wrong string parameters

Posted: Sat 28 Jul 2012 14:54
by Tarifer
I compile and run Demo application in Delphi XE2 and got the same effect.
I think it encountered zero byte in unicode string and breaks. When I send cyrilic string, it write more than one char, but saved text is wrong (not-readable wrong encoding text).

I compile Demo application in Delphi 7, and it works fine.
Please help, I need working Delphi XE2 code.

I found, it save Unicode as single-byte encoded values.

Posted: Sat 28 Jul 2012 18:37
by Tarifer
After some investigations I found that unicode values saved as single-byte encoding. I have LEN(c)=22 instead of 11 in the source.
MS SQL Server Management studio can see only part of value (up to first zero in Unicode).
Please give me workaround or fix this bug, and I will buy it.

Thanks,
Dmitry.

Re: TMSLoader 6.2.8 Trial save wrong string parameters

Posted: Sat 28 Jul 2012 19:07
by Tarifer
I found workaround. if VarType(Value)=varString it works, but varUString don't works.

Workaround is:

Code: Select all

  if VarType(Value)=varUString then
    FLoader.PutColumnData(ColName, FRowIndex, AnsiString(VarToStr(Value)))
  else
    FLoader.PutColumnData(ColName, FRowIndex, Value);
it is ugly, but works.

Re: TMSLoader 6.2.8 Trial save wrong string parameters

Posted: Mon 30 Jul 2012 09:11
by AndreyZ
Thank you for the information. We have reproduced this problem. We will fix this problem in the next SDAC build. For the time being you can use your workaround, it is correct.

Re: TMSLoader 6.2.8 Trial save wrong string parameters

Posted: Thu 02 Aug 2012 12:22
by AndreyZ
We have fixed this problem. This fix will be included in the next SDAC build.