/** * * @param string $sql * @param array $array * @return PDOStatement */ protected function getDBStatement($sql, $array = null) { if ($array) { list($sql, $array) = SQLBind::parseSQL($this->_connectionManagement, $sql, $array); $stmt = $this->_db->prepare($sql); foreach ($array as $key => $value) { $stmt->bindValue(":" . SQLBind::keyAdj($key), $value); } } else { $stmt = $this->_db->prepare($sql); } return $stmt; }
protected function getSQLRelayCursor($sql, $array = null) { $cur = sqlrcur_alloc($this->_conn); if ($array) { list($sql, $array) = SQLBind::parseSQL($this->_connectionManagement, $sql, $array); sqlrcur_prepareQuery($cur, $sql); $bindCount = 1; foreach ($array as $key => $value) { $field = strval($bindCount++); sqlrcur_inputBind($cur, $field, $value); } $success = sqlrcur_executeQuery($cur); sqlrcon_endSession($this->_conn); } else { $success = sqlrcur_sendQuery($cur, $sql); sqlrcon_endSession($this->_conn); } if (!$success) { throw new DatasetException(sqlrcur_errorMessage($cur)); } sqlrcur_lowerCaseColumnNames($cur); return $cur; }
protected function getOci8Cursor($sql, $array = null) { list($query, $array) = SQLBind::parseSQL($this->_connectionManagement, $sql, $array); // Prepare the statement $stid = oci_parse($this->_conn, $query); if (!$stid) { $e = oci_error($this->_conn); throw new DatabaseException($e['message']); } // Bind the parameters if (is_array($array)) { foreach ($array as $key => $value) { oci_bind_by_name($stid, ":{$key}", $value); } } // Perform the logic of the query $r = oci_execute($stid, $this->_transaction); // Check if is OK; if (!$r) { $e = oci_error($stid); throw new DatabaseException($e['message']); } return $stid; }