[yunqa.de] TDISQLite3UniDirQuery record count [this does work]

  • From: Todd Cary <todd@xxxxxxxxxxxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Thu, 18 Mar 2010 15:06:26 -0700

[This does work]

...
      sCmd := 'SELECT name FROM sqlite_master ' +
'WHERE type=''table'' AND name = ''' + sTableName + '''';
      SQLGenQry.SelectSQL := sCmd;
      SQLGenQry.Open;
      SQLGenQry.First;
      Result := not SQLGenQry.Eof;

...

I want to determine if a table exists, so I have this code:

...
      sCmd := 'SELECT name FROM sqlite_master ' +
'WHERE type=''table'' AND name = ''' + sTableName + '''';
      SQLGenQry.SelectSQL := sCmd;
      SQLGenQry.Open;
      Result := (SQLGenQry.RecordCount = 1);
...

SQLGenQry is a TDISQLite3UniDirQuery and the RecordCount is always -1. Am I making an error?

Todd

--
Ariste Software
Petaluma, CA 94952

http://www.toddcary.com/aristephotography/

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



Other related posts: