[yunqa.de] TDISQLite3UniDirQuery select * thinks string field is ftFloat

  • From: Ann Lynnworth <ann@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sat, 07 Jul 2012 02:05:14 +0000

Hi, I am using TDISQLite3UniDirQuery on a new small project which is small GUI to assist with admin of the open-source NNTP server ( http://www.wendzel.de/software/wendzelnntpd.html ) v1 for Windows.


Most of my select and update queries are working fine.

However, whenever I interact with string fields, I get garbage. In the table, the field is of type STRING according to SQLiteSpy. When I look at the table data with SQLiteSpy (which is very nice by the way), the values are all there as expected.

When I "select * from newsgroups" (with TDISQLite3UniDirQuery), the resulting string field has a field type of ftFloat and always gives me back a 0 (zero).

I do not have trouble with varchar nor integer fields.

I tried .AsString, .AsAnsiString, even raw bytes and it is all coming back 0. (raw bytes gives a short array of zeros).

Here is some Delphi code to show the usage. I am sure the database component itself is fine because I use it for the other queries which work 100%.

procedure TForm1.BtnResetNewsgroupClick(Sender: TObject);
var
  i: Integer;
  qng: TDISQLite3UniDirQuery;
begin
  qng := nil;
  Init;
  try
    qng := TDISQLite3UniDirQuery.Create(Self);
    qng.Name := 'qng';
    with qng do
    begin
      Name := 'qng';
      Database := NNTPDatabase;
      SelectSQL := 'select name from newsgroups';
    end;
    qng.Open;
    i := 0;
    Memo1.Lines.Add(qng.Fields[0].FieldName + sLineBreak +
      GetEnumName(TypeInfo(TFieldType),
      Ord(qng.Fields[0].DataType)));


The Memo1 shows 'ftFloat' for the type. !!! ???

As it turns out, the database has this string field in more than one table. I have tested both, and both have the same result. I thought the problem might be "name" as a reserved word but the ftFloat thing happens also when the fieldname is "ng".

Thanks for any advice. If you wish to see a copy of the .db file, I can arrange a download URL.

Delphi XE2, win32.

Ann

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



Other related posts: