mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 20:26:00 +02:00
* Patch from Ladislav Karrach, in some cases SQLExecute returns SQL_NO_DATA when no error occured, bug #13654 + test
git-svn-id: trunk@13132 -
This commit is contained in:
parent
6eeab240ba
commit
5ddddf60ae
@ -630,6 +630,7 @@ end;
|
|||||||
procedure TODBCConnection.Execute(cursor: TSQLCursor; ATransaction: TSQLTransaction; AParams: TParams);
|
procedure TODBCConnection.Execute(cursor: TSQLCursor; ATransaction: TSQLTransaction; AParams: TParams);
|
||||||
var
|
var
|
||||||
ODBCCursor:TODBCCursor;
|
ODBCCursor:TODBCCursor;
|
||||||
|
Res:SQLRETURN;
|
||||||
begin
|
begin
|
||||||
ODBCCursor:=cursor as TODBCCursor;
|
ODBCCursor:=cursor as TODBCCursor;
|
||||||
|
|
||||||
@ -638,12 +639,15 @@ begin
|
|||||||
|
|
||||||
// execute the statement
|
// execute the statement
|
||||||
case ODBCCursor.FSchemaType of
|
case ODBCCursor.FSchemaType of
|
||||||
stNoSchema : ODBCCheckResult( SQLExecute(ODBCCursor.FSTMTHandle), SQL_HANDLE_STMT, ODBCCursor.FSTMTHandle, 'Could not execute statement.' );
|
stNoSchema : Res:=SQLExecute(ODBCCursor.FSTMTHandle); //SQL_NO_DATA returns searched update or delete statement that does not affect any rows
|
||||||
stTables : ODBCCheckResult( SQLTables (ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0, nil, 0 ), SQL_HANDLE_STMT, ODBCCursor.FSTMTHandle, 'Could not execute statement.' );
|
stTables : Res:=SQLTables (ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0, nil, 0 );
|
||||||
stColumns : ODBCCheckResult( SQLColumns(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, @ODBCCursor.FQuery[1], length(ODBCCursor.FQuery), nil, 0 ), SQL_HANDLE_STMT, ODBCCursor.FSTMTHandle, 'Could not execute statement.' );
|
stColumns : Res:=SQLColumns(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, @ODBCCursor.FQuery[1], length(ODBCCursor.FQuery), nil, 0 );
|
||||||
stProcedures: ODBCCheckResult( SQLProcedures(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0 ), SQL_HANDLE_STMT, ODBCCursor.FSTMTHandle, 'Could not execute statement.' );
|
stProcedures: Res:=SQLProcedures(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0 );
|
||||||
|
else Res:=SQL_NO_DATA;
|
||||||
end; {case}
|
end; {case}
|
||||||
|
|
||||||
|
if (Res<>SQL_NO_DATA) then ODBCCheckResult( Res, SQL_HANDLE_STMT, ODBCCursor.FSTMTHandle, 'Could not execute statement.' );
|
||||||
|
|
||||||
// free parameter buffers
|
// free parameter buffers
|
||||||
FreeParamBuffers(ODBCCursor);
|
FreeParamBuffers(ODBCCursor);
|
||||||
end;
|
end;
|
||||||
|
@ -27,6 +27,7 @@ type
|
|||||||
procedure TearDown; override;
|
procedure TearDown; override;
|
||||||
procedure RunTest; override;
|
procedure RunTest; override;
|
||||||
published
|
published
|
||||||
|
procedure TestEmptyUpdateQuery; // bug 13654
|
||||||
procedure TestClearUpdateableStatus;
|
procedure TestClearUpdateableStatus;
|
||||||
procedure TestReadOnlyParseSQL; // bug 9254
|
procedure TestReadOnlyParseSQL; // bug 9254
|
||||||
procedure TestParseJoins; // bug 10148
|
procedure TestParseJoins; // bug 10148
|
||||||
@ -921,6 +922,11 @@ begin
|
|||||||
inherited RunTest;
|
inherited RunTest;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestFieldTypes.TestEmptyUpdateQuery;
|
||||||
|
begin
|
||||||
|
TSQLDBConnector(DBConnector).Connection.ExecuteDirect('update fpdev set name=''nothing'' where (1=0)');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestFieldTypes.TestTableNames;
|
procedure TTestFieldTypes.TestTableNames;
|
||||||
var TableList : TStringList;
|
var TableList : TStringList;
|
||||||
i : integer;
|
i : integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user