From baabd1192973156ac79c35f6d1b0dced4af8e8fb Mon Sep 17 00:00:00 2001 From: Matteo Beccati Date: Tue, 4 Jun 2013 17:20:20 +0200 Subject: Refactored custom PDO_pgsql methods to trigger errors/exceptions BC Break: the custom methods were previously just return false on failure. Now they throw an exception with a proper error message. An hopefully welcome improvement, but some application might be depending on the old behaviour. FWIW the PDO::pgsqlCopy* methods are not documented, even though they are available since 5.3.x. --- ext/pdo_pgsql/php_pdo_pgsql_int.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ext/pdo_pgsql/php_pdo_pgsql_int.h') diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index 02a6717760..5600a92541 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -83,9 +83,11 @@ typedef struct { extern pdo_driver_t pdo_pgsql_driver; -extern int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *sqlstate, const char *file, int line TSRMLS_DC); -#define pdo_pgsql_error(d,e,z) _pdo_pgsql_error(d, NULL, e, z, __FILE__, __LINE__ TSRMLS_CC) -#define pdo_pgsql_error_stmt(s,e,z) _pdo_pgsql_error(s->dbh, s, e, z, __FILE__, __LINE__ TSRMLS_CC) +extern int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *sqlstate, const char *msg, const char *file, int line TSRMLS_DC); +#define pdo_pgsql_error(d,e,z) _pdo_pgsql_error(d, NULL, e, z, NULL, __FILE__, __LINE__ TSRMLS_CC) +#define pdo_pgsql_error_msg(d,e,m) _pdo_pgsql_error(d, NULL, e, NULL, m, __FILE__, __LINE__ TSRMLS_CC) +#define pdo_pgsql_error_stmt(s,e,z) _pdo_pgsql_error(s->dbh, s, e, z, NULL, __FILE__, __LINE__ TSRMLS_CC) +#define pdo_pgsql_error_stmt_msg(s,e,m) _pdo_pgsql_error(s->dbh, s, e, NULL, m, __FILE__, __LINE__ TSRMLS_CC) extern struct pdo_stmt_methods pgsql_stmt_methods; -- cgit v1.2.1