cvs: php4 /ext/odbc php_odbc.c

From: Date: Tue, 05 Dec 2000 12:11:32 +0000
Subject: cvs: php4 /ext/odbc php_odbc.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2950@lists.php.net to get a copy of this message
ssb Tue Dec 5 04:11:32 2000 EDT Modified files: /php4/ext/odbc php_odbc.c Log: Applied IBM DB2 patch by Walter Franzini <walter@sys-net.it> @ext/odbc: IBM DB2 patch by Walter Franzini <walter@sys-net.it> Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.65 php4/ext/odbc/php_odbc.c:1.66 --- php4/ext/odbc/php_odbc.c:1.65 Fri Nov 17 07:48:09 2000 +++ php4/ext/odbc/php_odbc.c Tue Dec 5 04:11:30 2000 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.c,v 1.65 2000/11/17 15:48:09 kalowsky Exp $ */ +/* $Id: php_odbc.c,v 1.66 2000/12/05 12:11:30 ssb Exp $ */ #include "php.h" #include "php_globals.h" @@ -774,11 +774,17 @@ } #endif - if ((rc = SQLPrepare(result->stmt, query, SQL_NTS)) != SQL_SUCCESS) { - odbc_sql_error(conn->henv, conn->hdbc, result->stmt, "SQLPrepare"); - SQLFreeStmt(result->stmt, SQL_DROP); - RETURN_FALSE; - } + rc = SQLPrepare(result->stmt, query, SQL_NTS); + switch (rc) { + case SQL_SUCCESS: + break; + case SQL_SUCCESS_WITH_INFO: + odbc_sql_error(conn->henv, conn->hdbc, result->stmt, "SQLPrepare"); + break; + default: + odbc_sql_error(conn->henv, conn->hdbc, result->stmt, "SQLPrepare"); + RETURN_FALSE; + } SQLNumParams(result->stmt, &(result->numparams)); SQLNumResultCols(result->stmt, &(result->numcols)); @@ -933,10 +939,16 @@ } } } else { - if (rc != SQL_SUCCESS) { - odbc_sql_error(result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt, "SQLExecute"); - RETVAL_FALSE; - } + switch (rc) { + case SQL_SUCCESS: + break; + case SQL_NO_DATA_FOUND: + case SQL_SUCCESS_WITH_INFO: + odbc_sql_error(result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt, "SQLExecute"); + break; + default: + RETVAL_FALSE; + } } if (result->numparams > 0) { @@ -948,7 +960,8 @@ efree(params); } - if (rc == SQL_SUCCESS) { + if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO + || rc == SQL_NO_DATA_FOUND) { RETVAL_TRUE; } @@ -986,7 +999,7 @@ rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN, (void *)&max_len,0,&len); - if (rc != SQL_SUCCESS) { + if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { RETURN_FALSE; } @@ -997,7 +1010,7 @@ RETURN_FALSE; } rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len); - if (rc != SQL_SUCCESS) { + if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { char state[6]; /* Not used */ SDWORD error; /* Not used */ char errormsg[255]; @@ -1102,7 +1115,9 @@ #endif rc = SQLExecDirect(result->stmt, query, SQL_NTS); - if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { + if (rc != SQL_SUCCESS + && rc != SQL_SUCCESS_WITH_INFO + && rc != SQL_NO_DATA_FOUND) { /* XXX FIXME we should really check out SQLSTATE with SQLError * in case rc is SQL_SUCCESS_WITH_INFO here. */

« previous php.cvs (#2950) next »