/** * */ function _prepare_values_clause() { if ($this->type == 'single') { return parent::_prepare_values_clause(); } else { if ($this->type == 'multiple') { return $this->_prepare_values_multiple_clause(); } } }
/** * * * * * @param QueryBuilder $queryBuilder * @param array $params * @return array * * @version 20130211, d10n: */ function MultiQuery(QueryBuilder $queryBuilder, $params = array()) { //die(); // 20130211 d10n : $str = $queryBuilder->Prepare($params); //print_r($str); $timer = Timer::Start(); $mqresult = mysqli_multi_query($this->connection, $str); //print_r($mqresult); //die(); if (!$mqresult) { print_r("Error executing query<br><b>{$str}</b><br>" . mysqli_errno($this->connection) . ": " . mysqli_error($this->connection) . "\n" . $str); trigger_error("Error executing multi query (rowset #1) <br><b>{$str}</b><br>" . mysqli_errno($this->connection) . ": " . mysqli_error($this->connection) . "\n" . $str, E_USER_ERROR); //print_r("Error executing multi query (rowset #1) <br><b>$str</b><br>" . mysqli_errno($this->connection) . ": " . mysqli_error($this->connection) . "\n" . $str); //print_r("Error executing multi query (rowset #1) <br><b>$str</b><br>" . mysqli_errno($this->connection) . ": " . mysqli_error($this->connection) . "\n" . $str, E_USER_ERROR); _503('Error'); } $res = array(); $counter = 1; do { $counter++; if ($result = mysqli_store_result($this->connection)) { $set = array(); while ($row = mysqli_fetch_assoc($result)) { $set[] = $row; } mysqli_free_result($result); $res[] = $set; } $more_result = mysqli_more_results($this->connection); if ($more_result) { if (!mysqli_next_result($this->connection)) { //print_r("Error executing query<br><b>$str</b><br>" . mysqli_errno($this->connection) . ": " . mysqli_error($this->connection) . "\n" . $str); trigger_error("Error executing multi query (rowset #{$counter}) <br><b>{$str}</b><br>" . mysqli_errno($this->connection) . ": " . mysqli_error($this->connection) . "\n" . $str, E_USER_ERROR); _503('Error'); } } } while ($more_result); // // // CUT_LOG yes/no // MAX_LENGTH_PER_PARAM > 100 if (CUT_LOG == 'yes') { foreach ($params['values'] as $key => $value) { $value = (string) $value; if (mb_strlen($value) > MAX_LENGTH_PER_PARAM) { $params['values'][$key] = mb_strcut($value, 0, MAX_LENGTH_PER_PARAM) . ' ...'; } } $str = $queryBuilder->Prepare($params); } $this->_log_query($str, $timer->Stop()); //print_r('1'); return $res; }