/** * {@inheritDoc} */ public function rollBack() { if (!sqlsrv_rollback($this->conn)) { throw SQLSrvException::fromSqlSrvErrors(); } }
public function execute($params = null) { if ($params) { $hasZeroIndex = array_key_exists(0, $params); foreach ($params as $key => $val) { $key = $hasZeroIndex && is_numeric($key) ? $key + 1 : $key; $this->bindValue($key, $val); } } $this->stmt = sqlsrv_query($this->conn, $this->sql, $this->params); if (!$this->stmt) { throw SQLSrvException::fromSqlSrvErrors(); } if ($this->lastInsertId) { sqlsrv_next_result($this->stmt); sqlsrv_fetch($this->stmt); $this->lastInsertId->setId(sqlsrv_get_field($this->stmt, 0)); } }