|
@@ -141,29 +141,29 @@ class MySQL implements DatabaseInterface {
|
141
|
141
|
return mysqli_query($db,$sql);
|
142
|
142
|
}
|
143
|
143
|
|
144
|
|
- protected function convertFloatAndInt($result,&$values, $fields) {
|
145
|
|
- array_walk($values, function(&$v,$i) use ($result,$fields){
|
146
|
|
- $t = $fields[$i]->type;
|
147
|
|
- if (is_string($v) && in_array($t,array(1,2,3,4,5,6,8,9))) {
|
148
|
|
- $v+=0;
|
149
|
|
- }
|
150
|
|
- });
|
151
|
|
- }
|
152
|
|
-
|
153
|
|
- public function fetchAssoc($result,$fields=false) {
|
154
|
|
- $values = mysqli_fetch_assoc($result);
|
|
144
|
+ protected function convertFloatAndInt($result,&$values, $fields) {
|
|
145
|
+ array_walk($values, function(&$v,$i) use ($result,$fields){
|
|
146
|
+ $t = $fields[$i]->type;
|
|
147
|
+ if (is_string($v) && in_array($t,array(1,2,3,4,5,6,8,9))) {
|
|
148
|
+ $v+=0;
|
|
149
|
+ }
|
|
150
|
+ });
|
|
151
|
+ }
|
|
152
|
+
|
|
153
|
+ public function fetchAssoc($result,$fields=false) {
|
|
154
|
+ $values = mysqli_fetch_assoc($result);
|
155
|
155
|
if ($values && $fields && !defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) {
|
156
|
|
- $this->convertFloatAndInt($result,$values,$fields);
|
157
|
|
- }
|
158
|
|
- return $values;
|
159
|
|
- }
|
|
156
|
+ $this->convertFloatAndInt($result,$values,$fields);
|
|
157
|
+ }
|
|
158
|
+ return $values;
|
|
159
|
+ }
|
160
|
160
|
|
161
|
161
|
public function fetchRow($result,$fields=false) {
|
162
|
162
|
$values = mysqli_fetch_row($result);
|
163
|
163
|
if ($values && $fields && !defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) {
|
164
|
|
- $this->convertFloatAndInt($result,$values,array_values($fields));
|
165
|
|
- }
|
166
|
|
- return $values;
|
|
164
|
+ $this->convertFloatAndInt($result,$values,array_values($fields));
|
|
165
|
+ }
|
|
166
|
+ return $values;
|
167
|
167
|
}
|
168
|
168
|
|
169
|
169
|
public function insertId($result) {
|
|
@@ -1152,7 +1152,7 @@ class PHP_CRUD_API {
|
1152
|
1152
|
case 'ge': return array('! >= ?',$field,$value);
|
1153
|
1153
|
case 'gt': return array('! > ?',$field,$value);
|
1154
|
1154
|
case 'bt': $v = explode(',',$value); if (count($v)<2) return false;
|
1155
|
|
- return array('! BETWEEN ? AND ?',$field,$v[0],$v[1]);
|
|
1155
|
+ return array('! BETWEEN ? AND ?',$field,$v[0],$v[1]);
|
1156
|
1156
|
case 'in': return array('! IN ?',$field,explode(',',$value));
|
1157
|
1157
|
case 'is': return array('! IS NULL',$field);
|
1158
|
1158
|
}
|
|
@@ -1189,7 +1189,7 @@ class PHP_CRUD_API {
|
1189
|
1189
|
case 'nge': return array('! < ?',$field,$value);
|
1190
|
1190
|
case 'ngt': return array('! <= ?',$field,$value);
|
1191
|
1191
|
case 'nbt': $v = explode(',',$value); if (count($v)<2) return false;
|
1192
|
|
- return array('! NOT BETWEEN ? AND ?',$field,$v[0],$v[1]);
|
|
1192
|
+ return array('! NOT BETWEEN ? AND ?',$field,$v[0],$v[1]);
|
1193
|
1193
|
case 'nin': return array('! NOT IN ?',$field,explode(',',$value));
|
1194
|
1194
|
case 'nis': return array('! IS NOT NULL',$field);
|
1195
|
1195
|
}
|