The cDBTable component is generally the first data access control that you will pair with a DataSource control to construct a database application. It has been designed to provide uniform access to each row in the table types supported by PDO regardless of the underlying database. Despite the wide range of properties, its basic use is very simple to use. Place a table component on a form, set the Database and Table properties to point to the relation you want to access, and the data flows immediately to your application.


The cDBTable component will be used very often in your database driven applications because it is very convenient. You don't have to supply SQL, just the table name is enough to have all the required CRUD operations generated automatically. You can easily set up a master-detail relationship by binding tables together.


Important to know is that PHsPeed caches the search result in a temporary (sqlite) table that is stored locally at the webserver. The advantage is that you prevent duplicated access to the main database that can be hosted elsewhere, and that complex queries are executed only once as the temporary table is just a simple 'flat' table. 

To filter data, you can use the filter attribute. This attribute is used on the main query. The result of this query is stored in the temporary database. To filter on this secondary database you use the subfilter property.


Properties


Description

Active

If set, PHsPeed will open the table automatically (default)

AutoIncrement

Field that will be incremented on each insert. This is independent from the 'autoincrement' on database level. On occasions where you can't use a database trigger, you can use this field to increase the value based upon PHP code. (select max… +1)

AutoSync

Automatically synchronize result dataset after update (causes a full refresh of the form)

CustomFields

Property editor to add custom fields, i.e. for lookups. This is bound to the dbtable. Effectively it will append the lookup as an inner join to the original query, but does not influence the insert/delete/update operation. 

DBConnection

Pointer to the cConnection component that binds to the original database

Fields

The fields of the table. It allows to assign a primary key for queries that do not have one.

Filter

An optional filter to be used in the 'where' clause of a SQL statement.

FilterMode

Set to define the default filter behavior:

disabled: Will ignore the filter initially. That is required when you use parametrized filter

enabled: Default. 

empty: Will give an initial empty result before applying filter

full: Will give an initial full result before applying filter.

FixedFilter

An optional filter that will always be added tot the SQL 'where' clause. 

MasterDataMapping

Mapping of keyfields between master and detail

MasterDataSource

Datasource of the master table (only required on master-detail relationships)

ResultCache

Changes the search result in a sqlite table. Needed for bidirectional access. SET TO FALSE if this table is used as detail. Because of the caching, accessing this table will reopen the last result causing wrong results if you are using it as detail. B.t.w. if you set a master datasource this field is automatically set to false.

ResultLimitCount

Nobody is scrolling hundreds of pages to find a result. This field limits the amount of records found on a search for a better performance.

ResultLimitOffset

Startpoint within a resultset

Resultlimitstm

Statement for limiting resultset. Needed for compatibility. If not set, the system will use the settings at the database. Required due to the fact that there is no standard Ansii syntax for limiting result

ResultUseLimit

If set to false then the full resultset will be retrieved. This is required when the table is used in a lookup situation.

SubFilter

See Filter. This filter is applied to the resultset, not on the primary query.

Table

The name of the table that is accessed


PHP Events


Description

onAfterDelete

Fires after the database has completed the delete operation

onAfterInsert

Fires after the database has completed the insert operation

onAfterOpen

Fires after the table has been opened (executed the basic SQL query)

onAfterUpdate

Fires after the table has been completed the update operation

onBeforeDelete

Fires before the database will perform the delete operation

onBeforeInsert

Fires before the database will perform the insert operation

onBeforeOpen

Fires before the database will perform the basic SQL query

onBeforeÙpdate

Fires before the database will perform he update operation

onGetFilter

Fires before the filter is executed (original filter is passed for modification)

onGetFixedFilter

Fires before the fixed filter is executed (original fixed filter is passed for modificatio)


Javascript events

No additional events