本文整理汇总了PHP中uiConfPeer::doSelectStmt方法的典型用法代码示例。如果您正苦于以下问题:PHP uiConfPeer::doSelectStmt方法的具体用法?PHP uiConfPeer::doSelectStmt怎么用?PHP uiConfPeer::doSelectStmt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uiConfPeer
的用法示例。
在下文中一共展示了uiConfPeer::doSelectStmt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(uiConfPeer::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.
uiConfPeer::setUseCriteriaFilter(false);
$stmt = uiConfPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
uiConfPeer::setUseCriteriaFilter(true);
$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?
$this->collwidgets = null;
$this->lastwidgetCriteria = null;
}
// if (deep)
}
示例2: save
/**
* Persists this object to the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All modified related objects will also be persisted in the doSave()
* method. This method wraps all precipitate database operations in a
* single transaction.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see doSave()
*/
public function save(PropelPDO $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(uiConfPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
$isInsert = $this->isNew();
try {
$ret = $this->preSave($con);
if ($isInsert) {
$ret = $ret && $this->preInsert($con);
} else {
$ret = $ret && $this->preUpdate($con);
}
if (!$ret || !$this->isModified()) {
$con->commit();
return 0;
}
for ($retries = 1; $retries < KalturaPDO::SAVE_MAX_RETRIES; $retries++) {
$affectedRows = $this->doSave($con);
if ($affectedRows || !$this->isColumnModified(uiConfPeer::CUSTOM_DATA)) {
//ask if custom_data wasn't modified to avoid retry with atomic column
break;
}
KalturaLog::debug("was unable to save! retrying for the {$retries} time");
$criteria = $this->buildPkeyCriteria();
$criteria->addSelectColumn(uiConfPeer::CUSTOM_DATA);
$stmt = uiConfPeer::doSelectStmt($criteria, $con);
$cutsomDataArr = $stmt->fetchAll(PDO::FETCH_COLUMN);
$newCustomData = $cutsomDataArr[0];
$this->custom_data_md5 = md5($newCustomData);
$valuesToChangeTo = $this->m_custom_data->toArray();
$this->m_custom_data = myCustomData::fromString($newCustomData);
//set custom data column values we wanted to change to
foreach ($this->oldCustomDataValues as $namespace => $namespaceValues) {
foreach ($namespaceValues as $name => $oldValue) {
if ($namespace) {
$newValue = $valuesToChangeTo[$namespace][$name];
} else {
$newValue = $valuesToChangeTo[$name];
}
$this->putInCustomData($name, $newValue, $namespace);
}
}
$this->setCustomData($this->m_custom_data->toString());
}
if ($isInsert) {
$this->postInsert($con);
} else {
$this->postUpdate($con);
}
$this->postSave($con);
uiConfPeer::addInstanceToPool($this);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
示例3: 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 uiConfPeer::populateObjects(uiConfPeer::doSelectStmt($criteria, $con));
}