summaryrefslogtreecommitdiff
path: root/ext/oci8/oci8.c
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>2000-10-22 19:33:59 +0000
committerThies C. Arntzen <thies@php.net>2000-10-22 19:33:59 +0000
commit248d8527fd011e8d801628155a125fdff0fd821a (patch)
tree1126b899abb5ed822dd6988e1119494a58086aad /ext/oci8/oci8.c
parent7ef3e414e262ccd8d28c30784ef3a92878eb3dbf (diff)
downloadphp-git-248d8527fd011e8d801628155a125fdff0fd821a.tar.gz
@- OCIBindByName() now does better parameter-checking. (Thies)
Diffstat (limited to 'ext/oci8/oci8.c')
-rw-r--r--ext/oci8/oci8.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index c72148723f..bc7639f2f5 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2456,7 +2456,8 @@ PHP_FUNCTION(ocibindbyname)
sb4 value_sz = -1;
int ac = ZEND_NUM_ARGS(), inx;
- if (ac < 3 || ac > 5 || zend_get_parameters_ex(ac, &stmt, &name, &var, &maxlen, &type) == FAILURE) { WRONG_PARAM_COUNT;
+ if (ac < 3 || ac > 5 || zend_get_parameters_ex(ac, &stmt, &name, &var, &maxlen, &type) == FAILURE) {
+ WRONG_PARAM_COUNT;
}
switch (ac) {
@@ -2472,29 +2473,36 @@ PHP_FUNCTION(ocibindbyname)
OCI_GET_STMT(statement,stmt);
- switch ((*var)->type) {
- case IS_OBJECT :
- if ((inx = _oci_get_ocidesc(*var,&descr)) == 0) {
- RETURN_FALSE;
- }
-
- mydescr = (dvoid *) descr->ocidescr;
-
- if (! mydescr) {
- RETURN_FALSE;
- }
- value_sz = sizeof(void*);
- break;
+ switch (ocitype) {
+ case SQLT_BFILEE:
+ case SQLT_CFILEE:
+ case SQLT_CLOB:
+ case SQLT_BLOB:
+ if ((*var)->type != IS_OBJECT) {
+ php_error(E_WARNING,"Variable must be allocated using OCINewDescriptor()");
+ RETURN_FALSE;
+ }
+
+ if ((inx = _oci_get_ocidesc(*var,&descr)) == 0) {
+ php_error(E_WARNING,"Variable must be allocated using OCINewDescriptor()");
+ RETURN_FALSE;
+ }
- default:
- if (ocitype == SQLT_RSET) {
- /* XXX refcursor binding */
+ if (! (mydescr = (dvoid *) descr->ocidescr)) {
+ php_error(E_WARNING,"Descriptor empty");
+ RETURN_FALSE;
+ }
+ value_sz = sizeof(void*);
+ break;
+
+ case SQLT_RSET:
OCI_GET_STMT(bindstmt,var);
-
- mystmt = bindstmt->pStmt;
+
+ if (! (mystmt = bindstmt->pStmt)) {
+ RETURN_FALSE;
+ }
value_sz = sizeof(void*);
- }
- break;
+ break;
}
if ((ocitype == SQLT_CHR) && (value_sz == -1)) {