CVS update: php3/functions
| From: | thies | Date: | Thu, 11 Feb 1999 09:36:59 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-4036@lists.php.net to get a copy of this message | ||
Date: Thursday February 11, 1999 @ 4:36
Author: thies
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv2486
Modified Files:
oci8.c
Log Message:
all functions that take a column index (starting with 1) will now also take a column name.
Index: php3/functions/oci8.c
diff -c php3/functions/oci8.c:1.37 php3/functions/oci8.c:1.38
*** php3/functions/oci8.c:1.37 Thu Feb 11 04:12:48 1999
--- php3/functions/oci8.c Thu Feb 11 04:36:59 1999
***************
*** 32,38 ****
+----------------------------------------------------------------------+
*/
! /* $Id: oci8.c,v 1.37 1999/02/11 09:12:48 thies Exp $ */
#include "php.h"
#include "internal_functions.h"
--- 32,38 ----
+----------------------------------------------------------------------+
*/
! /* $Id: oci8.c,v 1.38 1999/02/11 09:36:59 thies Exp $ */
#include "php.h"
#include "internal_functions.h"
***************
*** 135,141 ****
static oci8_connection *oci8_get_conn(int, const char *, HashTable *, HashTable *);
static oci8_statement *oci8_get_stmt(int, const char *, HashTable *);
! static oci8_out_column *oci8_get_col(oci8_statement *, int, char *);
static pval *oci8_make_pval(pval *,int,oci8_out_column *, char *,HashTable *);
static int oci8_parse(oci8_connection *, text *, ub4, HashTable *);
static int oci8_execute(oci8_statement *, char *,ub4 mode);
--- 135,141 ----
static oci8_connection *oci8_get_conn(int, const char *, HashTable *, HashTable *);
static oci8_statement *oci8_get_stmt(int, const char *, HashTable *);
! static oci8_out_column *oci8_get_col(oci8_statement *, int, pval *, char *);
static pval *oci8_make_pval(pval *,int,oci8_out_column *, char *,HashTable *);
static int oci8_parse(oci8_connection *, text *, ub4, HashTable *);
static int oci8_execute(oci8_statement *, char *,ub4 mode);
***************
*** 597,612 ****
/* {{{ oci8_get_col() */
static oci8_out_column *
! oci8_get_col(oci8_statement *statement, int col, char *func)
{
oci8_out_column *outcol = NULL;
OCI8_TLS_VARS;
! if (_php3_hash_index_find(statement->columns, col, (void **)&outcol) == FAILURE) {
! php3_error(E_WARNING, "%s: invalid column %d", func, col);
! return NULL;
}
! return outcol;
}
/* }}} */
--- 597,633 ----
/* {{{ oci8_get_col() */
static oci8_out_column *
! oci8_get_col(oci8_statement *statement, int col, pval *pval, char *func)
{
oci8_out_column *outcol = NULL;
+ int i;
OCI8_TLS_VARS;
! if (pval) {
! if (pval->type == IS_STRING) {
! for (i = 0; i < statement->ncolumns; i++) {
! outcol = oci8_get_col(statement, i + 1, 0, func);
! if (outcol == NULL || outcol->indicator == -1) {
! continue;
! } else if ((outcol->name_len == pval->value.str.len)
! && (!
strncmp(outcol->name,pval->value.str.val,pval->value.str.len))) {
! return outcol;
! }
! }
! } else {
! convert_to_long(pval);
!
! return oci8_get_col(statement,pval->value.lval,0,func);
! }
! } else if (col != -1) {
! if (_php3_hash_index_find(statement->columns, col, (void **)&outcol) == FAILURE) {
! php3_error(E_WARNING, "%s: invalid column %d", func, col);
! return NULL;
! }
! return outcol;
}
!
! return NULL;
}
/* }}} */
***************
*** 1475,1486 ****
WRONG_PARAM_COUNT;
}
convert_to_long(stmt);
- convert_to_long(col);
statement = oci8_get_stmt(stmt->value.lval, "OCIColumnName", list);
if (statement == NULL) {
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, col->value.lval, "OCIColumnName");
if (outcol == NULL) {
RETURN_FALSE;
}
--- 1496,1506 ----
WRONG_PARAM_COUNT;
}
convert_to_long(stmt);
statement = oci8_get_stmt(stmt->value.lval, "OCIColumnName", list);
if (statement == NULL) {
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, -1, col, "OCIColumnName");
if (outcol == NULL) {
RETURN_FALSE;
}
***************
*** 1503,1514 ****
WRONG_PARAM_COUNT;
}
convert_to_long(stmt);
- convert_to_long(col);
statement = oci8_get_stmt(stmt->value.lval, "OCIColumnSize", list);
if (statement == NULL) {
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, col->value.lval, "OCIColumnSize");
if (outcol == NULL) {
RETURN_FALSE;
}
--- 1523,1533 ----
WRONG_PARAM_COUNT;
}
convert_to_long(stmt);
statement = oci8_get_stmt(stmt->value.lval, "OCIColumnSize", list);
if (statement == NULL) {
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, -1, col, "OCIColumnSize");
if (outcol == NULL) {
RETURN_FALSE;
}
***************
*** 1531,1542 ****
WRONG_PARAM_COUNT;
}
convert_to_long(stmt);
- convert_to_long(col);
statement = oci8_get_stmt(stmt->value.lval, "OCIColumnType", list);
if (statement == NULL) {
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, col->value.lval, "OCIColumnType");
if (outcol == NULL) {
RETURN_FALSE;
}
--- 1550,1560 ----
WRONG_PARAM_COUNT;
}
convert_to_long(stmt);
statement = oci8_get_stmt(stmt->value.lval, "OCIColumnType", list);
if (statement == NULL) {
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, -1, col, "OCIColumnType");
if (outcol == NULL) {
RETURN_FALSE;
}
***************
*** 1592,1603 ****
WRONG_PARAM_COUNT;
}
convert_to_long(stmt);
- convert_to_long(col);
statement = oci8_get_stmt(stmt->value.lval, "OCIColumnIsNULL", list);
if (statement == NULL) {
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, col->value.lval, "OCIColumnIsNULL");
if (outcol == NULL) {
RETURN_FALSE;
}
--- 1610,1620 ----
WRONG_PARAM_COUNT;
}
convert_to_long(stmt);
statement = oci8_get_stmt(stmt->value.lval, "OCIColumnIsNULL", list);
if (statement == NULL) {
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, -1, col, "OCIColumnIsNULL");
if (outcol == NULL) {
RETURN_FALSE;
}
***************
*** 1731,1737 ****
}
for (i = 0; i < statement->ncolumns; i++) {
! column = oci8_get_col(statement, i + 1, "OCIFetchInto");
if (column == NULL || column->indicator == -1) {
continue;
}
--- 1748,1754 ----
}
for (i = 0; i < statement->ncolumns; i++) {
! column = oci8_get_col(statement, i + 1, 0, "OCIFetchInto");
if (column == NULL || column->indicator == -1) {
continue;
}
***************
*** 1810,1816 ****
/* }}} */
/* {{{ proto int OCILogon(string user, string pass[, string db])
! Connect to an Oracle database and log on.
*/
/* Connects to an Oracle 8 database and logs on. If the
--- 1827,1833 ----
/* }}} */
/* {{{ proto int OCILogon(string user, string pass[, string db])
! Connect to an Oracle database and log on. returns a new session.
*/
/* Connects to an Oracle 8 database and logs on. If the
***************
*** 2038,2044 ****
pval *stmt, *col;
oci8_statement *statement;
oci8_out_column *outcol = NULL;
- int i;
OCI8_TLS_VARS;
if (getParameters(ht, 2, &stmt, &col) == FAILURE) {
--- 2055,2060 ----
***************
*** 2053,2074 ****
RETURN_FALSE;
}
! if (col->type == IS_STRING) {
! for (i = 0; i < statement->ncolumns; i++) {
! outcol = oci8_get_col(statement, i + 1, "OCIResult");
! if (outcol == NULL || outcol->indicator == -1) {
! continue;
! } else if ((outcol->name_len == col->value.str.len)
! && (! strncmp(outcol->name,col->value.str.val,col->value.str.len))) {
! break; /* got you! */
! }
! }
! }
!
! if (outcol == NULL) {
! convert_to_long(col);
! outcol = oci8_get_col(statement,col->value.lval, "OCIResult");
! }
if (outcol == NULL) {
RETURN_FALSE;
--- 2069,2075 ----
RETURN_FALSE;
}
! outcol = oci8_get_col(statement, -1, col, "OCIResult");
if (outcol == NULL) {
RETURN_FALSE;
--
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