本文整理汇总了PHP中Database::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::execute方法的具体用法?PHP Database::execute怎么用?PHP Database::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: persist
public function persist()
{
$db = new Database();
if ($this->id == null) {
$db->execute('INSERT INTO followers (user, follower) VALUES (?, ?)', array($this->user, $this->follower));
$this->id = $db->lastInsertId();
} else {
$req = 'UPDATE followers SET user = ?, follower = ? WHERE id = ?';
$db->execute($req, array($this->user, $this->follower, $this->id));
}
}
示例2: persist
public function persist()
{
$db = new Database();
if ($this->id == null) {
$req = 'INSERT INTO article (title, content, articleDate, streamType, url, stream_id) VALUES (?, ?, ?, ?, ?, ?)';
$db->execute($req, array($this->title, $this->content, $this->articleDate, $this->streamType, $this->url, $this->stream_id));
$this->id = $db->lastInsertId();
} else {
$req = 'UPDATE article SET title = ?, content = ?, articleDate = ?, streamType = ?, url = ?, stream_id = ? WHERE id = ?';
$db->execute($req, array($this->title, $this->content, $this->articleDate, $this->streamType, $this->url, $this->stream_id, $this->id));
}
}
示例3: persist
public function persist()
{
$db = new Database();
if ($this->id == null) {
$req = 'INSERT INTO stream_email (server, account, password, port, firstUpdate) VALUES (?, ?, ?, ?, ?)';
$db->execute($req, array($this->server, $this->account, $this->password, $this->port, $this->firstUpdate));
$this->id = $db->lastInsertId();
} else {
$req = 'UPDATE stream_email SET server = ?, account = ?, password = ?, port = ?, firstUpdate = ? WHERE id = ?';
$db->execute($req, array($this->server, $this->account, $this->password, $this->port, $this->firstUpdate, $this->id));
}
}
示例4: persist
public function persist()
{
$db = new Database();
if ($this->id == null) {
$req = 'INSERT INTO blog (account, article) VALUES (?, ?)';
$db->execute($req, array($this->account, $this->article));
$this->id = $db->lastInsertId();
} else {
$req = 'UPDATE blog SET account = ?, article = ? WHERE id = ?';
$db->execute($req, array($this->account, $this->article, $this->id));
}
}
示例5: testExecute
/**
* @covers Database::execute
* @covers Database::rowCount
*/
public function testExecute()
{
$this->assertEquals(1, $this->db->execute('INSERT INTO test (name) VALUES (?)', 'Value 4'), LoggerApp::getLastError());
$this->assertEquals(1, $this->db->execute("INSERT INTO test (name) VALUES (?)", array('teste')), LoggerApp::getLastError());
$this->assertEquals(1, $this->db->rowCount(), 'Erro no numero de linhas inseridas');
$this->assertEquals(5, $this->db->execute("UPDATE test SET name = name || ?", '_teste'), LoggerApp::getLastError());
$this->assertEquals(5, $this->db->rowCount(), 'Erro no numero de linhas alteradas');
$this->assertFalse(LoggerApp::hasError(), LoggerApp::getLastError());
$this->assertEquals(0, $this->db->execute("DELETE INVALIDTest SET name = ?", 'teste 2'), 'Comando inválido');
$this->assertTrue(LoggerApp::hasError(), 'Erro inválido');
$this->assertEquals(0, $this->db->rowCount(), 'Nenhuma linha afetada');
}
示例6: persist
public function persist()
{
$db = new Database();
if ($this->id == null) {
$req = 'INSERT INTO accounts (authentification, username, email, userKey, active, accountLevel, picture) VALUES (?, ?, ?, ?, ?, ?, ?)';
$db->execute($req, array($this->authentification, $this->username, $this->email, $this->userKey, $this->active, $this->accountLevel, $this->picture));
$this->id = $db->lastInsertId();
} else {
$req = 'UPDATE accounts SET authentification = ?, username = ?, email = ?, userKey = ?, active = ?, accountLevel = ?, picture = ? WHERE id = ?';
$db->execute($req, array($this->authentification, $this->username, $this->email, $this->userKey, $this->active, $this->accountLevel, $this->picture, $this->id));
}
}
示例7: persist
public function persist()
{
$db = new Database();
if ($this->id == null) {
$req = 'INSERT INTO stream_category (stream, category, streamType) VALUES (?, ?, ?)';
$db->execute($req, array($this->stream, $this->category, $this->streamType));
$this->id = $db->lastInsertId();
} else {
$req = 'UPDATE stream_category SET stream = ?, category = ?, streamType = ? WHERE id = ?';
$db->execute($req, array($this->stream, $this->category, $this->streamType, $this->id));
}
}
示例8: ListDistrictProcess
public function ListDistrictProcess($param)
{
parent::query('SELECT * FROM dy_location_district WHERE ds_city_id = :city_id ORDER BY ds_id ASC');
parent::bind(':city_id', $param['city_id']);
parent::execute();
return parent::resultset();
}
示例9: SearchLogCountProcess
public function SearchLogCountProcess()
{
parent::query('SELECT COUNT(lo_id) FROM log_search');
parent::execute();
$data = parent::single();
return $data['COUNT(lo_id)'];
}
示例10: execute
/**
* @param array $options single_column
*/
public function execute(array $options = null)
{
$data = $this->_compile();
if (isset($this->select)) {
if (isset($this->limit) && $this->_parameter_first('limit') == 1) {
$return = $this->_database->one($data['sql'], $data['values'], $options);
} else {
$return = $this->_database->many($data['sql'], $data['values'], $options);
}
} else {
$this->_database->execute($data['sql'], $data['values']);
$return = $this->_database->last_insert_id();
}
$this->clear();
return $return;
}
示例11: persist
public function persist()
{
$db = new Database();
$firstUpdate = date(Database::DATE_FORMAT, strtotime($this->firstUpdate));
$lastUpdate = date(Database::DATE_FORMAT, strtotime($this->lastUpdate));
if ($this->id == null) {
$req = 'INSERT INTO stream_twitter (channel, firstUpdate, lastUpdate) VALUES (?, ?, ?)';
$data = array($this->channel, $firstUpdate, $lastUpdate);
$db->execute($req, $data);
$this->id = $db->lastInsertId();
} else {
$req = 'UPDATE stream_twitter SET channel = ?, firstUpdate = ?, lastUpdate = ? WHERE id = ?';
$data = array($this->channel, $firstUpdate, $lastUpdate, $this->id);
$db->execute($req, $data);
}
}
示例12: DeleteItem
public function DeleteItem($id = 0)
{
$db = new Database();
$db->query("DELETE FROM menuitem WHERE `Id`=:id");
$db->bind(':id', $id);
$db->execute();
header("Location: index.php");
}
示例13: EditItemsInOrderProcess
public function EditItemsInOrderProcess($param)
{
parent::query('UPDATE dd_order_detail SET odt_amount = :amount WHERE odt_order_id = :order_id AND odt_product_id = :product_id');
parent::bind(':amount', $param['amount']);
parent::bind(':order_id', $param['order_id']);
parent::bind(':product_id', $param['product_id']);
parent::execute();
}
示例14: DeletePhotoProcess
public function DeletePhotoProcess($param)
{
parent::query('DELETE FROM dy_image WHERE (im_id = :image_id AND im_member_id = :member_id AND im_post_id = :post_id)');
parent::bind(':member_id', $param['member_id']);
parent::bind(':image_id', $param['image_id']);
parent::bind(':post_id', $param['post_id']);
parent::execute();
}
示例15: EditProductProcess
public function EditProductProcess($param)
{
parent::query('SELECT * FROM dd_product');
parent::execute();
parent::execute();
$dataset = parent::resultset();
return $dataset;
}