Add/expand comments for PDO handlers

This commit is contained in:
George Peter Banyard 2020-12-23 01:48:58 +01:00
parent 01c8fe8fc0
commit ca5fcb83bf
2 changed files with 8 additions and 3 deletions

View File

@ -600,8 +600,7 @@ PHP_METHOD(PDO, beginTransaction)
}
if (!dbh->methods->begin) {
/* TODO: this should be an exception; see the auto-commit mode
* comments below */
/* Throw an exception when the driver does not support transactions */
zend_throw_exception_ex(php_pdo_get_exception(), 0, "This driver doesn't support transactions");
RETURN_THROWS();
}
@ -904,6 +903,8 @@ PHP_METHOD(PDO, getAttribute)
RETURN_FALSE;
default:
/* No error state, just return as the return_value has been assigned
* by the get_attribute handler */
return;
}
}

View File

@ -255,7 +255,11 @@ typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, size_t *
* specific data ... */
typedef int (*pdo_dbh_fetch_error_func)(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info);
/* fetching of attributes */
/* fetching of attributes
* There are 3 return states:
* * -1 for errors while retrieving a valid attribute
* * 0 for attempting to retrieve an attribute which is not supported by the driver
* * any other value for success, *val must be set to the attribute value */
typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val);
/* checking/pinging persistent connections; return SUCCESS if the connection