當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Sql::setTable方法代碼示例

本文整理匯總了PHP中Zend\Db\Sql\Sql::setTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sql::setTable方法的具體用法?PHP Sql::setTable怎麽用?PHP Sql::setTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Db\Sql\Sql的用法示例。


在下文中一共展示了Sql::setTable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test__construct

 /**
  * @covers Zend\Db\Sql\Sql::__construct
  */
 public function test__construct()
 {
     $sql = new Sql($this->mockAdapter);
     $this->assertFalse($sql->hasTable());
     $sql->setTable('foo');
     $this->assertSame('foo', $sql->getTable());
     $this->setExpectedException('Zend\\Db\\Sql\\Exception\\InvalidArgumentException', 'Table must be a string or instance of TableIdentifier.');
     $sql->setTable(null);
 }
開發者ID:razvansividra,項目名稱:pnlzf2-1,代碼行數:12,代碼來源:SqlTest.php

示例2: insertSocialMedia

 public function insertSocialMedia(SocialMediaEntity $socMedEnt)
 {
     $select = $this->sql->select();
     $select->where(array("username" => $socMedEnt->getUsername(), "social_id" => $socMedEnt->getSocialId()));
     $result = $this->hydrateResult(new SocialMediaEntity(), $select);
     if ($result->count() == 0) {
         $hydrator = new ClassMethods();
         $data = $hydrator->extract($socMedEnt);
         $action = $this->sql->insert();
         $action->values($data);
         $statement = $this->sql->prepareStatementForSqlObject($action);
         // echo "<hr>"; echo $action->getSqlString($this->dbAdapter->getPlatform()); echo "<hr>asdf";
         $statement->execute();
         $sql = new Sql($this->dbAdapter);
         $sql->setTable('blvd');
         $update = $sql->update();
         $update->set(array("last_social_media_datetime" => $data['date_created']))->where(array("id" => $socMedEnt->getBlvdId()));
         $statement = $sql->prepareStatementForSqlObject($update);
         $r = $statement->execute();
         echo $action->getSqlString($this->dbAdapter->getPlatform());
     } elseif (false) {
         $hydrator = new ClassMethods();
         $data = $hydrator->extract($socMedEnt);
         $update = $this->sql->update();
         $update->set(array("date_created" => $data['date_created']))->where(array("username" => $socMedEnt->getUsername(), "social_id" => $socMedEnt->getSocialId()));
         $statement = $this->sql->prepareStatementForSqlObject($update);
         $r = $statement->execute();
         //echo "<hr>"; echo $update->getSqlString($this->dbAdapter->getPlatform()); echo "<hr>asdf";
         return $r;
     }
     return false;
 }
開發者ID:nowarena,項目名稱:zf2NowArena,代碼行數:32,代碼來源:SocialMediaMapper.php

示例3: getSqlStatement

 /**
  * Funcao que retorna o objeto Sql ja com o adaptador e o nome da tabela
  * preparado pronto para criar sua consulta
  * @return \Zend\Db\Sql\Sql
  */
 public function getSqlStatement()
 {
     $sqlObject = new Sql($this->dbAdapter);
     $sqlObject->setTable($this->tableName);
     return $sqlObject;
 }
開發者ID:danielventura90,項目名稱:calz,代碼行數:11,代碼來源:AbstractRepository.php


注:本文中的Zend\Db\Sql\Sql::setTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。