本文整理汇总了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);
}
示例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;
}
示例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;
}