|
@@ -799,7 +799,7 @@ class dao {
|
|
|
$i = 0;
|
|
|
while ($row = $stmt->fetch()) {
|
|
|
$key ? $rows[$row->$key] = $row : $rows[] = $row;
|
|
|
- $i ++;
|
|
|
+ $i++;
|
|
|
if ($i == $max)
|
|
|
break;
|
|
|
}
|
|
@@ -807,7 +807,7 @@ class dao {
|
|
|
}
|
|
|
/* Others, call the method in sql class. */ else {
|
|
|
/* Create the max counts of sql class methods, and then create $arg0, $arg1... */
|
|
|
- for ($i = 0; $i < SQL::MAX_ARGS; $i ++) {
|
|
|
+ for ($i = 0; $i < SQL::MAX_ARGS; $i++) {
|
|
|
${"arg$i"} = isset($funcArgs[$i]) ? $funcArgs[$i] : null;
|
|
|
}
|
|
|
$this->sqlobj->$funcName($arg0, $arg1, $arg2);
|
|
@@ -855,7 +855,7 @@ class dao {
|
|
|
unset($funcArgs[0]);
|
|
|
unset($funcArgs[1]);
|
|
|
|
|
|
- for ($i = 0; $i < VALIDATER::MAX_ARGS; $i ++) {
|
|
|
+ for ($i = 0; $i < VALIDATER::MAX_ARGS; $i++) {
|
|
|
${"arg$i"} = isset($funcArgs[$i + 2]) ? $funcArgs[$i + 2] : null;
|
|
|
}
|
|
|
$checkFunc = 'check' . $funcName;
|
|
@@ -880,7 +880,7 @@ class dao {
|
|
|
if (!$condition)
|
|
|
return $this;
|
|
|
$funcArgs = func_get_args();
|
|
|
- for ($i = 0; $i < VALIDATER::MAX_ARGS; $i ++) {
|
|
|
+ for ($i = 0; $i < VALIDATER::MAX_ARGS; $i++) {
|
|
|
${"arg$i"} = isset($funcArgs[$i + 3]) ? $funcArgs[$i + 3] : null;
|
|
|
}
|
|
|
$this->check($fieldName, $funcName, $arg0, $arg1, $arg2);
|
|
@@ -898,7 +898,7 @@ class dao {
|
|
|
public function batchCheck($fields, $funcName) {
|
|
|
$fields = explode(',', str_replace(' ', '', $fields));
|
|
|
$funcArgs = func_get_args();
|
|
|
- for ($i = 0; $i < VALIDATER::MAX_ARGS; $i ++) {
|
|
|
+ for ($i = 0; $i < VALIDATER::MAX_ARGS; $i++) {
|
|
|
${"arg$i"} = isset($funcArgs[$i + 2]) ? $funcArgs[$i + 2] : null;
|
|
|
}
|
|
|
foreach ($fields as $fieldName)
|
|
@@ -920,7 +920,7 @@ class dao {
|
|
|
return $this;
|
|
|
$fields = explode(',', str_replace(' ', '', $fields));
|
|
|
$funcArgs = func_get_args();
|
|
|
- for ($i = 0; $i < VALIDATER::MAX_ARGS; $i ++) {
|
|
|
+ for ($i = 0; $i < VALIDATER::MAX_ARGS; $i++) {
|
|
|
${"arg$i"} = isset($funcArgs[$i + 2]) ? $funcArgs[$i + 2] : null;
|
|
|
}
|
|
|
foreach ($fields as $fieldName)
|
|
@@ -949,7 +949,7 @@ class dao {
|
|
|
$options = array();
|
|
|
if (isset($validater['options']))
|
|
|
$options = array_values($validater['options']);
|
|
|
- for ($i = 0; $i < VALIDATER::MAX_ARGS; $i ++) {
|
|
|
+ for ($i = 0; $i < VALIDATER::MAX_ARGS; $i++) {
|
|
|
${"arg$i"} = isset($options[$i]) ? $options[$i] : null;
|
|
|
}
|
|
|
$this->check($fieldName, $validater['rule'], $arg0, $arg1, $arg2);
|
|
@@ -1428,7 +1428,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function where($arg1, $arg2 = null, $arg3 = null) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
if ($arg3 !== null) {
|
|
|
$value = $this->quote($arg3);
|
|
@@ -1449,7 +1449,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function andWhere($condition) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= " AND $condition ";
|
|
|
return $this;
|
|
@@ -1463,7 +1463,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function orWhere($condition) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= " OR $condition ";
|
|
|
return $this;
|
|
@@ -1477,7 +1477,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function eq($value) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= " = " . $this->quote($value);
|
|
|
return $this;
|
|
@@ -1491,7 +1491,7 @@ class sql {
|
|
|
* @return void the sql object.
|
|
|
*/
|
|
|
public function ne($value) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= " != " . $this->quote($value);
|
|
|
return $this;
|
|
@@ -1505,7 +1505,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function gt($value) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= " > " . $this->quote($value);
|
|
|
return $this;
|
|
@@ -1519,7 +1519,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function ge($value) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= " >= " . $this->quote($value);
|
|
|
return $this;
|
|
@@ -1533,7 +1533,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function lt($value) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= " < " . $this->quote($value);
|
|
|
|
|
@@ -1564,7 +1564,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function between($min, $max) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$min = $this->quote($min);
|
|
|
$max = $this->quote($max);
|
|
@@ -1581,7 +1581,7 @@ class sql {
|
|
|
*/
|
|
|
public function in($ids) {
|
|
|
// var_dump($ids);
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= self::dbIN($ids);
|
|
|
return $this;
|
|
@@ -1609,7 +1609,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function notin($ids) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= ' NOT ' . self::dbIN($ids);
|
|
|
return $this;
|
|
@@ -1623,7 +1623,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function like($string) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= " LIKE " . $this->quote($string);
|
|
|
return $this;
|
|
@@ -1637,7 +1637,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function notLike($string) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= "NOT LIKE " . $this->quote($string);
|
|
|
return $this;
|
|
@@ -1652,7 +1652,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function findInSet($str, $strList) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
$this->sql .= "FIND_IN_SET(" . $str . "," . $strList . ")";
|
|
|
}
|
|
@@ -1665,7 +1665,7 @@ class sql {
|
|
|
* @return object the sql object.
|
|
|
*/
|
|
|
public function orderBy($order) {
|
|
|
- if ($this->inCondition and ! $this->conditionIsTrue)
|
|
|
+ if ($this->inCondition and!$this->conditionIsTrue)
|
|
|
return $this;
|
|
|
|
|
|
$order = str_replace(array('|', '', '_'), ' ', $order);
|
|
@@ -1757,8 +1757,10 @@ class sql {
|
|
|
* @return mixed
|
|
|
*/
|
|
|
public function quote($value) {
|
|
|
- if ($this->magicQuote)
|
|
|
+ var_dump($value);
|
|
|
+ if ($this->magicQuote) {
|
|
|
$value = stripslashes($value);
|
|
|
+ }
|
|
|
return $this->dbh->quote($value);
|
|
|
}
|
|
|
|