Merge branch 'master' of dev.sourcefabric.org:airtime

This commit is contained in:
martin 2011-02-06 19:28:49 -05:00
commit 8396e12df1
8 changed files with 36 additions and 22 deletions

View File

@ -101,8 +101,8 @@ class ScheduleGroup {
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')"); $this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
$id = $this->dateToId($p_datetime); $id = $this->dateToId($p_datetime);
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
." (id, playlist_id, starts, ends, clip_length, group_id, file_id)" ." (playlist_id, starts, ends, clip_length, group_id, file_id)"
." VALUES ('$id', 0, TIMESTAMP '$p_datetime', " ." VALUES (0, TIMESTAMP '$p_datetime', "
." (TIMESTAMP '$p_datetime' + INTERVAL '$length')," ." (TIMESTAMP '$p_datetime' + INTERVAL '$length'),"
." '$length'," ." '$length',"
." {$this->groupId}, $p_audioFileId)"; ." {$this->groupId}, $p_audioFileId)";
@ -143,9 +143,9 @@ class ScheduleGroup {
$trackLength = $row["cliplength"]; $trackLength = $row["cliplength"];
//var_dump($trackLength); //var_dump($trackLength);
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
." (id, instance_id, playlist_id, starts, ends, group_id, file_id," ." (instance_id, playlist_id, starts, ends, group_id, file_id,"
." clip_length, cue_in, cue_out, fade_in, fade_out)" ." clip_length, cue_in, cue_out, fade_in, fade_out)"
." VALUES ($id, $show_instance, $p_playlistId, TIMESTAMP '$itemStartTime', " ." VALUES ($show_instance, $p_playlistId, TIMESTAMP '$itemStartTime', "
." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength')," ." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'),"
." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}'," ." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}',"
." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')"; ." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";

View File

@ -119,7 +119,8 @@ class Show {
FROM cc_show_instances FROM cc_show_instances
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id
WHERE ((starts >= '{$start_timestamp}' AND starts < '{$end_timestamp}') WHERE ((starts >= '{$start_timestamp}' AND starts < '{$end_timestamp}')
OR (ends > '{$start_timestamp}' AND ends <= '{$end_timestamp}'))"; OR (ends > '{$start_timestamp}' AND ends <= '{$end_timestamp}')
OR (starts <= '{$start_timestamp}' AND ends >= '{$end_timestamp}'))";
if(isset($excludeInstance)) { if(isset($excludeInstance)) {
foreach($excludeInstance as $instance) { foreach($excludeInstance as $instance) {

View File

@ -35,9 +35,10 @@ class CcScheduleTableMap extends TableMap {
$this->setPhpName('CcSchedule'); $this->setPhpName('CcSchedule');
$this->setClassname('CcSchedule'); $this->setClassname('CcSchedule');
$this->setPackage('airtime'); $this->setPackage('airtime');
$this->setUseIdGenerator(false); $this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_schedule_id_seq');
// columns // columns
$this->addPrimaryKey('ID', 'DbId', 'BIGINT', true, null, null); $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', true, null, null); $this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', true, null, null);
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null); $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null); $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);

View File

@ -26,7 +26,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* The value for the id field. * The value for the id field.
* @var string * @var int
*/ */
protected $id; protected $id;
@ -164,7 +164,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* Get the [id] column value. * Get the [id] column value.
* *
* @return string * @return int
*/ */
public function getDbId() public function getDbId()
{ {
@ -465,13 +465,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
* @param string $v new value * @param int $v new value
* @return CcSchedule The current object (for fluent API support) * @return CcSchedule The current object (for fluent API support)
*/ */
public function setDbId($v) public function setDbId($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (string) $v; $v = (int) $v;
} }
if ($this->id !== $v) { if ($this->id !== $v) {
@ -1014,7 +1014,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
{ {
try { try {
$this->id = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : 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->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
@ -1224,13 +1224,21 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->setCcShowInstances($this->aCcShowInstances); $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 object has been modified, then save it to the database.
if ($this->isModified()) { if ($this->isModified()) {
if ($this->isNew()) { if ($this->isNew()) {
$criteria = $this->buildCriteria(); $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); $pk = BasePeer::doInsert($criteria, $con);
$affectedRows += 1; $affectedRows += 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false); $this->setNew(false);
} else { } else {
$affectedRows += CcSchedulePeer::doUpdate($this, $con); $affectedRows += CcSchedulePeer::doUpdate($this, $con);
@ -1598,7 +1606,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* Returns the primary key for this object (row). * Returns the primary key for this object (row).
* @return string * @return int
*/ */
public function getPrimaryKey() public function getPrimaryKey()
{ {
@ -1608,7 +1616,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* Generic method to set the primary key (id column). * Generic method to set the primary key (id column).
* *
* @param string $key Primary key. * @param int $key Primary key.
* @return void * @return void
*/ */
public function setPrimaryKey($key) public function setPrimaryKey($key)
@ -1637,7 +1645,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/ */
public function copyInto($copyObj, $deepCopy = false) public function copyInto($copyObj, $deepCopy = false)
{ {
$copyObj->setDbId($this->id);
$copyObj->setDbPlaylistId($this->playlist_id); $copyObj->setDbPlaylistId($this->playlist_id);
$copyObj->setDbStarts($this->starts); $copyObj->setDbStarts($this->starts);
$copyObj->setDbEnds($this->ends); $copyObj->setDbEnds($this->ends);
@ -1653,6 +1660,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$copyObj->setDbInstanceId($this->instance_id); $copyObj->setDbInstanceId($this->instance_id);
$copyObj->setNew(true); $copyObj->setNew(true);
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
} }
/** /**

View File

@ -435,7 +435,7 @@ abstract class BaseCcSchedulePeer {
*/ */
public static function getPrimaryKeyFromRow($row, $startcol = 0) public static function getPrimaryKeyFromRow($row, $startcol = 0)
{ {
return (string) $row[$startcol]; return (int) $row[$startcol];
} }
/** /**
@ -789,6 +789,10 @@ abstract class BaseCcSchedulePeer {
$criteria = $values->buildCriteria(); // build Criteria from CcSchedule object $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 // Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME); $criteria->setDbName(self::DATABASE_NAME);
@ -973,7 +977,7 @@ abstract class BaseCcSchedulePeer {
/** /**
* Retrieve a single object by pkey. * Retrieve a single object by pkey.
* *
* @param string $pk the primary key. * @param int $pk the primary key.
* @param PropelPDO $con the connection to use * @param PropelPDO $con the connection to use
* @return CcSchedule * @return CcSchedule
*/ */

View File

@ -47,7 +47,7 @@
* @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query * @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 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(string $id) Return the first CcSchedule filtered by the id column * @method CcSchedule findOneByDbId(int $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 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 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 * @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 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 CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
* *
* @method array findByDbId(string $id) Return CcSchedule objects filtered by the id column * @method array findByDbId(int $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 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 findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
* @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends 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 * Filter the query on the id column
* *
* @param string|array $dbId The value to use as filter. * @param int|array $dbId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue) * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *

View File

@ -221,7 +221,7 @@
</index> </index>
</table> </table>
<table name="cc_schedule" phpName="CcSchedule"> <table name="cc_schedule" phpName="CcSchedule">
<column name="id" phpName="DbId" type="BIGINT" primaryKey="true" required="true"/> <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="true"/> <column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="true"/>
<column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/> <column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/>
<column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/> <column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/>

View File

@ -338,7 +338,7 @@ DROP TABLE "cc_schedule" CASCADE;
CREATE TABLE "cc_schedule" CREATE TABLE "cc_schedule"
( (
"id" INT8 NOT NULL, "id" serial NOT NULL,
"playlist_id" INTEGER NOT NULL, "playlist_id" INTEGER NOT NULL,
"starts" TIMESTAMP NOT NULL, "starts" TIMESTAMP NOT NULL,
"ends" TIMESTAMP NOT NULL, "ends" TIMESTAMP NOT NULL,