Class DataSet

(line 553)

Description

Object
   |
   --Persistent
      |
      --Component
         |
         --DataSet

Located in File: /db.inc.php

DataSet component, base class to inherit and create dataset components

A DataSet is a collection of information, organized in rows and fields, and this class implement the basic interface all data-aware components will use to show information.

A DataSet is not attached to an specific source of information, you can, for example, create a DataSet that provide information from a memory array.



Classes extended from DataSet:
DBDataSet
DBDataSet encapsulates database connectivity for descendant dataset objects.
IBDataSet
IBDataSet defines database-related connectivity properties and methods for a dataset.
MySQLDataSet
MySQLDataSet encapsulates database connectivity for descendant dataset objects.
OracleDataSet
OracleDataSet encapsulates database connectivity for descendant dataset objects.

Properties

Summary:
LimitCount Defines how many records will be shown
LimitStart Defines the starting record to filter the dataset with
Active Specifies whether or not a dataset is open.
BOF Indicates whether the first record in the dataset is active.
CanModify Indicates whether an application can insert, edit, and delete data in a table.
DataSetField Indicates the persistent DataSetField object that owns a nested dataset.
EOF Indicates whether a dataset is positioned at the last record.
FieldCount Indicates the number of field components associated with the dataset.
Fields This property returns an array with the field names and values
Filter Specifies the text of the current filter for a dataset.
MasterFields Specifies one or more fields in a master table to link with corresponding fields in this table in order to establish a master-detail relationship between the tables.
MasterSource Specifies the name of the data source for a dataset to use as a master table in establishing a detail-master relationship between this table and another one.
Modified Indicates whether the active record is modified.
RecKey Specifies the record key for this dataset
RecNo Indicates the current record in the dataset.
RecordCount Indicates the total number of records associated with the dataset.
State Indicates the current operating mode of the dataset.

Defined in class Component

Name Specifies the name for the component. The name is used as an identifier and should be unique.
Tag A versatile property of every Component that can be used in any way you want
ComponentCount Indicates the number of components owned by the component.
Components Lists all the components owned by this component.
ControlState A flag to know the state of the control, csLoading, csDesigning
DataFieldValue This property returns the value of the datafield if any.
NamePath Specifies the path to uniquely identify a component, qualified by the owner when required.
Owner Indicates the component that is responsible for streaming and freeing this component.

Defined in class Persistent

NamePath Used to serialize/unserialize. It returns the full path to identify this component.
Owner Owner of the component.

property LimitCount (line 582)

integer LimitCount

Defines how many records will be shown

Use this property to set how many records do you want to get on the set, at max.

Info


property LimitStart (line 568)

integer LimitStart

Defines the starting record to filter the dataset with

Use this property to filter the dataset and to set which is the first record to be added to the set.

Info


property Active (line 2302)

boolean Active

Specifies whether or not a dataset is open.

Use Active to determine or set whether a dataset is populated with data. When Active is false, the dataset is closed; the dataset cannot read or write data and data-aware controls can not use it to fetch data or post edits. When Active is true, the dataset can be populated with data. It can read data from a database or other source (such as a provider). Depending on the CanModify property, active datasets can post changes.

Setting Active to true:

Generates a OnBeforeOpen event.

Sets the dataset state to dsBrowse.

Establishes a way to fetch data (typically by opening a cursor).

Generates an OnAfterOpen event.

If an error occurs while opening the dataset, dataset state is set to dsInactive, and any cursor is closed.

Setting Active to false:

  1. - Triggers a BeforeClose event.
2 - Sets the State property to dsInactive.

3 - Closes the cursor.

4 - Triggers an AfterClose event.

An application must set Active to false before changing other properties that affect the status of a database or the controls that display data in an application.

Note: Calling the Open method sets Active to true; calling the Close method sets Active to false.

Info


property BOF (line 2389)

boolean BOF

Indicates whether the first record in the dataset is active.

Test Bof (beginning of file) to determine if the dataset is positioned at the first record. If Bof is true, the active record is unequivocally the first row in the dataset. Bof is true when an application.

Opens a dataset.

Calls a dataset’s First method.

Call a dataset’s Prior method, and the method fails because the first row is already active.

Bof is false in all other cases.

Info

  • see - EOF, First

property CanModify (line 881)

boolean CanModify

Indicates whether an application can insert, edit, and delete data in a table.

Check the status of CanModify to determine if an application can modify a dataset in any way. If CanModify is true, the dataset can be modified. If CanModify is false, the table is read-only.

CanModify is set automatically when an application opens a table. If the ReadOnly property of a table component is true, then CanModify is set to false.

Note: Even if CanModify is true, it is not a guarantee that a user will be able to insert or update records in a table. Other factors may come in to play, for example, SQL access privileges.

Info


property DataSetField (line 685)

Field DataSetField

Indicates the persistent DataSetField object that owns a nested dataset.

Not used.


property EOF (line 2415)

boolean EOF

Indicates whether a dataset is positioned at the last record.

Test Eof (end-of-file) to determine if the active record in a dataset is the last record. If Eof is true, the current record is unequivocally the last row in the dataset. Eof is true when an application:

Opens an empty dataset.

Calls a dataset’s Last method. (Unless it is a unidirectional dataset)

Call a dataset’s Next method, and the method fails because the current record is already the last row in the dataset.

Eof is false in all other cases.

Tip: If both Eof and Bof are true, the dataset is empty.

Info

  • see - BOF, Last, Next

property FieldCount (line 662)

integer FieldCount

Indicates the number of field components associated with the dataset.

Examine FieldCount to determine the number of fields listed by the Fields property.


property Fields (line 653)

array Fields

This property returns an array with the field names and values

Use Fields to access fields that make up this dataset. The order of field components in Fields corresponds directly to the order of columns in the table or tables underlying a dataset.

Accessing fields with the Fields property is useful for applications that:

Iterate over some or all fields in a dataset.

Work with underlying tables whose internal data structure is unknown at runtime.

If an application knows the data types of individual fields, then it can read or write individual field values through the Fields property.


property Filter (line 1175)

string Filter

Specifies the text of the current filter for a dataset.

Use Filter to specify a dataset filter. When filtering is applied to a dataset, only those records that meet a filter’s conditions are available. Filter describes the filter condition.


property MasterFields (line 732)

array MasterFields

Specifies one or more fields in a master table to link with corresponding fields in this table in order to establish a master-detail relationship between the tables.

Use MasterFields after setting the MasterSource property to specify the names of one or more fields to use in establishing a detail-master relationship between this table and the one specified in MasterSource.

MasterFields is an array containing one or more field names in the master table.

Each time the current record in the master table changes, the new values in those fields are used to select corresponding records in this table for display.

Info


property MasterSource (line 756)

DataSource MasterSource

Specifies the name of the data source for a dataset to use as a master table in establishing a detail-master relationship between this table and another one.

Use MasterSource to specify the name of the data source component whose DataSet property identifies a dataset to use as a master table in establishing a detail-master relationship between this table and another one.

Note: At design time choose an available data source from the MasterSource property’s drop-down list in the Object Inspector.

After setting the MasterSource property, specify which fields to use in the master table by setting the MasterFields property. At runtime each time the current record in the master table changes, the new values in those fields are used to select corresponding records in this table for display.

Info


property Modified (line 857)

boolean Modified

Indicates whether the active record is modified.

Check Modified to determine if the active record is modified. If Modified is true, the active record is modified. If false, the active record is not modified.

Note: In general, an application need not check the status of Modified. Properties, events, and methods of TDataSet and its descendants that modify records generally check this status automatically and take appropriate actions based on its value.

Info

  • see - redCanModify

property RecKey (line 803)

array RecKey

Specifies the record key for this dataset

This property specifies the fields and values that determine the key of a record.

Info


property RecNo (line 776)

integer RecNo

Indicates the current record in the dataset.

Examine RecNo to determine the record number of the current record in the dataset. Applications might use this property with RecordCount to iterate through all the records in a dataset, though typically record iteration is handled with calls to First, Last, MoveBy, Next, and Prior.

Info


property RecordCount (line 1761)

integer RecordCount

Indicates the total number of records associated with the dataset.

As implemented in DataSet, RecordCount is always 0. Ordinarily an application does not access RecordCount at the DataSet level. Instead a redeclared and implemented RecordCount property in a descendant class is accessed. RecordCount provides a fallback property for derived dataset classes that do not reimplement the property access method.


property State (line 706)

enum State

Indicates the current operating mode of the dataset.

Examine State to determine the current operating mode of the dataset. State determines what can be done with data in a dataset, such as editing existing records or inserting new ones. The dataset state constantly changes as an application processes data.

Opening a dataset changes State from dsInactive to dsBrowse. An application can call Edit to put a dataset into dsEdit state, or call Insert to put a dataset into dsInsert state.

Posting or canceling edits, insertions, or deletions, changes State from its current state to dsBrowse. Closing a dataset changes its state to dsInactive.


property Name

Specifies the name for the component. The name is used as an identifier and should be unique.
This property is implemented in Component::Name

property Tag

A versatile property of every Component that can be used in any way you want
This property is implemented in Component::Tag

property ComponentCount

Indicates the number of components owned by the component.
This property is implemented in Component::ComponentCount

property Components

Lists all the components owned by this component.
This property is implemented in Component::Components

property ControlState

A flag to know the state of the control, csLoading, csDesigning
This property is implemented in Component::ControlState

property DataFieldValue

This property returns the value of the datafield if any.
This property is implemented in Component::DataFieldValue

property NamePath

Specifies the path to uniquely identify a component, qualified by the owner when required.
This property is implemented in Component::NamePath

property Owner

Indicates the component that is responsible for streaming and freeing this component.
This property is implemented in Component::Owner

property NamePath

Used to serialize/unserialize. It returns the full path to identify this component.
This property is implemented in Persistent::NamePath

property Owner

Owner of the component.
This property is implemented in Persistent::Owner

Methods

Summary:
__construct Component constructor [Overrides Component::__construct()]
append Adds a new, empty record to the end of the dataset.
beginInsertAppend Begins an insert/append operation
cancel Cancels modifications to the active record if those changes are not yet posted.
checkActive Checks to see if the database connection is active.
checkBrowseMode Automatically posts or cancels data changes when the active record changes.
checkCanModify Checks to see if the dataset can be modified.
checkOperation Checks if an specific operation can be made, if not, calls $ErrorEvent
checkParentState Sets the parent dataset in edit state
clearBuffers Clear buffers associated with the dataset
close Closes a dataset.
closeCursor Close the cursor for this dataset
controlsDisabled Indicates whether data-aware controls update their display to reflect changes to the dataset.
dataEvent Used to notify attached datasets about an specific event
delete Deletes the active record and positions the dataset on the next record.
DisableControls Disables data display in data-aware controls associated with the dataset.
doInternalOpen Performs an internal open of the dataset
edit Enables editing of data in the dataset.
EnableControls Enable controls attached to the datasource
endInsertAppend Finishes an insert/append operation
first Moves to the first record in the dataset.
initRecord To initialize the current record
insert Inserts a new, empty record in the dataset.
internalAddRecord
internalCancel To be overriden to perform a cancel() operation
internalClose Override this method to perform the closing of the dataset
internalDelete To be overriden to perform a delete() operation
internalEdit To be overriden to perform a edit() operation
internalFirst To be overriden to perform a first() operation
internalHandleException Override this method to handle exceptions
internalInitFieldDefs Override this method to init field definitions. Not used.
internalInitRecord
internalInsert To be overriden to perform a insert() operation
internalLast To be overriden to perform a last() operation
internalOpen Override this method to perform the opening of the dataset
internalPost To be overriden to perform a post() operation
internalRefresh To be overriden to perform a refresh() operation
isCursorOpen Override this method to return if the cursor is open or not
last Moves to the last record in the dataset.
loaded Initializes the component after the form file has been read into memory. [Overrides Component::loaded()]
moveBy Moves to another record relative to the active record in the dataset.
next Moves to the next record in the dataset.
open Opens the dataset.
openCursor Opens the cursor for the dataset
OpenCursorComplete Finishes the open cursor operation
post Implements a virtual method to write a modified record to the database or change log.
prior Moves to the previous record in the dataset.
refresh Re-fetches data from the database to update a dataset’s view of data.
serialize Stores this object into the session. [Overrides Persistent::serialize()]
unserialize This method uses PHP reflection to iterate through published properties (the ones starting with get) and retrieve the properties stored by a previous serialize() call. [Overrides Persistent::unserialize()]
updateRecord Ensures that data-aware controls and detail datasets reflect record updates.

Defined in class Component

dumpChildrenJavascript Dumps the javascript code for all the children
dumpFormItems Dumps code just after the form tag, useful to dump hidden fields for state retrieving for non visible components
dumpHeaderCode Dumps header code required
dumpJavascript Dumps the javascript code needed by this component
hasValidDataField Returns true if a valid data field is attached to the component
init Initializes a component
loaded Initializes the component after the form file has been read into memory.
loadedChildren Calls childrens loaded
preinit Method called before init()
serializeChildren Serializes all children
unserializeChildren Unserializes all children by calling unserialize for all the components

Defined in class Persistent

serialize Stores this object into the session.
unserialize This method uses PHP reflection to iterate through published properties (the ones starting with get) and retrieve the properties stored by a previous serialize() call.

Defined in class Object

__construct Constructs an object and initializes its data before the object is first used.
className Returns a string indicating the type of the object instance (as opposed to the type of the variable passed as an argument).
classParent Returns the type of the immediate ancestor of a class.

Constructor __construct (line 1470)

DataSet __construct( [ $aowner = null])

Overrides : Component::__construct() Component constructor


Method append (line 1519)

void append( )

Adds a new, empty record to the end of the dataset.

For datasets that permit editing, call Append to:

  1. - Open a new, empty record at the end of the dataset.
  2. - Set the active record to the new record.
After a call to Append, an application can enable users to enter data in the fields of the record, and can then post those changes to the database or change log using Post

Info


Method beginInsertAppend (line 1434)

void beginInsertAppend( )

Begins an insert/append operation

This method is called by the dataset to start an insert or append operation, it first checks the browse mode, after that, checks if the dataset can be modified and finally, calls the OnBeforeInsert event

Info


Method cancel (line 1546)

void cancel( )

Cancels modifications to the active record if those changes are not yet posted.

Call Cancel to undo modifications made to one or more fields belonging to the active record. As long as those changes are not already posted, Cancel returns the record to its previous state, and sets the dataset state to dsBrowse.

Typically Cancel is used to back out of changes in response to user request, or in field validation routines that back out illegal field values.

Note: If the dataset is not in an editing state (dsEdit or dsInsert), Cancel does nothing.

Info


Method checkActive (line 1305)

void checkActive( )

Checks to see if the database connection is active.

Call CheckActive to determine if the connection to a database server is active. If the database connection is inactive, an DatabaseError exception is raised.

Info


Method checkBrowseMode (line 1608)

void checkBrowseMode( )

Automatically posts or cancels data changes when the active record changes.

CheckBrowseMode is used internally by many dataset methods to ensure that modifications to the active record are posted when a dataset’s state is dsEdit, dsInsert, or dsSetKey and a method switches to a different record.

If State is dsEdit or dsInsert, CheckBrowseMode calls UpdateRecord, and, if the Modified property for the dataset is true, calls Post. If Modified is false, CheckBrowseMode calls Cancel.

If State is dsSetKey, CheckBrowseMode calls Post.

If State is dsInactive, CheckBrowseMode raises an exception.

If an application uses existing dataset methods, CheckBrowseMode is always called when necessary, so there is usually no need to call CheckBrowseMode directly.

Applications that provide custom dataset routines may need to call CheckBrowseMode inside those routines to guarantee that changes are posted when switching to a different record.

Info


Method checkCanModify (line 1318)

void checkCanModify( )

Checks to see if the dataset can be modified.

Call CheckCanModify to determine if the dataset can be modified. If the dataset cannot be modified, an DatabaseError exception is raised.

Info


Method checkOperation (line 1222)

void checkOperation( string $Operation, string $ErrorEvent)

Checks if an specific operation can be made, if not, calls $ErrorEvent

Parameters

  • string $Operation: Operation to perform on the dataset
  • string $ErrorEvent: Event to call if there is any error

Method checkParentState (line 1697)

void checkParentState( )

Sets the parent dataset in edit state

This is an internal method you don't need to call directly.

Info


Method clearBuffers (line 1415)

void clearBuffers( )

Clear buffers associated with the dataset

This method set the dataset buffers to the inital state, that is, recordcount to 0 and bof/eof to true. The fieldbuffer is also cleared to an empty array.


Method close (line 1644)

void close( )

Closes a dataset.

Call Close to set the Active property of a dataset to false. When Active is false, the dataset is closed; it cannot read or write data and data-aware controls can’t use it to fetch data or post edits.

An application must close the dataset before changing properties that affect the status of the database or the controls that display data in an application. For example, to change the DataSource property for a dataset, the dataset must be closed. Closing the dataset puts it into the dsInactive state.

Info


Method closeCursor (line 1908)

void closeCursor( )

Close the cursor for this dataset

This method is used to close the cursor attached to the dataset, it calls InternalClose, a method you need to override if you are deriving from Dataset.

Info


Method controlsDisabled (line 1342)

boolean controlsDisabled( )

Indicates whether data-aware controls update their display to reflect changes to the dataset.

Call ControlsDisabled to ascertain whether the updating of data display in data-aware controls is currently disabled. If ControlsDisabled is true, controls are currently disabled. ControlsDisabled is true as long as the reference count that keeps track of disabling for the dataset is greater than zero. This count is incremented every time the DisableControls method is called and decremented when EnableControls is called. Applications call DisableControls to improve performance and prevent constant updates during automated iterations through records in the dataset.

In complex applications, when controls may be disabled multiple times by different processes, you can use ControlsDisabled as a check in a procedure to reenable controls should each call to DisableControls not be paired with a subsequent call to EnableControls.

Info

  • return - True if controls has been disabled
  • see - disableControls, enableControls

Method dataEvent (line 1251)

void dataEvent( integer $event, array $info)

Used to notify attached datasets about an specific event

Parameters

  • integer $event: Event to notify
  • array $info: Info for the event

Method delete (line 1674)

void delete( )

Deletes the active record and positions the dataset on the next record.

Call Delete to remove the active record from the database. If the dataset is inactive, Delete raises an exception. Otherwise, Delete:

Verifies that the dataset is not empty (and raises an exception if it is).

Calls CheckBrowseMode to post any pending changes to a prior record if necessary.

Calls the OnBeforeDelete event handler.

Deletes the record.

Frees any buffers allocated for the record.

Puts the dataset into dsBrowse mode.

Resynchronizes the dataset to make the next undeleted record active. If the record deleted was the last record in the dataset, then the previous record becomes the current record.

Calls the AfterDelete event handler.

Info


Method DisableControls (line 1373)

void DisableControls( )

Disables data display in data-aware controls associated with the dataset.

Call DisableControls prior to iterating through a large number of records in the dataset to prevent data-aware controls from updating every time the active record changes. Disabling controls speeds performance because data does not need to be processed by data-aware controls.

If controls are not already disabled, DisableControls records the current state of the dataset, broadcasts the state change to all associated data-aware controls and detail datasets, and increments the dataset’s disabled count variable. Otherwise, DisableControls just increments the disabled count variable.

The disabled count is used internally to determine whether to display data in data-aware controls. When the disable count variable is greater than zero, data is not updated.

If the dataset is the master of a master/detail relationship, calling DisableControls also disables the master/detail relationship.

Note: Calls to DisableControls can be nested. Only when all calls to DisableControls is matched to a corresponding call to EnableControls does the dataset update data controls and detail datasets.

Info


Method doInternalOpen (line 1834)

void doInternalOpen( )

Performs an internal open of the dataset

This is method called by the dataset to perform an open of the data. It calls InternalOpen, a method you should implement if you are deriving from Dataset.

Info


Method edit (line 1727)

void edit( )

Enables editing of data in the dataset.

Call Edit to permit editing of the active record in a dataset. Edit determines the current state of the dataset. If the dataset is empty, Edit calls Insert. Otherwise Edit:

Calls CheckBrowseMode to post any pending changes to a prior record if necessary.

Checks the CanModify property and raises an exception if the dataset can’t be edited.

Calls the OnBeforeEdit event handler.

Retrieves the record.

Puts the dataset into dsEdit state, enabling the application or user to modify fields in the record.

Broadcasts the state change to associated controls.

Calls the OnAfterEdit event handler.

Modifications will go to a buffer waiting for post()/cancel()

Info


Method EnableControls (line 1395)

void EnableControls( )

Enable controls attached to the datasource

Call EnableControls to permit data display in data-aware controls after a prior call to DisableControls. EnableControls decrements the disabled count variable for the dataset if it is not already zero. If the disable count variable is zero, EnableControls updates the current state of the dataset, if necessary, and then tells associated controls to re-enable display.

Info


Method endInsertAppend (line 1451)

void endInsertAppend( )

Finishes an insert/append operation

This method is called by a dataset to finish an insert or append operation. It sets the dataset in insert state, calls the OnNewRecord event and finally calls the OnAfterInsert.

Info


Method first (line 1791)

void first( )

Moves to the first record in the dataset.

Call First to make the first record in the dataset active. First posts any changes to the active record and:

Clears the record buffers.

Fetches the first record and makes it the active record.

Fetches any additional records required for display, such as those needed to fill out a grid control.

Sets the Bof property to true.

Broadcasts the record change so that data controls and linked detail sets can update.

Note: DataSet uses internal, protected methods to reposition the active record and to fetch additional records required for display. In DataSet, these internal methods are empty stubs. Descendant classes implement these methods to enable the First method to work.

Info


Method initRecord (line 1951)

void initRecord( array $Buffer)

To initialize the current record

Parameters

  • array $Buffer: Initial values

Info


Method insert (line 1490)

void insert( )

Inserts a new, empty record in the dataset.

Call Insert to:

  1. - Open a new, empty record in the dataset.
  2. - Set the active record to the new record.
After a call to Insert, an application can allow users to enter data in the fields of the record, and then post those changes to the database or change log using Post.

Info


Method internalAddRecord (line 1962)

void internalAddRecord( $buffer, $append)

Parameters

  • $buffer:
  • $append:

Method internalCancel (line 1999)

void internalCancel( )

To be overriden to perform a cancel() operation

This method is called when a cancel operation is atempted, so if you are creating new types of datasets, you need to override this method.

Info


Method internalClose (line 595)

void internalClose( )

Override this method to perform the closing of the dataset

This method is called internally by the engine to close the dataset. Is not intended to be called directly the component user.

Info

  • see - Close

Method internalDelete (line 1974)

void internalDelete( )

To be overriden to perform a delete() operation

This method is called when a delete operation is atempted, so if you are creating new types of datasets, you need to override this method.

Info


Method internalEdit (line 2011)

void internalEdit( )

To be overriden to perform a edit() operation

This method is called when a edit operation is atempted, so if you are creating new types of datasets, you need to override this method.

Info


Method internalFirst (line 1928)

void internalFirst( )

To be overriden to perform a first() operation

This method is called when a first operation is atempted, so if you are creating new types of datasets, you need to override this method.

Info


Method internalHandleException (line 605)

void internalHandleException( )

Override this method to handle exceptions

This method is called internally by the engine to handle an exception using the dataset.

Is not intended to be called directly the component user.


Method internalInitFieldDefs (line 610)

void internalInitFieldDefs( )

Override this method to init field definitions. Not used.

Method internalInitRecord (line 1958)

void internalInitRecord( $buffer)

Parameters

  • $buffer:

Method internalInsert (line 2023)

void internalInsert( )

To be overriden to perform a insert() operation

This method is called when a insert operation is atempted, so if you are creating new types of datasets, you need to override this method.

Info


Method internalLast (line 1940)

void internalLast( )

To be overriden to perform a last() operation

This method is called when a last operation is atempted, so if you are creating new types of datasets, you need to override this method.

Info


Method internalOpen (line 621)

void internalOpen( )

Override this method to perform the opening of the dataset

This method is called internally by the engine to open the dataset. Is not intended to be called directly the component user.

Info


Method internalPost (line 1986)

void internalPost( )

To be overriden to perform a post() operation

This method is called when a post operation is atempted, so if you are creating new types of datasets, you need to override this method.

Info


Method internalRefresh (line 2035)

void internalRefresh( )

To be overriden to perform a refresh() operation

This method is called when a refresh operation is atempted, so if you are creating new types of datasets, you need to override this method.

Info


Method isCursorOpen (line 633)

boolean isCursorOpen( )

Override this method to return if the cursor is open or not

This method is called internally by the engine to determine if the cursor is open or not.

Is not intended to be called directly the component user.

Info

  • return - True if cursor is open

Method last (line 2062)

void last( )

Moves to the last record in the dataset.

Call Last to make the last record in the dataset active. Last posts any changes to the active record and

Clears the record buffers.

Fetches the last record and makes it the active record.

Fetches any additional records required for display, such as those needed to fill out a grid control.

Sets the Eof property to true.

Broadcasts the record change so that data controls and linked detail sets can update.

Note: DataSet uses internal, protected methods to reposition the active record and to fetch additional records required for display. In DataSet, these internal methods are empty stubs. Descendant classes implement these methods to enable the Last method to work.

Info


Method loaded (line 2313)

void loaded( )

Overrides : Component::loaded() Initializes the component after the form file has been read into memory.


Method moveBy (line 2221)

void moveBy( integer $distance)

Moves to another record relative to the active record in the dataset.

Call MoveBy to move the active record by the number of records specified by Distance. A positive value for Distance indicates forward progress through the dataset, while a negative value indicates backward progress.

MoveBy posts any changes to the active record and

Sets the Bof and Eof properties to false.

If Distance is positive, repeatedly fetches Distance subsequent records (if possible), and makes the last record fetched active. If an attempt is made to move past the end of the file, MoveBy sets Eof to true.

If Distance is negative, repeatedly fetches the appropriate number of previous records (if possible), and makes the last record fetched active. If an attempt is made to move past the start of the file, MoveBy sets Bof to true. If the dataset is unidirectional, the dataset raises an EDatabaseError exception when MoveBy tries to fetch a prior record.

Broadcasts information about the record change so that data-aware controls and linked datasets can update.

Parameters

  • integer $distance: Records to move the pointer

Info


Method next (line 2126)

void next( )

Moves to the next record in the dataset.

Call Next to move to the next record in the dataset, making it the active record. Next posts any changes to the active record and

Sets the Bof and Eof properties to false.

Fetches the next record and makes it the active record.

Fetches any additional records required for display, such as those needed to fill out a grid control.

Sets the Eof property to true if the last record in the dataset was already active.

Broadcasts the record change so that data controls and linked detail sets can update.

Note: DataSet uses internal, protected methods to move the active record and to fetch additional records required for display. In DataSet, these internal methods are empty stubs. Descendant classes implement these methods to enable the Next method to work.

Info


Method open (line 2156)

void open( )

Opens the dataset.

Call Open to set the Active property for the dataset to true. When Active is true, dataset can be populated with data. It can read data from a database or other source (such as a provider). Depending on the CanModify property, active datasets can post changes.

Setting Active to true:

Triggers the OnBeforeOpen event handler if one is defined for the dataset.

Sets the dataset state to dsBrowse.

Establishes a way to fetch data (typically by opening a cursor).

Triggers the After Open event handler if one is defined for the dataset.

If an error occurs during the dataset open, dataset state is set to dsInactive, and any cursor is closed.

Info


Method openCursor (line 1853)

void openCursor( [boolean $InfoQuery = False])

Opens the cursor for the dataset

This method is called to open the cursor for this dataset by calling DoInternalOpen.

Parameters

  • boolean $InfoQuery: If true, initialize internal field defs

Info


Method OpenCursorComplete (line 1867)

void OpenCursorComplete( )

Finishes the open cursor operation

This method is called when opening a cursor to complete the open operation, it first calls DoInternalOpen and fires the OnAfterOpen event.

Info

  • see - DoInternalOpen, Open, OpenCursor

Method post (line 2173)

void post( )

Implements a virtual method to write a modified record to the database or change log.

DataSet implements a virtual method to write a modified record to the database or change log. Dataset methods that change the dataset state, such as Edit, Insert, or Append, or that move from one record to another, such as First, Last, Next, and Prior automatically call Post.

Designers of custom datasets can choose whether to implement Post by writing records to the database server or to an internal change log.

Info


Method prior (line 2251)

void prior( )

Moves to the previous record in the dataset.

Call Prior to move to the previous record in the dataset, making it the active record. Prior posts any changes to the active record and

Sets the Bof and Eof properties to false.

Fetches the previous record and makes it the active record. If the dataset is unidirectional, it raises an EDatabaseError exception at this point.

Fetches any additional records required for display, such as those needed to fill out a grid control.

Sets the Bof property to true if the first record in the dataset was already active.

Broadcasts the record change so that data controls and linked detail sets can update.

Note: DataSet uses internal, protected methods to move the active record and to fetch additional records required for display. In DataSet, these internal methods are empty stubs. Descendant classes implement these methods to enable the Prior method to work.

Info


Method refresh (line 2098)

void refresh( )

Re-fetches data from the database to update a dataset’s view of data.

Call Refresh to ensure that an application has the latest data from a database. For example, when an application turns off filtering for a dataset, it should immediately call Refresh to display all records in the dataset, not just those that used to meet the filter condition.

DataSet generates a OnBeforeRefresh event before refreshing the records and an OnAfterRefresh event afterwards.

Warning: Dataset refresh the data by closing and reopening the cursor. This can have unintended side effects if, for example, you have code in the OnBeforeClose, OnAfterClose, OnBeforeOpen, or OnAfterOpen event handlers.

Info


Method serialize (line 807)

void serialize( )

Overrides : Persistent::serialize() Stores this object into the session.


Method unserialize (line 826)

void unserialize( )

Overrides : Persistent::unserialize() This method uses PHP reflection to iterate through published properties (the ones starting with get) and retrieve the properties stored by a previous serialize() call.


Method updateRecord (line 1579)

void updateRecord( )

Ensures that data-aware controls and detail datasets reflect record updates.

UpdateRecord is used internally by some dataset methods to inform data-aware controls of updates and trigger an OnUpdateRecord event if updates are enabled. Applications should not need to call UpdateRecord directly unless they provide custom dataset methods that bypass DataSet methods.

Info


Events

Summary:
OnAfterCancel Occurs after an application completes a request to cancel modifications to the active record.
OnAfterClose Occurs after an application closes a dataset.
OnAfterDelete Occurs after an application deletes a record.
OnAfterEdit Occurs after an application starts editing a record.
OnAfterInsert Occurs after an application inserts a new record.
OnAfterOpen Occurs after an application completes opening a dataset and before any data access occurs.
OnAfterPost Occurs after an application writes the active record to the database or change log and returns to browse state.
OnBeforeCancel Occurs before an application executes a request to cancel changes to the active record.
OnBeforeClose Occurs immediately before the dataset closes.
OnBeforeDelete Occurs before an application attempts to delete the active record.
OnBeforeEdit Occurs before an application enters edit mode for the active record.
OnBeforeInsert Occurs before an application enters insert mode.
OnBeforeOpen Occurs before an application executes a request to open a dataset.
OnBeforePost Occurs before an application posts changes for the active record to the database or change log.
OnCalcFields Occurs when an application recalculates calculated fields.
OnDeleteError Not used, reserved for future use
OnFilterRecord Not used, reserved for future use
OnNewRecord Not used, reserved for future use
OnPostError Not used, reserved for future use

property OnAfterCancel (line 1103)

mixed OnAfterCancel

Occurs after an application completes a request to cancel modifications to the active record.

Write an OnAfterCancel event handler to take specific action after an application cancels changes to the active record. OnAfterCancel is called by the Cancel method after it updates the current position, releases the lock on the active record if necessary, and sets the dataset state to dsBrowse. If an application requires additional processing before returning control to a user after a Cancel event, code it in the OnAfterCancel event.

Info


property OnAfterClose (line 955)

mixed OnAfterClose

Occurs after an application closes a dataset.

Write an OnAfterClose event handler to take specific action immediately after an application closes a dataset.

OnAfterClose is called after a dataset is closed and the dataset state is set to dsInactive.

Info


property OnAfterDelete (line 1138)

mixed OnAfterDelete

Occurs after an application deletes a record.

Write an OnAfterDelete event handler to take specific action immediately after an application deletes the active record in a dataset. OnAfterDelete is called by Delete after it deletes the record, sets the dataset state to dsBrowse, and repositions the current record.

Info


property OnAfterEdit (line 1025)

mixed OnAfterEdit

Occurs after an application starts editing a record.

Write an OnAfterEdit event handler to take specific action immediately after dataset enters edit mode. OnAfterEdit is called by Edit after it enables editing of a record, recalculates calculated fields, and calls the data event handler to process a record change.

Info


property OnAfterInsert (line 989)

mixed OnAfterInsert

Occurs after an application inserts a new record.

Write an OnAfterInsert event handler to take specific action immediately after an application inserts a record. The Insert and Append methods generate an OnAfterInsert event after inserting or appending a new record.

Info


property OnAfterOpen (line 919)

mixed OnAfterOpen

Occurs after an application completes opening a dataset and before any data access occurs.

Write an AfterOpen event handler to take specific action immediately after an application opens the dataset. AfterOpen is called after the dataset establishes access to its data and the dataset is put into dsBrowse state. For example, an AfterOpen event handler might check an ini file to determine the last record touched in the dataset the previous time the application ran, and position the dataset at that record.

Info


property OnAfterPost (line 1064)

mixed OnAfterPost

Occurs after an application writes the active record to the database or change log and returns to browse state.

Write an OnAfterPost event handler to take specific action immediately after an application posts a change to the active record. OnAfterPost is called after a modification or insertion is made to a record.

Info


property OnBeforeCancel (line 1083)

mixed OnBeforeCancel

Occurs before an application executes a request to cancel changes to the active record.

Write a OnBeforeCancel event to take specific action before an application carries out a request to cancel changes. OnBeforeCancel is called by the Cancel method before it cancels a dataset operation such as Edit, Insert, or Delete.

An application might use the OnBeforeCancel event to record a user’s changes in an undo buffer.

Info


property OnBeforeClose (line 936)

mixed OnBeforeClose

Occurs immediately before the dataset closes.

Write a OnBeforeClose event to take specific action before an application closes a dataset. Calling Close or setting the Active property to false results in a call to the OnBeforeClose event handler.

Info


property OnBeforeDelete (line 1120)

mixed OnBeforeDelete

Occurs before an application attempts to delete the active record.

Write a BeforeDelete event handler to take specific action before an application deletes the active record. OnBeforeDelete is called by Delete before it actually deletes a record.

Info


property OnBeforeEdit (line 1007)

mixed OnBeforeEdit

Occurs before an application enters edit mode for the active record.

Write a OnBeforeEdit event handler to take specific action before an application enables editing of the active record. For example, an application that keeps a log of database edits could use the OnBeforeEdit event to record the edit request, time, and user before entering edit state.

Info


property OnBeforeInsert (line 972)

mixed OnBeforeInsert

Occurs before an application enters insert mode.

Write a OnBeforeInsert event handler to take specific action before an application inserts or appends a new record. The Insert or Append method generates a OnBeforeInsert method before it sets the dataset into dsInsert state.

Info


property OnBeforeOpen (line 899)

mixed OnBeforeOpen

Occurs before an application executes a request to open a dataset.

Write a OnBeforeOpen event handler to take specific action before an application opens a dataset for viewing or editing. OnBeforeOpen is triggered when an application sets the Active property to true for a dataset or an application calls Open.

Info


property OnBeforePost (line 1047)

mixed OnBeforePost

Occurs before an application posts changes for the active record to the database or change log.

Write a OnBeforePost event handler to take specific action before an application posts dataset changes. OnBeforePost is triggered when an application calls the Post method. Post checks to make sure all required fields are present, then calls OnBeforePost before posting the record.

An application might use OnBeforePost to perform validity checks on data changes before committing them. If it encountered a validity problem, it could call Abort to cancel the Post operation.

Info


property OnCalcFields (line 1151)

mixed OnCalcFields

Occurs when an application recalculates calculated fields.

(not used)


property OnDeleteError (line 1160)

void OnDeleteError

Not used, reserved for future use

property OnFilterRecord (line 1194)

void OnFilterRecord

Not used, reserved for future use

property OnNewRecord (line 1203)

void OnNewRecord

Not used, reserved for future use

property OnPostError (line 1212)

void OnPostError

Not used, reserved for future use

Javascript Events

Summary:

[none]

Documentation generated on Fri, 26 Dec 2008 11:44:36 +0100 by phpDocumentor 1.4.0a2