CVS update: php3/functions
| From: | thies | Date: | Mon, 08 Feb 1999 14:28:05 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3978@lists.php.net to get a copy of this message | ||
Date: Monday February 8, 1999 @ 9:28
Author: thies
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv19772
Modified Files:
oci8.c
Log Message:
CLOB and BLOB support
Index: php3/functions/oci8.c
diff -c php3/functions/oci8.c:1.27 php3/functions/oci8.c:1.28
*** php3/functions/oci8.c:1.27 Mon Feb 8 09:03:22 1999
--- php3/functions/oci8.c Mon Feb 8 09:28:04 1999
***************
*** 31,37 ****
+----------------------------------------------------------------------+
*/
! /* $Id: oci8.c,v 1.27 1999/02/08 14:03:22 thies Exp $ */
#include "php.h"
#include "internal_functions.h"
--- 31,37 ----
+----------------------------------------------------------------------+
*/
! /* $Id: oci8.c,v 1.28 1999/02/08 14:28:04 thies Exp $ */
#include "php.h"
#include "internal_functions.h"
***************
*** 278,306 ****
REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT);
! REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
! REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
- #if test
- static sb4 cbf_no_data(dvoid *ctxp, OCIBind *bindp, ub4 iter, ub4 index,
- dvoid **bufpp, ub4 *alenpp, ub1 *piecep, dvoid **indpp)
- {
- /*
- * This is a dummy input callback function that provides input data
- * for the bind variables in the RETURNING clause.
- */
- *bufpp = (dvoid *) 0;
- *alenpp = 0;
- *indpp = (dvoid *) 0;
- *piecep = OCI_ONE_PIECE;
-
- return OCI_CONTINUE;
- }
- #endif
-
/* ----------------------------------------------------------------- */
--- 278,289 ----
REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT);
! REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
! REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
/* ----------------------------------------------------------------- */
***************
*** 1019,1032 ****
/************************* EXTENSION FUNCTIONS *************************/
! /* {{{ proto int OCIBindByName(int stmt, string name, mixed &var, int maxlength)
Bind a PHP variable to an Oracle placeholder by name.
if you want to bind a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE
binding!!!
*/
void php3_oci8_bindbyname(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *stmt, *name, *var, *maxlen, *tmp;
oci8_statement *statement;
oci8_bind *bind, *tmp_bind;
sword error;
--- 1002,1015 ----
/************************* EXTENSION FUNCTIONS *************************/
! /* {{{ proto int OCIBindByName(int stmt, string name, mixed &var, int maxlength [,int
type])
Bind a PHP variable to an Oracle placeholder by name.
if you want to bind a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE
binding!!!
*/
void php3_oci8_bindbyname(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *stmt, *name, *var, *maxlen, *tmp,*type;
oci8_statement *statement;
oci8_bind *bind, *tmp_bind;
sword error;
***************
*** 1036,1063 ****
int descr_type;
ocitype = SQLT_STR;
! if (getParameters(ht, 4, &stmt, &name, &var, &maxlen) == SUCCESS) {
! convert_to_long(maxlen);
! ocimaxlen = maxlen->value.lval;
} else {
WRONG_PARAM_COUNT;
}
switch (var->type) {
case IS_OBJECT :
- /* find out what the hell the type of the object is and bind it!!! */
- if (_php3_hash_find(var->value.ht, "type", sizeof("type"), (void
**)&tmp) == FAILURE) {
- php3_error(E_WARNING, "unable to find my locator property");
- RETURN_FALSE;
- }
-
- switch (tmp->value.lval) { /* XXX i think we have to supply the type as a parameter!!!! */
- case OCI_DTYPE_LOB :
- ocitype = SQLT_CLOB;
- break;
- }
-
if (_php3_hash_find(var->value.ht, "descriptor",
sizeof("descriptor"), (void **)&tmp) == FAILURE) {
php3_error(E_WARNING, "unable to find my locator property");
RETURN_FALSE;
--- 1019,1040 ----
int descr_type;
ocitype = SQLT_STR;
+
+ if (getParameters(ht, 5, &stmt, &name, &var, &maxlen,&type) == SUCCESS) {
+
+ convert_to_long(type); ocitype = type->value.lval;
+ convert_to_long(maxlen); ocimaxlen = maxlen->value.lval;
+
+ } else if (getParameters(ht, 4, &stmt, &name, &var, &maxlen) == SUCCESS) {
! convert_to_long(maxlen); ocimaxlen = maxlen->value.lval;
!
} else {
WRONG_PARAM_COUNT;
}
switch (var->type) {
case IS_OBJECT :
if (_php3_hash_find(var->value.ht, "descriptor",
sizeof("descriptor"), (void **)&tmp) == FAILURE) {
php3_error(E_WARNING, "unable to find my locator property");
RETURN_FALSE;
***************
*** 1069,1085 ****
php3_error(E_WARNING, "unable to find identifier (%d)",
tmp->value.lval);
RETURN_FALSE;
}
break;
default:
convert_to_string(var);
if (ocimaxlen == -1) {
! ocimaxlen = var->value.str.len;
}
break;
}
- ocimaxlen++; /* SQLT_STR needs a trailing 0 - maybe we need to resize the var buffers????? */
convert_to_long(stmt);
convert_to_string(name);
--- 1046,1062 ----
php3_error(E_WARNING, "unable to find identifier (%d)",
tmp->value.lval);
RETURN_FALSE;
}
+
break;
default:
convert_to_string(var);
if (ocimaxlen == -1) {
! ocimaxlen = var->value.str.len + 1; /* SQLT_STR needs a trailing 0 - maybe we need to
resize the var buffers????? */
}
break;
}
convert_to_long(stmt);
convert_to_string(name);
***************
*** 1132,1138 ****
error = OCIBindDynamic(bind->pBind,
statement->pError,
(dvoid *)bind,
! /* cbf_no_data*/ oci8_bind_in_callback,
(dvoid *)bind,
oci8_bind_out_callback);
if (error != OCI_SUCCESS) {
--- 1109,1115 ----
error = OCIBindDynamic(bind->pBind,
statement->pError,
(dvoid *)bind,
! oci8_bind_in_callback,
(dvoid *)bind,
oci8_bind_out_callback);
if (error != OCI_SUCCESS) {
***************
*** 1326,1332 ****
locator = php3_list_insert(mylob, OCI8_GLOBAL(php3_oci8_module).le_descr);
add_property_long(return_value, "descriptor", locator);
add_property_long(return_value, "connection", conn->value.lval);
- add_property_long(return_value, "type", type);
add_method(return_value, "save", php3_oci8_savelob);
add_method(return_value, "load", php3_oci8_loadlob);
}
--- 1303,1308 ----
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net