Structures_DataGrid_DataSource_DBQuery

Structures_DataGrid_DataSource_DBQuery -- PEAR::DB SQL Query Data Source Driver

Description

This class is a data source driver for the PEAR::DB object

Supported operations modes

This driver supports the following operation modes:

Таблица 57-1. Supported operations modes of this driver

ModeSupported?
Multiple field sortingyes
Insert, update and delete recordsno

Options

This driver accepts the following options:

Таблица 57-2. Options for this driver

OptionTypeDescriptionDefault Value
dbcobjectA PEAR::DB instance that will be used by this driver. Either this or the 'dsn' option is required.null
dsnstringA PEAR::DB dsn string. The DB connection will be established by this driver. Either this or the 'dbc' option is required.null
fieldsarrayWhich data fields to fetch from the datasource. An empty array means: all fields. Form: array(field1, field2, ...)array()
generate_columnsboolGenerate Structures_DataGrid_Column objects with labels. See the 'labels' option. DEPRECATED: use Structures_DataGrid::generateColumns() insteadfalse
labelsarrayData field to column label mapping. Only used when 'generate_columns' is true. Form: array(field => label, ...) DEPRECATED: use Structures_DataGrid::generateColumns() insteadarray()
primary_keyarrayName(s), or numerical index(es) of the field(s) which contain a unique record identifier (only use several fields in case of a multiple-fields primary key)null

General notes

You need to specify either a DB instance or a DB compatible dsn string as an option to use this driver.

If you use complex queries (e.g. with complex joins or with aliases), $datagrid->getRecordCount() might return a wrong result. For the case of GROUP BY, UNION, or DISTINCT in your queries, this driver already has special handling. However, if you observe wrong record counts, you need to specify a special query that returns only the number of records (e.g. 'SELECT COUNT(*) FROM ...') as an additional option 'count_query' to the bind() call.

You can specify a ORDER BY statement in your query. Please be aware that this sorting statement is then used in *every* query before the sorting options that come from a renderer (e.g. by clicking on the column header when using the HTML_Table renderer which is sent in the HTTP request). If you want to give a default sorting statement that is only used if there is no sorting query in the HTTP request, then use $datagrid->setDefaultSort().


HIVE: All information for read only. Please respect copyright!
Hosted by hive ÊÃÁ: Êèåâñêàÿ ãîðîäñêàÿ áèáëèîòåêà