mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:09:20 +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;
|
FWhereStopPos := 0;
|
||||||
|
|
||||||
ConnOptions := TSQLConnection(DataBase).ConnOptions;
|
ConnOptions := TSQLConnection(DataBase).ConnOptions;
|
||||||
|
FUpdateable := False;
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
begin
|
begin
|
||||||
@ -1074,10 +1075,9 @@ begin
|
|||||||
Setlength(FFromPart,StrLength);
|
Setlength(FFromPart,StrLength);
|
||||||
Move(PStatementPart^,FFromPart[1],(StrLength));
|
Move(PStatementPart^,FFromPart[1],(StrLength));
|
||||||
FFrompart := trim(FFrompart);
|
FFrompart := trim(FFrompart);
|
||||||
|
|
||||||
if ExtractStrings([',',' '],[],pchar(FFromPart),nil) > 1 then
|
// select-statements from more then one table are not updateable
|
||||||
FUpdateable := False // select-statements from more then one table are not updateable
|
if ExtractStrings([',',' '],[],pchar(FFromPart),nil) = 1 then
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
FUpdateable := True;
|
FUpdateable := True;
|
||||||
FTableName := FFromPart;
|
FTableName := FFromPart;
|
||||||
|
@ -26,6 +26,7 @@ type
|
|||||||
procedure TearDown; override;
|
procedure TearDown; override;
|
||||||
procedure RunTest; override;
|
procedure RunTest; override;
|
||||||
published
|
published
|
||||||
|
procedure TestClearUpdateableStatus;
|
||||||
procedure TestParseJoins; // bug 10148
|
procedure TestParseJoins; // bug 10148
|
||||||
procedure TestInsertLargeStrFields; // bug 9600
|
procedure TestInsertLargeStrFields; // bug 9600
|
||||||
procedure TestNumericNames; // Bug9661
|
procedure TestNumericNames; // Bug9661
|
||||||
@ -876,6 +877,26 @@ begin
|
|||||||
inherited RunTest;
|
inherited RunTest;
|
||||||
end;
|
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;
|
procedure TTestFieldTypes.TestParseJoins;
|
||||||
begin
|
begin
|
||||||
with TSQLDBConnector(DBConnector) do
|
with TSQLDBConnector(DBConnector) do
|
||||||
|
Loading…
Reference in New Issue
Block a user