Bläddra i källkod

* Patch from Ladislav Karrach (Lacak2) to implement RowsAffected for ODBC, bug #14791

git-svn-id: trunk@15211 -
joost 15 år sedan
förälder
incheckning
722dbaa616
1 ändrade filer med 14 tillägg och 0 borttagningar
  1. 14 0
      packages/fcl-db/src/sqldb/odbc/odbcconn.pas

+ 14 - 0
packages/fcl-db/src/sqldb/odbc/odbcconn.pas

@@ -90,6 +90,7 @@ type
     procedure RollbackRetaining(trans:TSQLHandle); override;
     // - Statement execution
     procedure Execute(cursor:TSQLCursor; ATransaction:TSQLTransaction; AParams:TParams); override;
+    function RowsAffected(cursor: TSQLCursor): TRowsCount; override;
     // - Result retrieving
     procedure AddFieldDefs(cursor:TSQLCursor; FieldDefs:TFieldDefs); override;
     function Fetch(cursor:TSQLCursor):boolean; override;
@@ -652,6 +653,19 @@ begin
   FreeParamBuffers(ODBCCursor);
 end;
 
+function TODBCConnection.RowsAffected(cursor: TSQLCursor): TRowsCount;
+var
+  RowCount: SQLINTEGER;
+begin
+  if assigned(cursor) then
+    if ODBCSucces( SQLRowCount((cursor as TODBCCursor).FSTMTHandle, RowCount) ) then
+       Result:=RowCount
+    else
+       Result:=-1
+  else
+    Result:=-1;
+end;
+
 function TODBCConnection.Fetch(cursor: TSQLCursor): boolean;
 var
   ODBCCursor:TODBCCursor;