BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
SMWDataItemHandler Class Reference
Inheritance diagram for SMWDataItemHandler:

Public Member Functions

 __construct (SMWSQLStore3 $store)
 
 getTableFields ()
 
 getFetchFields ()
 
 getTableIndexes ()
 
 getWhereConds (SMWDataItem $dataItem)
 
 getInsertValues (SMWDataItem $dataItem)
 
 getIndexField ()
 
 getLabelField ()
 
 dataItemFromDBKeys ($dbkeys)
 

Protected Attributes

 $store
 

Detailed Description

File holding abstract class SMWDataItemHandler, the base for all dataitem handlers in SMW.

Author
Nischay Nahata Classes extending this represent all store layout that is known about a certain dataitem
Since
1.8

Constructor & Destructor Documentation

SMWDataItemHandler::__construct ( SMWSQLStore3  $store)
Since
1.8
Parameters
SMWSQLStore3$store

Member Function Documentation

SMWDataItemHandler::dataItemFromDBKeys (   $dbkeys)
abstract

Create a dataitem from an array of DB keys or a single DB key string. May throw an SMWDataItemException if the given DB keys cannot be converted back into a dataitem. Each implementation of this method must otherwise run without errors for both array and string inputs.

Since
1.8
Parameters
array | string$dbkeys
Exceptions
SMWDataItemException
Returns
SMWDataItem
SMWDataItemHandler::getFetchFields ( )
abstract

Return an array with all the field names and types that need to be retrieved from the database in order to create a dataitem using dataItemFromDBKeys(). The result format is the same as for getTableFields(), but usually with fewer field names.

Note
In the future, we will most likely use a method that return only a single field name. Currently, we still need an array for concepts.
Since
1.8
Returns
array
SMWDataItemHandler::getIndexField ( )
abstract

Return the field used to select this type of SMWDataItem. In particular, this identifies the column that is used to sort values of this kind. Every type of data returns a non-empty string here.

Since
1.8
Returns
string
SMWDataItemHandler::getInsertValues ( SMWDataItem  $dataItem)
abstract

Return an array of fields=>values that is to be inserted when writing the given SMWDataItem to the database. Values should be set for all columns, even if NULL. This array is used to perform all insert operations into the DB.

Since
1.8
Parameters
SMWDataItem$dataItem
Returns
array
SMWDataItemHandler::getLabelField ( )
abstract

Return the label field for this type of SMWDataItem. This should be a string column in the database table that can be used for selecting values using criteria such as "starts with". The return value can be empty if this is not supported. This is preferred for SMWDataItem classes that do not have an obvious canonical string writing anyway.

The return value can be a column name or the empty string (if the give type of SMWDataItem does not have a label field).

Since
1.8
Returns
string
SMWDataItemHandler::getTableFields ( )
abstract

Return array of fields for a DI type.

Tables declare value columns ("object fields") by specifying their name and type. Types are given using letters:

  • t for strings of the same maximal length as MediaWiki title names,
  • l for arbitrarily long strings; searching/sorting with such data may be limited for performance reasons,
  • w for strings as used in MediaWiki for encoding interwiki prefixes
  • n for namespace numbers (or other similar integers)
  • f for floating point numbers of double precision
  • p for a reference to an SMW ID as stored in the SMW IDs table; this corresponds to a data entry of ID "tnwt".
Since
1.8
Returns
array
SMWDataItemHandler::getTableIndexes ( )

Return an array of additional indexes that should be provided for the table using this DI handler. By default, SMWSQLStore3 will already create indexes for all standard select operations, based on the indexfield provided by getIndexField(). Hence, most handlers do not need to define any indexes.

Since
1.8
Returns
array
SMWDataItemHandler::getWhereConds ( SMWDataItem  $dataItem)
abstract

Return an array of fields=>values to conditions (WHERE part) in SQL queries for the given SMWDataItem. This method can return fewer fields than getInstertValues as long as they are enough to identify an item for search.

Since
1.8
Parameters
SMWDataItem$dataItem
Returns
array

The documentation for this class was generated from the following file: