Sign in Join
FPDoc Onlineexperiment

TSQLQuery class

In unit SQLDB

Class to handle SQL commands (with or without result set).

Declaration

pascal
TSQLQuery = class(TCustomSQLQuery)

Inheritance

  1. TSQLQuery
  2. TCustomSQLQuery
  3. TCustomBufDataset
  4. TDBDataset
  5. TDataSet
  6. TComponent
  7. TPersistent
  8. TObject

Description

TSQLQuery exposes the properties and some methods introduced in TCustomSQLQuery. It encapsulates a single SQL statement: it implements all the necessary TDataset functionality to be able to handle a result set. It can also be used to execute a single SQL statement that does not return data, using the ExecSQL method.

Typically, the Database property must be set once, the Transaction property as well. Then the SQL property can be set. Depending on the kind of SQL statement, the Open method can be used to retrieve data, or the ExecSQL method can be used to execute the SQL statement (this can be used for DDL statements, or update statements).

See also

Properties

SchemaTypepublicSchema type.
StatementTypepublicSQL statement type.
MaxIndexesCountpublishedMaximum allowed number of indexes.
FieldDefspublishedList of field definitions.
ActivepublishedIs the dataset open or closed.
AutoCalcFieldspublishedHow often should the value of calculated fields be calculated.
FilterpublishedFilter to apply to the data in memory.
FilteredpublishedIs the filter active or not.
AfterCancelpublishedEvent triggered after a Cancel operation.
AfterClosepublishedEvent triggered after the dataset is closed.
AfterDeletepublishedEvent triggered after a successful Delete operation.
AfterEditpublishedEvent triggered after the dataset is put in edit mode.
AfterInsertpublishedEvent triggered after the dataset is put in insert mode.
AfterOpenpublishedEvent triggered after the dataset is opened.
AfterPostpublishedEvent called after changes have been posted to the underlying database.
AfterRefreshpublishedEvent triggered after refresh.
AfterScrollpublishedEvent triggered after the cursor has changed position.
BeforeCancelpublishedEvent triggered before a Cancel operation.
BeforeClosepublishedEvent triggered before the dataset is closed.
BeforeDeletepublishedEvent triggered before a Delete operation.
BeforeEditpublishedEvent triggered before the dataset is put in edit mode.
BeforeInsertpublishedEvent triggered before the dataset is put in insert mode.
BeforeOpenpublishedEvent triggered before the dataset is opened.
BeforePostpublishedEvent called before changes are posted to the underlying database.
BeforeRefreshpublishedEvent triggered before refresh.
BeforeScrollpublishedEvent triggered before the cursor changes position.
DatabasepublishedThe TSQLConnection instance on which to execute SQL Statements.
TransactionpublishedTransaction in which to execute SQL statements.
ReadOnlypublishedIndicates if records can be added, deleted, or modified in the dataset.
SQLpublishedThe SQL statement to execute.
InsertSQLpublishedStatement to be used when inserting a new row in the database.
UpdateSQLpublishedStatement to be used when updating an existing row in the database.
DeleteSQLpublishedStatement to be used when deleting a new row in the database.
RefreshSQLpublishedRefresh query to re-fetch field values after a DB update.
IndexDefspublishedList of local index Definitions.
OptionspublishedOptions controlling the behaviour of the dataset.
ParamspublishedParameters detected in the SQL statement.
ParamCheckpublishedShould the SQL statement be checked for parameters.
MacrospublishedSet of macros for this SQL statement.
MacroCheckpublishedCheck for macros in the SQL statement.
MacroCharpublishedMacro delimiter character.
ParseSQLpublishedShould the SQL statement be parsed or not.
UpdateModepublishedHow to create update SQL statements.
UsePrimaryKeyAsKeypublishedShould primary key fields be marked pfInKey.
DataSourcepublishedSource for parameter values for unbound parameters.
SequencepublishedSequence to use for auto-generating values using a sequence.
ServerFilterpublishedAppend server-side filter to SQL statement.
ServerFilteredpublishedShould server-side filter be applied.
ServerIndexDefspublishedList of indexes on the primary table of the query.

Events

OnCalcFieldspublishedEvent triggered when values for calculated fields must be computed.
OnDeleteErrorpublishedEvent triggered when a delete operation fails.
OnEditErrorpublishedEvent triggered when an edit operation fails.
OnFilterRecordpublishedEvent triggered to filter records.
OnNewRecordpublishedEvent triggered when a new record is created.
OnPostErrorpublishedEvent triggered when a post operation fails.

Inherited

From TCustomSQLQuery (53)

ApplyRecUpdate ApplyReturningResult ApplyUpdates BeforeRefreshOpenCursor Create CreateParams CreateSQLStatement Cursor Delete Destroy DoBeforePost DoOnNewRecord ExecSQL Fetch FieldDefsClass GetCanModify GetDataSource InternalAddRecord InternalClose InternalInitFieldDefs InternalOpen InternalRefresh IsPrepared LoadBlobIntoBuffer LoadField Log LogEvent MacroByName NeedRefreshRecord Notification OpenCursor ParamByName Post Prepare Prepared PSGetTableName PSGetUpdateException RefreshLastInsertID RefreshRecord RowsAffected SetDatabase SetDataSource SetPacketRecords SetReadOnly SetSchemaInfo SetServerFiltered SetServerFilterText SetTransaction SQLConnection SQLTransaction TableName UnPrepare UpdateServerIndexDefs

From TCustomBufDataset (72)

AddIndex AllocRecordBuffer ApplyRecUpdateEx BookmarkValid CancelUpdates ChangeCount Clear ClearCalcFields ClearIndexes CompareBookmarks CopyFromDataset CreateBlobStream CreateDataset CreateDefaultPacketReader DataEvent DefaultPacketClass DefaultReadFileFormat DefaultWriteFileFormat DoBeforeClose DoFilterRecord DoLocate FileName FreeBlobBuffer FreeRecordBuffer GetBookmarkData GetBookmarkFlag GetChangeCount GetDatasetPacket GetFieldData GetNewBlobBuffer GetNewWriteBlobBuffer getnextpacket GetPacketReader GetRecNo GetRecord GetRecordCount GetRecordSize IndexFieldNames IndexName InternalAddIndex InternalCancel InternalDelete InternalFirst InternalGotoBookmark InternalInitRecord InternalLast InternalPost InternalSetToRecord IsCursorOpen IsReadFromPacket LoadFromFile LoadFromStream Locate Lookup ManualMergeChangeLog MergeChangeLog OnUpdateError PacketRecords Refreshing RevertRecord SaveToFile SaveToStream SetBookmarkData SetBookmarkFlag SetDatasetPacket SetFieldData SetFiltered SetFilterText SetOnUpdateError SetRecNo UniDirectional UpdateStatus

From TDBDataset (1)

CheckDatabase

From TDataSet (166)

ActivateBuffers ActiveBuffer ActiveRecord Append AppendRecord BindFields BlobFieldCount BlockReadNext BlockReadSize BOF Bookmark BookmarkAvailable BookmarkSize BufferCount Buffers CalcBuffer CalcFieldsSize CalculateFields Cancel CanModify CheckActive CheckBiDirectional CheckBrowseMode CheckInactive ClearBuffers ClearFields Close CloseBlob CloseCursor Constraints ControlsDisabled CreateFields CurrentRecord CursorPosChanged DataConvert DefaultFields DestroyFields DisableControls DoAfterCancel DoAfterClose DoAfterDelete DoAfterEdit DoAfterInsert DoAfterOpen DoAfterPost DoAfterRefresh DoAfterScroll DoBeforeCancel DoBeforeDelete DoBeforeEdit DoBeforeInsert DoBeforeOpen DoBeforeRefresh DoBeforeScroll DoOnCalcFields Edit EnableControls EOF FieldByName FieldByNumber FieldCount Fields FieldsClass FieldValues FilterOptions FindField FindFirst FindLast FindNext FindPrior FindRecord First Found FreeBookmark FreeFieldBuffers GetBookmark GetBookmarkStr GetCalcFields GetChildren GetCurrentRecord GetDefaultBufferCount GetFieldClass GetfieldCount GetFieldList GetFieldNames GetFieldValues GetIndexDefs GetIsIndexField GetNextRecord GetNextRecords GetPriorRecord GetPriorRecords GotoBookmark InitFieldDefs InitFieldDefsFromFields InitRecord Insert InsertRecord InternalCalcFields InternalEdit InternalHandleException InternalInsert IsEmpty IsLinkedTo IsSequenced IsUniDirectional Last Loaded Modified MoveBy MyDataSourceCount MyDataSources Next Open OpenCursorcomplete Prior PSEndTransaction PSExecute PSExecuteStatement PSGetAttributes PSGetCommandText PSGetCommandType PSGetDefaultOrder PSGetIndexDefs PSGetKeyFields PSGetParams PSGetQuoteChar PSInTransaction PSIsSQLBased PSIsSQLSupported PSReset PSSetCommandText PSSetParams PSStartTransaction PSUpdateRecord RecalcBufListSize RecNo RecordCount RecordSize Refresh RefreshInternalCalcFields RestoreState Resync SetActive SetBookmarkStr SetBufListSize SetChildOrder SetCurrentRecord SetDefaultFields SetFields SetFieldValues SetFilterOptions SetFound SetModified SetName SetOnFilterRecord SetState SetTempState SetUniDirectional SparseArrays State TempBuffer Translate UpdateCursorPos UpdateIndexDefs UpdateRecord

From TComponent (69)

_AddRef _Release BeforeDestruction CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DefineProperties DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetParentComponent GetTypeInfo GetTypeInfoCount HasParent iicrGetComponent InsertComponent Invoke IsImplementorOf Loading Name ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReadState ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetDesigning SetDesignInstance SetInline SetParentComponent SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState

From TPersistent (5)

Assign AssignTo FPOAttachObserver FPODetachObserver FPONotifyObservers

From TObject (37)

AfterConstruction 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 StringMessageTable SystemHasExtendedRTTI UnitName

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