当前位置: 首页>>代码示例>>PHP>>正文


PHP Database::execute方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:11,代码来源:FollowerEntity.php

示例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));
     }
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:12,代码来源:ArticleEntity.php

示例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));
     }
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:12,代码来源:EmailEntity.php

示例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));
     }
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:12,代码来源:BlogEntity.php

示例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');
 }
开发者ID:diego3,项目名称:myframework-core,代码行数:16,代码来源:DataBaseTest.php

示例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));
     }
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:12,代码来源:UserEntity.php

示例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));
     }
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:12,代码来源:StreamCategoryEntity.php

示例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();
 }
开发者ID:jimmy18dev,项目名称:dailypoint,代码行数:7,代码来源:location.model.php

示例9: SearchLogCountProcess

 public function SearchLogCountProcess()
 {
     parent::query('SELECT COUNT(lo_id) FROM log_search');
     parent::execute();
     $data = parent::single();
     return $data['COUNT(lo_id)'];
 }
开发者ID:jimmy18dev,项目名称:prachindaily,代码行数:7,代码来源:site.model.php

示例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;
 }
开发者ID:snowfire,项目名称:database,代码行数:19,代码来源:Query.php

示例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);
     }
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:16,代码来源:TwitterEntity.php

示例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");
 }
开发者ID:xenonoize,项目名称:DeViersprong,代码行数:8,代码来源:menuItem.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();
 }
开发者ID:jimmy18dev,项目名称:dotdotdot_store,代码行数:8,代码来源:config.model.php

示例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();
 }
开发者ID:jimmy18dev,项目名称:dailypoint,代码行数:8,代码来源:photo.model.php

示例15: EditProductProcess

 public function EditProductProcess($param)
 {
     parent::query('SELECT * FROM dd_product');
     parent::execute();
     parent::execute();
     $dataset = parent::resultset();
     return $dataset;
 }
开发者ID:jimmy18dev,项目名称:dotdotdot_store,代码行数:8,代码来源:image.model.php


注:本文中的Database::execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。