Commit d87decd6 authored by Alexander Butenko's avatar Alexander Butenko Committed by GitHub

fixes (#673)

* fixed limit variable ordering in the comments

* Expand readme on autoreconnect and multipe connections usage

* update release numbers

* update copyright years

* Bug #623:  Mistake in Regexp

* Fix for #554 Fixing Join usage with 'USING' instead of 'ON'

* Fix empty exception message
parent eac330f7
......@@ -1004,7 +1004,7 @@ class MysqliDb
*/
public function join($joinTable, $joinCondition, $joinType = '')
{
$allowedTypes = array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER');
$allowedTypes = array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER', 'NATURAL');
$joinType = strtoupper(trim($joinType));
if ($joinType && !in_array($joinType, $allowedTypes)) {
......@@ -1900,8 +1900,11 @@ class MysqliDb
{
$stmt = $this->mysqli()->prepare($this->_query);
if ($stmt !== false)
goto release;
if ($stmt !== false) {
if ($this->traceEnabled)
$this->traceStartQ = microtime(true);
return $stmt;
}
if ($this->mysqli()->errno === 2006 && $this->autoReconnect === true && $this->autoReconnectCount === 0) {
$this->connect($this->defConnectionName);
......@@ -1909,15 +1912,11 @@ class MysqliDb
return $this->_prepareQuery();
}
$error = $this->mysqli()->error;
$query = $this->_query;
$errno = $this->mysqli()->errno;
$this->reset();
throw new Exception(sprintf('%s query: %s', $this->mysqli()->error, $this->_query), $this->mysqli()->errno);
release:
if ($this->traceEnabled) {
$this->traceStartQ = microtime(true);
}
return $stmt;
throw new Exception(sprintf('%s query: %s', error, query), errno);
}
/**
......@@ -2356,7 +2355,9 @@ class MysqliDb
else
$joinStr = $joinTable;
$this->_query .= " " . $joinType. " JOIN " . $joinStr ." on " . $joinCondition;
$this->_query .= " " . $joinType. " JOIN " . $joinStr .
(false !== stripos($joinCondition, 'using') ? " " : " on ")
. $joinCondition;
// Add join and query
if (!empty($this->_joinAnd) && isset($this->_joinAnd[$joinStr])) {
......
......@@ -651,7 +651,7 @@ class dbObject {
$regexp = "/^[0-9\.]*$/";
break;
case "bool":
$regexp = '/^[yes|no|0|1|true|false]$/i';
$regexp = '/^(yes|no|0|1|true|false)$/i';
break;
case "datetime":
$regexp = "/^[0-9a-zA-Z -:]*$/";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment