Structures_DataGrid_DataSource_DBTable
[ class tree: Structures_DataGrid_DataSource_DBTable ] [ index: Structures_DataGrid_DataSource_DBTable ] [ all elements ]

Class: Structures_DataGrid_DataSource_DBTable

Source Location: /Structures_DataGrid_DataSource_DBTable-0.1.7/DataGrid/DataSource/DBTable.php

Class Overview

Structures_DataGrid_DataSource
   |
   --Structures_DataGrid_DataSource_DBTable

PEAR::DB_Table Data Source Driver


Author(s):

Version:

  • $Revision: 1.31 $

Methods


Inherited Variables

Inherited Methods


Class Details

[line 82]
PEAR::DB_Table Data Source Driver

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

SUPPORTED OPTIONS:

  • view: (string) The view from $sql array in your DB_Table object. This option is required.
  • where: (string) A where clause for the SQL query.
  • params: (array) Placeholder parameters for prepare/execute
GENERAL NOTES:

If you use aliases in the select part of your view, the count() method from DB_Table and, therefore, $datagrid->getRecordCount() might return a wrong result. To avoid this, DB_Table uses a special query for counting if it is given via a view that needs to be named as '__count_' followed by the name of the view that this counting view belongs to. (For example: if you have a view named 'all', the counting view needs to be named as '__count_all'.)

To use update() and delete() methods, it is required that the indexes are properly defined in the $idx array in your DB_Table subclass. If you have, for example, created your database table yourself and did not setup the $idx array, you can use the 'primaryKey' option to define the primary key field.



[ Top ]


Method Detail

Structures_DataGrid_DataSource_DBTable (Constructor)   [line 117]

Structures_DataGrid_DataSource_DBTable Structures_DataGrid_DataSource_DBTable( )

Constructor
  • Access: public

[ Top ]

bind   [line 136]

mixed bind( &$object, [mixed $options = array()], object DB_Table $object)

Bind
  • Return: True on success, PEAR_Error on failure
  • Access: public

Parameters:

object DB_Table   $object   —  The object (subclass of DB_Table) to bind
mixed   $options   —  Associative array of options.
   &$object   — 

[ Top ]

count   [line 205]

int count( )

Count
  • Return: The number or records
  • Access: public

[ Top ]

delete   [line 318]

mixed delete( string $key)

Record deletion method
  • Return: Boolean true on success, PEAR_Error otherwise
  • Access: public

Parameters:

string   $key   —  Unique record identifier

[ Top ]

fetch   [line 163]

array &fetch( [integer $offset = 0], [integer $limit = null])

Fetch
  • Return: The 2D Array of the records
  • Access: public

Parameters:

integer   $offset   —  Offset (starting from 0)
integer   $limit   —  Limit

[ Top ]

getPrimaryKey   [line 250]

mixed getPrimaryKey( )

Return the primary key field name or numerical index
  • Return: on success: Field name(s) of primary/unique fields on error: PEAR_Error with message 'No primary key found'
  • Access: protected

[ Top ]

insert   [line 275]

mixed insert( array $data)

Record insertion method
  • Return: Boolean true on success, PEAR_Error otherwise
  • Access: public

Parameters:

array   $data   —  Associative array of the form: array(field => value, ...)

[ Top ]

sort   [line 234]

void sort( mixed $sortSpec, [string $sortDir = 'ASC'])

This can only be called prior to the fetch method.
  • Access: public

Parameters:

mixed   $sortSpec   —  A single field (string) to sort by, or a sort specification array of the form: array(field => direction, ...)
string   $sortDir   —  Sort direction: 'ASC' or 'DESC' This is ignored if $sortDesc is an array

[ Top ]

update   [line 293]

mixed update( string $key, array $data)

Record updating method
  • Return: Boolean true on success, PEAR_Error otherwise
  • Access: public

Parameters:

string   $key   —  Unique record identifier
array   $data   —  Associative array of the form: array(field => value, ...)

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:13:17 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.