[yunqa.de] Re: AsString/AsWideString problem.

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Tue, 09 Feb 2010 11:40:30 +0100

At 18:10 08.02.2010, Alex Vulpe wrote:

Unfortunately, you provide snippets only and not a complete project. Please see 
questions about details below.

>DISQLite Personal version 2.2.0, Delphi 2007
>
>table is created like this:
>
>FDB.Execute('create table test (ii integer, ss text)');
>
>Some records are inserted like this:
>
>FDB.Execute('insert into test values (' + IntToStr(I) + ', ''' + FSt + ' ' + 
>IntToStr(I) + ''')');

What are your values of I and Fst? Does FSt contain an UTF-8 encoded string?

Here is the FDB.Execute syntax:

  procedure TDISQLite3Database.Execute(const ASql: Utf8String); 

If in doubt, always its UnicodeString variant instead:

  procedure TDISQLite3Database.Execute16(const ASql: UnicodeString); 

>When I do:
>
>DISQLite3UniDirQuery1.Database := FDB;
>DISQLite3UniDirQuery1.SelectSQL := 'select * from test';
>DISQLite3UniDirQuery1.Open;
>DISQLite3UniDirQuery1.First;
>
>StW := DISQLite3UniDirQuery1.Fields[1].AsWideString;
>
>StW has extra 2 characters at the end.
>The same problem with AsString.

Both work fine here and are part of my regression test suite.

>Do I do something wrong or it's a bug?

Please try the advice given above. If it still does not produce the expected 
results, please send a full project (source code only!) which allows me to 
reproduce your problem.

Ralf  

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: