Skip to content

Commit ca5fcb8

Browse files
committed
Add/expand comments for PDO handlers
1 parent 01c8fe8 commit ca5fcb8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ext/pdo/pdo_dbh.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,7 @@ PHP_METHOD(PDO, beginTransaction)
600600
}
601601

602602
if (!dbh->methods->begin) {
603-
/* TODO: this should be an exception; see the auto-commit mode
604-
* comments below */
603+
/* Throw an exception when the driver does not support transactions */
605604
zend_throw_exception_ex(php_pdo_get_exception(), 0, "This driver doesn't support transactions");
606605
RETURN_THROWS();
607606
}
@@ -904,6 +903,8 @@ PHP_METHOD(PDO, getAttribute)
904903
RETURN_FALSE;
905904

906905
default:
906+
/* No error state, just return as the return_value has been assigned
907+
* by the get_attribute handler */
907908
return;
908909
}
909910
}

ext/pdo/php_pdo_driver.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@ typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, size_t *
255255
* specific data ... */
256256
typedef int (*pdo_dbh_fetch_error_func)(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info);
257257

258-
/* fetching of attributes */
258+
/* fetching of attributes
259+
* There are 3 return states:
260+
* * -1 for errors while retrieving a valid attribute
261+
* * 0 for attempting to retrieve an attribute which is not supported by the driver
262+
* * any other value for success, *val must be set to the attribute value */
259263
typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val);
260264

261265
/* checking/pinging persistent connections; return SUCCESS if the connection

0 commit comments

Comments
 (0)