Source for file SqlRecord.php
Documentation is available at SqlRecord.php
* @copyright Copyright (c) 2003-2006 Mirchev Ideas Ltd. All rights reserved.
require_once(dirname(__FILE__
) .
'/../database/StaticDBUtil.php');
* Handle and manage the inserting, updating, deleting and reading of data from the
* database. This class works only with one record row specified by a table primary key or
* @copyright Copyright (c) 2003-2006 Mirchev Ideas Ltd. All rights reserved.
protected $_row =
array();
* miSqlRecord constructor. It takes two parameters table name and
* $record = new miSqlRecord('tableName', 'tablePrimaryKey');
* @param string $table database table name
* @param string $primaryKey database table primary key
* Gets the primary key column of the table that this SQLRecord uses
* @return string the primary key column name
* Gets the table name of this SQLRecord
* @return string the table name
* Gets the value of a field
* $record = new miSqlRecord('tableName', 'tablePrimaryKey');
* $record->readPK($value);
* $value = $record->get($someField);
* @param string $field field name
* @return mixed the field value
public function get($field) {
return $this->_row[$field];
* Gets the value of the primary key
* @return mixed the primary key value
* Sets the value of a field
* $record = new miSqlRecord('tableName', 'tablePrimaryKey');
* $record->set($field, $value);
* @param string $field the name of the field
* @param mixed $value value of the field
public function set($field, $value)
$this->_row[$field] =
$value;
* Return the data row as array
* $record = new miSqlRecord('tableName', 'tablePrimaryKey');
* $record->readPK($value);
* $row = $record->getRow();
* @return array the data row
* Directly set the data row
* $record = new miSqlRecord('tableName', 'tablePrimaryKey');
* @param array $dataRow the data row
public function setRow($dataRow)
* Read a record where the specified field represented by $key
* is equal to the value represented by $value
* If there are is than one record matching the first one will be read in
* $record = new miSqlRecord('tableName', 'tablePrimaryKey');
* $record->read('uniqueField', $uniqueFieldValue);
* @param string $key the name of the field
* @param string $value the value
public function read($key, $value)
* Read a record using the specified primary key value
* $record = new miSqlRecord('tableName', 'tablePrimaryKey');
* $record->readPK($value);
* @param mixed $value primary key value
public function readPK($value)
* Insert a record in the db table
* It also updates the the PK value of the inserted row
* @return PK the primary key of the newly created record
* Update a record in the db table
* @return PK the primary key of the updated record
* Delete a record in the db table
* @return PK the primary key of the deleted record
Documentation generated on Thu, 08 May 2008 16:57:35 +0300 by phpDocumentor 1.4.1