Re: Towards 4.0.2

From: Date: Sat, 12 Aug 2000 15:45:30 +0000
Subject: Re: Towards 4.0.2
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-28689@lists.php.net to get a copy of this message
I think bug fixes should still go into the current tree. It's probably best if someone else who is more familiar with ODBC takes a look at your patch. Andi At 05:26 PM 8/11/00 +0100, Jon Evans wrote:
Hi Andi, On Fri, Aug 11, 2000 at 01:05:28PM +0300, Andi Gutmans wrote: I think feature wise 4.0.2 is pretty much set now unless someone has anything important to add. I have fixed two lingering bugs (switch() and foreach()) and we have finished with the major Zend patch we wanted to get in for 4.0.2. I think the current CVS tree needs quite a lot of testing now so it would be great if within the next few days people will test the CVS in their development environments. I will try and post new Windows binaries tomorrow evening (in about 36 hours) Please could the following patch go in? It fixes ODBC access to Access datasources. The Access ODBC driver doesn't support SQLDescribeParam, so the source as shipped fails to work with parameterised queries. Tested here on NT 4.0 sp 6a. --- /home/jevans/share/src/cvs/php4/ext/odbc/php_odbc.c Thu Jul 6 09:38:12 2000 +++ php_odbc.c Thu Aug 10 11:03:08 2000 @@ -805,7 +805,7 @@
        UDWORD precision;
        odbc_result   *result;
        int numArgs, i, ne;
-       RETCODE rc;
+       RETCODE rc, desc_param;
        numArgs = ZEND_NUM_ARGS();
        if (numArgs == 1) {
@@ -854,8 +854,13 @@
                                RETURN_FALSE;
                        }
-            SQLDescribeParam(result->stmt, (UWORD)i, &sqltype, &precision,
+                       sqltype=SQL_CHAR;
+                       scale=0;
+                       precision=params[i-1].vallen;
+
+                       desc_param = SQLDescribeParam(result->stmt, (UWORD)i, &sqltype, &precision,
                                                        &scale, &nullable);
+
                        params[i-1].vallen = (*tmp)->value.str.len;
                        params[i-1].fp = -1;
@@ -882,15 +887,33 @@
                                }
                                params[i-1].vallen = SQL_LEN_DATA_AT_EXEC(0);
+
+                               if (desc_param != SQL_SUCCESS) {
+                                       /* SQLDescribeParameter failed - not supported? */
+                                       sqltype = SQL_LONGVARCHAR;
+                                       precision = lseek(params[i-1].fp, 0L, SEEK_END);
+                                       lseek(params[i-1].fp, 0L, SEEK_SET);
+                                       scale=0;
+                               }
                                rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
ctype, sqltype, precision, scale, (void *)params[i-1].fp, 0, &params[i-1].vallen);
                        } else {
+
+                               if (desc_param != SQL_SUCCESS) {
+                                       /* SQLDescribeParameter failed - not supported? */
+                                       sqltype = SQL_CHAR;
+                       precision = params[i-1].vallen;
+                                       scale=0;
+                               }
+ #ifdef HAVE_DBMAKER
                 precision = params[i-1].vallen;
#endif + +
                                rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
ctype, sqltype, precision, scale, (*tmp)->value.str.val, 0, Jon. -- Jon Evans / Red Internet Ltd. / +44 1869 337977
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#28689) next »