1
0
mirror of https://github.com/php/php-src.git synced 2026-04-10 01:23:53 +02:00

@- OCIBindByName() now does better parameter-checking. (Thies)

This commit is contained in:
Thies C. Arntzen
2000-10-22 19:33:59 +00:00
parent 7ef3e414e2
commit 248d8527fd

View File

@@ -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;
}
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;
}
mydescr = (dvoid *) descr->ocidescr;
if (! mydescr) {
RETURN_FALSE;
}
value_sz = sizeof(void*);
break;
default:
if (ocitype == SQLT_RSET) {
/* XXX refcursor binding */
OCI_GET_STMT(bindstmt,var);
mystmt = bindstmt->pStmt;
if (! (mydescr = (dvoid *) descr->ocidescr)) {
php_error(E_WARNING,"Descriptor empty");
RETURN_FALSE;
}
value_sz = sizeof(void*);
}
break;
break;
case SQLT_RSET:
OCI_GET_STMT(bindstmt,var);
if (! (mystmt = bindstmt->pStmt)) {
RETURN_FALSE;
}
value_sz = sizeof(void*);
break;
}
if ((ocitype == SQLT_CHR) && (value_sz == -1)) {