* @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
private $uniqueKey = "";
+ /**
+ * Primary key
+ */
+ private $primaryKey = "";
+
/**
* Protected constructor
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Storeable data set for databases");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
/**
* Creates an instance of this criteria
*
- * @return $criteriaInstance An instance of this criteria
+ * @param $tableName Name of the table
+ * @return $criteriaInstance An instance of this criteria
*/
- public final static function createDataSetCriteria () {
+ public final static function createDataSetCriteria ($tableName) {
// Get a new instance
$criteriaInstance = new DataSetCriteria();
+ // Set table name
+ $criteriaInstance->setTableName($tableName);
+
// Return the instance
return $criteriaInstance;
}
public final function getCriteriaArray () {
return $this->tableColumns;
}
+
+ /**
+ * Getter for primary key or unique key if not set
+ *
+ * @return $primaryKey Primary key or unique key if not set
+ */
+ public final function getPrimaryKey () {
+ // Get primary key by default
+ $primaryKey = $this->primaryKey;
+
+ if (empty($primaryKey)) {
+ // Get uniqueKey
+ $primaryKey = $this->getUniqueKey();
+ } // END - if
+
+ // Return it
+ return $primaryKey;
+ }
+
+ /**
+ * Setter for primary key
+ *
+ * @param $primaryKey Primary key to set
+ * @return void
+ */
+ public final function setPrimaryKey ($primaryKey) {
+ $this->primaryKey = (string) $primaryKey;
+ }
}
// [EOF]