本文整理匯總了PHP中FileSyncPeer::doSelectStmt方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSyncPeer::doSelectStmt方法的具體用法?PHP FileSyncPeer::doSelectStmt怎麽用?PHP FileSyncPeer::doSelectStmt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileSyncPeer
的用法示例。
在下文中一共展示了FileSyncPeer::doSelectStmt方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reload
/**
* Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
*
* This will only work if the object has been saved and has a valid primary key set.
*
* @param boolean $deep (optional) Whether to also de-associated any related objects.
* @param PropelPDO $con (optional) The PropelPDO connection to use.
* @return void
* @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
*/
public function reload($deep = false, PropelPDO $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("Cannot reload a deleted object.");
}
if ($this->isNew()) {
throw new PropelException("Cannot reload an unsaved object.");
}
if ($con === null) {
$con = Propel::getConnection(FileSyncPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// We don't need to alter the object instance pool; we're just modifying this instance
// already in the pool.
$stmt = FileSyncPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
$row = $stmt->fetch(PDO::FETCH_NUM);
$stmt->closeCursor();
if (!$row) {
throw new PropelException('Cannot find matching row in the database to reload object values.');
}
$this->hydrate($row, 0, true);
// rehydrate
if ($deep) {
// also de-associate any related objects?
}
// if (deep)
}
示例2: doSelect
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return FileSyncPeer::populateObjects(FileSyncPeer::doSelectStmt($criteria, $con));
}
示例3: deleteOldVersionedFileSyncs
protected static function deleteOldVersionedFileSyncs($objectType, $objectSubType)
{
if (!isset(self::$oldVersionsStartUpdatedAt[$objectType])) {
self::$oldVersionsStartUpdatedAt[$objectType] = 0;
}
if (!isset(self::$oldVersionsEndUpdatedAt[$objectType])) {
self::$oldVersionsEndUpdatedAt[$objectType] = 0;
}
$criteria = new Criteria();
switch ($objectType) {
case FileSyncObjectType::ASSET:
if ($objectSubType != asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET) {
return array();
}
$join = new Join();
$join->addCondition(FileSyncPeer::OBJECT_ID, assetPeer::ID);
$join->addCondition(FileSyncPeer::VERSION, assetPeer::VERSION, Criteria::NOT_EQUAL);
$join->setJoinType(Criteria::LEFT_JOIN);
$criteria->addJoinObject($join);
$criteria->add(assetPeer::VERSION, null, Criteria::ISNOTNULL);
break;
case FileSyncObjectType::UICONF:
$join = new Join();
$join->addCondition(FileSyncPeer::OBJECT_ID, uiConfPeer::ID);
$join->addCondition(FileSyncPeer::VERSION, uiConfPeer::VERSION, Criteria::NOT_EQUAL);
$join->setJoinType(Criteria::LEFT_JOIN);
$criteria->addJoinObject($join);
$criteria->add(uiConfPeer::VERSION, null, Criteria::ISNOTNULL);
break;
case FileSyncObjectType::ENTRY:
$join = new Join();
$join->addCondition(FileSyncPeer::OBJECT_ID, entryPeer::ID);
switch ($objectSubType) {
case entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB:
$join->addCondition(FileSyncPeer::VERSION, entryPeer::THUMBNAIL, Criteria::NOT_EQUAL);
$criteria->add(entryPeer::THUMBNAIL, null, Criteria::ISNOTNULL);
break;
case entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA:
case entry::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD:
$join->addCondition(FileSyncPeer::VERSION, entryPeer::DATA, Criteria::NOT_EQUAL);
$criteria->add(entryPeer::DATA, null, Criteria::ISNOTNULL);
break;
default:
return array();
}
$join->setJoinType(Criteria::LEFT_JOIN);
$criteria->addJoinObject($join);
break;
case FileSyncObjectType::METADATA:
$join = new Join();
$join->addCondition(FileSyncPeer::OBJECT_ID, MetadataPeer::ID);
$join->addCondition(FileSyncPeer::VERSION, MetadataPeer::VERSION, Criteria::NOT_EQUAL);
$join->setJoinType(Criteria::LEFT_JOIN);
$criteria->addJoinObject($join);
$criteria->add(MetadataPeer::VERSION, null, Criteria::ISNOTNULL);
break;
case FileSyncObjectType::METADATA_PROFILE:
$join = new Join();
$join->addCondition(FileSyncPeer::OBJECT_ID, MetadataProfilePeer::ID);
switch ($objectSubType) {
case MetadataProfile::FILE_SYNC_METADATA_DEFINITION:
$join->addCondition(FileSyncPeer::VERSION, MetadataProfilePeer::FILE_SYNC_VERSION, Criteria::NOT_EQUAL);
$criteria->add(MetadataProfilePeer::FILE_SYNC_VERSION, null, Criteria::ISNOTNULL);
break;
case MetadataProfile::FILE_SYNC_METADATA_VIEWS:
$join->addCondition(FileSyncPeer::VERSION, MetadataProfilePeer::VIEWS_VERSION, Criteria::NOT_EQUAL);
$criteria->add(MetadataProfilePeer::VIEWS_VERSION, null, Criteria::ISNOTNULL);
break;
default:
return array();
}
$join->setJoinType(Criteria::LEFT_JOIN);
$criteria->addJoinObject($join);
break;
default:
return array();
}
$criteria->add(FileSyncPeer::DC, kDataCenterMgr::getCurrentDcId());
$criteria->add(FileSyncPeer::OBJECT_TYPE, $objectType);
$criteria->add(FileSyncPeer::OBJECT_SUB_TYPE, $objectSubType);
$criteria->add(FileSyncPeer::STATUS, array(FileSync::FILE_SYNC_STATUS_DELETED, FileSync::FILE_SYNC_STATUS_PURGED), Criteria::NOT_IN);
$nextCriteria = clone $criteria;
$criteria->add(FileSyncPeer::UPDATED_AT, self::$oldVersionsStartUpdatedAt[$objectType], Criteria::GREATER_EQUAL);
$criteria->addAnd(FileSyncPeer::UPDATED_AT, self::$oldVersionsEndUpdatedAt[$objectType], Criteria::LESS_EQUAL);
$criteria->addAscendingOrderByColumn(FileSyncPeer::UPDATED_AT);
$criteria->setLimit(self::$queryLimit);
$fileSyncs = FileSyncPeer::doSelect($criteria);
if (count($fileSyncs)) {
foreach ($fileSyncs as $fileSync) {
/* @var $fileSync FileSync */
self::deleteFileSync($fileSync);
if ($fileSync->getUpdatedAt(null)) {
self::$oldVersionsNextStartUpdatedAt[$objectType] = $fileSync->getUpdatedAt(null);
}
}
} else {
self::$oldVersionsNextStartUpdatedAt[$objectType] = self::$oldVersionsStartUpdatedAt[$objectType];
$nextCriteria->add(FileSyncPeer::UPDATED_AT, self::$oldVersionsStartUpdatedAt[$objectType], Criteria::GREATER_THAN);
$nextCriteria->addSelectColumn('UNIX_TIMESTAMP(MIN(' . FileSyncPeer::UPDATED_AT . '))');
$stmt = FileSyncPeer::doSelectStmt($nextCriteria);
//.........這裏部分代碼省略.........
示例4: foreach
} else {
$sizeCrit->addAnd($c->getNewCriterion(FileSyncPeer::FILE_SIZE, $value, $comparison));
}
}
if ($sizeCrit) {
$c->addAnd($sizeCrit);
}
// select the count and size group by object type & sub type
$c->addGroupByColumn(FileSyncPeer::OBJECT_TYPE);
$c->addGroupByColumn(FileSyncPeer::OBJECT_SUB_TYPE);
$c->addSelectColumn('COUNT(file_sync.ID)');
$c->addSelectColumn('SUM(file_sync.FILE_SIZE)');
foreach ($c->getGroupByColumns() as $column) {
$c->addSelectColumn($column);
}
$stmt = FileSyncPeer::doSelectStmt($c);
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
// count only file syncs that should be synced
$count = 0;
$size = 0;
foreach ($rows as $row) {
$objectType = $row['OBJECT_TYPE'];
$objectSubType = $row['OBJECT_SUB_TYPE'];
if (isset($excludeFileSyncMap[$objectType]) && (!count($excludeFileSyncMap[$objectType]) || in_array($objectSubType, $excludeFileSyncMap[$objectType]))) {
continue;
}
$count += $row['COUNT(file_sync.ID)'];
$size += $row['SUM(file_sync.FILE_SIZE)'];
}
if ($count) {
$breakdownBySize[$sizeName] = array($count, $size);