#1 2014-02-17 09:49:52

mingda
Member
Registered: 2013-01-04
Posts: 121

ISQLDBRows interface how to rewind

use ISQLDBRows, sometime need to a second step,
but seems step(TRUE) is not function, test code below, thanks!
(or introduce a function like TSQLRecorrd's FillRewind to ISQLDBRows, remove the step parameter?)

procedure TForm3.Button1Click(Sender: TObject);
var
  props: TSQLDBConnectionProperties;
  rows: ISQLDBRows;
begin
  props := TOleDBMSSQLConnectionProperties.Create('localhost', 'testdb', '', '');
  rows := props.Execute('select * from test1', []);

  while rows.Step do
  begin
    Memo1.Lines.Add(utf8ToString(rows.ColumnUTF8('column1')));
  end;

  if rows.Step(TRUE) then
  begin
    Memo2.Lines.Add(utf8ToString(rows.ColumnUTF8('column1')));
    while rows.Step do
      Memo2.Lines.Add(utf8ToString(rows.ColumnUTF8('column1')));
  end;

  props.Free;
end;

Offline

#2 2014-02-17 12:35:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,232
Website

Re: ISQLDBRows interface how to rewind

There was indeed an issue when running TOleDBStatement.Step(true).

It should now be fixed.
See http://synopse.info/fossil/info/b99b745118

Thanks for the feedback and code to reproduce!

Offline

#3 2014-02-18 11:47:38

mingda
Member
Registered: 2013-01-04
Posts: 121

Re: ISQLDBRows interface how to rewind

Yes, it now works, thanks!

Offline

Board footer

Powered by FluxBB