示例#1
0
 /**
  * 执行插入
  *
  * @return Statement
  *
  * @throws \Exception
  */
 public function execute()
 {
     $query = $this->compile();
     $return = $this->connection->query($query['sql'], $query['arguments']);
     $this->insertRow = array();
     return $return;
 }
示例#2
0
 /**
  * 执行创建操作
  *
  * @return Statement
  *
  * @throws Monkey\Exceptions\Sql\SqlEmptyException
  */
 public function execute()
 {
     $sql = $this->getSql();
     if (!$sql) {
         new Monkey\Exceptions\Sql\SqlEmptyException('sql语句为空,创建数据库表失败', 1024);
     }
     return $this->connection->query($sql);
 }
示例#3
0
 /**
  * 执行事务query
  */
 protected function pop()
 {
     foreach (array_reverse($this->pdoTrans) as $name => $active) {
         if ($active) {
             break;
         }
         unset($this->pdoTrans[$name]);
         if (empty($this->pdoTrans)) {
             if (!$this->conn->commit()) {
                 throw new \Exception('commit failed.');
             }
         } else {
             $this->conn->query('RELEASE SAVEPOINT ' . $name);
         }
     }
 }
示例#4
0
 /**
  * 返回最后插入的ID
  *
  * @return string
  */
 public function lastInsertId()
 {
     return $this->conn->lastInsertId();
 }
示例#5
0
 /**
  * 执行查询
  *
  * @return Statement
  */
 public function execute()
 {
     return $this->connection->query($this->getString(), $this->getArguments());
 }
示例#6
0
 /**
  * 执行更新
  *
  * @return Statement
  */
 public function execute()
 {
     $query = $this->compile();
     return $this->connection->query($query['sql'], $query['arguments']);
 }