当前位置: 首页>>代码示例>>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;未经允许,请勿转载。