TCustomSQLQuery¶
Custom Class to handle SQL commands (with or without result set).
Declaration¶
Source position: sqldb.pp line 508
type
TCustomSQLQuery = class(TCustomBufDataset)
public
constructor Create;
destructor Destroy;
procedure Prepare;
procedure UnPrepare;
procedure ExecSQL;
procedure SetSchemaInfo;
function RowsAffected : TRowsCount;
function ParamByName : TParam;
function MacroByName : TParam;
property Prepared: Boolean; {r}
property SQLConnection: TSQLConnection; {rw}
property SQLTransaction: TSQLTransaction; {rw}
procedure ApplyUpdates; overload;
procedure Post;
procedure Delete;
end;
Description¶
TCustomSQLQuery encapsulates a SQL statement: it implements all the necessary #fcl.db.TDataset functionality to be able to handle a result set. It can also be used to execute SQL statements that do not return data, using the ExecSQL method.
Do not instantiate a TCustomSQLQuery class directly, instead use the TSQLQuery descendent.
Properties¶
| Member | Visibility | Description |
|---|---|---|
| Prepared read only | public | Is the query prepared ? |
| SQLConnection | public | Database as TSQLConnection. |
| SQLTransaction | public | Transaction as TSQLTransaction. |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| ApplyUpdates | public | Apply updates and check result. |
| Create | public | Create a new instance of TCustomSQLQuery. |
| Delete | public | Delete and optionally apply updates. |
| Destroy | public | Destroy instance of TCustomSQLQuery. |
| ExecSQL | public | Execute a SQL statement that does not return a result set. |
| MacroByName | public | Convenience for Macros.ParamByName. |
| ParamByName | public | Return parameter by name. |
| Post | public | Post pending changes and optionally apply updates. |
| Prepare | public | Prepare a query for execution. |
| RowsAffected | public | Return the number of rows (records) affected by the last DML/DDL statement. |
| SetSchemaInfo | public | SetSchemaInfo prepares the dataset to retrieve schema info. |
| UnPrepare | public | Unprepare a prepared query. |