From 75eea94641e8d2e58f373efdf474cee63d74a679 Mon Sep 17 00:00:00 2001 From: naomiaro Date: Sun, 6 Feb 2011 15:31:36 -0500 Subject: [PATCH] changed back to old schedule id to test if playback works now. --- application/models/Schedule.php | 8 +++---- .../models/airtime/map/CcScheduleTableMap.php | 5 ++-- .../models/airtime/om/BaseCcSchedule.php | 24 +++++++------------ .../models/airtime/om/BaseCcSchedulePeer.php | 8 ++----- .../models/airtime/om/BaseCcScheduleQuery.php | 6 ++--- build/schema.xml | 2 +- build/sql/schema.sql | 2 +- 7 files changed, 21 insertions(+), 34 deletions(-) diff --git a/application/models/Schedule.php b/application/models/Schedule.php index 20b54deb8..734eef4ee 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -101,8 +101,8 @@ class ScheduleGroup { $this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')"); $id = $this->dateToId($p_datetime); $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] - ." (playlist_id, starts, ends, clip_length, group_id, file_id)" - ." VALUES (0, TIMESTAMP '$p_datetime', " + ." (id, playlist_id, starts, ends, clip_length, group_id, file_id)" + ." VALUES ('$id', 0, TIMESTAMP '$p_datetime', " ." (TIMESTAMP '$p_datetime' + INTERVAL '$length')," ." '$length'," ." {$this->groupId}, $p_audioFileId)"; @@ -143,9 +143,9 @@ class ScheduleGroup { $trackLength = $row["cliplength"]; //var_dump($trackLength); $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] - ." (instance_id, playlist_id, starts, ends, group_id, file_id," + ." (id, instance_id, playlist_id, starts, ends, group_id, file_id," ." clip_length, cue_in, cue_out, fade_in, fade_out)" - ." VALUES ($show_instance, $p_playlistId, TIMESTAMP '$itemStartTime', " + ." VALUES ($id, $show_instance, $p_playlistId, TIMESTAMP '$itemStartTime', " ." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength')," ." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}'," ." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')"; diff --git a/application/models/airtime/map/CcScheduleTableMap.php b/application/models/airtime/map/CcScheduleTableMap.php index 3f2502f1c..9bd987ad1 100644 --- a/application/models/airtime/map/CcScheduleTableMap.php +++ b/application/models/airtime/map/CcScheduleTableMap.php @@ -35,10 +35,9 @@ class CcScheduleTableMap extends TableMap { $this->setPhpName('CcSchedule'); $this->setClassname('CcSchedule'); $this->setPackage('airtime'); - $this->setUseIdGenerator(true); - $this->setPrimaryKeyMethodInfo('cc_schedule_id_seq'); + $this->setUseIdGenerator(false); // columns - $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addPrimaryKey('ID', 'DbId', 'BIGINT', true, null, null); $this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', true, null, null); $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null); $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null); diff --git a/application/models/airtime/om/BaseCcSchedule.php b/application/models/airtime/om/BaseCcSchedule.php index 2c8933840..bee75588e 100644 --- a/application/models/airtime/om/BaseCcSchedule.php +++ b/application/models/airtime/om/BaseCcSchedule.php @@ -26,7 +26,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent /** * The value for the id field. - * @var int + * @var string */ protected $id; @@ -164,7 +164,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent /** * Get the [id] column value. * - * @return int + * @return string */ public function getDbId() { @@ -465,13 +465,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent /** * Set the value of [id] column. * - * @param int $v new value + * @param string $v new value * @return CcSchedule The current object (for fluent API support) */ public function setDbId($v) { if ($v !== null) { - $v = (int) $v; + $v = (string) $v; } if ($this->id !== $v) { @@ -1014,7 +1014,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent { try { - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->id = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; $this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; @@ -1224,21 +1224,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->setCcShowInstances($this->aCcShowInstances); } - if ($this->isNew() ) { - $this->modifiedColumns[] = CcSchedulePeer::ID; - } // If this object has been modified, then save it to the database. if ($this->isModified()) { if ($this->isNew()) { $criteria = $this->buildCriteria(); - if ($criteria->keyContainsValue(CcSchedulePeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSchedulePeer::ID.')'); - } - $pk = BasePeer::doInsert($criteria, $con); $affectedRows += 1; - $this->setDbId($pk); //[IMV] update autoincrement primary key $this->setNew(false); } else { $affectedRows += CcSchedulePeer::doUpdate($this, $con); @@ -1606,7 +1598,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent /** * Returns the primary key for this object (row). - * @return int + * @return string */ public function getPrimaryKey() { @@ -1616,7 +1608,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent /** * Generic method to set the primary key (id column). * - * @param int $key Primary key. + * @param string $key Primary key. * @return void */ public function setPrimaryKey($key) @@ -1645,6 +1637,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent */ public function copyInto($copyObj, $deepCopy = false) { + $copyObj->setDbId($this->id); $copyObj->setDbPlaylistId($this->playlist_id); $copyObj->setDbStarts($this->starts); $copyObj->setDbEnds($this->ends); @@ -1660,7 +1653,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $copyObj->setDbInstanceId($this->instance_id); $copyObj->setNew(true); - $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value } /** diff --git a/application/models/airtime/om/BaseCcSchedulePeer.php b/application/models/airtime/om/BaseCcSchedulePeer.php index d5a4e9afb..f809b8239 100644 --- a/application/models/airtime/om/BaseCcSchedulePeer.php +++ b/application/models/airtime/om/BaseCcSchedulePeer.php @@ -435,7 +435,7 @@ abstract class BaseCcSchedulePeer { */ public static function getPrimaryKeyFromRow($row, $startcol = 0) { - return (int) $row[$startcol]; + return (string) $row[$startcol]; } /** @@ -789,10 +789,6 @@ abstract class BaseCcSchedulePeer { $criteria = $values->buildCriteria(); // build Criteria from CcSchedule object } - if ($criteria->containsKey(CcSchedulePeer::ID) && $criteria->keyContainsValue(CcSchedulePeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSchedulePeer::ID.')'); - } - // Set the correct dbName $criteria->setDbName(self::DATABASE_NAME); @@ -977,7 +973,7 @@ abstract class BaseCcSchedulePeer { /** * Retrieve a single object by pkey. * - * @param int $pk the primary key. + * @param string $pk the primary key. * @param PropelPDO $con the connection to use * @return CcSchedule */ diff --git a/application/models/airtime/om/BaseCcScheduleQuery.php b/application/models/airtime/om/BaseCcScheduleQuery.php index 73c237c69..ccad9e4b8 100644 --- a/application/models/airtime/om/BaseCcScheduleQuery.php +++ b/application/models/airtime/om/BaseCcScheduleQuery.php @@ -47,7 +47,7 @@ * @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query * @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found * - * @method CcSchedule findOneByDbId(int $id) Return the first CcSchedule filtered by the id column + * @method CcSchedule findOneByDbId(string $id) Return the first CcSchedule filtered by the id column * @method CcSchedule findOneByDbPlaylistId(int $playlist_id) Return the first CcSchedule filtered by the playlist_id column * @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column * @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column @@ -62,7 +62,7 @@ * @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column * @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column * - * @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column + * @method array findByDbId(string $id) Return CcSchedule objects filtered by the id column * @method array findByDbPlaylistId(int $playlist_id) Return CcSchedule objects filtered by the playlist_id column * @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column * @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column @@ -188,7 +188,7 @@ abstract class BaseCcScheduleQuery extends ModelCriteria /** * Filter the query on the id column * - * @param int|array $dbId The value to use as filter. + * @param string|array $dbId The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * diff --git a/build/schema.xml b/build/schema.xml index ee1d4dde0..dcebdfc67 100644 --- a/build/schema.xml +++ b/build/schema.xml @@ -221,7 +221,7 @@ - + diff --git a/build/sql/schema.sql b/build/sql/schema.sql index 9376c9ac1..8e4275dc0 100644 --- a/build/sql/schema.sql +++ b/build/sql/schema.sql @@ -338,7 +338,7 @@ DROP TABLE "cc_schedule" CASCADE; CREATE TABLE "cc_schedule" ( - "id" serial NOT NULL, + "id" INT8 NOT NULL, "playlist_id" INTEGER NOT NULL, "starts" TIMESTAMP NOT NULL, "ends" TIMESTAMP NOT NULL,