Skip to content

Commit 072b19f

Browse files
committed
More TODOs
1 parent 99a7173 commit 072b19f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa
6262
param->name = zend_string_init(name, strlen(name), 0);
6363
return 1;
6464
}
65+
/* TODO Error? */
6566
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined");
6667
return 0;
6768
}
@@ -72,12 +73,14 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa
7273
continue;
7374
}
7475
if (param->paramno >= 0) {
76+
/* TODO Error? */
7577
pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "PDO refuses to handle repeating the same :named parameter for multiple positions with this driver, as it might be unsafe to do so. Consider using a separate name for each parameter instead");
7678
return -1;
7779
}
7880
param->paramno = position;
7981
return 1;
8082
} ZEND_HASH_FOREACH_END();
83+
/* TODO Error? */
8184
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined");
8285
return 0;
8386
}
@@ -267,6 +270,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s
267270
if (param->paramno == -1) {
268271
/* Should this always be an Error? */
269272
char *tmp;
273+
/* TODO Error? */
270274
spprintf(&tmp, 0, "Did not find column name '%s' in the defined columns; it will not be bound", ZSTR_VAL(param->name));
271275
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", tmp);
272276
efree(tmp);
@@ -674,7 +678,7 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt) /* {{{ */
674678
fcc->called_scope = ce;
675679
return 1;
676680
} else if (!Z_ISUNDEF(stmt->fetch.cls.ctor_args)) {
677-
/* Promote to Error? */
681+
/* TODO Error? */
678682
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");
679683
return 0;
680684
} else {
@@ -868,6 +872,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
868872
}
869873
ce = stmt->fetch.cls.ce;
870874
if (!ce) {
875+
/* TODO ArgumentCountError? */
871876
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch class specified");
872877
return 0;
873878
}
@@ -885,6 +890,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
885890
stmt->fetch.cls.fci.object = Z_OBJ_P(return_value);
886891
stmt->fetch.cls.fcc.object = Z_OBJ_P(return_value);
887892
if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc) == FAILURE) {
893+
/* TODO Error? */
888894
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor");
889895
return 0;
890896
} else {
@@ -899,6 +905,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
899905

900906
case PDO_FETCH_INTO:
901907
if (Z_ISUNDEF(stmt->fetch.into)) {
908+
/* TODO ArgumentCountError? */
902909
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch-into object specified.");
903910
return 0;
904911
break;
@@ -913,6 +920,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
913920

914921
case PDO_FETCH_FUNC:
915922
if (Z_ISUNDEF(stmt->fetch.func.function)) {
923+
/* TODO ArgumentCountError? */
916924
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch function specified");
917925
return 0;
918926
}
@@ -1059,6 +1067,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
10591067
stmt->fetch.cls.fci.object = Z_OBJ_P(return_value);
10601068
stmt->fetch.cls.fcc.object = Z_OBJ_P(return_value);
10611069
if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc) == FAILURE) {
1070+
/* TODO Error? */
10621071
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor");
10631072
return 0;
10641073
} else {
@@ -1079,6 +1088,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
10791088
stmt->fetch.func.fci.param_count = idx;
10801089
stmt->fetch.func.fci.retval = &retval;
10811090
if (zend_call_function(&stmt->fetch.func.fci, &stmt->fetch.func.fcc) == FAILURE) {
1091+
/* TODO Error? */
10821092
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call user-supplied function");
10831093
return 0;
10841094
} else {
@@ -2031,6 +2041,7 @@ static zval *dbstmt_prop_write(zend_object *object, zend_string *name, zval *val
20312041
pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
20322042

20332043
if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
2044+
/* TODO Error? */
20342045
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only");
20352046
return value;
20362047
} else {
@@ -2043,6 +2054,7 @@ static void dbstmt_prop_delete(zend_object *object, zend_string *name, void **ca
20432054
pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
20442055

20452056
if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
2057+
/* TODO Error? */
20462058
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only");
20472059
} else {
20482060
zend_std_unset_property(object, name, cache_slot);

0 commit comments

Comments
 (0)