| @@ 933-971 (lines=39) @@ | ||
| 930 | * @param mixed $val |
|
| 931 | * @return string |
|
| 932 | */ |
|
| 933 | public function QuoteValue ($table, $column, $val) { |
|
| 934 | $this->GetMetaColumn($table); |
|
| 935 | if (!isset($this->aMetaColumn[$table][$column]->type)) { |
|
| 936 | error_log("Column to quote not exists($table.$column).\n"); |
|
| 937 | // Return quoted value for safety |
|
| 938 | $val = stripslashes($val); |
|
| 939 | return $this->qstr($val, false); |
|
| 940 | } |
|
| 941 | ||
| 942 | //print_r($this->aMetaColumn[$table][$column]); |
|
| 943 | $type = $this->aMetaColumn[$table][$column]->type; |
|
| 944 | //var_dump($type); |
|
| 945 | if (in_array($type, array( |
|
| 946 | 'bigint', |
|
| 947 | 'bit', |
|
| 948 | 'decimal', |
|
| 949 | 'double', |
|
| 950 | 'float', |
|
| 951 | 'int', |
|
| 952 | 'intn', // Sybase - tinyint |
|
| 953 | 'mediumint', |
|
| 954 | 'numeric', |
|
| 955 | 'numericn', // Sybase - numeric |
|
| 956 | 'real', |
|
| 957 | 'smallint', |
|
| 958 | 'tinyint', |
|
| 959 | ))) |
|
| 960 | // Need not quote, output directly |
|
| 961 | return $val; |
|
| 962 | // Sybase timestamp |
|
| 963 | //elseif ($this->IsDbSybase() && 'varbinary' == $type && 'timestamp' == $column) |
|
| 964 | elseif ($this->IsDbSybase() && 'timestamp' == $type) |
|
| 965 | return '0x' . $val; |
|
| 966 | else { |
|
| 967 | // Need quote, use db's quote method |
|
| 968 | $val = stripslashes($val); |
|
| 969 | return $this->qstr($val, false); |
|
| 970 | } |
|
| 971 | } // end of func GenSqlQuote |
|
| 972 | ||
| 973 | ||
| 974 | /** |
|
| @@ 1227-1277 (lines=51) @@ | ||
| 1224 | * @param mixed $val |
|
| 1225 | * @return string |
|
| 1226 | */ |
|
| 1227 | public function quoteValue($table, $col, $val) |
|
| 1228 | { |
|
| 1229 | $this->getMetaColumn($table); |
|
| 1230 | if (!isset($this->metaColumn[$table][$col]->type)) { |
|
| 1231 | trigger_error( |
|
| 1232 | "Column to quote not exists($table.$col).", |
|
| 1233 | E_USER_WARNING |
|
| 1234 | ); |
|
| 1235 | ||
| 1236 | // @codeCoverageIgnoreStart |
|
| 1237 | // Return quoted value for safety |
|
| 1238 | $val = stripslashes($val); |
|
| 1239 | return $this->conn->qstr($val, false); |
|
| 1240 | // @codeCoverageIgnoreEnd |
|
| 1241 | } |
|
| 1242 | ||
| 1243 | $type = $this->metaColumn[$table][$col]->type; |
|
| 1244 | if (in_array( |
|
| 1245 | $type, |
|
| 1246 | [ |
|
| 1247 | 'bigint', |
|
| 1248 | 'bit', |
|
| 1249 | 'decimal', |
|
| 1250 | 'double', |
|
| 1251 | 'float', |
|
| 1252 | 'int', |
|
| 1253 | 'intn', // Sybase - tinyint |
|
| 1254 | 'mediumint', |
|
| 1255 | 'numeric', |
|
| 1256 | 'numericn', // Sybase - numeric |
|
| 1257 | 'real', |
|
| 1258 | 'smallint', |
|
| 1259 | 'tinyint', |
|
| 1260 | ] |
|
| 1261 | )) { |
|
| 1262 | // Need not quote, output directly |
|
| 1263 | return $val; |
|
| 1264 | ||
| 1265 | } elseif ($this->isDbSybase() && 'timestamp' == $type) { |
|
| 1266 | // Sybase timestamp |
|
| 1267 | // @codeCoverageIgnoreStart |
|
| 1268 | return '0x' . $val; |
|
| 1269 | //elseif ($this->IsDbSybase() && 'varbinary' == $type && 'timestamp' == $col) |
|
| 1270 | // @codeCoverageIgnoreEnd |
|
| 1271 | ||
| 1272 | } else { |
|
| 1273 | // Need quote, use db's quote method |
|
| 1274 | $val = stripslashes($val); |
|
| 1275 | return $this->conn->qstr($val, false); |
|
| 1276 | } |
|
| 1277 | } |
|
| 1278 | ||
| 1279 | ||
| 1280 | /** |
|