mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 23:21:57 +02:00
* Always reset FUpdateable when calling the SQLParser (+test)
git-svn-id: trunk@9878 -
This commit is contained in:
parent
ff4b5fcb59
commit
ce9b080854
@ -997,6 +997,7 @@ begin
|
||||
FWhereStopPos := 0;
|
||||
|
||||
ConnOptions := TSQLConnection(DataBase).ConnOptions;
|
||||
FUpdateable := False;
|
||||
|
||||
repeat
|
||||
begin
|
||||
@ -1074,10 +1075,9 @@ begin
|
||||
Setlength(FFromPart,StrLength);
|
||||
Move(PStatementPart^,FFromPart[1],(StrLength));
|
||||
FFrompart := trim(FFrompart);
|
||||
|
||||
if ExtractStrings([',',' '],[],pchar(FFromPart),nil) > 1 then
|
||||
FUpdateable := False // select-statements from more then one table are not updateable
|
||||
else
|
||||
|
||||
// select-statements from more then one table are not updateable
|
||||
if ExtractStrings([',',' '],[],pchar(FFromPart),nil) = 1 then
|
||||
begin
|
||||
FUpdateable := True;
|
||||
FTableName := FFromPart;
|
||||
|
@ -26,6 +26,7 @@ type
|
||||
procedure TearDown; override;
|
||||
procedure RunTest; override;
|
||||
published
|
||||
procedure TestClearUpdateableStatus;
|
||||
procedure TestParseJoins; // bug 10148
|
||||
procedure TestInsertLargeStrFields; // bug 9600
|
||||
procedure TestNumericNames; // Bug9661
|
||||
@ -876,6 +877,26 @@ begin
|
||||
inherited RunTest;
|
||||
end;
|
||||
|
||||
procedure TTestFieldTypes.TestClearUpdateableStatus;
|
||||
// Test if CanModify is correctly disabled in case of a select query without
|
||||
// a from-statement.
|
||||
begin
|
||||
if not (SQLDbType in MySQLdbTypes) then Ignore('This test does only apply to MySQL because the used SQL-statement is MySQL only.');
|
||||
with TSQLDBConnector(DBConnector) do
|
||||
begin
|
||||
with (GetNDataset(false,5) as TSQLQuery) do
|
||||
begin
|
||||
Open;
|
||||
AssertEquals(True,CanModify);
|
||||
Close;
|
||||
SQL.Text:='select last_insert_id();';
|
||||
Open;
|
||||
AssertEquals(False,CanModify);
|
||||
close;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestFieldTypes.TestParseJoins;
|
||||
begin
|
||||
with TSQLDBConnector(DBConnector) do
|
||||
|
Loading…
Reference in New Issue
Block a user