CC-3174 : showbuilder
change columns sample rate and bitrate to be integers so they sort properly in the library.
This commit is contained in:
parent
73a91e6982
commit
36cf8ded18
6 changed files with 53 additions and 35 deletions
|
@ -592,7 +592,7 @@ class Application_Model_StoredFile {
|
||||||
$fileSelect[] = $key;
|
$fileSelect[] = $key;
|
||||||
}
|
}
|
||||||
//need to cast certain data as ints for the union to search on.
|
//need to cast certain data as ints for the union to search on.
|
||||||
else if (in_array($key, array("track_number"))){
|
else if (in_array($key, array("track_number", "bit_rate", "sample_rate"))){
|
||||||
$plSelect[] = "NULL::int AS ".$key;
|
$plSelect[] = "NULL::int AS ".$key;
|
||||||
$fileSelect[] = $key;
|
$fileSelect[] = $key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ class CcFilesTableMap extends TableMap {
|
||||||
$this->addColumn('MD5', 'DbMd5', 'CHAR', false, 32, null);
|
$this->addColumn('MD5', 'DbMd5', 'CHAR', false, 32, null);
|
||||||
$this->addColumn('TRACK_TITLE', 'DbTrackTitle', 'VARCHAR', false, 512, null);
|
$this->addColumn('TRACK_TITLE', 'DbTrackTitle', 'VARCHAR', false, 512, null);
|
||||||
$this->addColumn('ARTIST_NAME', 'DbArtistName', 'VARCHAR', false, 512, null);
|
$this->addColumn('ARTIST_NAME', 'DbArtistName', 'VARCHAR', false, 512, null);
|
||||||
$this->addColumn('BIT_RATE', 'DbBitRate', 'VARCHAR', false, 32, null);
|
$this->addColumn('BIT_RATE', 'DbBitRate', 'INTEGER', false, null, null);
|
||||||
$this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'VARCHAR', false, 32, null);
|
$this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'INTEGER', false, null, null);
|
||||||
$this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null);
|
$this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null);
|
||||||
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
|
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
|
||||||
$this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null);
|
$this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null);
|
||||||
|
|
|
@ -128,13 +128,13 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the bit_rate field.
|
* The value for the bit_rate field.
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $bit_rate;
|
protected $bit_rate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the sample_rate field.
|
* The value for the sample_rate field.
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $sample_rate;
|
protected $sample_rate;
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
/**
|
/**
|
||||||
* Get the [bit_rate] column value.
|
* Get the [bit_rate] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getDbBitRate()
|
public function getDbBitRate()
|
||||||
{
|
{
|
||||||
|
@ -713,7 +713,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
/**
|
/**
|
||||||
* Get the [sample_rate] column value.
|
* Get the [sample_rate] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getDbSampleRate()
|
public function getDbSampleRate()
|
||||||
{
|
{
|
||||||
|
@ -1578,13 +1578,13 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
/**
|
/**
|
||||||
* Set the value of [bit_rate] column.
|
* Set the value of [bit_rate] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param int $v new value
|
||||||
* @return CcFiles The current object (for fluent API support)
|
* @return CcFiles The current object (for fluent API support)
|
||||||
*/
|
*/
|
||||||
public function setDbBitRate($v)
|
public function setDbBitRate($v)
|
||||||
{
|
{
|
||||||
if ($v !== null) {
|
if ($v !== null) {
|
||||||
$v = (string) $v;
|
$v = (int) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->bit_rate !== $v) {
|
if ($this->bit_rate !== $v) {
|
||||||
|
@ -1598,13 +1598,13 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
/**
|
/**
|
||||||
* Set the value of [sample_rate] column.
|
* Set the value of [sample_rate] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param int $v new value
|
||||||
* @return CcFiles The current object (for fluent API support)
|
* @return CcFiles The current object (for fluent API support)
|
||||||
*/
|
*/
|
||||||
public function setDbSampleRate($v)
|
public function setDbSampleRate($v)
|
||||||
{
|
{
|
||||||
if ($v !== null) {
|
if ($v !== null) {
|
||||||
$v = (string) $v;
|
$v = (int) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->sample_rate !== $v) {
|
if ($this->sample_rate !== $v) {
|
||||||
|
@ -2575,8 +2575,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
$this->md5 = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
|
$this->md5 = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
|
||||||
$this->track_title = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null;
|
$this->track_title = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null;
|
||||||
$this->artist_name = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
|
$this->artist_name = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
|
||||||
$this->bit_rate = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null;
|
$this->bit_rate = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null;
|
||||||
$this->sample_rate = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null;
|
$this->sample_rate = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null;
|
||||||
$this->format = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null;
|
$this->format = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null;
|
||||||
$this->length = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null;
|
$this->length = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null;
|
||||||
$this->album_title = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null;
|
$this->album_title = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null;
|
||||||
|
|
|
@ -175,8 +175,8 @@
|
||||||
* @method CcFiles findOneByDbMd5(string $md5) Return the first CcFiles filtered by the md5 column
|
* @method CcFiles findOneByDbMd5(string $md5) Return the first CcFiles filtered by the md5 column
|
||||||
* @method CcFiles findOneByDbTrackTitle(string $track_title) Return the first CcFiles filtered by the track_title column
|
* @method CcFiles findOneByDbTrackTitle(string $track_title) Return the first CcFiles filtered by the track_title column
|
||||||
* @method CcFiles findOneByDbArtistName(string $artist_name) Return the first CcFiles filtered by the artist_name column
|
* @method CcFiles findOneByDbArtistName(string $artist_name) Return the first CcFiles filtered by the artist_name column
|
||||||
* @method CcFiles findOneByDbBitRate(string $bit_rate) Return the first CcFiles filtered by the bit_rate column
|
* @method CcFiles findOneByDbBitRate(int $bit_rate) Return the first CcFiles filtered by the bit_rate column
|
||||||
* @method CcFiles findOneByDbSampleRate(string $sample_rate) Return the first CcFiles filtered by the sample_rate column
|
* @method CcFiles findOneByDbSampleRate(int $sample_rate) Return the first CcFiles filtered by the sample_rate column
|
||||||
* @method CcFiles findOneByDbFormat(string $format) Return the first CcFiles filtered by the format column
|
* @method CcFiles findOneByDbFormat(string $format) Return the first CcFiles filtered by the format column
|
||||||
* @method CcFiles findOneByDbLength(string $length) Return the first CcFiles filtered by the length column
|
* @method CcFiles findOneByDbLength(string $length) Return the first CcFiles filtered by the length column
|
||||||
* @method CcFiles findOneByDbAlbumTitle(string $album_title) Return the first CcFiles filtered by the album_title column
|
* @method CcFiles findOneByDbAlbumTitle(string $album_title) Return the first CcFiles filtered by the album_title column
|
||||||
|
@ -238,8 +238,8 @@
|
||||||
* @method array findByDbMd5(string $md5) Return CcFiles objects filtered by the md5 column
|
* @method array findByDbMd5(string $md5) Return CcFiles objects filtered by the md5 column
|
||||||
* @method array findByDbTrackTitle(string $track_title) Return CcFiles objects filtered by the track_title column
|
* @method array findByDbTrackTitle(string $track_title) Return CcFiles objects filtered by the track_title column
|
||||||
* @method array findByDbArtistName(string $artist_name) Return CcFiles objects filtered by the artist_name column
|
* @method array findByDbArtistName(string $artist_name) Return CcFiles objects filtered by the artist_name column
|
||||||
* @method array findByDbBitRate(string $bit_rate) Return CcFiles objects filtered by the bit_rate column
|
* @method array findByDbBitRate(int $bit_rate) Return CcFiles objects filtered by the bit_rate column
|
||||||
* @method array findByDbSampleRate(string $sample_rate) Return CcFiles objects filtered by the sample_rate column
|
* @method array findByDbSampleRate(int $sample_rate) Return CcFiles objects filtered by the sample_rate column
|
||||||
* @method array findByDbFormat(string $format) Return CcFiles objects filtered by the format column
|
* @method array findByDbFormat(string $format) Return CcFiles objects filtered by the format column
|
||||||
* @method array findByDbLength(string $length) Return CcFiles objects filtered by the length column
|
* @method array findByDbLength(string $length) Return CcFiles objects filtered by the length column
|
||||||
* @method array findByDbAlbumTitle(string $album_title) Return CcFiles objects filtered by the album_title column
|
* @method array findByDbAlbumTitle(string $album_title) Return CcFiles objects filtered by the album_title column
|
||||||
|
@ -797,20 +797,29 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
||||||
/**
|
/**
|
||||||
* Filter the query on the bit_rate column
|
* Filter the query on the bit_rate column
|
||||||
*
|
*
|
||||||
* @param string $dbBitRate The value to use as filter.
|
* @param int|array $dbBitRate The value to use as filter.
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
* 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
|
||||||
*
|
*
|
||||||
* @return CcFilesQuery The current query, for fluid interface
|
* @return CcFilesQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterByDbBitRate($dbBitRate = null, $comparison = null)
|
public function filterByDbBitRate($dbBitRate = null, $comparison = null)
|
||||||
{
|
{
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($dbBitRate)) {
|
if (is_array($dbBitRate)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($dbBitRate['min'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($dbBitRate['max'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
$comparison = Criteria::IN;
|
$comparison = Criteria::IN;
|
||||||
} elseif (preg_match('/[\%\*]/', $dbBitRate)) {
|
|
||||||
$dbBitRate = str_replace('*', '%', $dbBitRate);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate, $comparison);
|
return $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate, $comparison);
|
||||||
|
@ -819,20 +828,29 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
||||||
/**
|
/**
|
||||||
* Filter the query on the sample_rate column
|
* Filter the query on the sample_rate column
|
||||||
*
|
*
|
||||||
* @param string $dbSampleRate The value to use as filter.
|
* @param int|array $dbSampleRate The value to use as filter.
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
* 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
|
||||||
*
|
*
|
||||||
* @return CcFilesQuery The current query, for fluid interface
|
* @return CcFilesQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterByDbSampleRate($dbSampleRate = null, $comparison = null)
|
public function filterByDbSampleRate($dbSampleRate = null, $comparison = null)
|
||||||
{
|
{
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($dbSampleRate)) {
|
if (is_array($dbSampleRate)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($dbSampleRate['min'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($dbSampleRate['max'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
$comparison = Criteria::IN;
|
$comparison = Criteria::IN;
|
||||||
} elseif (preg_match('/[\%\*]/', $dbSampleRate)) {
|
|
||||||
$dbSampleRate = str_replace('*', '%', $dbSampleRate);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate, $comparison);
|
return $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate, $comparison);
|
||||||
|
|
|
@ -51,8 +51,8 @@
|
||||||
<column name="md5" phpName="DbMd5" type="CHAR" size="32" required="false"/>
|
<column name="md5" phpName="DbMd5" type="CHAR" size="32" required="false"/>
|
||||||
<column name="track_title" phpName="DbTrackTitle" type="VARCHAR" size="512" required="false"/>
|
<column name="track_title" phpName="DbTrackTitle" type="VARCHAR" size="512" required="false"/>
|
||||||
<column name="artist_name" phpName="DbArtistName" type="VARCHAR" size="512" required="false"/>
|
<column name="artist_name" phpName="DbArtistName" type="VARCHAR" size="512" required="false"/>
|
||||||
<column name="bit_rate" phpName="DbBitRate" type="VARCHAR" size="32" required="false"/>
|
<column name="bit_rate" phpName="DbBitRate" type="INTEGER" required="false"/>
|
||||||
<column name="sample_rate" phpName="DbSampleRate" type="VARCHAR" size="32" required="false"/>
|
<column name="sample_rate" phpName="DbSampleRate" type="INTEGER" required="false"/>
|
||||||
<column name="format" phpName="DbFormat" type="VARCHAR" size="128" required="false"/>
|
<column name="format" phpName="DbFormat" type="VARCHAR" size="128" required="false"/>
|
||||||
<column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" required="false"/>
|
<column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" required="false"/>
|
||||||
<column name="album_title" phpName="DbAlbumTitle" type="VARCHAR" size="512" required="false"/>
|
<column name="album_title" phpName="DbAlbumTitle" type="VARCHAR" size="512" required="false"/>
|
||||||
|
|
|
@ -77,8 +77,8 @@ CREATE TABLE "cc_files"
|
||||||
"md5" CHAR(32),
|
"md5" CHAR(32),
|
||||||
"track_title" VARCHAR(512),
|
"track_title" VARCHAR(512),
|
||||||
"artist_name" VARCHAR(512),
|
"artist_name" VARCHAR(512),
|
||||||
"bit_rate" VARCHAR(32),
|
"bit_rate" INTEGER,
|
||||||
"sample_rate" VARCHAR(32),
|
"sample_rate" INTEGER,
|
||||||
"format" VARCHAR(128),
|
"format" VARCHAR(128),
|
||||||
"length" interval default '00:00:00',
|
"length" interval default '00:00:00',
|
||||||
"album_title" VARCHAR(512),
|
"album_title" VARCHAR(512),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue