41
41
RETURN_THROWS(); \
42
42
} \
43
43
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 ) /* {{{ */
45
45
{
46
46
if (stmt -> bound_param_map ) {
47
47
/* rewriting :name to ? style.
@@ -90,9 +90,9 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa
90
90
/* }}} */
91
91
92
92
/* 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 ) /* {{{ */
94
94
{
95
- int ret = 1 , is_param = 1 ;
95
+ bool ret = 1 , is_param = 1 ;
96
96
struct pdo_bound_param_data * param ;
97
97
HashTable * ht ;
98
98
@@ -212,7 +212,7 @@ static void param_dtor(zval *el) /* {{{ */
212
212
}
213
213
/* }}} */
214
214
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 ) /* {{{ */
216
216
{
217
217
HashTable * hash ;
218
218
zval * parameter ;
@@ -381,12 +381,7 @@ PHP_METHOD(PDOStatement, execute)
381
381
param .paramno = -1 ;
382
382
} else {
383
383
/* 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 */
390
385
param .paramno = num_index ;
391
386
}
392
387
@@ -601,7 +596,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
601
596
}
602
597
/* }}} */
603
598
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 ) /* {{{ */
605
600
{
606
601
if (!stmt -> executed ) {
607
602
return 0 ;
@@ -652,7 +647,7 @@ static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zen
652
647
}
653
648
/* }}} */
654
649
655
- static int do_fetch_class_prepare (pdo_stmt_t * stmt ) /* {{{ */
650
+ static bool do_fetch_class_prepare (pdo_stmt_t * stmt ) /* {{{ */
656
651
{
657
652
zend_class_entry * ce = stmt -> fetch .cls .ce ;
658
653
zend_fcall_info * fci = & stmt -> fetch .cls .fci ;
@@ -677,16 +672,15 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt) /* {{{ */
677
672
fcc -> called_scope = ce ;
678
673
return 1 ;
679
674
} 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" );
682
676
return 0 ;
683
677
} else {
684
678
return 1 ; /* no ctor no args is also ok */
685
679
}
686
680
}
687
681
/* }}} */
688
682
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 ) /* {{{ */
690
684
{
691
685
char * is_callable_error = NULL ;
692
686
@@ -809,6 +803,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
809
803
810
804
case PDO_FETCH_KEY_PAIR :
811
805
if (stmt -> column_count != 2 ) {
806
+ /* TODO: Error? */
812
807
pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain exactly 2 columns." );
813
808
return 0 ;
814
809
}
@@ -904,6 +899,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
904
899
break ;
905
900
906
901
case PDO_FETCH_INTO :
902
+ /* TODO: Make this an assertion and ensure this is true higher up? */
907
903
if (Z_ISUNDEF (stmt -> fetch .into )) {
908
904
/* TODO ArgumentCountError? */
909
905
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
919
915
break ;
920
916
921
917
case PDO_FETCH_FUNC :
918
+ /* TODO: Make this an assertion and ensure this is true higher up? */
922
919
if (Z_ISUNDEF (stmt -> fetch .func .function )) {
923
920
/* TODO ArgumentCountError? */
924
921
pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "No fetch function specified" );
@@ -1633,7 +1630,7 @@ PHP_METHOD(PDOStatement, setAttribute)
1633
1630
1634
1631
/* {{{ Get an attribute */
1635
1632
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 )
1637
1634
{
1638
1635
switch (attr ) {
1639
1636
case PDO_ATTR_EMULATE_PREPARES :
0 commit comments