#1 2019-04-13 07:59:26

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Little Patch for SynOleDB

Hi AB i got an Exception in SynOLEDB - TOleDBStatement.ExecutePrepared
mr was nil after Query

Here is my Patch (Line 1997 ff)

        if not OleDBConnection.OleDBProperties.fSupportsOnlyIRowset then begin
          // use IMultipleResults for 'insert into table1 values (...); select ... from table2 where ...'
          res := fCommand.Execute(nil,IID_IMultipleResults,fDBParams,@fUpdateCount,@mr);
          if assigned(mr) and (res=E_NOINTERFACE) then		// <-- PATCH itSDS
            OleDBConnection.OleDBProperties.fSupportsOnlyIRowset := true else begin
            repeat
              res := mr.GetResult(nil,0,IID_IRowset,@fUpdateCount,@RowSet);
            until Assigned(RowSet) or (res <> S_OK);
          end;
        end;

Rad Studio 12.1 Santorini

Offline

#2 2019-04-13 12:48:53

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,539
Website

Re: Little Patch for SynOleDB

For what OleDB provider and what kind of statement you got nil there? May be you need to set ExpectResults to false?
In any case i think we should throw in else block

if assigned(mr) and (res=E_NOINTERFACE) then		// <-- PATCH itSDS
  OleDBConnection.OleDBProperties.fSupportsOnlyIRowset := true else begin
  repeat
     res := mr.GetResult(nil,0,IID_IRowset,@fUpdateCount,@RowSet);
     until Assigned(RowSet) or (res <> S_OK);
end else
  raise EOleDBException.CreateUTF8('%s.Statement does not return rowset',[self]);

Isn't it?

BTW - github pull request much more readible then forum post At last wee see a diff there...

Offline

#3 2019-04-15 11:11:04

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: Little Patch for SynOleDB

@Mpv ty for your answer, but my patch does not solve the underlying problem i found out yesterday

Im Doing a nested Query with TOleDBMSSQL2012ConnectionProperties Calling ExecuteInlined.

The Schema is

var
LRows1, LRows2 : ISQLDBRows;

begin
...
LRows1 := ConnectionProperties.ExecuteInlned(SomeSQL, true);
While LRows1.Step do begin
.. Do Something with LRows1

  LRows2 := ConnectionProperties.ExecuteInlined(AnotherSQL, true);
  if LRows2.Step then
    .. Do Something with LRows2
 
end;

if ConnectionProperties is TOleDBMSSQL2012ConnectionProperties then i got Exception in the Second ExecuteInlined
if ConnectionProperties is TSQLDBZEOSConnectionProperties then it works (MySQL - Server)

Seems to be something wrong with the TOleDBMSSQL2012ConnectionProperties Implementation reusing the internal Connection.

Any Idea ?


Rad Studio 12.1 Santorini

Offline

Board footer

Powered by FluxBB