| @@ 1335-1357 (lines=23) @@ | ||
| 1332 | * |
|
| 1333 | * @return false|int false on error |
|
| 1334 | */ |
|
| 1335 | public function delete($table, $where) |
|
| 1336 | { |
|
| 1337 | ||
| 1338 | $table = trim($table); |
|
| 1339 | ||
| 1340 | if ($table === '') { |
|
| 1341 | $this->_debug->displayError('invalid table name'); |
|
| 1342 | ||
| 1343 | return false; |
|
| 1344 | } |
|
| 1345 | ||
| 1346 | if (is_string($where)) { |
|
| 1347 | $WHERE = $this->escape($where, false); |
|
| 1348 | } elseif (is_array($where)) { |
|
| 1349 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1350 | } else { |
|
| 1351 | $WHERE = ''; |
|
| 1352 | } |
|
| 1353 | ||
| 1354 | $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1355 | ||
| 1356 | return $this->query($sql); |
|
| 1357 | } |
|
| 1358 | ||
| 1359 | /** |
|
| 1360 | * Execute a "select"-query. |
|
| @@ 1367-1387 (lines=21) @@ | ||
| 1364 | * |
|
| 1365 | * @return false|Result false on error |
|
| 1366 | */ |
|
| 1367 | public function select($table, $where = '1=1') |
|
| 1368 | { |
|
| 1369 | ||
| 1370 | if ($table === '') { |
|
| 1371 | $this->_debug->displayError('invalid table name'); |
|
| 1372 | ||
| 1373 | return false; |
|
| 1374 | } |
|
| 1375 | ||
| 1376 | if (is_string($where)) { |
|
| 1377 | $WHERE = $this->escape($where, false); |
|
| 1378 | } elseif (is_array($where)) { |
|
| 1379 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1380 | } else { |
|
| 1381 | $WHERE = ''; |
|
| 1382 | } |
|
| 1383 | ||
| 1384 | $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1385 | ||
| 1386 | return $this->query($sql); |
|
| 1387 | } |
|
| 1388 | ||
| 1389 | /** |
|
| 1390 | * Get the last sql-error. |
|