ID: 9397
Updated by: kalowsky
Status: Open
Old-Bug Type: ODBC related
Bug Type: Feature/Change Request
PHP Version: 4.0.4pl1
Assigned To: 

Changing this to a feature request as it seems to be more a request to update PHP/ODBC 
to ODBC3 compliancy.  

Previous Comments:

[2001-03-05 00:37:22] [EMAIL PROTECTED]
Dear kara,

I am sorry for not specifying it clearly last time. SQL_EXTENSION_NAME is used 
specifically for our database, DBMaker.

We are developers for this database and we have also have developed php driver for our 
database. Because of some specific features of our database, we really need to let 
users who use our database be able to set this kind of options. Unfortunately, ODBC 
2.x does not allow setting attributes with string-type values.

Since the ODBC version currently used in php is, as you can see from the source code, 
2.x. We really cannot use SQLSetStmtAttr() provided by ODBC 3.

We didn't use HAVE_DBMAKER ifdefs because we think other databases might be glad to 
see this, too.


[2001-02-22 11:35:25] [EMAIL PROTECTED]
In ODBC 2.x it is not possible to pass string values to
SQLSetStmtOption(). It is possible with ODBC 3,
SQLSetStmtAttr() has an additional parameter to specify the
string length. 
By the way: I couldn't find SQL_EXTENSION_NAME as possible
attribute to SQLSetStmtAttr(). What's it's pupose?


[2001-02-22 04:55:38] [EMAIL PROTECTED]
When I tried to use odbc_setoption() to set file extension

odbc_setoption($sth, 2, 2001, "JPG"); /*2001 means SQL_EXTENSION_NAME*/

php will hang.

The patch followed:

****** BEGIN PATCH ***********

--- php_odbc.c.old      Wed Jan  3 23:04:50 2001
+++ php_odbc.c  Thu Feb 22 10:29:52 2001
@@ -2393,6 +2393,7 @@
        odbc_result     *result;
        RETCODE rc;
        pval **pv_handle, **pv_which, **pv_opt, **pv_val;
+       UDWORD val;
        if ( zend_get_parameters_ex(4, &pv_handle, &pv_which, &pv_opt, &pv_val) == 
@@ -2400,7 +2401,20 @@
+       switch (Z_TYPE_PP(pv_val)) {
+               case IS_LONG:
+                       val = (*pv_val)->value.lval;
+                       break;
+               case IS_STRING:
+                       convert_to_string_ex(pv_val); 
+                       val = (UDWORD) (*pv_val)->value.str.val;
+                       break;
+               default:
+                       php_error(E_WARNING, "Unknown param type");
+                       RETURN_FALSE;
+                       break;
+       }
        switch ((*pv_which)->value.lval) {
                case 1:         /* SQLSetConnectOption */
@@ -2409,7 +2423,7 @@
                                php_error(E_WARNING, "Can't set option for persistent 
-                       rc = SQLSetConnectOption(conn->hdbc, (unsigned 
short)((*pv_opt)->value.lval), (*pv_val)->value.lval);
+                       rc = SQLSetConnectOption(conn->hdbc, (unsigned 
+short)((*pv_opt)->value.lval), val);
                        if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
                                odbc_sql_error(conn->henv, conn->hdbc, SQL_NULL_HSTMT, 
@@ -2418,7 +2432,7 @@
                case 2:         /* SQLSetStmtOption */
                        ZEND_FETCH_RESOURCE(result, odbc_result *, pv_handle, -1, 
"ODBC result", le_result);
-                       rc = SQLSetStmtOption(result->stmt, (unsigned 
short)((*pv_opt)->value.lval), ((*pv_val)->value.lval));
+                       rc = SQLSetStmtOption(result->stmt, (unsigned 
+short)((*pv_opt)->value.lval), val);
                        if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
result->conn_ptr->hdbc, result->stmt, "SetStmtOption");

****** END PATCH ***********


ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to