Retrieving Results


When an SQL statement was executed, there can be a result generated by it -  i.e. result retrieving is the matter of IResultSetStatement interface. The result is being seen as two-dimensional array, called result set. It is organized into the columns and rows. The columns describe names, nullability and data types of all elements that compose one row of the result set. This information is available with taken of ColCount property; the count is returned by the ColCount method. The row of the result set is accessible with taken of the ResulSet property. See the Result Set chapter for more info. Only one row can be fetched into the memory. It is done by the Fetch method and it returns true whether row has been fetched or false if there is no row to be fetch.

Elements composing the one row of result set must be read in ascending order, e.g.


and not


The fetching can be canceled at any time by calling the Cancel method.


Example How To Retrieve a Result Set

procedure MyObj.WriteNamesAndPrices;
var Statement:IStatement;
    Statement.Statement:='select name, price from components_price_list';
    while Statement.Fetch do 
      writeln(Statement[0].AsString,' - ',Statement[1].AsString);