本文整理汇总了PHP中Criteria::setPrimaryTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::setPrimaryTableName方法的具体用法?PHP Criteria::setPrimaryTableName怎么用?PHP Criteria::setPrimaryTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::setPrimaryTableName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDoInsert
public function testDoInsert()
{
try {
$c = new Criteria();
$c->setPrimaryTableName(BookPeer::TABLE_NAME);
$c->add(BookPeer::AUTHOR_ID, 'lkhlkhj');
BasePeer::doInsert($c, Propel::getConnection());
} catch (PropelException $e) {
$this->assertContains('[INSERT INTO `book` (`AUTHOR_ID`) VALUES (:p1)]', $e->getMessage(), 'SQL query is written in the exception message');
}
}
示例2: doUpdate
/**
* Performs an UPDATE on the database, given a AbsenceEleveTraitement or Criteria object.
*
* @param mixed $values Criteria or AbsenceEleveTraitement object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AbsenceEleveTraitementPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(AbsenceEleveTraitementPeer::ID);
$value = $criteria->remove(AbsenceEleveTraitementPeer::ID);
if ($value) {
$selectCriteria->add(AbsenceEleveTraitementPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(AbsenceEleveTraitementPeer::TABLE_NAME);
}
} else { // $values is AbsenceEleveTraitement object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
示例3: doUpdate
/**
* Performs an UPDATE on the database, given a Traspaso or Criteria object.
*
* @param mixed $values Criteria or Traspaso object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(TraspasoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(TraspasoPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values;
// rename for clarity
$comparison = $criteria->getComparison(TraspasoPeer::IDINVENTARIOLUGAR);
$value = $criteria->remove(TraspasoPeer::IDINVENTARIOLUGAR);
if ($value) {
$selectCriteria->add(TraspasoPeer::IDINVENTARIOLUGAR, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(TraspasoPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(TraspasoPeer::IDLUGARREMITENTE);
$value = $criteria->remove(TraspasoPeer::IDLUGARREMITENTE);
if ($value) {
$selectCriteria->add(TraspasoPeer::IDLUGARREMITENTE, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(TraspasoPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(TraspasoPeer::IDLUGARDESTINATARIO);
$value = $criteria->remove(TraspasoPeer::IDLUGARDESTINATARIO);
if ($value) {
$selectCriteria->add(TraspasoPeer::IDLUGARDESTINATARIO, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(TraspasoPeer::TABLE_NAME);
}
} else {
// $values is Traspaso object
$criteria = $values->buildCriteria();
// gets full criteria
$selectCriteria = $values->buildPkeyCriteria();
// gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(TraspasoPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
示例4: testCommentDoUpdate
public function testCommentDoUpdate()
{
$c1 = new Criteria();
$c1->setPrimaryTableName(BookPeer::TABLE_NAME);
$c1->setComment('Foo');
$c2 = new Criteria();
$c2->add(BookPeer::TITLE, 'Updated Title');
$con = Propel::getConnection(BookPeer::DATABASE_NAME);
BasePeer::doUpdate($c1, $c2, $con);
$expected = 'UPDATE /* Foo */ `book` SET `TITLE`=\'Updated Title\'';
$this->assertEquals($expected, $con->getLastExecutedQuery(), 'Criteria::setComment() adds a comment to update queries');
}
示例5: doUpdate
/**
* Method perform an UPDATE on the database, given a SessionRelCourseRelUser or Criteria object.
*
* @param mixed $values Criteria or SessionRelCourseRelUser object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(SessionRelCourseRelUserPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values;
// rename for clarity
$comparison = $criteria->getComparison(SessionRelCourseRelUserPeer::ID_SESSION);
$value = $criteria->remove(SessionRelCourseRelUserPeer::ID_SESSION);
if ($value) {
$selectCriteria->add(SessionRelCourseRelUserPeer::ID_SESSION, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(SessionRelCourseRelUserPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(SessionRelCourseRelUserPeer::COURSE_CODE);
$value = $criteria->remove(SessionRelCourseRelUserPeer::COURSE_CODE);
if ($value) {
$selectCriteria->add(SessionRelCourseRelUserPeer::COURSE_CODE, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(SessionRelCourseRelUserPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(SessionRelCourseRelUserPeer::ID_USER);
$value = $criteria->remove(SessionRelCourseRelUserPeer::ID_USER);
if ($value) {
$selectCriteria->add(SessionRelCourseRelUserPeer::ID_USER, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(SessionRelCourseRelUserPeer::TABLE_NAME);
}
} else {
// $values is SessionRelCourseRelUser object
$criteria = $values->buildCriteria();
// gets full criteria
$selectCriteria = $values->buildPkeyCriteria();
// gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
示例6: doUpdate
/**
* Performs an UPDATE on the database, given a LanguageObjectHistory or Criteria object.
*
* @param mixed $values Criteria or LanguageObjectHistory object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(LanguageObjectHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(LanguageObjectHistoryPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values;
// rename for clarity
$comparison = $criteria->getComparison(LanguageObjectHistoryPeer::OBJECT_ID);
$value = $criteria->remove(LanguageObjectHistoryPeer::OBJECT_ID);
if ($value) {
$selectCriteria->add(LanguageObjectHistoryPeer::OBJECT_ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(LanguageObjectHistoryPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(LanguageObjectHistoryPeer::LANGUAGE_ID);
$value = $criteria->remove(LanguageObjectHistoryPeer::LANGUAGE_ID);
if ($value) {
$selectCriteria->add(LanguageObjectHistoryPeer::LANGUAGE_ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(LanguageObjectHistoryPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(LanguageObjectHistoryPeer::REVISION);
$value = $criteria->remove(LanguageObjectHistoryPeer::REVISION);
if ($value) {
$selectCriteria->add(LanguageObjectHistoryPeer::REVISION, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(LanguageObjectHistoryPeer::TABLE_NAME);
}
} else {
// $values is LanguageObjectHistory object
$criteria = $values->buildCriteria();
// gets full criteria
$selectCriteria = $values->buildPkeyCriteria();
// gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(LanguageObjectHistoryPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
示例7: doUpdate
/**
* Performs an UPDATE on the database, given a SubscriberGroupMembership or Criteria object.
*
* @param mixed $values Criteria or SubscriberGroupMembership object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(SubscriberGroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(SubscriberGroupMembershipPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values;
// rename for clarity
$comparison = $criteria->getComparison(SubscriberGroupMembershipPeer::SUBSCRIBER_ID);
$value = $criteria->remove(SubscriberGroupMembershipPeer::SUBSCRIBER_ID);
if ($value) {
$selectCriteria->add(SubscriberGroupMembershipPeer::SUBSCRIBER_ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(SubscriberGroupMembershipPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(SubscriberGroupMembershipPeer::SUBSCRIBER_GROUP_ID);
$value = $criteria->remove(SubscriberGroupMembershipPeer::SUBSCRIBER_GROUP_ID);
if ($value) {
$selectCriteria->add(SubscriberGroupMembershipPeer::SUBSCRIBER_GROUP_ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(SubscriberGroupMembershipPeer::TABLE_NAME);
}
} else {
// $values is SubscriberGroupMembership object
$criteria = $values->buildCriteria();
// gets full criteria
$selectCriteria = $values->buildPkeyCriteria();
// gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(SubscriberGroupMembershipPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
示例8: doUpdate
/**
* Performs an UPDATE on the database, given a Proveedoritradeservicio or Criteria object.
*
* @param mixed $values Criteria or Proveedoritradeservicio object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ProveedoritradeservicioPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(ProveedoritradeservicioPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values;
// rename for clarity
$comparison = $criteria->getComparison(ProveedoritradeservicioPeer::IDPROVEEDORITRADESERVICIO);
$value = $criteria->remove(ProveedoritradeservicioPeer::IDPROVEEDORITRADESERVICIO);
if ($value) {
$selectCriteria->add(ProveedoritradeservicioPeer::IDPROVEEDORITRADESERVICIO, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(ProveedoritradeservicioPeer::TABLE_NAME);
}
} else {
// $values is Proveedoritradeservicio object
$criteria = $values->buildCriteria();
// gets full criteria
$selectCriteria = $values->buildPkeyCriteria();
// gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(ProveedoritradeservicioPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}