Skip to content

Exceptions_Query

Grigoriev Oleg edited this page Apr 23, 2012 · 3 revisions

go\DB\Exceptions\Query: ошибка в запросе

Раздел: обработка исключений.

final class Query extends Logic

Ошибка при выполнении запроса.

$db->query('SELECT * FORM `table`');
// go\DB\Exceptions\Query:
// Error SQL "SELECT * FORM `table`"; error="You have an error in your SQL syntax;
// check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM `table`' at line 1" [#1064]

Методы

try {
    $db->query($pattern, $data);
} catch (go\DB\Exceptions\Query $e) {
    echo 'SQL-query: '.$e->getQuery()."\n";
    echo 'Error description: '.$e->getError()."\n";
    echo 'Error code: '.$e->getErrorCode()."\n";
}