@@ -240,40 +240,40 @@ public function changeDB($newDB) {
240
240
public function select ($ table , $ order = "" , $ cols = "* " , $ limit = NULL , $ flags = 129 , $ name = "select " ) {
241
241
if (is_array ($ cols )) {
242
242
foreach ($ cols as $ k => $ v ) {
243
- if (gettype ($ k )!="integer " )
244
- $ cols [$ k ] = "` " . $ v . "` " . " AS " . "` " . $ k . "` " ;
243
+ if (gettype ($ k )!="integer " )
244
+ $ cols [$ k ] = "` " . $ v . "` " . " AS " . "` " . $ k . "` " ;
245
245
else
246
246
$ cols [$ k ] = "` " . $ v . "` " ;
247
- };
247
+ };
248
248
$ colsValue = implode (", " , $ cols );
249
249
}
250
250
else
251
251
$ colsValue = strval ($ cols );
252
- $ limitString = ($ limit ===NULL || $ limit ==="" ) ? "" : " LIMIT " . intval ($ this ->escape ($ limit ));
253
- if (!empty ($ order ))
254
- $ order = " ORDER BY ` " . $ order . "` " . (boolval ($ flags & self ::ORDER_DESC ) ? "DESC " : "ASC " );
252
+ $ limitString = ($ limit ===NULL || $ limit ==="" ) ? "" : " LIMIT " . intval ($ this ->escape ($ limit ));
253
+ if (!empty ($ order ))
254
+ $ order = " ORDER BY ` " . $ order . "` " . (boolval ($ flags & self ::ORDER_DESC ) ? " DESC " : " ASC " );
255
255
return $ this ->query ("
256
256
SELECT $ colsValue FROM ` $ table` $ limitString$ order
257
257
" , $ flags , $ name );
258
258
}
259
259
260
260
public function selectWhere ($ table , $ cond , $ order = "" , $ cols = "* " , $ limit = NULL , $ flags = 129 , $ name = "selectWhere " ) {
261
- $ all = !boolval ($ cond & self ::COND_OR );
261
+ $ all = !boolval ($ flags & self ::COND_OR );
262
262
if (is_array ($ cols )) {
263
263
foreach ($ cols as $ k => $ v ) {
264
- if (gettype ($ k )!="integer " )
265
- $ cols [$ k ] = "` " . $ v . "` " . " AS " . "` " . $ k . "` " ;
264
+ if (gettype ($ k )!="integer " )
265
+ $ cols [$ k ] = "` " . $ v . "` " . " AS " . "` " . $ k . "` " ;
266
266
else
267
267
$ cols [$ k ] = "` " . $ v . "` " ;
268
- };
268
+ };
269
269
$ colsValue = implode (", " , $ cols );
270
270
}
271
271
else
272
272
$ colsValue = strval ($ cols );
273
273
$ condString = $ this ->getCondString ($ cond , $ all );
274
- $ limitString = ($ limit ===NULL || $ limit ==="" ) ? "" : " LIMIT " . intval ($ this ->escape ($ limit ));
274
+ $ limitString = ($ limit ===NULL || $ limit ==="" ) ? "" : " LIMIT " . intval ($ this ->escape ($ limit ));
275
275
if (!empty ($ order ))
276
- $ order = " ORDER BY ` " . $ order . "` " . (boolval ($ flags & self ::ORDER_DESC ) ? "DESC " : "ASC " );
276
+ $ order = " ORDER BY ` " . $ order . "` " . (boolval ($ flags & self ::ORDER_DESC ) ? " DESC " : " ASC " );
277
277
return $ this ->query ("
278
278
SELECT $ colsValue FROM ` $ table` WHERE $ condString$ limitString$ order
279
279
" , $ flags , $ name );
@@ -289,19 +289,19 @@ public function selectJoin($table, $join, $on, $order = "", $cols = "*", $limit
289
289
};
290
290
if (is_array ($ cols )) {
291
291
foreach ($ cols as $ k => $ v ) {
292
- if (gettype ($ k )!="integer " )
293
- $ cols [$ k ] = "` " . $ v . "` " . " AS " . "` " . $ k . "` " ;
292
+ if (gettype ($ k )!="integer " )
293
+ $ cols [$ k ] = "` " . $ v . "` " . " AS " . "` " . $ k . "` " ;
294
294
else
295
295
$ cols [$ k ] = "` " . $ v . "` " ;
296
- };
296
+ };
297
297
$ colsValue = implode (", " , $ cols );
298
298
}
299
299
else
300
300
$ colsValue = strval ($ cols );
301
301
$ onString = $ this ->getCondString ($ on , $ all , true );
302
- $ limitString = ($ limit ===NULL || $ limit ==="" ) ? "" : " LIMIT " . intval ($ this ->escape ($ limit ));
303
- if (!empty ($ order ))
304
- $ order = " ORDER BY ` " . $ order . "` " . (boolval ($ flags & self ::ORDER_DESC ) ? "DESC " : "ASC " );
302
+ $ limitString = ($ limit ===NULL || $ limit ==="" ) ? "" : " LIMIT " . intval ($ this ->escape ($ limit ));
303
+ if (!empty ($ order ))
304
+ $ order = " ORDER BY ` " . $ order . "` " . (boolval ($ flags & self ::ORDER_DESC ) ? " DESC " : " ASC " );
305
305
return $ this ->query ("
306
306
SELECT $ colsValue
307
307
FROM ` $ table`
@@ -319,20 +319,20 @@ public function selectJoinWhere($table, $join, $on, $cond, $order = "", $cols =
319
319
};
320
320
if (is_array ($ cols )) {
321
321
foreach ($ cols as $ k => $ v ) {
322
- if (gettype ($ k )!="integer " )
323
- $ cols [$ k ] = "` " . $ v . "` " . " AS " . "` " . $ k . "` " ;
322
+ if (gettype ($ k )!="integer " )
323
+ $ cols [$ k ] = "` " . $ v . "` " . " AS " . "` " . $ k . "` " ;
324
324
else
325
325
$ cols [$ k ] = "` " . $ v . "` " ;
326
- };
326
+ };
327
327
$ colsValue = implode (", " , $ cols );
328
328
}
329
329
else
330
330
$ colsValue = strval ($ cols );
331
331
$ onString = $ this ->getCondString ($ on , $ all , true );
332
332
$ condString = $ this ->getCondString ($ cond , $ all );
333
- $ limitString = ($ limit ===NULL || $ limit ==="" ) ? "" : " LIMIT " . intval ($ this ->escape ($ limit ));
334
- if (!empty ($ order ))
335
- $ order = " ORDER BY ` " . $ order . "` " . (boolval ($ flags & self ::ORDER_DESC ) ? "DESC " : "ASC " );
333
+ $ limitString = ($ limit ===NULL || $ limit ==="" ) ? "" : " LIMIT " . intval ($ this ->escape ($ limit ));
334
+ if (!empty ($ order ))
335
+ $ order = " ORDER BY ` " . $ order . "` " . (boolval ($ flags & self ::ORDER_DESC ) ? " DESC " : " ASC " );
336
336
return $ this ->query ("
337
337
SELECT $ colsValue
338
338
FROM ` $ table`
@@ -597,20 +597,20 @@ private function getCondString($a, $and, $on = false) {
597
597
};
598
598
if (!is_numeric ($ v2 ))
599
599
$ v3 = $ this ->escape ($ v2 );
600
- if (is_numeric ($ k ))
601
- $ r .= $ v ;
602
- else {
603
- $ r .= "` " . $ this ->escape ($ k ) . "` " ;
604
- $ r .= " = " ;
605
- if (is_numeric ($ v3 ))
606
- $ v3 = intval ($ v3 );
607
- if ($ v3 ===NULL )
608
- $ r .= "IS NULL " ;
609
- elseif (is_numeric ($ v3 ))
610
- $ r .= $ v ;
611
- else
612
- $ r .= ($ on || $ col ) ? "` $ v3` " : "' $ v3' " ;
613
- };
600
+ if (is_numeric ($ k ))
601
+ $ r .= $ v ;
602
+ else {
603
+ $ r .= "` " . $ this ->escape ($ k ) . "` " ;
604
+ $ r .= " = " ;
605
+ if (is_numeric ($ v3 ))
606
+ $ v3 = intval ($ v3 );
607
+ if ($ v3 ===NULL )
608
+ $ r .= "IS NULL " ;
609
+ elseif (is_numeric ($ v3 ))
610
+ $ r .= $ v ;
611
+ else
612
+ $ r .= ($ on || $ col ) ? "` $ v3` " : "' $ v3' " ;
613
+ };
614
614
$ r .= $ and ? " AND " : " OR " ;
615
615
};
616
616
return rtrim ($ r , $ and ? " AND " : " OR " );
@@ -625,18 +625,18 @@ private function getCondString($a, $and, $on = false) {
625
625
};
626
626
if (!is_numeric ($ v ))
627
627
$ v = $ this ->escape ($ v );
628
- if (is_numeric ($ k ))
629
- $ r .= $ v ;
630
- else {
631
- $ r .= "` " . $ this ->escape ($ k ) . "` " ;
632
- $ r .= " = " ;
633
- if (is_numeric ($ v ))
634
- $ v = intval ($ v );
635
- if (is_numeric ($ v ))
636
- $ r .= $ v ;
637
- else
638
- $ r .= ($ on || $ col ) ? "` $ v` " : "' $ v' " ;
639
- };
628
+ if (is_numeric ($ k ))
629
+ $ r .= $ v ;
630
+ else {
631
+ $ r .= "` " . $ this ->escape ($ k ) . "` " ;
632
+ $ r .= " = " ;
633
+ if (is_numeric ($ v ))
634
+ $ v = intval ($ v );
635
+ if (is_numeric ($ v ))
636
+ $ r .= $ v ;
637
+ else
638
+ $ r .= ($ on || $ col ) ? "` $ v` " : "' $ v' " ;
639
+ };
640
640
$ r .= $ and ? " AND " : " OR " ;
641
641
};
642
642
};
@@ -682,7 +682,7 @@ public function getColumns() {
682
682
switch ($ meta ['pdo_type ' ]) {
683
683
case PDO ::PARAM_BOOL : $ columns [bcsub ($ i , 1 )]->type = "BOOL " ; break ;
684
684
case PDO ::PARAM_INT : $ columns [bcsub ($ i , 1 )]->type = "INT " ; break ;
685
- case PDO ::PARAM_STR : $ columns [bcsub ($ i , 1 )]->type = $ meta ['native_type ' ]=="VAR_STRING " ? "VARCHAR " : " CHAR " ; break ;
685
+ case PDO ::PARAM_STR : $ columns [bcsub ($ i , 1 )]->type = $ meta ['native_type ' ]=="VAR_STRING " ? "VARCHAR " : ( $ meta [ ' native_type ' ]== " LONGLONG " ? " BIGINT " : " CHAR ") ; break ;
686
686
default : $ columns [bcsub ($ i , 1 )]->type = NULL ;
687
687
};
688
688
if ($ meta ['native_type ' ]=="TINY " )
0 commit comments