List:Commits« Previous MessageNext Message »
From:pharvey Date:March 9 2006 7:22am
Subject:Connector/ODBC 3.51 commit: r45 - / myodbc3 test/dyn_cursor test/test32
View as plain text  
Added:
   Upgrade.bat
Modified:
   ChangeLog
   CreateBinaryMsi.bat
   Install.bat
   PostBuildTest.bat
   Uninstall.bat
   connector-odbc3.vpj
   defines.pri
   myodbc3/connect.c
   myodbc3/cursor.c
   myodbc3/prepare.c
   test/dyn_cursor/my_dyn_cursor.c
   test/test32/mytest32.c
Log:
- added Upgrade.bat
- SQLPrepare now removes {} when used to embrace a complete statement
- some WIP for a bug in positioned DELETE

Modified: ChangeLog
===================================================================
--- ChangeLog	2006-03-06 07:12:03 UTC (rev 44)
+++ ChangeLog	2006-03-09 06:22:51 UTC (rev 45)
@@ -7,6 +7,8 @@
 22-FEB-2006 (3.51.13): pharvey@stripped
 ---------------------------------------------
 
+-- added MYODBCBrowser to distro
+-- now handles statements embraced by {} (removes the braces)
 -- fixed the windows-specifie problem with GUI and SQL_DRIVER_PROMPT
 -- fixed issue with numeric/decimal rounding
 -- improved post-build/smoke tests

Modified: CreateBinaryMsi.bat
===================================================================
--- CreateBinaryMsi.bat	2006-03-06 07:12:03 UTC (rev 44)
+++ CreateBinaryMsi.bat	2006-03-09 06:22:51 UTC (rev 45)
@@ -50,6 +50,8 @@
 copy bin\mysql-connector-odbc-%1-win32\Windows\System32\LICENSE.exceptions
bin\mysql-connector-odbc-%1-win32\Windows\System32\myodbc3-exceptions.rtf
 call OdbcMakeSetup.bat %1 %2 gpl
 
+cd ..\*odbc3
+
 EXIT /B 0
 
 :doSyntax

Modified: Install.bat
===================================================================
--- Install.bat	2006-03-06 07:12:03 UTC (rev 44)
+++ Install.bat	2006-03-09 06:22:51 UTC (rev 45)
@@ -21,6 +21,7 @@
 REM ****
 REM * Copying myodbc libraries and executables to install dir...
 REM ****
+copy lib\qt-mt335.dll \Windows\System32
 copy lib\myodbc3S.dll \Windows\System32
 copy lib\myodbc3S.lib \Windows\System32
 copy lib\myodbc3.dll \Windows\System32

Modified: PostBuildTest.bat
===================================================================
--- PostBuildTest.bat	2006-03-06 07:12:03 UTC (rev 44)
+++ PostBuildTest.bat	2006-03-09 06:22:51 UTC (rev 45)
@@ -22,9 +22,8 @@
 IF "%1"=="" GOTO doSyntax
 
 ECHO BEGIN: Post build test...
-
+GOTO d
 test\bin\connect.exe %1 %2 %3
-EXIT /B 0
 test\bin\basics.exe %1 %2 %3
 test\bin\param.exe %1 %2 %3
 test\bin\result.exe %1 %2 %3
@@ -46,7 +45,9 @@
 REM test\bin\use_result.exe 10000 %1 %2 %3
 test\bin\use_result.exe 100 %1 %2 %3
 test\bin\catalog.exe %1 %2 %3
+:d
 test\bin\test32.exe %1 %2 %3
+EXIT /B 0
 
 ECHO END: Post build test.
 

Modified: Uninstall.bat
===================================================================
--- Uninstall.bat	2006-03-06 07:12:03 UTC (rev 44)
+++ Uninstall.bat	2006-03-09 06:22:51 UTC (rev 45)
@@ -1,21 +1,21 @@
 @ECHO OFF
 REM #########################################################
-REM 
+REM
 REM \brief  Uninstall myodbc.
 REM
 REM         This exists for those working with the Windows source
 REM         distribution.
-REM 
+REM
 REM \sa     README.win
 REM
 REM #########################################################
 
-IF "%1"=="0" GOTO :doNormal
-IF "%1"=="1" GOTO :doDebug
+IF "%1"=="0" GOTO doNormal
+IF "%1"=="1" GOTO doDebug
 GOTO doSyntax
 
 :doNormal
-IF NOT EXIST \Windows\System32\myodbc3i.exe GOTO :doError2
+IF NOT EXIST \Windows\System32\myodbc3i.exe GOTO doError2
 REM ****
 REM * Deregistering driver...
 REM ****
@@ -35,8 +35,8 @@
 GOTO doSuccess
 
 :doDebug
-IF NOT EXIST \Windows\System32\myodbc3d.dll GOTO :doError3
-IF NOT EXIST \Windows\System32\myodbc3i.exe GOTO :doError1
+IF NOT EXIST \Windows\System32\myodbc3d.dll GOTO doError3
+IF NOT EXIST \Windows\System32\myodbc3i.exe GOTO doError1
 REM ****
 REM * Deregistering driver...
 REM ****

Added: Upgrade.bat
===================================================================
--- Upgrade.bat	2006-03-06 07:12:03 UTC (rev 44)
+++ Upgrade.bat	2006-03-09 06:22:51 UTC (rev 45)
@@ -0,0 +1,43 @@
+@ECHO OFF
+REM #########################################################
+REM 
+REM \brief  Upgrade an existing install.
+REM
+REM         Often when testing you want to Uninstall and Install. This
+REM         script does this.
+REM
+REM \sa     README.win
+REM
+REM #########################################################
+
+
+IF "%1"=="1" GOTO :doIt
+IF "%1"=="0" GOTO :doIt
+
+:doSyntax
+ECHO "+-----------------------------------------------------+"
+ECHO "| Upgrade.bat                                         |"
+ECHO "+-----------------------------------------------------+"
+ECHO "|                                                     |"
+ECHO "| DESCRIPTION                                         |"
+ECHO "|                                                     |"
+ECHO "| Use this upgrade an existing install. This just     |"
+ECHO "| calls Uninstall/Install so it has nothing to do     |"
+ECHO "| with MS installed software thingy in Control Panel. |"
+ECHO "|                                                     |"
+ECHO "| SYNTAX                                              |"
+ECHO "|                                                     |"
+ECHO "| Upgrade <debug>                                     |"
+ECHO "|                                                     |"
+ECHO "| <debug>  must be;                                   |"
+ECHO "|              0 - to install a regular build         |"
+ECHO "|              1 - to install a debug version         |"
+ECHO "|                                                     |"
+ECHO "+-----------------------------------------------------+"
+EXIT /B 1
+
+:doIt
+CALL Uninstall.bat %1
+CALL Install.bat %1
+
+

Modified: connector-odbc3.vpj
===================================================================
--- connector-odbc3.vpj	2006-03-06 07:12:03 UTC (rev 44)
+++ connector-odbc3.vpj	2006-03-09 06:22:51 UTC (rev 45)
@@ -106,6 +106,7 @@
 			<F N="README.dist"/>
 			<F N="root.pro"/>
 			<F N="Uninstall.bat"/>
+			<F N="Upgrade.bat"/>
 		</Folder>
 	</Files>
 </Project>

Modified: defines.pri
===================================================================
--- defines.pri	2006-03-06 07:12:03 UTC (rev 44)
+++ defines.pri	2006-03-09 06:22:51 UTC (rev 45)
@@ -28,7 +28,7 @@
 # Define DBUG_OFF to leave trace code out of the build. The
 # default is to include the trace code.
 # #########################################################
-# DEFINES += DBUG_OFF 
+DEFINES += DBUG_OFF 
 
 # #########################################################
 # Define the ammount of output from post-build tests. The

Modified: myodbc3/connect.c
===================================================================
--- myodbc3/connect.c	2006-03-06 07:12:03 UTC (rev 44)
+++ myodbc3/connect.c	2006-03-09 06:22:51 UTC (rev 45)
@@ -198,7 +198,7 @@
     uint port_nr= 0;
     DBC FAR *dbc= (DBC FAR*) hdbc;
     MYODBCDbgEnter("SQLConnect");
-printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
+
     if (dbc->mysql.net.vio != 0)
         MYODBCDbgReturn(set_conn_error(hdbc,MYERR_08002,NULL,0));
 

Modified: myodbc3/cursor.c
===================================================================
--- myodbc3/cursor.c	2006-03-06 07:12:03 UTC (rev 44)
+++ myodbc3/cursor.c	2006-03-09 06:22:51 UTC (rev 45)
@@ -621,24 +621,18 @@
     MYSQL_RES *     result = stmt->result;
     MYSQL_FIELD *   field;
     SQLUSMALLINT    ncol;
-    MYSQL_RES *     presult;
+    MYSQL_RES *     presultAllColumns;
     char            select[NAME_LEN+15];
 
-    /*
-      As there is no key columns in the current result,
-      try to include all columns from the table in the
-      search clause
-    */
+    /* get base table name - fails if we have more than one */
     if ( !( find_used_table( stmt ) ) )
-    {
         return ( SQL_ERROR );
-    }
 
-    /* Get a temp result of all columns from the table .. */
+    /* get a list of all table cols using "SELECT & LIMIT 0" method */
     strxmov( select, "SELECT * FROM `", stmt->table_name, "` LIMIT 0", NullS );
     MYLOG_QUERY( stmt, select );
     pthread_mutex_lock( &stmt->dbc->lock );
-    if ( ( mysql_query( &stmt->dbc->mysql, select ) || !( presult =
mysql_store_result( &stmt->dbc->mysql ) ) ) )
+    if ( ( mysql_query( &stmt->dbc->mysql, select ) || !( presultAllColumns =
mysql_store_result( &stmt->dbc->mysql ) ) ) )
     {
         set_error( stmt, MYERR_S1000, mysql_error( &stmt->dbc->mysql ),
mysql_errno( &stmt->dbc->mysql ) );
         pthread_mutex_unlock( &stmt->dbc->lock );
@@ -654,21 +648,27 @@
       This can be buggy, if multiple times the same
       column is used in the select ..rare case ..
     */
-    if ( presult->row_count != result->row_count &&
!if_dynamic_cursor(stmt) )
+/* printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ ); */
+    if ( presultAllColumns->row_count != result->row_count &&
!if_dynamic_cursor(stmt) )
     {
-        mysql_free_result(presult);
-        presult= 0;
+/* printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ ); */
+        mysql_free_result(presultAllColumns);
+        presultAllColumns= 0;
     }
-    else if ( presult->field_count != result->field_count ||
+    else if ( presultAllColumns->field_count != result->field_count ||
               !result->data_cursor ||
               (if_dynamic_cursor(stmt) &&
-               presult->row_count != result->row_count) )
+               presultAllColumns->row_count != result->row_count) )
     {
         for ( ncol= 0; ncol < (SQLUSMALLINT)stmt->current_row; ncol++ )
-            presult->data_cursor = presult->data_cursor->next;
-        result = presult;
+        {
+/* printf( "\n[PAH][%s][%d] Column %d of %d\n", __FILE__, __LINE__, ncol,
stmt->current_row ); */
+            presultAllColumns->data_cursor =
presultAllColumns->data_cursor->next;
+        }
+        result = presultAllColumns;
     }
 
+/* printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ ); */
     pthread_mutex_lock( &stmt->dbc->lock );
     /* Copy all row buffers to query search clause */
     for ( ncol = 0; ncol < result->field_count; ncol++ )
@@ -677,21 +677,15 @@
         dynstr_append_quoted_name( dynQuery, field->name );
         dynstr_append_mem( dynQuery, "=", 1 );
 
-        /*
-            Disabled the if_float_field() check as it prevented positioned update on a
table
-            lacking a pk and having floating field (such as a double). Tests seem to
indicate
-            that this works. If you add it back then please state why. Better yet do not
-            add it back and fix root cause. - PAH 01.SEP.05
-        */
         if ( if_float_field( stmt, field ) || insert_field( stmt, result, dynQuery, ncol
) )
-        /* if ( insert_field( stmt, result, dynQuery, ncol ) ) */
         {
-            mysql_free_result( presult );
+            mysql_free_result( presultAllColumns );
             pthread_mutex_unlock( &stmt->dbc->lock );
             return ( SQL_ERROR );
         }
     }
-    mysql_free_result( presult );
+
+    mysql_free_result( presultAllColumns );
     pthread_mutex_unlock( &stmt->dbc->lock );
 
     return( SQL_SUCCESS );
@@ -706,45 +700,37 @@
                                      DYNAMIC_STRING * dynQuery,
                                      SQLUSMALLINT     irow )
 {
+    /* set our cursor to irow - we call assuming irow is valid */
     set_current_cursor_data( pStmt, irow );
+
+    /* simply append WHERE to our statement */
     dynstr_append_mem( dynQuery, " WHERE ", 7 );
 
+    /* IF pk exists THEN use pk cols for where ELSE use all cols */
     if ( check_if_pk_exists( pStmt ) )
     {
-        /* Primary keys exists, build the search pattern using keys */
         if ( insert_pk_fields( pStmt, dynQuery ) != SQL_SUCCESS )
-        {
             return set_stmt_error( pStmt, "HY000", "Build WHERE -> insert_pk_fields()
failed.", 0 );
-        }
     }
     else
     {
-        /*
-          No primary key exists, build the search pattern using
-          all current open columns
-        */
         if ( insert_fields( pStmt, dynQuery ) != SQL_SUCCESS )
-        {
             return set_stmt_error( pStmt, "HY000", "Build WHERE -> insert_fields()
failed.", 0 );
-        }
     }
     dynQuery->length -= 5;
 
-    /*
-      If irow= 0, include search clause for all rows,
-      else for all current rowset size
-    */
-    if ( irow )
+    /* IF irow = 0 THEN delete all rows in the rowset ELSE specific (as in one) row */
+    if ( irow == 0 )
     {
-        dynstr_append_mem( dynQuery, " LIMIT 1", 8 );
-    }
-    else
-    {
         char buff[32];
 
         sprintf( buff, " LIMIT %lu", pStmt->stmt_options.rows_in_set );
         dynstr_append( dynQuery, buff );
     }
+    else
+    {
+        dynstr_append_mem( dynQuery, " LIMIT 1", 8 );
+    }
 
     return SQL_SUCCESS;
 }
@@ -939,7 +925,7 @@
 
 /*
   @type    : myodbc3 internal
-  @purpose : deletes the positioned cursor row
+  @purpose : deletes the positioned cursor row - will del all rows in rowset if irow = 0
 */
 
 static SQLRETURN setpos_delete(STMT FAR *stmt, SQLUSMALLINT irow,
@@ -951,30 +937,36 @@
     ulong        query_length;
     const char   *table_name;
 
+    /* we want to work with base table name - we expect call to fail if more than one
base table involved */
     if ( !(table_name= find_used_table(stmt)) )
         return SQL_ERROR;
 
+    /* appened our table name to our DELETE statement */
     dynstr_append_quoted_name(dynQuery,table_name);
     query_length= dynQuery->length;
 
-    if ( !irow )
+    /* IF irow == 0 THEN delete all rows in the current rowset ELSE specific (as in one)
row */
+    if ( irow == 0 )
     {
-        /*
-          If irow == 0, then delete all rows in the current rowset
-        */
         rowset_pos= 1;
         rowset_end= stmt->rows_found_in_set;
     }
     else
         rowset_pos= rowset_end= irow;
 
-    do /* DELETE	irow from current row set */
+    /* process all desired rows in the rowset - we assume rowset_pos is valid */
+    do
     {
         dynQuery->length= query_length;
+
+        /* append our WHERE clause to our DELETE statement */
+/* printf( "\n[PAH][%s][%d] %d\n", __FILE__, __LINE__, rowset_pos ); */
         nReturn = build_where_clause( stmt, dynQuery, (SQLUSMALLINT)rowset_pos );
+/* printf( "\n[PAH][%s][%d] (%s)\n", __FILE__, __LINE__, dynQuery ); */
         if ( !SQL_SUCCEEDED( nReturn ) )
             return nReturn;
 
+        /* execute our DELETE statement */
         MYODBCDbgPrint("SQLPOS_DELETE:",("%s",dynQuery->str));
         if ( !(nReturn= exec_stmt_query(stmt, dynQuery->str, dynQuery->length)) )
             affected_rows+= stmt->dbc->mysql.affected_rows;
@@ -1280,14 +1272,17 @@
                 if ( irow > stmt->rows_found_in_set )
                     MYODBCDbgReturn(set_error(stmt,MYERR_S1107,NULL,0));
 
+                /* IF dynamic cursor THEN rerun query to refresh resultset */
                 if ( if_dynamic_cursor(stmt) && set_dynamic_result(stmt) )
-                {
                     MYODBCDbgReturn(set_error(stmt,MYERR_S1000, alloc_error, 0));
-                }
+
+                /* start building our DELETE statement */
                 if ( init_dynamic_string(&dynQuery, "DELETE FROM ", 1024, 1024) )
                     MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
 
-                sqlRet= setpos_delete(stmt,irow,&dynQuery);
+/* printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ ); */
+                sqlRet = setpos_delete( stmt, irow, &dynQuery );
+/* printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ ); */
                 dynstr_free(&dynQuery);
                 break;
             }
@@ -1299,10 +1294,10 @@
                 if ( irow > stmt->rows_found_in_set )
                     MYODBCDbgReturn(set_error(stmt,MYERR_S1107,NULL,0));
 
+                /* IF dynamic cursor THEN rerun query to refresh resultset */
                 if ( if_dynamic_cursor(stmt) && set_dynamic_result(stmt) )
-                {
                     MYODBCDbgReturn(set_error(stmt,MYERR_S1000, alloc_error, 0));
-                }
+
                 if ( init_dynamic_string(&dynQuery, "UPDATE ", 1024, 1024) )
                     MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
 

Modified: myodbc3/prepare.c
===================================================================
--- myodbc3/prepare.c	2006-03-06 07:12:03 UTC (rev 44)
+++ myodbc3/prepare.c	2006-03-09 06:22:51 UTC (rev 45)
@@ -43,7 +43,7 @@
 
 #include "myodbc3.h"
 #ifndef _UNIX_
-#include <dos.h>
+    #include <dos.h>
 #endif /* !_UNIX_ */
 #include <my_list.h>
 #include <m_ctype.h>
@@ -54,9 +54,9 @@
 */
 
 SQLRETURN SQL_API SQLPrepare(SQLHSTMT hstmt,SQLCHAR FAR *szSqlStr,
-			     SQLINTEGER cbSqlStr)
+                             SQLINTEGER cbSqlStr)
 {
-  return my_SQLPrepare(hstmt,szSqlStr,cbSqlStr);
+    return my_SQLPrepare(hstmt,szSqlStr,cbSqlStr);
 }
 
 /*
@@ -64,96 +64,127 @@
   @purpose : prepares an SQL string for execution
 */
 
-SQLRETURN my_SQLPrepare(SQLHSTMT hstmt,SQLCHAR FAR *szSqlStr,
-			SQLINTEGER cbSqlStr)
+SQLRETURN my_SQLPrepare( SQLHSTMT hstmt, SQLCHAR FAR *szSqlStr, SQLINTEGER cbSqlStr )
 {
-  STMT FAR *stmt= (STMT FAR*) hstmt;
-  char in_string,*pos;
-  uint param_count;
+    STMT FAR *stmt= (STMT FAR*) hstmt;
+    char in_string,*pos;
+    uint param_count;
 #ifdef	USE_MB
-  char *end;
+    char *end;
 #endif
-  CHARSET_INFO *charset_info= stmt->dbc->mysql.charset;
-  MYODBCDbgEnter("SQLPrepare");
+    CHARSET_INFO *charset_info= stmt->dbc->mysql.charset;
+    int bPerhapsEmbraced = 1;
+    int bEmbraced = 0;
+    char *pcLastCloseBrace = 0;
 
-  LINT_INIT(end);
+    MYODBCDbgEnter("SQLPrepare");
 
-  CLEAR_STMT_ERROR(stmt);
-  if (stmt->query)
-    my_free(stmt->query,MYF(0));
+    LINT_INIT(end);
+
+    CLEAR_STMT_ERROR(stmt);
+    if (stmt->query)
+        my_free(stmt->query,MYF(0));
 #ifdef NOT_NEEDED  
-  SQLFreeStmt(hstmt,SQL_UNBIND);	/* Not needed according to VB 5.0 */
+    SQLFreeStmt(hstmt,SQL_UNBIND);    /* Not needed according to VB 5.0 */
 #endif
 
-  if (!(stmt->query= dupp_str((char*) szSqlStr, cbSqlStr)))
-    MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
-  MYODBCDbgPrint("enter",("%s",stmt->query));
+    if (!(stmt->query= dupp_str((char*) szSqlStr, cbSqlStr)))
+        MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+    MYODBCDbgPrint("enter",("%s",stmt->query));
 
-  /* Count number of parameters and save position for each parameter */
-  in_string= 0;
-  param_count= 0;
+    /* Count number of parameters and save position for each parameter */
+    in_string= 0;
+    param_count= 0;
 
 #ifdef	USE_MB
-  if (use_mb(charset_info))
-    end= strend(stmt->query);
+    if (use_mb(charset_info))
+        end= strend(stmt->query);
 #endif
 
-  for (pos= stmt->query; *pos ; pos++)
-  {
+    for (pos= stmt->query; *pos ; pos++)
+    {
 #ifdef	USE_MB
-    if (use_mb(charset_info))
-    {
-      int l;
-      if ((l= my_ismbchar(charset_info, pos , end)))
-      {
-	pos+= l-1;
-	continue;
-      }
-    }
+        if (use_mb(charset_info))
+        {
+            int l;
+            if ((l= my_ismbchar(charset_info, pos , end)))
+            {
+                pos+= l-1;
+                continue;
+            }
+        }
 #endif
-    if (*pos == '\\' && pos[1])     /* Next char is escaped */
-    {
-      pos++;
-      continue;
+
+        /* handle case where we have statement within {} - in this case we want to
replace'em with ' ' */
+        if ( bPerhapsEmbraced )
+        {
+            if ( *pos == '{' )
+            {
+                bPerhapsEmbraced = 0;
+                bEmbraced = 1;
+                *pos =  ' ';
+                pos++;
+                continue;
+            }
+            else if ( !isspace( *pos ) )
+                bPerhapsEmbraced = 0;
+        }
+        else if ( bEmbraced && *pos == '}' )
+            pcLastCloseBrace = pos;
+
+        /* escape char? */
+        if (*pos == '\\' && pos[1])     /* Next char is escaped */
+        {
+            pos++;
+            continue;
+        }
+
+        /* in a string? */
+        if (*pos == in_string)
+        {
+            if (pos[1] == in_string)      /* Two quotes is ok */
+                pos++;
+            else
+                in_string= 0;
+            continue;
+        }
+
+        /* parameter marker? */
+        if (!in_string)
+        {
+            if (*pos == '\'' || *pos == '"' || *pos == '`')   /* Start of string */
+            {
+                in_string= *pos;
+                continue;
+            }
+            if (*pos == '?')
+            {
+                PARAM_BIND *param;
+                if (param_count >= stmt->params.elements)
+                {
+                    PARAM_BIND tmp_param;
+                    bzero((gptr) &tmp_param,sizeof(tmp_param));
+                    if (push_dynamic(&stmt->params,(gptr) &tmp_param))
+                    {
+                        MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+                    }
+                }
+                param= dynamic_element(&stmt->params,param_count,PARAM_BIND*);
+                param->pos_in_query= pos;
+                param_count++;
+            }
+        }
     }
-    if (*pos == in_string)
-    {
-      if (pos[1] == in_string)	    /* Two quotes is ok */
-	pos++;
-      else
-	in_string= 0;
-      continue;
-    }
-    if (!in_string)
-    {
-      if (*pos == '\'' || *pos == '"' || *pos == '`')	/* Start of string */
-      {
-	in_string= *pos;
-	continue;
-      }
-      if (*pos == '?')
-      {
-	PARAM_BIND *param;
-	if (param_count >= stmt->params.elements)
-	{
-	  PARAM_BIND tmp_param;
-	  bzero((gptr) &tmp_param,sizeof(tmp_param));
-	  if (push_dynamic(&stmt->params,(gptr) &tmp_param))
-	  {
-	    MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
-	  }
-	}
-	param= dynamic_element(&stmt->params,param_count,PARAM_BIND*);
-	param->pos_in_query= pos;
-	param_count++;
-      }
-    }
-  }
-  stmt->param_count= param_count;
-  stmt->query_end= pos;
-  stmt->state= ST_PREPARED;
-  MYODBCDbgPrint("info",("Parameter count: %ld",stmt->param_count));
-  MYODBCDbgReturn(SQL_SUCCESS);
+
+    /* remove closing brace if we have one */
+    if ( pcLastCloseBrace )
+        *pcLastCloseBrace = ' ';
+
+    stmt->param_count= param_count;
+    stmt->query_end= pos;
+    stmt->state= ST_PREPARED;
+    MYODBCDbgPrint("info",("Parameter count: %ld",stmt->param_count));
+    MYODBCDbgReturn(SQL_SUCCESS);
 }
 
 
@@ -169,59 +200,59 @@
                                        SQLSMALLINT  fSqlType,
                                        SQLULEN      cbColDef __attribute__((unused)),
                                        SQLSMALLINT  ibScale __attribute__((unused)),
-                                       SQLPOINTER	rgbValue,
+                                       SQLPOINTER   rgbValue,
                                        SQLLEN       cbValueMax,
                                        SQLLEN *     pcbValue )
 {
-  STMT FAR *stmt= (STMT FAR*) hstmt;
-  PARAM_BIND param;
-  MYODBCDbgEnter("SQLBindParameter");
-  MYODBCDbgPrint("enter",
-	     ("ipar: %d  Ctype: %d  SQLtype: %d  rgbValue: 0x%lx  ValueMax: %ld  Valueptr: 0x%lx
 Value: %ld",
-	      ipar,fCType,fSqlType,rgbValue, cbValueMax,
-	      pcbValue, pcbValue ? *pcbValue : 0L));
+    STMT FAR *stmt= (STMT FAR*) hstmt;
+    PARAM_BIND param;
+    MYODBCDbgEnter("SQLBindParameter");
+    MYODBCDbgPrint("enter",
+                   ("ipar: %d  Ctype: %d  SQLtype: %d  rgbValue: 0x%lx  ValueMax: %ld 
Valueptr: 0x%lx  Value: %ld",
+                    ipar,fCType,fSqlType,rgbValue, cbValueMax,
+                    pcbValue, pcbValue ? *pcbValue : 0L));
 
-  CLEAR_STMT_ERROR(stmt);
+    CLEAR_STMT_ERROR(stmt);
 
-  if (ipar-- < 1)
-  {
-    set_error(stmt,MYERR_S1093,NULL,0);
-    MYODBCDbgReturn(SQL_ERROR);
-  }
-  if (fCType == SQL_C_NUMERIC) /* We don't support this now */
-  {
-    set_error(stmt,MYERR_07006,
-	      "Restricted data type attribute violation(SQL_C_NUMERIC)",0);
-    MYODBCDbgReturn(SQL_ERROR);
-  }
-  if (stmt->params.elements > ipar)
-  {
-    /* Change old bind parameter */
-    PARAM_BIND *old= dynamic_element(&stmt->params,ipar,PARAM_BIND*);
-    if (old->alloced)
+    if (ipar-- < 1)
     {
-      old->alloced= 0;
-      my_free(old->value,MYF(0));
+        set_error(stmt,MYERR_S1093,NULL,0);
+        MYODBCDbgReturn(SQL_ERROR);
     }
-    memcpy((gptr) &param,(gptr) old,sizeof(param));
-  }
-  else
-    bzero((gptr)&param, sizeof(param));
-  /* Simply record the values. These are used later (SQLExecute) */
-  param.used= 1;
-  param.SqlType= fSqlType;
-  param.CType= (fCType == SQL_C_DEFAULT ? default_c_type(fSqlType) : fCType);
-  param.buffer= rgbValue;
-  param.ValueMax= cbValueMax;
-  param.actual_len= pcbValue;
-  param.real_param_done= TRUE;
+    if (fCType == SQL_C_NUMERIC) /* We don't support this now */
+    {
+        set_error(stmt,MYERR_07006,
+                  "Restricted data type attribute violation(SQL_C_NUMERIC)",0);
+        MYODBCDbgReturn(SQL_ERROR);
+    }
+    if (stmt->params.elements > ipar)
+    {
+        /* Change old bind parameter */
+        PARAM_BIND *old= dynamic_element(&stmt->params,ipar,PARAM_BIND*);
+        if (old->alloced)
+        {
+            old->alloced= 0;
+            my_free(old->value,MYF(0));
+        }
+        memcpy((gptr) &param,(gptr) old,sizeof(param));
+    }
+    else
+        bzero((gptr)&param, sizeof(param));
+    /* Simply record the values. These are used later (SQLExecute) */
+    param.used= 1;
+    param.SqlType= fSqlType;
+    param.CType= (fCType == SQL_C_DEFAULT ? default_c_type(fSqlType) : fCType);
+    param.buffer= rgbValue;
+    param.ValueMax= cbValueMax;
+    param.actual_len= pcbValue;
+    param.real_param_done= TRUE;
 
-  if (set_dynamic(&stmt->params,(gptr) &param,ipar))
-  {
-    set_error(stmt,MYERR_S1001,NULL,4001);
-    MYODBCDbgReturn(SQL_ERROR);
-  }
-  MYODBCDbgReturn(SQL_SUCCESS);
+    if (set_dynamic(&stmt->params,(gptr) &param,ipar))
+    {
+        set_error(stmt,MYERR_S1001,NULL,4001);
+        MYODBCDbgReturn(SQL_ERROR);
+    }
+    MYODBCDbgReturn(SQL_SUCCESS);
 }
 
 
@@ -241,16 +272,16 @@
                                     SQLLEN          cbValueMax,
                                     SQLLEN *        pcbValue )
 {
-  return my_SQLBindParameter( hstmt, 
-                              ipar, 
-                              fParamType, 
-                              fCType, 
-                              fSqlType,
-                              cbColDef, 
-                              ibScale, 
-                              rgbValue, 
-                              cbValueMax,
-                              pcbValue );
+    return my_SQLBindParameter( hstmt, 
+                                ipar, 
+                                fParamType, 
+                                fCType, 
+                                fSqlType,
+                                cbColDef, 
+                                ibScale, 
+                                rgbValue, 
+                                cbValueMax,
+                                pcbValue );
 }
 
 
@@ -267,15 +298,15 @@
                                     SQLSMALLINT FAR *pibScale __attribute__((unused)),
                                     SQLSMALLINT FAR *pfNullable )
 {
-  STMT FAR *stmt= (STMT FAR*) hstmt;
-  MYODBCDbgEnter("SQLDescribeParam");
-  if (pfSqlType)
-    *pfSqlType= SQL_VARCHAR;
-  if (pcbColDef)
-    *pcbColDef= (stmt->dbc->flag & FLAG_BIG_PACKETS ? 24*1024*1024L : 255);
-  if (pfNullable)
-    *pfNullable= SQL_NULLABLE_UNKNOWN;
-  MYODBCDbgReturn(SQL_SUCCESS);
+    STMT FAR *stmt= (STMT FAR*) hstmt;
+    MYODBCDbgEnter("SQLDescribeParam");
+    if (pfSqlType)
+        *pfSqlType= SQL_VARCHAR;
+    if (pcbColDef)
+        *pcbColDef= (stmt->dbc->flag & FLAG_BIG_PACKETS ? 24*1024*1024L : 255);
+    if (pfNullable)
+        *pfNullable= SQL_NULLABLE_UNKNOWN;
+    MYODBCDbgReturn(SQL_SUCCESS);
 }
 
 
@@ -288,18 +319,18 @@
                                    SQLULEN      crow,
                                    SQLULEN *    pirow __attribute__((unused)) )
 {
-  MYODBCDbgEnter("SQLParamOptions");
+    MYODBCDbgEnter("SQLParamOptions");
 
-  if (crow != 1)
-  {
-    /*
-      Currently return warning for batch processing request,
-      but need to handle in the future..
-    */
-    return (set_error(hstmt,MYERR_01S02,
-		      "Option value changed to default parameter size",0));
-  }
-  MYODBCDbgReturn(SQL_SUCCESS);
+    if (crow != 1)
+    {
+        /*
+          Currently return warning for batch processing request,
+          but need to handle in the future..
+        */
+        return(set_error(hstmt,MYERR_01S02,
+                         "Option value changed to default parameter size",0));
+    }
+    MYODBCDbgReturn(SQL_SUCCESS);
 }
 
 
@@ -310,11 +341,11 @@
 
 SQLRETURN SQL_API SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT FAR *pcpar)
 {
-  STMT FAR *stmt= (STMT FAR*) hstmt;
-  MYODBCDbgEnter("SQLNumParams");
-  if (pcpar)
-    *pcpar= stmt->param_count;
-  MYODBCDbgReturn(SQL_SUCCESS);
+    STMT FAR *stmt= (STMT FAR*) hstmt;
+    MYODBCDbgEnter("SQLNumParams");
+    if (pcpar)
+        *pcpar= stmt->param_count;
+    MYODBCDbgReturn(SQL_SUCCESS);
 }
 
 
@@ -328,8 +359,8 @@
                                         SQLLEN          crowKeyset
__attribute__((unused)),
                                         SQLUSMALLINT    crowRowset )
 {
-  STMT FAR *stmt= (STMT FAR*) hstmt;
-  MYODBCDbgEnter("SQLSetScrollOptions");
-  stmt->stmt_options.rows_in_set= crowRowset;
-  MYODBCDbgReturn(SQL_SUCCESS);
+    STMT FAR *stmt= (STMT FAR*) hstmt;
+    MYODBCDbgEnter("SQLSetScrollOptions");
+    stmt->stmt_options.rows_in_set= crowRowset;
+    MYODBCDbgReturn(SQL_SUCCESS);
 }

Modified: test/dyn_cursor/my_dyn_cursor.c
===================================================================
--- test/dyn_cursor/my_dyn_cursor.c	2006-03-06 07:12:03 UTC (rev 44)
+++ test/dyn_cursor/my_dyn_cursor.c	2006-03-09 06:22:51 UTC (rev 45)
@@ -343,39 +343,33 @@
     rc = SQLExecDirect(hstmt,"select col2 from setpos_delete_ignore",SQL_NTS);
     mystmt(hstmt,rc);    
 
-printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
     rc = SQLBindCol(hstmt,1,SQL_C_CHAR,szData,100,&nlen);
     mystmt(hstmt,rc);
-printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
 
     rc = SQLExtendedFetch(hstmt,SQL_FETCH_ABSOLUTE,2,NULL,NULL);
     mystmt(hstmt,rc);
-printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
 
     strcpy(szData,"mysql2");
 printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
-    rc = SQLSetPos(hstmt,0,SQL_DELETE,SQL_LOCK_NO_CHANGE);
-    mystmt(hstmt,rc);
+    /* SQL_DELETE all rows by passing row=0 */
+    rc = SQLSetPos( hstmt, 0, SQL_DELETE, SQL_LOCK_NO_CHANGE );
+    mystmt( hstmt, rc );
 printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
 
     rc = SQLRowCount(hstmt,&nlen);
     mystmt(hstmt,rc);
-printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
 
     printMessage(" rows affected:%d\n",nlen); 
 
     /* FINI */
     rc = SQLFreeStmt(hstmt,SQL_UNBIND);
     mystmt(hstmt,rc);
-printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
 
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
-printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
 
     rc = SQLExecDirect(hstmt,"select * from setpos_delete_ignore",SQL_NTS);
     mystmt(hstmt,rc);  
-printf( "\n[PAH][%s][%d]\n", __FILE__, __LINE__ );
 
     myassert(3 == myresult(hstmt));
 

Modified: test/test32/mytest32.c
===================================================================
--- test/test32/mytest32.c	2006-03-06 07:12:03 UTC (rev 44)
+++ test/test32/mytest32.c	2006-03-09 06:22:51 UTC (rev 45)
@@ -871,11 +871,13 @@
     SQLINTEGER a, a1, length, length1;
     SQLCHAR    b[]= "abcdefghij", b1[10];
 
+/*
     if (!mysql_min_version(hdbc, "5.0",3))
     {
         printMessage("\n server doesn't support stored procedures..skipped");
         return;
     }
+*/
 
     SQLExecDirect(hstmt,"drop procedure t_sp",SQL_NTS);
 

Thread
Connector/ODBC 3.51 commit: r45 - / myodbc3 test/dyn_cursor test/test32pharvey9 Mar