mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 11:06:19 +02:00
fcl-db: sqldb: - Move private method "GetStatementInfo" to protected and make it virtual to allow TSQLConnection descendants override it
- Rename new property "CheckParams" to "ParamCheck" to align with other components such as Zeos, IBObjects, IBX, ADODB, ElevateDB, SQLMemTable and many others. git-svn-id: trunk@25165 -
This commit is contained in:
parent
35b771e421
commit
bc7fd7afa8
@ -110,7 +110,6 @@ type
|
|||||||
FRole : String;
|
FRole : String;
|
||||||
FStatements : TFPList;
|
FStatements : TFPList;
|
||||||
function GetPort: cardinal;
|
function GetPort: cardinal;
|
||||||
function GetStatementInfo(const ASQL: string; Full: Boolean; ASchema : TSchemaType): TSQLStatementInfo;
|
|
||||||
procedure SetPort(const AValue: cardinal);
|
procedure SetPort(const AValue: cardinal);
|
||||||
protected
|
protected
|
||||||
FConnOptions : TConnOptions;
|
FConnOptions : TConnOptions;
|
||||||
@ -147,6 +146,7 @@ type
|
|||||||
procedure RollBackRetaining(trans : TSQLHandle); virtual; abstract;
|
procedure RollBackRetaining(trans : TSQLHandle); virtual; abstract;
|
||||||
procedure UpdateIndexDefs(IndexDefs : TIndexDefs;TableName : string); virtual;
|
procedure UpdateIndexDefs(IndexDefs : TIndexDefs;TableName : string); virtual;
|
||||||
function GetSchemaInfoSQL(SchemaType : TSchemaType; SchemaObjectName, SchemaPattern : string) : string; virtual;
|
function GetSchemaInfoSQL(SchemaType : TSchemaType; SchemaObjectName, SchemaPattern : string) : string; virtual;
|
||||||
|
function GetStatementInfo(const ASQL: string; Full: Boolean; ASchema : TSchemaType): TSQLStatementInfo; virtual;
|
||||||
procedure LoadBlobIntoBuffer(FieldDef: TFieldDef;ABlobBuf: PBufBlobField; cursor: TSQLCursor; ATransaction : TSQLTransaction); virtual; abstract;
|
procedure LoadBlobIntoBuffer(FieldDef: TFieldDef;ABlobBuf: PBufBlobField; cursor: TSQLCursor; ATransaction : TSQLTransaction); virtual; abstract;
|
||||||
function RowsAffected(cursor: TSQLCursor): TRowsCount; virtual;
|
function RowsAffected(cursor: TSQLCursor): TRowsCount; virtual;
|
||||||
Property Statements : TFPList Read FStatements;
|
Property Statements : TFPList Read FStatements;
|
||||||
@ -221,7 +221,7 @@ type
|
|||||||
|
|
||||||
TCustomSQLStatement = Class(TComponent)
|
TCustomSQLStatement = Class(TComponent)
|
||||||
Private
|
Private
|
||||||
FCheckParams: Boolean;
|
FParamCheck: Boolean;
|
||||||
FCursor : TSQLCursor;
|
FCursor : TSQLCursor;
|
||||||
FDatabase: TSQLConnection;
|
FDatabase: TSQLConnection;
|
||||||
FParams: TParams;
|
FParams: TParams;
|
||||||
@ -263,7 +263,7 @@ type
|
|||||||
Property Params : TParams Read FParams Write SetParams;
|
Property Params : TParams Read FParams Write SetParams;
|
||||||
Property Datasource : TDatasource Read GetDataSource Write SetDataSource;
|
Property Datasource : TDatasource Read GetDataSource Write SetDataSource;
|
||||||
Property ParseSQL : Boolean Read FParseSQL Write FParseSQL;
|
Property ParseSQL : Boolean Read FParseSQL Write FParseSQL;
|
||||||
Property CheckParams : Boolean Read FCheckParams Write FCheckParams default true;
|
Property ParamCheck : Boolean Read FParamCheck Write FParamCheck default true;
|
||||||
Public
|
Public
|
||||||
constructor Create(AOwner : TComponent); override;
|
constructor Create(AOwner : TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -283,14 +283,14 @@ type
|
|||||||
Property Params;
|
Property Params;
|
||||||
Property Datasource;
|
Property Datasource;
|
||||||
Property ParseSQL;
|
Property ParseSQL;
|
||||||
Property CheckParams;
|
Property ParamCheck;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCustomSQLQuery }
|
{ TCustomSQLQuery }
|
||||||
|
|
||||||
TCustomSQLQuery = class (TCustomBufDataset)
|
TCustomSQLQuery = class (TCustomBufDataset)
|
||||||
private
|
private
|
||||||
// FCheckParams: Boolean;
|
// FParamCheck: Boolean;
|
||||||
// FCursor : TSQLCursor;
|
// FCursor : TSQLCursor;
|
||||||
FSchemaType: TSchemaType;
|
FSchemaType: TSchemaType;
|
||||||
// FSQL: TStringlist;
|
// FSQL: TStringlist;
|
||||||
@ -324,13 +324,13 @@ type
|
|||||||
FDeleteQry,
|
FDeleteQry,
|
||||||
FInsertQry : TCustomSQLQuery;
|
FInsertQry : TCustomSQLQuery;
|
||||||
procedure FreeFldBuffers;
|
procedure FreeFldBuffers;
|
||||||
function GetCheckParams: Boolean;
|
function GetParamCheck: Boolean;
|
||||||
function GetParams: TParams;
|
function GetParams: TParams;
|
||||||
function GetParseSQL: Boolean;
|
function GetParseSQL: Boolean;
|
||||||
function GetServerIndexDefs: TServerIndexDefs;
|
function GetServerIndexDefs: TServerIndexDefs;
|
||||||
function GetSQL: TStringlist;
|
function GetSQL: TStringlist;
|
||||||
function GetStatementType : TStatementType;
|
function GetStatementType : TStatementType;
|
||||||
procedure SetCheckParams(AValue: Boolean);
|
procedure SetParamCheck(AValue: Boolean);
|
||||||
procedure SetDeleteSQL(const AValue: TStringlist);
|
procedure SetDeleteSQL(const AValue: TStringlist);
|
||||||
procedure SetInsertSQL(const AValue: TStringlist);
|
procedure SetInsertSQL(const AValue: TStringlist);
|
||||||
procedure SetParams(AValue: TParams);
|
procedure SetParams(AValue: TParams);
|
||||||
@ -425,7 +425,7 @@ type
|
|||||||
property UsePrimaryKeyAsKey : boolean read FUsePrimaryKeyAsKey write SetUsePrimaryKeyAsKey default true;
|
property UsePrimaryKeyAsKey : boolean read FUsePrimaryKeyAsKey write SetUsePrimaryKeyAsKey default true;
|
||||||
property StatementType : TStatementType read GetStatementType;
|
property StatementType : TStatementType read GetStatementType;
|
||||||
property ParseSQL : Boolean read GetParseSQL write SetParseSQL default true;
|
property ParseSQL : Boolean read GetParseSQL write SetParseSQL default true;
|
||||||
Property CheckParams : Boolean Read GetCheckParams Write SetCheckParams default true;
|
Property ParamCheck : Boolean Read GetParamCheck Write SetParamCheck default true;
|
||||||
Property DataSource : TDatasource Read GetDataSource Write SetDatasource;
|
Property DataSource : TDatasource Read GetDataSource Write SetDatasource;
|
||||||
property ServerFilter: string read FServerFilterText write SetServerFilterText;
|
property ServerFilter: string read FServerFilterText write SetServerFilterText;
|
||||||
property ServerFiltered: Boolean read FServerFiltered write SetServerFiltered default False;
|
property ServerFiltered: Boolean read FServerFiltered write SetServerFiltered default False;
|
||||||
@ -481,7 +481,7 @@ type
|
|||||||
property UpdateMode;
|
property UpdateMode;
|
||||||
property UsePrimaryKeyAsKey;
|
property UsePrimaryKeyAsKey;
|
||||||
property ParseSQL;
|
property ParseSQL;
|
||||||
Property CheckParams;
|
Property ParamCheck;
|
||||||
Property DataSource;
|
Property DataSource;
|
||||||
property ServerFilter;
|
property ServerFilter;
|
||||||
property ServerFiltered;
|
property ServerFiltered;
|
||||||
@ -645,7 +645,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
UnPrepare;
|
UnPrepare;
|
||||||
if not CheckParams then
|
if not ParamCheck then
|
||||||
exit;
|
exit;
|
||||||
if assigned(DataBase) then
|
if assigned(DataBase) then
|
||||||
ConnOptions:=DataBase.ConnOptions
|
ConnOptions:=DataBase.ConnOptions
|
||||||
@ -784,7 +784,7 @@ begin
|
|||||||
FSQL:=TStringList.Create;
|
FSQL:=TStringList.Create;
|
||||||
TStringList(FSQL).OnChange:=@OnChangeSQL;
|
TStringList(FSQL).OnChange:=@OnChangeSQL;
|
||||||
FParams:=CreateParams;
|
FParams:=CreateParams;
|
||||||
FCheckParams:=True;
|
FParamCheck:=True;
|
||||||
FParseSQL:=True;
|
FParseSQL:=True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1402,7 +1402,7 @@ var ConnOptions : TConnOptions;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
FSchemaType:=stNoSchema;
|
FSchemaType:=stNoSchema;
|
||||||
if (FSQL <> nil) and CheckParams then
|
if (FSQL <> nil) and ParamCheck then
|
||||||
begin
|
begin
|
||||||
if assigned(DataBase) then
|
if assigned(DataBase) then
|
||||||
ConnOptions := TSQLConnection(DataBase).ConnOptions
|
ConnOptions := TSQLConnection(DataBase).ConnOptions
|
||||||
@ -1565,9 +1565,9 @@ begin
|
|||||||
TSQLConnection(Database).FreeFldBuffers(Cursor);
|
TSQLConnection(Database).FreeFldBuffers(Cursor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomSQLQuery.GetCheckParams: Boolean;
|
function TCustomSQLQuery.GetParamCheck: Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=FStatement.CheckParams;
|
Result:=FStatement.ParamCheck;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomSQLQuery.GetParams: TParams;
|
function TCustomSQLQuery.GetParams: TParams;
|
||||||
@ -2009,7 +2009,7 @@ procedure TQuerySQLStatement.OnChangeSQL(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
UnPrepare;
|
UnPrepare;
|
||||||
inherited OnChangeSQL(Sender);
|
inherited OnChangeSQL(Sender);
|
||||||
If CheckParams and Assigned(FDataLink) then
|
If ParamCheck and Assigned(FDataLink) then
|
||||||
(FDataLink as TMasterParamsDataLink).RefreshParamNames;
|
(FDataLink as TMasterParamsDataLink).RefreshParamNames;
|
||||||
FQuery.ServerIndexDefs.Updated:=false;
|
FQuery.ServerIndexDefs.Updated:=false;
|
||||||
end;
|
end;
|
||||||
@ -2317,9 +2317,9 @@ begin
|
|||||||
Result:=stUnknown;
|
Result:=stUnknown;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSQLQuery.SetCheckParams(AValue: Boolean);
|
procedure TCustomSQLQuery.SetParamCheck(AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
FStatement.CheckParams:=Avalue;
|
FStatement.ParamCheck:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSQLQuery.SetDeleteSQL(const AValue: TStringlist);
|
procedure TCustomSQLQuery.SetDeleteSQL(const AValue: TStringlist);
|
||||||
|
Loading…
Reference in New Issue
Block a user