CVS update: php3/functions

From: Date: Mon, 10 May 1999 15:37:18 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5482@lists.php.net to get a copy of this message
Date: Monday May 10, 1999 @ 11:37 Author: kara Update of /repository/php3/functions In directory php:/tmp/cvs-serv32566/functions Modified Files: php3_unified_odbc.h unified_odbc.c Log Message: Setting statement options for both prepared and direct executed statements Index: php3/functions/php3_unified_odbc.h diff -u php3/functions/php3_unified_odbc.h:1.49 php3/functions/php3_unified_odbc.h:1.50 --- php3/functions/php3_unified_odbc.h:1.49 Thu Apr 22 09:19:50 1999 +++ php3/functions/php3_unified_odbc.h Mon May 10 11:37:18 1999 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php3_unified_odbc.h,v 1.49 1999/04/22 13:19:50 ssb Exp $ */ +/* $Id: php3_unified_odbc.h,v 1.50 1999/05/10 15:37:18 kara Exp $ */ #ifndef _UNIFIED_ODBC_H #define _UNIFIED_ODBC_H @@ -385,6 +385,9 @@ HDBC hdbc; #endif int open; +# if HAVE_SQL_EXTENDED_FETCH + int fetch_abs; +# endif } UODBC_CONNECTION; typedef struct UODBC_RESULT_VALUE { @@ -403,9 +406,6 @@ UODBC_RESULT_VALUE *values; SWORD numcols; SWORD numparams; -# if HAVE_SQL_EXTENDED_FETCH - int fetch_abs; -# endif long longreadlen; int binmode; int fetched; Index: php3/functions/unified_odbc.c diff -u php3/functions/unified_odbc.c:1.105 php3/functions/unified_odbc.c:1.106 --- php3/functions/unified_odbc.c:1.105 Thu Apr 22 09:19:51 1999 +++ php3/functions/unified_odbc.c Mon May 10 11:37:18 1999 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: unified_odbc.c,v 1.105 1999/04/22 13:19:51 ssb Exp $ */ +/* $Id: unified_odbc.c,v 1.106 1999/05/10 15:37:18 kara Exp $ */ /* This file is based on the Adabas D extension. * Adabas D will no longer be supported as separate module. @@ -711,6 +711,23 @@ RETURN_FALSE; } +#if HAVE_SQL_EXTENDED_FETCH + /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info, + whether Driver supports ExtendedFetch */ + if (curr_conn->fetch_abs){ + /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other + type if not possible. + */ + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) + == SQL_ERROR){ + UODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, " SQLSetStmtOption"); + SQLFreeStmt(result->stmt, SQL_DROP); + efree(result); + RETURN_FALSE; + } + } +#endif + if ((rc = SQLPrepare(result->stmt, query, SQL_NTS)) != SQL_SUCCESS){ UODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, "SQLPrepare"); SQLFreeStmt(result->stmt, SQL_DROP); @@ -982,9 +999,6 @@ UODBC_RESULT *result=NULL; UODBC_CONNECTION *curr_conn=NULL; RETCODE rc; -#if HAVE_SQL_EXTENDED_FETCH - UDWORD scrollopts; -#endif if (getParameters(ht, 2, &arg1, &arg2) == FAILURE){ WRONG_PARAM_COUNT; @@ -1024,22 +1038,17 @@ #if HAVE_SQL_EXTENDED_FETCH /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info, whether Driver supports ExtendedFetch */ - rc = SQLGetInfo(curr_conn->hdbc, SQL_FETCH_DIRECTION, (void *) &scrollopts, sizeof(scrollopts), NULL); - if (rc == SQL_SUCCESS){ - if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))){ - /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other - type if not possible. - */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) - == SQL_ERROR){ - UODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, " SQLSetStmtOption"); - SQLFreeStmt(result->stmt, SQL_DROP); - efree(result); - RETURN_FALSE; - } + if (curr_conn->fetch_abs){ + /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other + type if not possible. + */ + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) + == SQL_ERROR){ + UODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, " SQLSetStmtOption"); + SQLFreeStmt(result->stmt, SQL_DROP); + efree(result); + RETURN_FALSE; } - } else { - result->fetch_abs = 0; } #endif @@ -1143,7 +1152,7 @@ } #if HAVE_SQL_EXTENDED_FETCH - if (result->fetch_abs){ + if (result->conn_ptr->fetch_abs){ if (rownum > 0) rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); else @@ -1157,7 +1166,7 @@ RETURN_FALSE; #if HAVE_SQL_EXTENDED_FETCH - if (rownum > 0 && result->fetch_abs) + if (rownum > 0 && result->conn_ptr->fetch_abs) result->fetched = rownum; else #endif @@ -1297,7 +1306,7 @@ } #if HAVE_SQL_EXTENDED_FETCH - if (result->fetch_abs){ + if (result->conn_ptr->fetch_abs){ if (numArgs > 1) rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus); else @@ -1392,7 +1401,7 @@ if (result->fetched == 0){ /* User forgot to call odbc_fetchrow(), let's do it here */ #if HAVE_SQL_EXTENDED_FETCH - if (result->fetch_abs) + if (result->conn_ptr->fetch_abs) rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus); else #endif @@ -1547,7 +1556,7 @@ RETURN_FALSE; } #if HAVE_SQL_EXTENDED_FETCH - if (result->fetch_abs) + if (result->conn_ptr->fetch_abs) rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); else #endif @@ -1630,7 +1639,7 @@ php3_printf("</tr>\n"); #if HAVE_SQL_EXTENDED_FETCH - if (result->fetch_abs) + if (result->conn_ptr->fetch_abs) rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); else #endif @@ -1698,6 +1707,10 @@ char *hashed_details; int hashed_len, len, id, cur_opt; int type; +#if HAVE_SQL_EXTENDED_FETCH + UDWORD scrollopts; +#endif + UODBC_TLS_VARS; UODBC_GLOBAL(PHP3_UODBC_MODULE).resource_list = list; @@ -1879,6 +1892,18 @@ RETURN_FALSE; } db_conn->open = 1; + +#if HAVE_SQL_EXTENDED_FETCH + /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info, + whether Driver supports ExtendedFetch */ + rc = SQLGetInfo(db_conn->hdbc, SQL_FETCH_DIRECTION, (void *) &scrollopts, sizeof(scrollopts), NULL); + if (rc == SQL_SUCCESS){ + db_conn->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE); + } else { + db_conn->fetch_abs = 0; + } +#endif + if (persistent){ new_le.type = UODBC_GLOBAL(PHP3_UODBC_MODULE).le_pconn; new_le.ptr = db_conn; -- 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

« previous php.dev (#5482) next »