@@ 934-972 (lines=39) @@ | ||
931 | * @param mixed $val |
|
932 | * @return string |
|
933 | */ |
|
934 | public function QuoteValue ($table, $column, $val) { |
|
935 | $this->GetMetaColumn($table); |
|
936 | if (!isset($this->aMetaColumn[$table][$column]->type)) { |
|
937 | error_log("Column to quote not exists($table.$column).\n"); |
|
938 | // Return quoted value for safety |
|
939 | $val = stripslashes($val); |
|
940 | return $this->qstr($val, false); |
|
941 | } |
|
942 | ||
943 | //print_r($this->aMetaColumn[$table][$column]); |
|
944 | $type = $this->aMetaColumn[$table][$column]->type; |
|
945 | //var_dump($type); |
|
946 | if (in_array($type, array( |
|
947 | 'bigint', |
|
948 | 'bit', |
|
949 | 'decimal', |
|
950 | 'double', |
|
951 | 'float', |
|
952 | 'int', |
|
953 | 'intn', // Sybase - tinyint |
|
954 | 'mediumint', |
|
955 | 'numeric', |
|
956 | 'numericn', // Sybase - numeric |
|
957 | 'real', |
|
958 | 'smallint', |
|
959 | 'tinyint', |
|
960 | ))) |
|
961 | // Need not quote, output directly |
|
962 | return $val; |
|
963 | // Sybase timestamp |
|
964 | //elseif ($this->IsDbSybase() && 'varbinary' == $type && 'timestamp' == $column) |
|
965 | elseif ($this->IsDbSybase() && 'timestamp' == $type) |
|
966 | return '0x' . $val; |
|
967 | else { |
|
968 | // Need quote, use db's quote method |
|
969 | $val = stripslashes($val); |
|
970 | return $this->qstr($val, false); |
|
971 | } |
|
972 | } // end of func GenSqlQuote |
|
973 | ||
974 | ||
975 | /** |
@@ 1323-1373 (lines=51) @@ | ||
1320 | * @param mixed $val |
|
1321 | * @return string |
|
1322 | */ |
|
1323 | public function quoteValue($table, $col, $val) |
|
1324 | { |
|
1325 | $this->getMetaColumn($table); |
|
1326 | if (!isset($this->metaColumn[$table][$col]->type)) { |
|
1327 | trigger_error( |
|
1328 | "Column to quote not exists($table.$col).", |
|
1329 | E_USER_WARNING |
|
1330 | ); |
|
1331 | ||
1332 | // @codeCoverageIgnoreStart |
|
1333 | // Return quoted value for safety |
|
1334 | $val = stripslashes($val); |
|
1335 | ||
1336 | return $this->conn->qstr($val, false); |
|
1337 | // @codeCoverageIgnoreEnd |
|
1338 | } |
|
1339 | ||
1340 | $type = $this->metaColumn[$table][$col]->type; |
|
1341 | if (in_array( |
|
1342 | $type, |
|
1343 | [ |
|
1344 | 'bigint', |
|
1345 | 'bit', |
|
1346 | 'decimal', |
|
1347 | 'double', |
|
1348 | 'float', |
|
1349 | 'int', |
|
1350 | 'intn', // Sybase - tinyint |
|
1351 | 'mediumint', |
|
1352 | 'numeric', |
|
1353 | 'numericn', // Sybase - numeric |
|
1354 | 'real', |
|
1355 | 'smallint', |
|
1356 | 'tinyint', |
|
1357 | ] |
|
1358 | )) { |
|
1359 | // Need not quote, output directly |
|
1360 | return $val; |
|
1361 | ||
1362 | } elseif ($this->isDbSybase() && 'timestamp' == $type) { |
|
1363 | // Sybase timestamp |
|
1364 | // @codeCoverageIgnoreStart |
|
1365 | return '0x' . $val; |
|
1366 | //elseif ($this->IsDbSybase() && 'varbinary' == $type && 'timestamp' == $col) |
|
1367 | // @codeCoverageIgnoreEnd |
|
1368 | ||
1369 | } else { |
|
1370 | // Need quote, use db's quote method |
|
1371 | $val = stripslashes($val); |
|
1372 | ||
1373 | return $this->conn->qstr($val, false); |
|
1374 | } |
|
1375 | } |
|
1376 |