|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-04-08 00:28 UTC] kalowsky@php.net
[2003-04-09 06:20 UTC] rich at kastle dot com
[2003-07-11 08:13 UTC] kalowsky@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 21:00:01 2025 UTC |
Things I have attempted to fix and are illustrated by the enclosed diff (if I were more expert I'd call it a patch but I've done virtually no patch files and so make no such claim): 1. odbc_next_result calls SQLMoreResults but does not properly report an error resturned from the call (anything but SQL_SUCCESS is treated like SQL_NO_MORE_DATA). This defeats attempts to detect errors in mid-batch. 2. PHP documentation claims that odbc_error and odbc_errormsg are blank if no error has occured, but in reality they are uninitialized until an error occurs. 3. I also blank odbc_error and odbc_errormsg in odbc_exec so that (among other things) upon a FALSE return from odbc_next_result, an error can be distinguished from normal no-more-data. 4. Microsoft documentation claims that callers to SQLDriverConnect should provide at least a 1024 byte buffer. 5. I added a function odbc_get_handle which yeilds the underlying HDBC as a long, for a given $dbid resource. diff -r temp/php-4.3.2RC1\ext\odbc\php_odbc.c php-4.3.2RC1\ext\odbc\php_odbc.c 113a114 > PHP_FE(odbc_get_handle, NULL) 1344a1346,1348 > // No error > conn->laststate[0] = conn->lasterrormsg[0] = 0; > 2081a2086,2088 > (*conn)->laststate[0] = 0; > (*conn)->lasterrormsg[0] = 0; > 2115c2122 < char dsnbuf[300]; --- > char dsnbuf[1024]; 2133c2140 < rc = SQLDriverConnect((*conn)->hdbc, NULL, ldb, strlen(ldb), dsnbuf, 300, --- > rc = SQLDriverConnect((*conn)->hdbc, NULL, ldb, strlen(ldb), dsnbuf, sizeof(dsnbuf), 2410a2418,2435 > /* {{{ proto int odbc_handle(int connection_id) > Returns the basic ODBC HDBC for a connection */ > PHP_FUNCTION(odbc_get_handle) > { > odbc_connection *conn; > pval **pv_conn; > int is_pconn = 0; > > if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) { > WRONG_PARAM_COUNT; > } > > ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); > > RETURN_LONG((long)conn->hdbc); > } > /* }}} */ > 2454c2479,2480 < else { --- > else if(rc == SQL_NO_DATA_FOUND) > { 2456a2483,2485 > > odbc_sql_error(result->conn_ptr, result->stmt, " SQLMoreResults"); > RETURN_FALSE; diff -r temp/php-4.3.2RC1\ext\odbc\php_odbc.h php-4.3.2RC1\ext\odbc\php_odbc.h 94a95 > PHP_FUNCTION(odbc_get_handle);