Date: 12/05/00
- Next message: t.rogall <email protected>: "[PHP-DEV] PHP 4.0 Bug #8116: HTTP_POST-Data not accessible when no variable-name specified"
- Previous message: Bernd Nies: "[PHP-DEV] Re: PHP 4.0 Bug #5394 Updated: Linking problem with libphp4.a and libmodphp4.a"
- In reply to: Walter Franzini: "[PHP-DEV] [PATCH] etc/odbc/php_odbc.c"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 <email protected>
> 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 <email protected>
> For additional commands, e-mail: php-dev-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: t.rogall <email protected>: "[PHP-DEV] PHP 4.0 Bug #8116: HTTP_POST-Data not accessible when no variable-name specified"
- Previous message: Bernd Nies: "[PHP-DEV] Re: PHP 4.0 Bug #5394 Updated: Linking problem with libphp4.a and libmodphp4.a"
- In reply to: Walter Franzini: "[PHP-DEV] [PATCH] etc/odbc/php_odbc.c"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

