[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'db' (#fcl)

TParams

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

A collection of parameter values for SQL-based datasets

Declaration

Source position: db.pas line 1255

type TParams = class(TCollection)

public

  constructor Create();

  

Create a new instance of TParams

  procedure AddParam();

  

Add a parameter to the collection

  procedure AssignValues();

  

Copy values from another collection

  function CreateParam();

  

Create and add a new parameter to the collection

  function FindParam();

  

Find a parameter with given name

  procedure GetParamList();

  

Fetch a list of TParam instances

  function IsEqual();

  

Is the list of parameters equal

  function GetEnumerator;

  

Return an enumerator for the parameters

  function ParamByName();

  

Return a parameter by name

  function ParseSQL();

  

Parse SQL statement, replacing parameter names with SQL parameter placeholders

  procedure RemoveParam();

  

Remove a parameter from the collection

  procedure CopyParamValuesFromDataset();

  

Copy parameter values from the fields in a dataset.

  property Dataset: TDataSet; [r]

  

Dataset that owns the TParams instance

  property Items []: TParam; default; [rw]

  

Indexed access to TParams instances in the collection

  property ParamValues []: Variant; [rw]

  

Named access to the parameter values.

end;

Inheritance

TParams

  

A collection of parameter values for SQL-based datasets

|

TCollection

|

TPersistent,IFPObserved

|

TObject

Description

TParams is a collection of TParam values. It is used to specify parameter values for parametrized SQL statemens, but is also used to specify parameter values for stored procedures. Its default property is an array of TParam values. The class also offers a method to scan a SQL statement for parameter names and replace them with placeholders understood by the SQL engine: TParams.ParseSQL.

TDataset itself does not use TParams. The class is provided in the DB unit, so all TDataset descendents that need some kind of parametrization make use of the same interface. The TMasterParamsDataLink class can be used to establish a master-detail relationship between a parameter-aware TDataset instance and another dataset; it will automatically refresh parameter values when the fields in the master dataset change. To this end, the TParams.CopyParamValuesFromDataset method exists.

See also

TDataset

  

Base class for records-based data-access

TMasterParamsDataLink

  

Class to establish a master-detail relationship between dataset, based on parameters

TParam

  

Parameter description class

TParams.ParseSQL

  

Parse SQL statement, replacing parameter names with SQL parameter placeholders

TParams.CopyParamValuesFromDataset

  

Copy parameter values from the fields in a dataset.


Documentation generated on: Sep 28 2017