CVS update: php3/functions
| From: | thies | Date: | Mon, 08 Feb 1999 16:54:23 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3982@lists.php.net to get a copy of this message | ||
Date: Monday February 8, 1999 @ 11:54
Author: thies
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv26202
Modified Files:
oci8.c
Log Message:
small fixes
STILL WORK IN PROGRESS!!!!
Index: php3/functions/oci8.c
diff -c php3/functions/oci8.c:1.28 php3/functions/oci8.c:1.29
*** php3/functions/oci8.c:1.28 Mon Feb 8 09:28:04 1999
--- php3/functions/oci8.c Mon Feb 8 11:54:22 1999
***************
*** 1,3 ****
--- 1,4 ----
+ #define OCI8_USE_EMALLOC 0
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
***************
*** 31,37 ****
+----------------------------------------------------------------------+
*/
! /* $Id: oci8.c,v 1.28 1999/02/08 14:28:04 thies Exp $ */
#include "php.h"
#include "internal_functions.h"
--- 32,38 ----
+----------------------------------------------------------------------+
*/
! /* $Id: oci8.c,v 1.29 1999/02/08 16:54:22 thies Exp $ */
#include "php.h"
#include "internal_functions.h"
***************
*** 130,136 ****
/* static int oci8_ping(oci8_connection *conn); XXX NYI */
static void oci8_debug(const char *format,...);
static void oci8_close_conn(oci8_connection *connection);
! static void oci8_free_descr(oci8_connection *connection);
static void oci8_free_stmt(oci8_statement *statement);
static oci8_connection *oci8_get_conn(int, const char *, HashTable *, HashTable *);
--- 131,137 ----
/* static int oci8_ping(oci8_connection *conn); XXX NYI */
static void oci8_debug(const char *format,...);
static void oci8_close_conn(oci8_connection *connection);
! static void oci8_free_descr(dvoid *descr);
static void oci8_free_stmt(oci8_statement *statement);
static oci8_connection *oci8_get_conn(int, const char *, HashTable *, HashTable *);
***************
*** 341,352 ****
/* {{{ debug malloc/realloc/free */
! #if 0
CONST dvoid *mymalloc(dvoid *ctx, size_t size)
{
dvoid *ret;
oci8_debug("mymalloc(%d)\n", size);
- rflush(GLOBAL(php3_rqst));
ret = (dvoid *)emalloc(size);
return ret;
}
--- 342,352 ----
/* {{{ debug malloc/realloc/free */
! #if OCI8_USE_EMALLOC
CONST dvoid *mymalloc(dvoid *ctx, size_t size)
{
dvoid *ret;
oci8_debug("mymalloc(%d)\n", size);
ret = (dvoid *)emalloc(size);
return ret;
}
***************
*** 355,361 ****
{
dvoid *ret;
oci8_debug("myrealloc(%08x, %d)\n", ptr, size);
- rflush(GLOBAL(php3_rqst));
ret = (dvoid *)erealloc(ptr, size);
return ptr;
}
--- 355,360 ----
***************
*** 363,369 ****
CONST void myfree(dvoid *ctx, dvoid *ptr)
{
oci8_debug("myfree(%08x)\n", ptr);
- rflush(GLOBAL(php3_rqst));
efree(ptr);
}
#endif
--- 362,367 ----
***************
*** 374,382 ****
static int
oci8_free_column(oci8_out_column *column)
{
if (column->data) {
if (column->is_descr) {
! /* XXX free lob here */
} else {
efree(column->data);
}
--- 372,382 ----
static int
oci8_free_column(oci8_out_column *column)
{
+ oci8_debug("oci8_free_column:");
+
if (column->data) {
if (column->is_descr) {
! OCIDescriptorFree(column->data, OCI_DTYPE_LOB);
} else {
efree(column->data);
}
***************
*** 397,406 ****
{
OCI8_TLS_VARS;
- /*
oci8_debug("oci8_free_stmt: id=%d last_query=\"%s\".",statement->id,
(char *)(statement->last_query?statement->last_query:"???"));
- */
if (statement->pStmt) {
OCIHandleFree(statement->pStmt, OCI_HTYPE_STMT);
--- 397,404 ----
***************
*** 432,441 ****
/* {{{ oci8_free_descr() */
static void
! oci8_free_descr(oci8_connection *connection)
{
OCI8_TLS_VARS;
! /* XXX needs implementation */
}
/* }}} */
--- 430,442 ----
/* {{{ oci8_free_descr() */
static void
! oci8_free_descr(dvoid *descr)
{
OCI8_TLS_VARS;
!
! oci8_debug("oci8_free_descr:");
!
! /* XXX OCIDescriptorFree(column->data, OCI_DTYPE_LOB); */
}
/* }}} */
***************
*** 446,451 ****
--- 447,454 ----
oci8_close_conn(oci8_connection *connection)
{
OCI8_TLS_VARS;
+
+ oci8_debug("oci8_close_conn:");
connection->open = 0;
oci8_error(connection->pError, "OCILogoff",
***************
*** 612,626 ****
size = column->size;
break;
case 0: /* intact value */
! /* XXX
! if ((column->type == SQLT_LBI) || (column->type == SQLT_LNG)) {
! */
! size = strlen(column->data); /*XXX LONGS should be done via callbacks */
! /*
! } else {
! size = column->storage_size - 1;
! }
! */
break;
default:
var_reset(value);
--- 615,621 ----
size = column->size;
break;
case 0: /* intact value */
! size = strlen(column->data); /* everything is now a NULL terminated string */
break;
default:
var_reset(value);
***************
*** 631,638 ****
value->value.str.len = size;
value->value.str.val = emalloc(size);
memcpy(value->value.str.val, column->data, size);
- column->value = value;
}
return value;
}
--- 626,633 ----
value->value.str.len = size;
value->value.str.val = emalloc(size);
memcpy(value->value.str.val, column->data, size);
}
+ column->value = value;
return value;
}
***************
*** 715,720 ****
--- 710,716 ----
}
if (stmttype == OCI_STMT_SELECT) {
+
OCIHandleAlloc(statement->conn->pEnv, (dvoid **)¶m,
OCI_DTYPE_PARAM, 0, NULL);
counter = 1;
***************
*** 730,736 ****
--- 726,734 ----
/* out of memory */
return 0;
} else {
+ /*
oci8_debug("added info about column %d", counter);
+ */
}
efree(outcol);
if (_php3_hash_index_find(statement->columns, counter,
***************
*** 758,768 ****
(dvoid **)&outcol->name,
(ub4 *)&outcol->name_len,
(ub4)OCI_ATTR_NAME, statement->pError));
- { char buffer [ 1024 ];
- strncpy(buffer,outcol->name,outcol->name_len);
- buffer[ outcol->name_len ] = 0;
- printf("%s -> %d\n",buffer,outcol->storage_size);fflush(stdout);
- }
/* Remember the size Oracle told us, we have to increase the
* storage size for some types.
--- 756,761 ----
***************
*** 861,867 ****
--- 854,862 ----
error = OCIStmtFetch(statement->pStmt, statement->pError, nrows,
OCI_FETCH_NEXT, OCI_DEFAULT);
+ /*
oci8_debug("OCIStmtFetch returned %d", error);
+ */
if (error == OCI_NO_DATA) {
return 0;
}
***************
*** 918,930 ****
--- 913,930 ----
if (phpbind->descr == 0) { /* "normal string bind */
convert_to_string(val);
+ /*
oci8_debug("oci8_bind_in_callback: buffer=\"%s\"
maxlen=%d",val->value.str.val,phpbind->maxsize);
+ */
*bufpp = val->value.str.val;
*alenp = phpbind->maxsize;
*indpp = (dvoid *)&phpbind->indicator;
} else { /* descriptor bind */
+
+ /*
oci8_debug("oci8_bind_in_callback: descriptor");
+ */
*bufpp = phpbind->descr;
*alenp = -1; /* seems to be allright */
***************
*** 1165,1170 ****
--- 1165,1175 ----
}
loblen = arg->value.str.len;
+
+ if (loblen < 1) {
+ php3_error(E_WARNING, "Cannot save a lob wich size is < 1 byte");
+ RETURN_FALSE;
+ }
ociresult = OCILobWrite(connection->pServiceContext,
connection->pError,
***************
*** 1757,1763 ****
}
/* Set up the Oracle environment. */
! #if 0
OCIInitialize(OCI_DEFAULT, (dvoid *)connection, mymalloc, myrealloc, myfree);
#else
OCIInitialize(OCI_DEFAULT, NULL, NULL, NULL, NULL);
--- 1762,1768 ----
}
/* Set up the Oracle environment. */
! #if OCI8_USE_EMALLOC
OCIInitialize(OCI_DEFAULT, (dvoid *)connection, mymalloc, myrealloc, myfree);
#else
OCIInitialize(OCI_DEFAULT, NULL, NULL, NULL, NULL);
--
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