Sign in Join
FPDoc Onlineexperiment

TParams class

In unit DB

A collection of parameter values for SQL-based datasets.

Declaration

pascal
TParams = class(TCollection)

Inheritance

  1. TParams
  2. TCollection
  3. TPersistent
  4. TObject

Descends from it: TSQLDBParams

Description

TParams is a collection of TParam values. It is used to specify parameter values for parameterized SQL statements, 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: ParseSQL.

TDataset itself does not use TParams. The class is provided in the DB unit, so all TDataset descendents that need some kind of parameterization 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 CopyParamValuesFromDataset method exists.

See also

Properties

DatasetpublicDataset that owns the TParams instance.
ItemspublicIndexed access to TParams instances in the collection.
ParamValuespublicNamed access to the parameter values.

Methods

CreateParseOptsprotected
DoParseSQLprotected
AssignToprotectedGeneric assignment function.
GetDataSetprotected
GetOwnerprotectedReturns the owner of the component.
ParamClassprotected
CreatepublicCreate a new instance of TParams.
AddParampublicAdd a parameter to the collection.
AssignValuespublicCopy values from another collection.
CreateParampublicCreate and add a new parameter to the collection.
FindParampublicFind a parameter with given name.
GetParamListpublicFetch a list of TParam instances.
IsEqualpublicIs the list of parameters equal.
GetEnumeratorpublicReturn an enumerator for the parameters.
ParamByNamepublicReturn a parameter by name.
ParseSQLpublicParse SQL statement, replacing parameter names with SQL parameter placeholders.
RemoveParampublicRemove a parameter from the collection.
CopyParamValuesFromDatasetpublicCopy parameter values from the fields in a dataset.

Inherited

From TCollection (28)

Add Assign BeginUpdate Changed Clear Count Delete Destroy EndUpdate Exchange FindItemID GetAttr GetAttrCount GetItem GetItemAttr GetNamePath Insert ItemClass Move Notify Owner PropName SetItem SetItemName SetPropName Sort Update UpdateCount

From TPersistent (4)

DefineProperties FPOAttachObserver FPODetachObserver FPONotifyObservers

From TObject (40)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.