| @@ 1360-1382 (lines=23) @@ | ||
| 1357 | * |
|
| 1358 | * @return false|int false on error |
|
| 1359 | */ |
|
| 1360 | public function delete($table, $where) |
|
| 1361 | { |
|
| 1362 | ||
| 1363 | $table = trim($table); |
|
| 1364 | ||
| 1365 | if ($table === '') { |
|
| 1366 | $this->_debug->displayError('invalid table name'); |
|
| 1367 | ||
| 1368 | return false; |
|
| 1369 | } |
|
| 1370 | ||
| 1371 | if (is_string($where)) { |
|
| 1372 | $WHERE = $this->escape($where, false); |
|
| 1373 | } elseif (is_array($where)) { |
|
| 1374 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1375 | } else { |
|
| 1376 | $WHERE = ''; |
|
| 1377 | } |
|
| 1378 | ||
| 1379 | $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1380 | ||
| 1381 | return $this->query($sql); |
|
| 1382 | } |
|
| 1383 | ||
| 1384 | /** |
|
| 1385 | * Execute a "select"-query. |
|
| @@ 1392-1412 (lines=21) @@ | ||
| 1389 | * |
|
| 1390 | * @return false|Result false on error |
|
| 1391 | */ |
|
| 1392 | public function select($table, $where = '1=1') |
|
| 1393 | { |
|
| 1394 | ||
| 1395 | if ($table === '') { |
|
| 1396 | $this->_debug->displayError('invalid table name'); |
|
| 1397 | ||
| 1398 | return false; |
|
| 1399 | } |
|
| 1400 | ||
| 1401 | if (is_string($where)) { |
|
| 1402 | $WHERE = $this->escape($where, false); |
|
| 1403 | } elseif (is_array($where)) { |
|
| 1404 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1405 | } else { |
|
| 1406 | $WHERE = ''; |
|
| 1407 | } |
|
| 1408 | ||
| 1409 | $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1410 | ||
| 1411 | return $this->query($sql); |
|
| 1412 | } |
|
| 1413 | ||
| 1414 | /** |
|
| 1415 | * Get the last sql-error. |
|