| @@ 1325-1347 (lines=23) @@ | ||
| 1322 | * |
|
| 1323 | * @return false|int false on error |
|
| 1324 | */ |
|
| 1325 | public function delete($table, $where) |
|
| 1326 | { |
|
| 1327 | ||
| 1328 | $table = trim($table); |
|
| 1329 | ||
| 1330 | if ($table === '') { |
|
| 1331 | $this->_debug->displayError('invalid table name'); |
|
| 1332 | ||
| 1333 | return false; |
|
| 1334 | } |
|
| 1335 | ||
| 1336 | if (is_string($where)) { |
|
| 1337 | $WHERE = $this->escape($where, false); |
|
| 1338 | } elseif (is_array($where)) { |
|
| 1339 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1340 | } else { |
|
| 1341 | $WHERE = ''; |
|
| 1342 | } |
|
| 1343 | ||
| 1344 | $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1345 | ||
| 1346 | return $this->query($sql); |
|
| 1347 | } |
|
| 1348 | ||
| 1349 | /** |
|
| 1350 | * Execute a "select"-query. |
|
| @@ 1357-1377 (lines=21) @@ | ||
| 1354 | * |
|
| 1355 | * @return false|Result false on error |
|
| 1356 | */ |
|
| 1357 | public function select($table, $where = '1=1') |
|
| 1358 | { |
|
| 1359 | ||
| 1360 | if ($table === '') { |
|
| 1361 | $this->_debug->displayError('invalid table name'); |
|
| 1362 | ||
| 1363 | return false; |
|
| 1364 | } |
|
| 1365 | ||
| 1366 | if (is_string($where)) { |
|
| 1367 | $WHERE = $this->escape($where, false); |
|
| 1368 | } elseif (is_array($where)) { |
|
| 1369 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1370 | } else { |
|
| 1371 | $WHERE = ''; |
|
| 1372 | } |
|
| 1373 | ||
| 1374 | $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1375 | ||
| 1376 | return $this->query($sql); |
|
| 1377 | } |
|
| 1378 | ||
| 1379 | /** |
|
| 1380 | * Get the last sql-error. |
|