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; }
/** * Set an input bind * Warning, not all databases support those functionalities. * * @access protected * @param array $aBind * @return bool * @see this::_prepQuery() */ function _setInputBind($aBind) { if ($this->isOracle()) { if ($aBind['TYPE'] == 'Clob') { if (sqlrcur_inputBindClob($this->curs_id, $aBind['VARIABLE'], $aBind['VALUE'], strlen($aBind['VALUE']))) { echo '<hr>' . mb_strlen($aBind['VALUE']) . '<hr>'; return true; } else { if ($this->db_debug) { log_message('error', 'Driver Db_sqlrelay ' . "\t" . 'Method _setInputBind ' . PHP_EOL . "\t\t" . 'Unable to bind: "' . var_export($aBind, true) . '"' . PHP_EOL . " Connexion data " . PHP_EOL . " username : "******" hostname : " . $this->hostname . PHP_EOL . " database : " . $this->database . PHP_EOL . " dbdriver : " . $this->dbdriver . PHP_EOL . " dbprefix : " . $this->dbprefix . PHP_EOL . " port : " . $this->port); return $this->display_error('db_invalid_bind'); } return false; } } else { if (sqlrcur_inputBind($this->curs_id, $aBind['VARIABLE'], $aBind['VALUE'], $aBind['PRECISION'], $aBind['SCALE'])) { return true; } else { if ($this->db_debug) { log_message('error', 'Driver Db_sqlrelay ' . "\t" . 'Method _setInputBind ' . PHP_EOL . "\t\t" . 'Unable to bind: "' . var_export($aBind, true) . '"' . PHP_EOL . " Connexion data " . PHP_EOL . " username : "******" hostname : " . $this->hostname . PHP_EOL . " database : " . $this->database . PHP_EOL . " dbdriver : " . $this->dbdriver . PHP_EOL . " dbprefix : " . $this->dbprefix . PHP_EOL . " port : " . $this->port); return $this->display_error('db_invalid_bind'); } return false; } } } else { return false; } }