4141 RETURN_THROWS(); \
4242 } \
4343
44- static inline int rewrite_name_to_position (pdo_stmt_t * stmt , struct pdo_bound_param_data * param ) /* {{{ */
44+ static inline bool rewrite_name_to_position (pdo_stmt_t * stmt , struct pdo_bound_param_data * param ) /* {{{ */
4545{
4646 if (stmt -> bound_param_map ) {
4747 /* rewriting :name to ? style.
@@ -90,9 +90,9 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa
9090/* }}} */
9191
9292/* trigger callback hook for parameters */
93- static int dispatch_param_event (pdo_stmt_t * stmt , enum pdo_param_event event_type ) /* {{{ */
93+ static bool dispatch_param_event (pdo_stmt_t * stmt , enum pdo_param_event event_type ) /* {{{ */
9494{
95- int ret = 1 , is_param = 1 ;
95+ bool ret = 1 , is_param = 1 ;
9696 struct pdo_bound_param_data * param ;
9797 HashTable * ht ;
9898
@@ -212,7 +212,7 @@ static void param_dtor(zval *el) /* {{{ */
212212}
213213/* }}} */
214214
215- static int really_register_bound_param (struct pdo_bound_param_data * param , pdo_stmt_t * stmt , int is_param ) /* {{{ */
215+ static bool really_register_bound_param (struct pdo_bound_param_data * param , pdo_stmt_t * stmt , bool is_param ) /* {{{ */
216216{
217217 HashTable * hash ;
218218 zval * parameter ;
@@ -381,12 +381,7 @@ PHP_METHOD(PDOStatement, execute)
381381 param .paramno = -1 ;
382382 } else {
383383 /* we're okay to be zero based here */
384- /* num_index is unsignend
385- if (num_index < 0) {
386- pdo_raise_impl_error(stmt->dbh, stmt, "HY093", NULL);
387- RETURN_FALSE;
388- }
389- */
384+ /* num_index is unsignend */
390385 param .paramno = num_index ;
391386 }
392387
@@ -601,7 +596,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
601596}
602597/* }}} */
603598
604- static int do_fetch_common (pdo_stmt_t * stmt , enum pdo_fetch_orientation ori , zend_long offset ) /* {{{ */
599+ static bool do_fetch_common (pdo_stmt_t * stmt , enum pdo_fetch_orientation ori , zend_long offset ) /* {{{ */
605600{
606601 if (!stmt -> executed ) {
607602 return 0 ;
@@ -652,7 +647,7 @@ static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zen
652647}
653648/* }}} */
654649
655- static int do_fetch_class_prepare (pdo_stmt_t * stmt ) /* {{{ */
650+ static bool do_fetch_class_prepare (pdo_stmt_t * stmt ) /* {{{ */
656651{
657652 zend_class_entry * ce = stmt -> fetch .cls .ce ;
658653 zend_fcall_info * fci = & stmt -> fetch .cls .fci ;
@@ -677,16 +672,15 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt) /* {{{ */
677672 fcc -> called_scope = ce ;
678673 return 1 ;
679674 } else if (!Z_ISUNDEF (stmt -> fetch .cls .ctor_args )) {
680- /* TODO Error? */
681- pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "user-supplied class does not have a constructor, use NULL for the ctor_params parameter, or simply omit it" );
675+ zend_throw_error (NULL , "User-supplied statement does not accept constructor arguments" );
682676 return 0 ;
683677 } else {
684678 return 1 ; /* no ctor no args is also ok */
685679 }
686680}
687681/* }}} */
688682
689- static int make_callable_ex (pdo_stmt_t * stmt , zval * callable , zend_fcall_info * fci , zend_fcall_info_cache * fcc , int num_args ) /* {{{ */
683+ static bool make_callable_ex (pdo_stmt_t * stmt , zval * callable , zend_fcall_info * fci , zend_fcall_info_cache * fcc , int num_args ) /* {{{ */
690684{
691685 char * is_callable_error = NULL ;
692686
@@ -809,6 +803,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
809803
810804 case PDO_FETCH_KEY_PAIR :
811805 if (stmt -> column_count != 2 ) {
806+ /* TODO: Error? */
812807 pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain exactly 2 columns." );
813808 return 0 ;
814809 }
@@ -904,6 +899,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
904899 break ;
905900
906901 case PDO_FETCH_INTO :
902+ /* TODO: Make this an assertion and ensure this is true higher up? */
907903 if (Z_ISUNDEF (stmt -> fetch .into )) {
908904 /* TODO ArgumentCountError? */
909905 pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "No fetch-into object specified." );
@@ -919,6 +915,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
919915 break ;
920916
921917 case PDO_FETCH_FUNC :
918+ /* TODO: Make this an assertion and ensure this is true higher up? */
922919 if (Z_ISUNDEF (stmt -> fetch .func .function )) {
923920 /* TODO ArgumentCountError? */
924921 pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "No fetch function specified" );
@@ -1633,7 +1630,7 @@ PHP_METHOD(PDOStatement, setAttribute)
16331630
16341631/* {{{ Get an attribute */
16351632
1636- static int generic_stmt_attr_get (pdo_stmt_t * stmt , zval * return_value , zend_long attr )
1633+ static bool generic_stmt_attr_get (pdo_stmt_t * stmt , zval * return_value , zend_long attr )
16371634{
16381635 switch (attr ) {
16391636 case PDO_ATTR_EMULATE_PREPARES :
0 commit comments