Re: [PATCH] etc/odbc/php_odbc.c

From: Date: Tue, 05 Dec 2000 12:18:06 +0000
Subject: Re: [PATCH] etc/odbc/php_odbc.c
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-40120@lists.php.net to get a copy of this message
Applied. Thanks. - Stig Walter Franzini wrote: > > Please, can someone apply this patch ? > > With it the odbc module works better with ibmdb2. > > thanks > > -- > Walter Franzini, e-mail: walter@sys-net.it > SysNet, Via Digione 8, 27100 Pavia - Italy > > diff -aur -x*~ -x*.so --show-c-function php-4.0.3pl1.ORIG/ext/odbc/php_odbc.c > php-4.0.3pl1/ext/odbc/php_odbc.c > --- php-4.0.3pl1.ORIG/ext/odbc/php_odbc.c Fri Sep 29 21:03:23 2000 > +++ php-4.0.3pl1/ext/odbc/php_odbc.c Fri Dec 1 11:08:34 2000 > @@ -771,11 +771,17 @@ PHP_FUNCTION(odbc_prepare) > } > #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)); > @@ -930,10 +936,16 @@ PHP_FUNCTION(odbc_execute) > } > } > } 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) { > @@ -945,7 +957,8 @@ PHP_FUNCTION(odbc_execute) > efree(params); > } > > - if (rc == SQL_SUCCESS) { > + if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO > + || rc == SQL_NO_DATA_FOUND) { > RETVAL_TRUE; > } > > @@ -983,7 +996,7 @@ PHP_FUNCTION(odbc_cursor) > > 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; > } > > @@ -994,7 +1007,7 @@ PHP_FUNCTION(odbc_cursor) > 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]; > @@ -1099,7 +1112,9 @@ PHP_FUNCTION(odbc_exec) > #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. > */ > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.dev (#40120) next »