#1 2022-12-12 09:12:18

squirrel
Member
Registered: 2015-08-13
Posts: 126

Getting RowCount with ISQLDBRows

Is it possible to get the number of rows with ISQLDBROWS in Mormot 1?  I need to know if no rows were returned.  While it is possible to set a local boolean variable first to false and then to true during each ISQLDBROWS.Step, it will add to an already complex code base.

Is there something similar to TSQLDBStatement.TotalRowsRetrieved that can be used after the code has stepped through the data to determine if an empty set has been returned?

Something along the lines of:

var 
  data: ISQLDBROWS;
begin
  data := Connection.Execute('select * from table', []);
  while data.step do
    ...

  if data.TotalRowsRetrieved = 0 then
    HandleNoData;

EDIT: Please ignore my idiocy, I completely forgot about being able to just do: data.Instance.TotalRowsRetrieved

Last edited by squirrel (2022-12-12 09:56:06)

Offline

Board footer

Powered by FluxBB