Unit 'msesqlquery' Package
[Overview][Types][Classes][Procedures and functions][Index] [#msegui]

tsqlquery

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

Holds a buffer of all records fetched by SQL; the db*edit widgets work from and to this buffer, not directly against the database

Declaration

Source position: msesqlquery.pas line 67

type tsqlquery = class(tmsebufdataset,isqlclient,icursorclient)

public

  constructor Create(); override;

  destructor Destroy; override;

  function isutf8; override;

  procedure applyupdate(); override;

  procedure applyupdates(); override;

  function refreshrecquery();

  procedure checktablename;

  function updaterecquery;

  function insertrecquery;

  function deleterecquery;

  function writetransaction;

  procedure refresh(); overload;

  procedure Prepare; virtual;

  procedure UnPrepare; virtual;

  procedure ExecSQL; virtual;

  function executedirect();

  function rowsreturned;

  function rowsaffected;

  property updaterowsaffected: Integer; [r]

  function CreateBlobStream(); override;

  property Prepared: Boolean; [r]

  property connected: Boolean; [rw]

published

  property ReadOnly: Boolean; [rw]

  property ParseSQL: Boolean; [rw]

  property params: tmseparams; [rw]

  property SQL: tsqlstringlist; [rw]

  

Stored as ANSI text — avoid non-ASCII characters

  property SQLUpdate: tupdatestringlist; [rw]

  

SQLUpdate/SQLInsert/SQLDelete each hold a single SQL statement, even though they are string lists (only for readability of a multi-line statement)

  property SQLInsert: tupdatestringlist; [rw]

  property SQLDelete: tupdatestringlist; [rw]

  property beforeexecute: tcustomsqlstatement; [rw]

  property aftercursorclose: tcustomsqlstatement; [rw]

  property IndexDefs: TIndexDefs; [r]

  

Only populated while UsePrimaryKeyAsKey is True, since that is what makes tsqlquery parse the index definitions

  property UpdateMode: TUpdateMode; [rw]

  property UsePrimaryKeyAsKey: Boolean; [rw]

  

When True (the default), the primary key field(s) automatically get of_InKey added to optionsfield (the pfInKey equivalent), so they are used in the "where" part of the update statement

  property tablename: string; [rw]

  property StatementType: TStatementType; [rw]

  property DataSource: TDatasource; [rw]

  property masterdelayus: Integer; [rw]

  property optionsmasterlink: optionsmasterlinkty; [rw]

  property database: tcustomsqlconnection; [rw]

  property Active;

  property Filter;

  

Unlike the base tdataset behavior, setting Filter or Filtered on a tsqlquery inserts Filter into the "where" part of the SQL statement and re-executes the query against the database

  property Filtered;

  property BeforeOpen;

  property AfterOpen;

  property BeforeClose;

  property AfterClose;

  property BeforeInsert;

  property AfterInsert;

  property BeforeEdit;

  property AfterEdit;

  property BeforePost;

  property AfterPost;

  property BeforeCancel;

  property AfterCancel;

  property BeforeDelete;

  property AfterDelete;

  property BeforeScroll;

  property AfterScroll;

  property BeforeRefresh;

  property AfterRefresh;

  property OnCalcFields;

  property OnDeleteError;

  property OnEditError;

  property OnFilterRecord;

  property OnNewRecord;

  property OnPostError;

  property onmodified;

  property AutoCalcFields;

  property Transaction: TSQLTransaction; [rw]

  property transactionwrite: TSQLTransaction; [rw]

  

For disconnected (offline) updates

end;

Inheritance

tsqlquery

  

Holds a buffer of all records fetched by SQL; the db*edit widgets work from and to this buffer, not directly against the database

|

tmsebufdataset,isqlclient,icursorclient

  

Keeps three buffers: the record buffer holds all fetched records (fkdata and fkinternalcalc field values — see oninternalcalcfields)

|

tmdbdataset,iblobchache,idatasetsum,imasterlink,idbdata,iobjectlink

|

TObject,idatabaseclient,itransactionclient

Description

Holds a buffer of all records fetched by SQL; the db*edit widgets work from and to this buffer, not directly against the database. Post transfers the current record's edited values into that buffer, marking it changed/inserted/deleted and keeping a copy of the original values, so Cancel can still revert the current record before Post. applyupdates then posts every changed record to the database using the SQLInsert/SQLDelete/ SQLUpdate statements (generated automatically from TField.ProviderFlags when left empty, if there is a primary key) — override applyrecupdate for full control, e.g. for multi-table queries; applyupdates itself calls CheckBrowseMode (which posts a record left in edit/insert state), so an explicit Post right before it is not required. Before applyupdates, CancelUpdates can still revert all pending changes. Applied changes still need an explicit TTransaction.Commit/ CommitRetaining; set bdo_autoapply and bdo_autocommitret in options to do both automatically.


Documentation generated on: 2026-10-03