Removed:
trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c
Modified:
trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgConnectAttrString.c
trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro
trunk/MYODBCDbg/include/MYODBCDbg.h
trunk/defines.pri
trunk/myodbc3/catalog.c
trunk/myodbc3/connect.c
trunk/myodbc3/cursor.c
trunk/myodbc3/dll.c
trunk/myodbc3/error.c
trunk/myodbc3/execute.c
trunk/myodbc3/handle.c
trunk/myodbc3/info.c
trunk/myodbc3/myodbc3.h
trunk/myodbc3/myodbc3.pro
trunk/myodbc3/myutil.h
trunk/myodbc3/options.c
trunk/myodbc3/prepare.c
trunk/myodbc3/results.c
trunk/myodbc3/transact.c
trunk/myodbc3/utility.c
trunk/mysql.pri
Log:
ENH: decoupled debug/trace of driver from client for greater control of ODBC debug
sessions and less dependencies (similar trace output will make easier to compare with
c/odbc v5 trace)
ENH: Uses same MYODBC_LOG env var as C/ODBC v5
Modified: trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgConnectAttrString.c
===================================================================
--- trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgConnectAttrString.c 2006-10-07 09:05:28 UTC (rev
126)
+++ trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgConnectAttrString.c 2006-10-07 21:07:10 UTC (rev
127)
@@ -28,6 +28,10 @@
*/
#include "../include/MYODBCDbg.h"
+int MYODBCDbgOn = 0;
+FILE * MYODBCDbgFile = NULL;
+int MYODBCDbgNest = 0;
+
const char *MYODBCDbgConnectAttrString( SQLINTEGER nAttribute )
{
Deleted: trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c
===================================================================
--- trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c 2006-10-07 09:05:28 UTC (rev
126)
+++ trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c 2006-10-07 21:07:10 UTC (rev
127)
@@ -1,42 +0,0 @@
-/*!
- \file MYODBCDbgGetFileDefault.c
- \author Peter Harvey <pharvey@stripped>
- Copyright (C) MySQL AB 2004-2005, Released under GPL.
- \version Connector/ODBC v3
- \date 2005
- \brief Code to provide debug information.
-
- \license Copyright (C) 2000-2005 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- There are special exceptions to the terms and conditions of the GPL as it
- is applied to this software. View the full text of the exception in file
- EXCEPTIONS in the directory of this software distribution.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-#include "../include/MYODBCDbg.h"
-
-const char *MYODBCDbgGetFileDefault()
-{
- if ( getenv( "MYODBC_LOG" ) )
- return getenv( "MYODBC_LOG" );
-
-#ifdef _UNIX_
- return "d:t:S:O,/tmp/myodbc.log";
-#else
- return "d:t:S:O,c:\\myodbc.log";
-#endif /* _UNIX */
-}
-
Modified: trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro
===================================================================
--- trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro 2006-10-07 21:07:10 UTC (rev 127)
@@ -39,7 +39,6 @@
MYODBCDbgDiagFieldString.c \
MYODBCDbgEnvAttrString.c \
MYODBCDbgFunctionsString.c \
- MYODBCDbgGetFileDefault.c \
MYODBCDbgHandleTypeString.c \
MYODBCDbgInfoTypeString.c \
MYODBCDbgPosTypeString.c \
Modified: trunk/MYODBCDbg/include/MYODBCDbg.h
===================================================================
--- trunk/MYODBCDbg/include/MYODBCDbg.h 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/MYODBCDbg/include/MYODBCDbg.h 2006-10-07 21:07:10 UTC (rev 127)
@@ -29,10 +29,199 @@
#ifndef MYODBC_DBG_H
#define MYODBC_DBG_H
+#include <stdio.h>
+
/* #include "../../MYODBC_MYSQL.h" */
+
#include "../../MYODBC_CONF.h"
#include "../../MYODBC_ODBC.h"
+extern int MYODBCDbgOn;
+extern FILE * MYODBCDbgFile;
+extern int MYODBCDbgNest;
+
+#ifdef MYODBC_DBG
+
+#define MYODBCDbgInit \
+{ \
+ char *pszMyODBCLog = getenv( "MYODBC_LOG" ); \
+ MYODBCDbgOn = 0; \
+ MYODBCDbgFile = NULL; \
+ MYODBCDbgNest = 0; \
+ if ( pszMyODBCLog && *pszMyODBCLog ) \
+ { \
+ if ( strcmp( pszMyODBCLog, "off" ) == 0 ) \
+ { \
+ } \
+ else if ( strcmp( pszMyODBCLog, "stdout" ) == 0 || strcmp( pszMyODBCLog, "stderr"
) == 0 ) \
+ { \
+ MYODBCDbgSetFile( pszMyODBCLog ); \
+ } \
+ else \
+ { \
+ MYODBCDbgSetFile( pszMyODBCLog ); \
+ if ( !MYODBCDbgFile ) \
+ { \
+ MYODBCDbgSetFile( "stderr" ); \
+ } \
+ } \
+ } \
+ if ( MYODBCDbgFile ) \
+ MYODBCDbgSetOn; \
+}
+
+#define MYODBCDbgFini \
+{ \
+ if ( MYODBCDbgFile ) \
+ { \
+ if ( MYODBCDbgFile != stdout && MYODBCDbgFile != stderr ) \
+ fclose( MYODBCDbgFile ); \
+ } \
+ MYODBCDbgOn = 0; \
+ MYODBCDbgFile = NULL; \
+ MYODBCDbgNest = 0; \
+}
+
+#define MYODBCDbgEnter \
+{ \
+ int nNest = 0; \
+ if ( MYODBCDbgOn && MYODBCDbgFile ) \
+ { \
+ for ( nNest = 0; nNest < MYODBCDbgNest; nNest++ ) \
+ { \
+ fprintf( MYODBCDbgFile, "| " ); \
+ } \
+ fprintf( MYODBCDbgFile, "[ENTER][%s][%s][%d]\n", __FILE__, __FUNCTION__, __LINE__
); \
+ } \
+ MYODBCDbgNest++; \
+}
+
+#define MYODBCDbgReturn( A ) \
+{ \
+ int nNest = 0; \
+ if ( MYODBCDbgOn && MYODBCDbgFile ) \
+ { \
+ for ( nNest = 0; nNest < MYODBCDbgNest; nNest++ ) \
+ { \
+ fprintf( MYODBCDbgFile, "| " ); \
+ } \
+ fprintf( MYODBCDbgFile, "[RETURN][%s][%s][%d]\n", __FILE__, __FUNCTION__,
__LINE__ ); \
+ } \
+ MYODBCDbgNest--; \
+ return ( A ); \
+}
+
+#define MYODBCDbgReturnReturn( A ) \
+{ \
+ int nNest = 0; \
+ SQLRETURN nReturn_ = A; \
+ if ( MYODBCDbgOn && MYODBCDbgFile ) \
+ { \
+ for ( nNest = 0; nNest < MYODBCDbgNest; nNest++ ) \
+ { \
+ fprintf( MYODBCDbgFile, "| " ); \
+ } \
+ fprintf( MYODBCDbgFile, "[RETURN][%s][%s][%d] %s\n", __FILE__, __FUNCTION__,
__LINE__, MYODBCDbgReturnString( nReturn_ ) ); \
+ } \
+ MYODBCDbgNest--; \
+ return ( nReturn_ ); \
+}
+
+#define MYODBCDbgReturnVoid \
+{ \
+ int nNest = 0; \
+ if ( MYODBCDbgOn && MYODBCDbgFile ) \
+ { \
+ for ( nNest = 0; nNest < MYODBCDbgNest; nNest++ ) \
+ { \
+ fprintf( MYODBCDbgFile, "| " ); \
+ } \
+ fprintf( MYODBCDbgFile, "[RETURN][%s][%s][%d]\n", __FILE__, __FUNCTION__,
__LINE__ ); \
+ } \
+ MYODBCDbgNest--; \
+}
+
+#define MYODBCDbgInfo( A, B ) \
+{ \
+ int nNest = 0; \
+ if ( MYODBCDbgOn && MYODBCDbgFile ) \
+ { \
+ for ( nNest = 0; nNest < MYODBCDbgNest; nNest++ ) \
+ { \
+ fprintf( MYODBCDbgFile, "| " ); \
+ } \
+ fprintf( MYODBCDbgFile, "[INFO][%s][%s][%d]" A "\n", __FILE__, __FUNCTION__,
__LINE__, B ); \
+ } \
+}
+
+#define MYODBCDbgWarning( A, B ) \
+{ \
+ int nNest = 0; \
+ if ( MYODBCDbgOn && MYODBCDbgFile ) \
+ { \
+ for ( nNest = 0; nNest < MYODBCDbgNest; nNest++ ) \
+ { \
+ fprintf( MYODBCDbgFile, "| " ); \
+ } \
+ fprintf( MYODBCDbgFile, "[WARNING][%s][%s][%d]" A "\n", __FILE__, __FUNCTION__,
__LINE__, B ); \
+ } \
+}
+
+#define MYODBCDbgError( A, B ) \
+{ \
+ int nNest = 0; \
+ if ( MYODBCDbgOn && MYODBCDbgFile ) \
+ { \
+ for ( nNest = 0; nNest < MYODBCDbgNest; nNest++ ) \
+ { \
+ fprintf( MYODBCDbgFile, "| " ); \
+ } \
+ fprintf( MYODBCDbgFile, "[ERROR][%s][%s][%d]" A "\n", __FILE__, __FUNCTION__,
__LINE__, B ); \
+ } \
+}
+
+#define MYODBCDbgSetOn \
+{ \
+ MYODBCDbgOn = 1; \
+}
+
+#define MYODBCDbgSetOff \
+{ \
+ MYODBCDbgOn = 0; \
+}
+
+#define MYODBCDbgSetFile( A ) \
+{ \
+ if ( MYODBCDbgFile ) \
+ { \
+ if ( MYODBCDbgFile != stdout && MYODBCDbgFile != stderr ) \
+ fclose( MYODBCDbgFile ); \
+ } \
+ if ( strcmp( A, "stdout" ) == 0 ) \
+ MYODBCDbgFile = stdout; \
+ else if ( strcmp( A, "stderr" ) == 0 ) \
+ MYODBCDbgFile = stderr; \
+ else \
+ { \
+ MYODBCDbgFile = fopen( A, "aw+" ); \
+ } \
+}
+
+#else
+ #define MYODBCDbgInit
+ #define MYODBCDbgFini
+ #define MYODBCDbgEnter
+ #define MYODBCDbgReturn( A ) return ( A )
+ #define MYODBCDbgReturnReturn( A ) return ( A )
+ #define MYODBCDbgReturnVoid return
+ #define MYODBCDbgInfo( A, B )
+ #define MYODBCDbgWarning( A, B )
+ #define MYODBCDbgError( A, B )
+ #define MYODBCDbgSetOn
+ #define MYODBCDbgSetOff
+ #define MYODBCDbgSetFile( A )
+#endif
+
/*!
\brief Returns a string version of a connection attribute.
@@ -134,25 +323,6 @@
const char *MYODBCDbgInfoTypeString( SQLUSMALLINT nInfoType );
/*!
- \brief Initializes debug output.
-
- Call this before using any of the MYODBCDbg functions.
-
- \sa MYODBCDbgPrint
- MYODBCDbgSetFile
-*/
-#ifdef DBUG_OFF
-#define MYODBCDbgInit
-#else
-#define MYODBCDbgInit \
-{ \
- char *psz = getenv( "MYODBC_LOG" ); \
- if ( psz && *psz ) \
- MYODBCDbgSetFile( psz ) \
-}
-#endif
-
-/*!
\brief Returns a string version of the position type as found in SQLSetPos.
Returns a string version of position type. This is great for
@@ -236,145 +406,5 @@
*/
const char *MYODBCDbgTransactionTypeString( SQLSMALLINT nType );
-/*!
- \brief Sets debug control information.
-
- Sets debug control information including filename for output.
-
- \note This has not effect if DBUG_OFF is set.
-
- \param pszControl This is a "const char *" which indicates the control
- information. Example;
-
- "d:t:S:O,/tmp/myodbc.log"
-
- \return void
-
- \sa MYODBCDbgInit
- MYODBCDbgFini
- MYODBCDbgPrint
-*/
-#define MYODBCDbgSetFile(A) \
-{ \
- DBUG_PUSH(A); \
- DBUG_PROCESS( "MYODBC" ); \
- MYODBCDbgPrint( "start", ( "Driver name: Connector/ODBC Version: %s", VERSION ) ); \
-}
-
-/*!
- \brief Inits debug for a function.
-
- This declares some working vars for dbg interface and logs that
- we have entered the function.
-
- \note This has not effect if DBUG_OFF is set.
-
- \param pszMsg This is a "const char *" which can be any message.
-
- \return void
-
- \sa MYODBCDbgInit
- MYODBCDbgFini
- MYODBCDbgPrint
- MYODBCDbgReturn
-*/
-#define MYODBCDbgEnter DBUG_ENTER
-
-/*!
- \brief Prints useful debug information.
-
- This processes the given keyword & argslist and prints the result
according
- to the debug control information.
-
- \note This has not effect if DBUG_OFF is set.
-
- \param keyword
- \param arglist
-
- \return void
-
- \sa MYODBCDbgInit
- MYODBCDbgFini
-*/
-#define MYODBCDbgPrint DBUG_PRINT
-
-/*!
- \brief Stops the debug.
-
- Stops the debug and frees resources allocated in MYODBCDbgInit.
-
- \note This has not effect if DBUG_OFF is set.
-
- \return void
-
- \sa MYODBCDbgInit
- MYODBCDbgFini
-*/
-#define MYODBCDbgFini {}
-
-/*!
- \brief Returns from a function.
-
- Prints that we are leaving a function and what the retval is.
-
- \note This has not effect if DBUG_OFF is set.
-
- \param SQLRETURN
-
- \return SQLRETURN
-
- \sa MYODBCDbgInit
- MYODBCDbgFini
- MYODBCDbgEnter
- MYODBCDbgReturn2
- MYODBCDbgReturn3
-*/
-#ifdef DBUG_OFF
-#define MYODBCDbgReturn(A) return (A);
-#else
-#define MYODBCDbgReturn(A) \
-{ \
- SQLRETURN rc= (A); \
- MYODBCDbgPrint("exit", ("%s", MYODBCDbgReturnString( rc )) ); \
- DBUG_RETURN( rc ); \
-}
#endif
-const char *MYODBCDbgGetFileDefault();
-
-/*!
- \brief Returns from a function.
-
- Prints that we are leaving a function and what the retval is.
-
- \note This has not effect if DBUG_OFF is set.
-
- \param SQLRETURN
-
- \return SQLRETURN
-
- \sa MYODBCDbgInit
- MYODBCDbgFini
- MYODBCDbgEnter
- MYODBCDbgReturn
- MYODBCDbgReturn3
-*/
-#define MYODBCDbgReturn2 DBUG_RETURN
-
-/*!
- \brief Returns from a function.
-
- Prints that we are leaving a function.
-
- \note This has not effect if DBUG_OFF is set.
-
- \sa MYODBCDbgInit
- MYODBCDbgFini
- MYODBCDbgEnter
- MYODBCDbgReturn2
- MYODBCDbgReturn
-*/
-#define MYODBCDbgReturn3 DBUG_VOID_RETURN
-
-#endif
-
Modified: trunk/defines.pri
===================================================================
--- trunk/defines.pri 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/defines.pri 2006-10-07 21:07:10 UTC (rev 127)
@@ -11,6 +11,7 @@
# #########################################################
DEFINES += SETUP_VERSION=\"3.51.13\"
+DEFINES += VERSION=\"3.51.13\"
win32 {
DEFINES -= UNICODE
@@ -25,10 +26,19 @@
}
# #########################################################
-# Define DBUG_OFF to leave trace code out of the build. The
-# default is to include the trace code.
+# Define MYODBC_DBG to enable debug trace/log. Set environment
+# variable.
+#
+# Set MYODBC_LOG to enable/disable at exec time.
+#
+# 1. undefined MYODBC_LOG - No log
+# 2. SET MYODBC_LOG=off - No log
+# 3. SET MYODBC_LOG=stdout - Log to stdout
+# 4. SET MYODBC_LOG=stderr - Log to stderr
+# 5. SET MYODBC_LOG=<filename> - Log appended to <filename>
+#
# #########################################################
-DEFINES += DBUG_OFF
+DEFINES += MYODBC_DBG
# #########################################################
# Define the ammount of output from post-build tests. The
Modified: trunk/myodbc3/catalog.c
===================================================================
--- trunk/myodbc3/catalog.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/catalog.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -287,7 +287,7 @@
MYSQL_RES *result, *sys_result;
my_bool all_dbs= 1, sys_tables, user_tables;
- MYODBCDbgEnter("SQLTables");
+ MYODBCDbgEnter;
CLEAR_STMT_ERROR(hstmt);
my_SQLFreeStmt(hstmt,MYSQL_RESET);
@@ -305,7 +305,7 @@
!TableOwner[0] && !TableName[0] )
{
/* Return set of allowed qualifiers */
- MYODBCDbgPrint("info ",("Return set of table qualifiers / Catalog names"));
+ MYODBCDbgInfo( "%s", "Return set of table qualifiers / Catalog names" );
if ( !all_dbs )
TableQualifier= "%";
@@ -316,8 +316,8 @@
if ( !stmt->result )
{
- MYODBCDbgPrint("error",("%d:%s", mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_errno(&stmt->dbc->mysql) );
goto empty_set;
}
@@ -328,7 +328,7 @@
sizeof(SQLTABLES_qualifier_values),
MYF(0));
mysql_link_fields(stmt,SQLTABLES_fields,SQLTABLES_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
if ( !TableQualifier[0] && (!strcmp(TableOwner,"%") ||
@@ -336,14 +336,14 @@
!TableName[0] )
{
/* Return set of allowed Table owners */
- MYODBCDbgPrint("info ",("Return set of table owners / Schema names"));
+ MYODBCDbgInfo( "%s", "Return set of table owners / Schema names" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_owner_values,
sizeof(SQLTABLES_owner_values),
MYF(0));
stmt->result->row_count= 1;
mysql_link_fields(stmt,SQLTABLES_fields, SQLTABLES_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
TableType= myodbc_get_valid_buffer( Type_buff, szTableType, cbTableType );
@@ -353,7 +353,7 @@
!myodbc_casecmp(TableType,"SQL_ALL_TABLE_TYPES",19)) )
{
/* Return set of TableType qualifiers */
- MYODBCDbgPrint("info ",("Return set of table types"));
+ MYODBCDbgInfo( "%s", "Return set of table types" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_type_values,
sizeof(SQLTABLES_type_values),
@@ -362,7 +362,7 @@
stmt->result->row_count= sizeof(SQLTABLES_type_values)/
sizeof(SQLTABLES_type_values[0]);
mysql_link_fields(stmt,SQLTABLES_fields,SQLTABLES_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
sys_tables= 0;
sys_result= result= 0;
@@ -399,7 +399,8 @@
if ( szTableQualifier && (!stmt->dbc->mysql.db ||
cmp_database(stmt->dbc->mysql.db, TableQualifier)) )
{
/* Return tables from a perticular database */
- MYODBCDbgPrint("info ",("Return set of tables '%s' from '%s'",TableName,
TableQualifier));
+ MYODBCDbgInfo( "Return set of tables '%s'", TableName );
+ MYODBCDbgInfo( " from '%s'", TableQualifier );
pthread_mutex_lock(&stmt->dbc->lock);
result= mysql_list_dbtables(stmt->dbc,TableQualifier,TableName);
pthread_mutex_unlock(&stmt->dbc->lock);
@@ -407,31 +408,29 @@
else
{
/* Return tables from default/current database */
- MYODBCDbgPrint("info ",("Returning set of current database tables
'%s'",TableName));
+ MYODBCDbgInfo( "Returning set of current database tables '%s'", TableName );
pthread_mutex_lock(&stmt->dbc->lock);
result= mysql_list_tables(&stmt->dbc->mysql,TableName);
pthread_mutex_unlock(&stmt->dbc->lock);
}
if ( !result )
{
- MYODBCDbgPrint("error",("%d:%s",
- mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
}
}
/* System tables with type as 'SYSTEM' or 'SYSTEM TABLE' */
if ( sys_tables )
{
- MYODBCDbgPrint("info ",("Return set of system tables"));
+ MYODBCDbgInfo( "%s", "Return set of system tables" );
pthread_mutex_lock(&stmt->dbc->lock);
stmt->result= mysql_list_dbtables(stmt->dbc,"mysql",TableName);
pthread_mutex_unlock(&stmt->dbc->lock);
if ( !(sys_result= stmt->result) )
{
- MYODBCDbgPrint("error",("%d:%s",
- mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
}
}
{
@@ -472,7 +471,7 @@
if ( !(stmt->result_array= (char**) my_malloc(
(uint)(sizeof(char
*)*SQLTABLES_FIELDS*row_count),
MYF(MY_FAE | MY_ZEROFILL))) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1001,NULL,4001) );
data= stmt->result_array;
@@ -532,18 +531,18 @@
stmt->result->row_count= row_count;
}
mysql_link_fields(stmt,SQLTABLES_fields,SQLTABLES_FIELDS);
- MYODBCDbgPrint("info ",("total tables: %ld", stmt->result->row_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total tables: %ld", stmt->result->row_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_values,
sizeof(SQLTABLES_values),
MYF(0));
mysql_link_fields(stmt,SQLTABLES_fields, SQLTABLES_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
@@ -656,7 +655,7 @@
if ( !(select= (char *) my_malloc(sizeof(char *)*(ulong)result->row_count*
(NAME_LEN+1)+NAME_LEN *2, MYF(MY_FAE))) )
{
- MYODBCDbgPrint("error",("Memory allocation failed"));
+ MYODBCDbgError( "%s", "Memory allocation failed" );
return 0;
}
to= strxmov(select,"SELECT ",NullS);
@@ -721,13 +720,16 @@
MEM_ROOT *alloc;
ulong transfer_length,precision,display_size;
- MYODBCDbgEnter("SQLColumns");
+ MYODBCDbgEnter;
- MYODBCDbgPrint("enter",("Qualifier: '%s'(%d) Owner: '%s'(%d) Table: '%s'(%d)
Column: '%s'(%d)",
- szTableQualifier ? (char*) szTableQualifier : "null",
cbTableQualifier,
- szTableOwner ? (char*) szTableOwner : "null", cbTableOwner,
- szTableName ? (char*) szTableName : "null", cbTableName,
- szColumnName ? (char*) szColumnName : "null", cbColumnName));
+ MYODBCDbgInfo( "Qualifier: '%s'", szTableQualifier ? (char*) szTableQualifier :
"null" );
+ MYODBCDbgInfo( "Qualifier: (%d)", cbTableQualifier );
+ MYODBCDbgInfo( "Owner: '%s'", szTableOwner ? (char*) szTableOwner : "null" );
+ MYODBCDbgInfo( "Owner: (%d)", cbTableOwner );
+ MYODBCDbgInfo( "Table: '%s'", szTableName ? (char*) szTableName : "null" );
+ MYODBCDbgInfo( "Table: (%d)", cbTableName );
+ MYODBCDbgInfo( "Column: '%s'", szColumnName ? (char*) szColumnName : "null" );
+ MYODBCDbgInfo( "Column: (%d)", cbColumnName );
TableQualifier= myodbc_get_valid_buffer( Qualifier_buff, szTableQualifier,
cbTableQualifier );
TableName= myodbc_get_valid_buffer( Table_buff, szTableName, cbTableName );
@@ -746,8 +748,8 @@
stmt->result= mysql_list_dbcolumns(stmt,TableQualifier,TableName,ColumnName);
if ( !(result= stmt->result) )
{
- MYODBCDbgPrint("error",("%d:%s", mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
goto empty_set;
}
stmt->result_array= (char**) my_malloc(sizeof(char*)*SQLCOLUMNS_FIELDS*
@@ -857,18 +859,18 @@
}
result->row_count= result->field_count;
mysql_link_fields(stmt,SQLCOLUMNS_fields,SQLCOLUMNS_FIELDS);
- MYODBCDbgPrint("info ",("total columns: %ld", result->row_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total columns: %ld", result->row_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLCOLUMNS_values,
sizeof(SQLCOLUMNS_values),
MYF(0));
mysql_link_fields(stmt,SQLCOLUMNS_fields, SQLCOLUMNS_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
/*
@@ -966,13 +968,16 @@
Table_buff[NAME_LEN+1],
*TableQualifier, *TableName;
- MYODBCDbgEnter("SQLStatistics");
+ MYODBCDbgEnter;
- MYODBCDbgPrint("enter",("Qualifier: '%s'(%d) Owner: '%s'(%d) Table: '%s'(%d)
fUnique: %d, fAccuracy: %d)",
- szTableQualifier ? (char*) szTableQualifier : "null",
cbTableQualifier,
- szTableOwner ? (char*) szTableOwner : "null", cbTableOwner,
- szTableName ? (char*) szTableName : "null", cbTableName,
- fUnique, fAccuracy));
+ MYODBCDbgInfo( "Qualifier: '%s'", szTableQualifier ? (char*) szTableQualifier :
"null" );
+ MYODBCDbgInfo( "Qualifier: (%d)", cbTableQualifier );
+ MYODBCDbgInfo( "Owner: '%s'", szTableOwner ? (char*) szTableOwner : "null" );
+ MYODBCDbgInfo( "Owner: (%d)", cbTableOwner );
+ MYODBCDbgInfo( "Table: '%s'", szTableName ? (char*) szTableName : "null" );
+ MYODBCDbgInfo( "Table: (%d)", cbTableName );
+ MYODBCDbgInfo( "fUnique: %d", fUnique );
+ MYODBCDbgInfo( "fAccuracy: %d)", fAccuracy );
TableQualifier= myodbc_get_valid_buffer( Qualifier_buff, szTableQualifier,
cbTableQualifier );
TableName= myodbc_get_valid_buffer( Table_buff, szTableName, cbTableName );
@@ -989,7 +994,8 @@
pthread_mutex_lock(&dbc->lock);
if ( !(stmt->result= mysql_list_dbkeys(stmt->dbc,TableQualifier,TableName)) )
{
- MYODBCDbgPrint("error",("%d:%s", mysql_errno(mysql),mysql_error(mysql)));
+ MYODBCDbgError( "%d", mysql_errno(mysql) );
+ MYODBCDbgError( "%s", mysql_error(mysql) );
pthread_mutex_unlock(&dbc->lock);
goto empty_set;
}
@@ -1031,18 +1037,18 @@
mysql_data_seek(stmt->result,0); /* Restore pointer */
}
mysql_link_fields(stmt,SQLSTAT_fields,SQLSTAT_FIELDS);
- MYODBCDbgPrint("info ",("total stats count: %ld", stmt->result->row_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total stats count: %ld", stmt->result->row_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLSTAT_values,
sizeof(SQLSTAT_values),
MYF(0));
mysql_link_fields(stmt,SQLSTAT_fields, SQLSTAT_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
/*
@@ -1160,12 +1166,11 @@
STMT FAR *stmt= (STMT FAR*) hstmt;
uint row_count;
- MYODBCDbgEnter("SQLTablePrivileges");
+ MYODBCDbgEnter;
- MYODBCDbgPrint("enter",("Qualifier: '%s' Owner: '%s' Table: '%s'",
- szTableQualifier ? (char*) szTableQualifier : "null",
- szTableOwner ? (char*) szTableOwner : "null",
- szTableName ? (char*) szTableName : "null"));
+ MYODBCDbgInfo( "Qualifier: '%s'", szTableQualifier ? (char*) szTableQualifier :
"null" );
+ MYODBCDbgInfo( "Owner: '%s'", szTableOwner ? (char*) szTableOwner : "null" );
+ MYODBCDbgInfo( "Table: '%s'", szTableName ? (char*) szTableName : "null" );
TableQualifier= myodbc_get_valid_buffer( Qualifier_buff, szTableQualifier,
cbTableQualifier );
TableName= myodbc_get_valid_buffer( Name_buff, szTableName, cbTableName );
@@ -1180,8 +1185,8 @@
if ( !(stmt->result= mysql_list_table_priv(stmt->dbc,
TableQualifier,TableName)) )
{
- MYODBCDbgPrint("error",("%d:%s", mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
pthread_mutex_unlock(&stmt->dbc->lock);
goto empty_set;
}
@@ -1224,18 +1229,18 @@
}
stmt->result->row_count= row_count;
mysql_link_fields(stmt,SQLTABLES_priv_fields,SQLTABLES_PRIV_FIELDS);
- MYODBCDbgPrint("info ",("total table priv count: %ld", row_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total table priv count: %ld", row_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_priv_values,
sizeof(SQLTABLES_priv_values),
MYF(0));
mysql_link_fields(stmt,SQLTABLES_priv_fields,SQLTABLES_PRIV_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
@@ -1334,13 +1339,12 @@
MEM_ROOT *alloc;
uint row_count;
- MYODBCDbgEnter("SQLColumnPrivileges");
+ MYODBCDbgEnter;
- MYODBCDbgPrint("enter",("Qualifier: '%s' Owner: '%s' Table: '%s' column: '%s'",
- szTableQualifier ? (char*) szTableQualifier : "null",
- szTableOwner ? (char*) szTableOwner : "null",
- szTableName ? (char*) szTableName : "null",
- szColumnName ? (char*) szColumnName : "null"));
+ MYODBCDbgInfo( "Qualifier: '%s'", szTableQualifier ? (char*) szTableQualifier :
"null" );
+ MYODBCDbgInfo( "Owner: '%s'", szTableOwner ? (char*) szTableOwner : "null" );
+ MYODBCDbgInfo( "Table: '%s'", szTableName ? (char*) szTableName : "null" );
+ MYODBCDbgInfo( "Column: '%s'", szColumnName ? (char*) szColumnName : "null" );
TableQualifier=myodbc_get_valid_buffer( Qualifier_buff, szTableQualifier,
cbTableQualifier );
TableName= myodbc_get_valid_buffer( Table_buff, szTableName, cbTableName );
@@ -1358,8 +1362,8 @@
TableQualifier,
TableName,ColumnName)) )
{
- MYODBCDbgPrint("error",("%d:%s", mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
pthread_mutex_unlock(&stmt->dbc->lock);
goto empty_set;
}
@@ -1399,18 +1403,18 @@
}
stmt->result->row_count= row_count;
mysql_link_fields(stmt,SQLCOLUMNS_priv_fields,SQLCOLUMNS_PRIV_FIELDS);
- MYODBCDbgPrint("info ",("total columns priv count: %ld", row_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total columns priv count: %ld", row_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLCOLUMNS_priv_values,
sizeof(SQLCOLUMNS_priv_values),
MYF(0));
mysql_link_fields(stmt,SQLCOLUMNS_priv_fields,SQLCOLUMNS_PRIV_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
/*
@@ -1486,14 +1490,14 @@
uint field_count;
my_bool primary_key;
- MYODBCDbgEnter("SQLSpecialColumns");
+ MYODBCDbgEnter;
- MYODBCDbgPrint("enter",("ColType: %d Qualifier: '%s' Owner: '%s' Table: '%s'
Scope: '%d' Nullable: %d",
- fColType,
- szTableQualifier ? (char*) szTableQualifier : "null",
- szTableOwner ? (char*) szTableOwner : "null",
- szTableName ? (char*) szTableName : "null",
- fScope, fNullable));
+ MYODBCDbgInfo( "ColType: %d", fColType );
+ MYODBCDbgInfo( "Qualifier: '%s'", szTableQualifier ? (char*) szTableQualifier :
"null" );
+ MYODBCDbgInfo( "Owner: '%s'", szTableOwner ? (char*) szTableOwner : "null" );
+ MYODBCDbgInfo( "Table: '%s'", szTableName ? (char*) szTableName : "null" );
+ MYODBCDbgInfo( "Scope: '%d'", fScope );
+ MYODBCDbgInfo( "Nullable: %d", fNullable );
TableQualifier=myodbc_get_valid_buffer( Qualifier_buff, szTableQualifier,
cbTableQualifier );
TableName= myodbc_get_valid_buffer( Table_buff, szTableName, cbTableName );
@@ -1506,8 +1510,8 @@
stmt->result= mysql_list_dbcolumns(stmt,TableQualifier,TableName,0);
if ( !(result= stmt->result) )
{
- MYODBCDbgPrint("error",("%d:%s", mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
goto empty_set;
}
@@ -1517,7 +1521,7 @@
if ( !(stmt->result_array= (char**)
my_malloc(sizeof(char*)*SQLSPECIALCOLUMNS_FIELDS*
result->field_count, MYF(MY_FAE
| MY_ZEROFILL))) )
{
- MYODBCDbgPrint("error",("Memory allocation failed"));
+ MYODBCDbgError( "%s", "Memory allocation failed" );
goto empty_set;
}
@@ -1552,15 +1556,15 @@
}
result->row_count= field_count;
mysql_link_fields(stmt,SQLSPECIALCOLUMNS_fields,SQLSPECIALCOLUMNS_FIELDS);
- MYODBCDbgPrint("info ",("total columns count: %ld", field_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total columns count: %ld", field_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
if ( fColType != SQL_BEST_ROWID )
{
- MYODBCDbgReturn(set_error(stmt,MYERR_S1000,
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1000,
"Unsupported argument to SQLSpecialColumns",
- 4000));
+ 4000) );
}
/*
@@ -1582,7 +1586,7 @@
if ( !(stmt->result_array= (char**)
my_malloc(sizeof(char*)*SQLSPECIALCOLUMNS_FIELDS*
result->field_count, MYF(MY_FAE |
MY_ZEROFILL))) )
{
- MYODBCDbgPrint("error",("Memory allocation failed"));
+ MYODBCDbgError( "%s", "Memory allocation failed" );
goto empty_set;
}
@@ -1623,18 +1627,18 @@
}
result->row_count= field_count;
mysql_link_fields(stmt,SQLSPECIALCOLUMNS_fields,SQLSPECIALCOLUMNS_FIELDS);
- MYODBCDbgPrint("info ",("total columns count: %ld", field_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total columns count: %ld", field_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLSPECIALCOLUMNS_values,
sizeof(SQLSPECIALCOLUMNS_values),
MYF(0));
mysql_link_fields(stmt,SQLSPECIALCOLUMNS_fields,SQLSPECIALCOLUMNS_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
/*
@@ -1694,12 +1698,14 @@
char **data;
uint row_count;
- MYODBCDbgEnter("SQLPrimaryKeys");
+ MYODBCDbgEnter;
- MYODBCDbgPrint("enter",("Qualifier: '%s'(%d) Owner: '%s'(%d) Table: '%s'(%d)",
- szTableQualifier ? (char*) szTableQualifier : "null",
cbTableQualifier,
- szTableOwner ? (char*) szTableOwner : "null", cbTableOwner,
- szTableName ? (char*) szTableName : "null", cbTableName));
+ MYODBCDbgInfo( "Qualifier: '%s'", szTableQualifier ? (char*) szTableQualifier :
"null" );
+ MYODBCDbgInfo( "Qualifier: (%d)", cbTableQualifier );
+ MYODBCDbgInfo( "Owner: '%s'", szTableOwner ? (char*) szTableOwner : "null" );
+ MYODBCDbgInfo( "Owner: (%d)", cbTableOwner );
+ MYODBCDbgInfo( "Table: '%s'", szTableName ? (char*) szTableName : "null" );
+ MYODBCDbgInfo( "Table: (%d)", cbTableName );
TableQualifier= myodbc_get_valid_buffer( Qualifier_buff, szTableQualifier,
cbTableQualifier );
TableName= myodbc_get_valid_buffer( Table_buff, szTableName, cbTableName );
@@ -1713,8 +1719,8 @@
pthread_mutex_lock(&stmt->dbc->lock);
if ( !(stmt->result= mysql_list_dbkeys(stmt->dbc,TableQualifier,TableName)) )
{
- MYODBCDbgPrint("error",("%d:%s", mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
pthread_mutex_unlock(&stmt->dbc->lock);
goto empty_set;
}
@@ -1742,18 +1748,18 @@
stmt->result->row_count= row_count;
mysql_link_fields(stmt,SQLPRIM_KEYS_fields,SQLPRIM_KEYS_FIELDS);
- MYODBCDbgPrint("info ",("total keys count: %ld", row_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total keys count: %ld", row_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLPRIM_KEYS_values,
sizeof(SQLPRIM_KEYS_values),
MYF(0));
mysql_link_fields(stmt,SQLPRIM_KEYS_fields,SQLPRIM_KEYS_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
/*
@@ -1854,16 +1860,20 @@
STMT FAR *stmt=(STMT FAR*) hstmt;
uint row_count= 0;
- MYODBCDbgEnter("SQLForeignKeys");
+ MYODBCDbgEnter;
- MYODBCDbgPrint("enter",("PKQualifier: '%s'(%d) PKOwner: '%s'(%d) PKTable: '%s'(%d)
\
- FKQualifier: '%s'(%d) FKOwner: '%s'(%d) FKTable: '%s'(%d)",
- szPkTableQualifier ? (char*) szPkTableQualifier : "null",
cbPkTableQualifier,
- szPkTableOwner ? (char*) szPkTableOwner : "null", cbPkTableOwner,
- szPkTableName ? (char*) szPkTableName : "null", cbPkTableName,
- szFkTableQualifier ? (char*) szFkTableQualifier : "null",
cbFkTableQualifier,
- szFkTableOwner ? (char*) szFkTableOwner : "null", cbFkTableOwner,
- szFkTableName ? (char*) szFkTableName : "null", cbFkTableName));
+ MYODBCDbgInfo( "PKQualifier: '%s'", szPkTableQualifier ? (char*) szPkTableQualifier :
"null" );
+ MYODBCDbgInfo( "PKQualifier: (%d)", cbPkTableQualifier );
+ MYODBCDbgInfo( "PKOwner: '%s'", szPkTableOwner ? (char*) szPkTableOwner : "null" );
+ MYODBCDbgInfo( "PKOwner: (%d)", cbPkTableOwner );
+ MYODBCDbgInfo( "PKTable: '%s'", szPkTableName ? (char*) szPkTableName : "null" );
+ MYODBCDbgInfo( "PKTable: (%d)", cbPkTableName );
+ MYODBCDbgInfo( "FKQualifier: '%s'", szFkTableQualifier ? (char*) szFkTableQualifier :
"null" );
+ MYODBCDbgInfo( "FKQualifier: (%d)", cbFkTableQualifier );
+ MYODBCDbgInfo( "FKOwner: '%s'", szFkTableOwner ? (char*) szFkTableOwner : "null" );
+ MYODBCDbgInfo( "FKOwner: (%d)", cbFkTableOwner );
+ MYODBCDbgInfo( "FKTable: '%s'", szFkTableName ? (char*) szFkTableName : "null" );
+ MYODBCDbgInfo( "FKTable: (%d)", cbFkTableName );
CLEAR_STMT_ERROR(hstmt);
my_SQLFreeStmt(hstmt,MYSQL_RESET);
@@ -1894,8 +1904,8 @@
pthread_mutex_lock(&stmt->dbc->lock);
if ( !(stmt->result= mysql_table_status(stmt,FkTableQualifier,FkTableName)) )
{
- MYODBCDbgPrint("error",("%d:%s", mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) )
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
pthread_mutex_unlock(&stmt->dbc->lock);
goto empty_set;
}
@@ -2019,18 +2029,18 @@
}
stmt->result->row_count= row_count;
mysql_link_fields(stmt,SQLFORE_KEYS_fields,SQLFORE_KEYS_FIELDS);
- MYODBCDbgPrint("info ",("total keys count: %ld", row_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total keys count: %ld", row_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLFORE_KEYS_values,
sizeof(SQLFORE_KEYS_values),
MYF(0));
mysql_link_fields(stmt,SQLFORE_KEYS_fields,SQLFORE_KEYS_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
/*
@@ -2111,19 +2121,21 @@
*ProcName;
STMT FAR *stmt= (STMT FAR*) hstmt;
- MYODBCDbgEnter("SQLProcedures");
+ MYODBCDbgEnter;
- MYODBCDbgPrint("enter",("Qualifier: '%s'(%d) Owner: '%s'(%d) Procedure: '%s'(%d)",
- szProcQualifier ? (char*) szProcQualifier : "null",
cbProcQualifier,
- szProcOwner ? (char*) szProcOwner : "null", cbProcOwner,
- szProcName ? (char*) szProcName : "null", cbProcName));
+ MYODBCDbgInfo( "Qualifier: '%s'", szProcQualifier ? (char*) szProcQualifier : "null"
);
+ MYODBCDbgInfo( "Qualifier: (%d)", cbProcQualifier );
+ MYODBCDbgInfo( "Owner: '%s'", szProcOwner ? (char*) szProcOwner : "null" );
+ MYODBCDbgInfo( "Owner: (%d)", cbProcOwner );
+ MYODBCDbgInfo( "Procedure: '%s'", szProcName ? (char*) szProcName : "null" );
+ MYODBCDbgInfo( "Procedure: (%d)", cbProcName );
CLEAR_STMT_ERROR(hstmt);
my_SQLFreeStmt(hstmt,MYSQL_RESET);
if ( !is_minimum_version(stmt->dbc->mysql.server_version,"5.0",3) )
{
- MYODBCDbgPrint("error",("%s", "Driver doesn't support for this MySQL server
version, upgrade to >= 5.0"));
+ MYODBCDbgError( "%s", "Driver doesn't support for this MySQL server version,
upgrade to >= 5.0" );
goto empty_set;
}
my_SQLFreeStmt(hstmt,MYSQL_RESET);
@@ -2140,8 +2152,8 @@
if ( !stmt->result )
{
- MYODBCDbgPrint("error",("%d:%s",mysql_errno(&stmt->dbc->mysql),
- mysql_error(&stmt->dbc->mysql)));
+ MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
+ MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
goto empty_set;
}
stmt->order = SQLPROCEDURES_order;
@@ -2152,18 +2164,18 @@
sizeof(SQLPROCEDURES_values),MYF(0));
mysql_link_fields(stmt,SQLPROCEDURES_fields,SQLPROCEDURES_FIELDS);
- MYODBCDbgPrint("info ",("total procedures count: %ld",
stmt->result->row_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "total procedures count: %ld", stmt->result->row_count );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
empty_set:
- MYODBCDbgPrint("info ",("Can't match anything; Returning empty set"));
+ MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
stmt->result->row_count= 0;
stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLPROCEDURES_values,
sizeof(SQLPROCEDURES_values),
MYF(0));
mysql_link_fields(stmt,SQLPROCEDURES_fields,SQLPROCEDURES_FIELDS);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
/*
Modified: trunk/myodbc3/connect.c
===================================================================
--- trunk/myodbc3/connect.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/connect.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -58,8 +58,10 @@
{
SQLRETURN error= 0;
my_bool reconnect = 1;
- MYODBCDbgEnter("set_connect_defaults");
-#ifndef DBUG_OFF
+
+ MYODBCDbgEnter;
+
+#ifdef MYODBC_DBG
if (dbc->flag & FLAG_LOG_QUERY && !dbc->query_log)
dbc->query_log= init_query_log();
#endif
@@ -85,13 +87,13 @@
0);
else if (autocommit_on(dbc) &&
(odbc_stmt(dbc,"SET AUTOCOMMIT=0") != SQL_SUCCESS))
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
}
else if ((dbc->commit_flag == CHECK_AUTOCOMMIT_ON) &&
trans_supported(dbc) && !autocommit_on(dbc))
{
if (odbc_stmt(dbc,"SET AUTOCOMMIT=1") != SQL_SUCCESS)
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
}
if (!(dbc->txn_isolation & DEFAULT_TXN_ISOLATION))/* TXN_ISOLATION */
@@ -109,19 +111,17 @@
level="READ UNCOMMITTED";
if (trans_supported(dbc))
{
- MYODBCDbgPrint("info",("setting transaction isolation to level '%s'",
- level));
+ MYODBCDbgInfo( "setting transaction isolation to level '%s'", level );
sprintf(buff,"SET SESSION TRANSACTION ISOLATION LEVEL %s",level);
if (odbc_stmt(dbc,buff) != SQL_SUCCESS)
error= SQL_ERROR;
}
else
{
- MYODBCDbgPrint("info",("SQL_ATTR_TXN_ISOLATION %ld ignored",
- dbc->txn_isolation));
+ MYODBCDbgInfo( "SQL_ATTR_TXN_ISOLATION %ld ignored", dbc->txn_isolation );
}
}
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn( error );
}
@@ -134,8 +134,9 @@
char *init_stmt)
{
ulong client_flag= CLIENT_ODBC;
- MYODBCDbgEnter("get_client_flag");
+ MYODBCDbgEnter;
+
mysql_init(mysql);
if (option_flag & (FLAG_FOUND_ROWS | FLAG_SAFE))
@@ -162,9 +163,10 @@
if (connect_timeout)
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT,(char*) &connect_timeout);
- MYODBCDbgPrint("info",("option_flag: %ld client_flag: %ld", option_flag,
- client_flag));
- MYODBCDbgReturn2( client_flag );
+ MYODBCDbgInfo( "option_flag: %ld", option_flag );
+ MYODBCDbgInfo( "client_flag: %ld", client_flag );
+
+ MYODBCDbgReturn( client_flag );
}
@@ -204,17 +206,18 @@
ulong flag_nr,client_flag;
uint port_nr= 0;
DBC FAR *dbc= (DBC FAR*) hdbc;
- MYODBCDbgEnter("SQLConnect");
+ MYODBCDbgEnter;
+
if (dbc->mysql.net.vio != 0)
- MYODBCDbgReturn(set_conn_error(hdbc,MYERR_08002,NULL,0));
+ MYODBCDbgReturnReturn( set_conn_error(hdbc,MYERR_08002,NULL,0) );
/* Reset error state */
CLEAR_DBC_ERROR(dbc);
dsn_ptr= fix_str(dsn, (char*) szDSN, cbDSN);
if (dsn_ptr && !dsn_ptr[0])
- MYODBCDbgReturn(set_conn_error(hdbc, MYERR_S1000, "Invalid Connection
Parameters",0));
+ MYODBCDbgReturnReturn( set_conn_error(hdbc, MYERR_S1000, "Invalid Connection
Parameters",0) );
SQLGetPrivateProfileString(dsn_ptr,"user","", user, sizeof(user),
MYODBCUtilGetIniFileName( TRUE ) );
SQLGetPrivateProfileString(dsn_ptr,"password","", passwd, sizeof(passwd),
MYODBCUtilGetIniFileName( TRUE ) );
@@ -231,24 +234,18 @@
SQLGetPrivateProfileString(dsn_ptr,"stmt", "", init_stmt, sizeof(init_stmt),
MYODBCUtilGetIniFileName( TRUE ) );
-#ifndef DBUG_OFF
- if ( flag_nr & FLAG_DEBUG && !_db_on_ )
+#ifdef MYODBC_DBG
+ if ( flag_nr & FLAG_DEBUG && !MYODBCDbgOn )
{
- char szMYODBC_LOG[FILENAME_MAX+20]= "";
-
SQLGetPrivateProfileString(dsn_ptr, "TRACE", "", szTRACE, sizeof(szTRACE),
MYODBCUtilGetIniFileName( TRUE ) );
if ( strcasecmp( szTRACE, "ON" ) == 1 || strcasecmp( szTRACE, "YES" ) == 1 ||
strcasecmp( szTRACE, "Y" ) == 1 || *szTRACE == '1' )
{
char szTRACEFILE[FILENAME_MAX+1]= "";
SQLGetPrivateProfileString(dsn_ptr, "TRACEFILE", "", szTRACEFILE,
sizeof(szTRACEFILE), MYODBCUtilGetIniFileName( TRUE ) );
if ( *szTRACEFILE )
- sprintf(szMYODBC_LOG, "d:t:F:L:S:A,%s", szTRACEFILE);
+ MYODBCDbgSetFile( szTRACEFILE );
+ MYODBCDbgSetOn( 1 );
}
-
- if ( *szMYODBC_LOG )
- MYODBCDbgSetFile( szMYODBC_LOG )
- else
- MYODBCDbgSetFile( MYODBCDbgGetFileDefault() )
}
#endif
client_flag= get_client_flag(&dbc->mysql,flag_nr,(uint) dbc->login_timeout,
@@ -271,7 +268,7 @@
mysql_errno(&dbc->mysql));
translate_error(dbc->error.sqlstate,
MYERR_S1000,mysql_errno(&dbc->mysql));
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
}
dbc->dsn= my_strdup(dsn_ptr ? dsn_ptr : database ,MYF(MY_WME));
dbc->database= my_strdup(database,MYF(MY_WME));
@@ -281,7 +278,7 @@
dbc->port= port_nr;
dbc->flag= flag_nr;
- MYODBCDbgReturn(set_connect_defaults(dbc));
+ MYODBCDbgReturnReturn( set_connect_defaults(dbc) );
}
@@ -344,7 +341,7 @@
void * hModule = NULL;
#endif
- MYODBCDbgEnter("SQLDriverConnect");
+ MYODBCDbgEnter;
/* parse incoming string */
if ( !MYODBCUtilReadConnectStr( pDataSource, (LPCSTR)szConnStrIn ) )
@@ -386,10 +383,10 @@
*/
MYODBCUtilDefaultDataSource( pDataSource );
-#ifndef DBUG_OFF
- if ( atol( pDataSource->pszOPTION ) & FLAG_DEBUG && ! _db_on_ )
- MYODBCDbgSetFile( MYODBCDbgGetFileDefault() );
- MYODBCDbgPrint( "enter",( "fDriverCompletion: %d", fDriverCompletion ) );
+#ifdef MYODBC_DBG
+ if ( atol( pDataSource->pszOPTION ) & FLAG_DEBUG && !MYODBCDbgOn )
+ MYODBCDbgSetFile( "stderr" );
+ MYODBCDbgInfo( "fDriverCompletion: %d", fDriverCompletion );
#endif
/*!
@@ -654,7 +651,7 @@
MYODBCUtilFreeDriver( pDriver );
MYODBCUtilFreeDataSource( pDataSource );
- MYODBCDbgReturn( nReturn );
+ MYODBCDbgReturnReturn( nReturn );
}
@@ -697,9 +694,9 @@
SQLSMALLINT cbConnStrOutMax __attribute__((unused)),
SQLSMALLINT FAR *pcbConnStrOut __attribute__((unused)))
{
- MYODBCDbgEnter("SQLBrowseConnect");
- MYODBCDbgReturn(set_conn_error(hdbc,MYERR_S1000,
- "Driver Does not support this API",0));
+ MYODBCDbgEnter;
+ MYODBCDbgReturnReturn( set_conn_error(hdbc,MYERR_S1000,
+ "Driver Does not support this API",0 ) );
}
@@ -712,8 +709,9 @@
{
LIST *list_element,*next_element;
DBC FAR *dbc= (DBC FAR*) hdbc;
- MYODBCDbgEnter("my_SQLDisconnect");
+ MYODBCDbgEnter;
+
for (list_element= dbc->statements ; list_element ;
list_element= next_element)
{
@@ -727,11 +725,11 @@
my_free(dbc->user,MYF(0));
my_free(dbc->password,MYF(0));
dbc->dsn= dbc->database= dbc->server= dbc->user= dbc->password= 0;
-#ifndef DBUG_OFF
+#ifdef MYODBC_DBG
if (dbc->flag & FLAG_LOG_QUERY)
end_query_log(dbc->query_log);
#endif
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
Modified: trunk/myodbc3/cursor.c
===================================================================
--- trunk/myodbc3/cursor.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/cursor.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -55,10 +55,11 @@
MYSQL_FIELD *field, *end;
char *table_name;
MYSQL_RES *result= stmt->result;
- MYODBCDbgEnter("find_used_table");
+ MYODBCDbgEnter;
+
if ( stmt->table_name && stmt->table_name[0] )
- MYODBCDbgReturn2(stmt->table_name);
+ MYODBCDbgReturn( stmt->table_name );
table_name= 0;
for ( field= result->fields, end= field+ result->field_count;
@@ -74,7 +75,7 @@
{
set_error(stmt,MYERR_S1000,
"Can't modify a row from a statement that uses more than one
table",0);
- MYODBCDbgReturn2(NULL);
+ MYODBCDbgReturn( NULL );
}
}
#else
@@ -86,7 +87,7 @@
{
set_error(stmt,MYERR_S1000,
"Can't modify a row from a statement that uses more than one
table",0);
- MYODBCDbgReturn2(NULL);
+ MYODBCDbgReturn( NULL );
}
}
#endif
@@ -96,7 +97,7 @@
while using cursors.
*/
stmt->table_name= dupp_str(table_name,SQL_NTS);
- MYODBCDbgReturn2(stmt->table_name);
+ MYODBCDbgReturn( stmt->table_name );
}
@@ -872,7 +873,7 @@
return nReturn;
/* DELETE the row(s) */
- MYODBCDbgPrint("SQL_DELETE:",("%s",dynQuery->str));
+ MYODBCDbgInfo( "SQL_DELETE: %s", dynQuery->str );
nReturn= exec_stmt_query(stmt, dynQuery->str, dynQuery->length);
if ( nReturn == SQL_SUCCESS || nReturn == SQL_SUCCESS_WITH_INFO )
{
@@ -977,7 +978,7 @@
return nReturn;
/* execute our DELETE statement */
- MYODBCDbgPrint("SQLPOS_DELETE:",("%s",dynQuery->str));
+ MYODBCDbgInfo( "SQLPOS_DELETE: %s", dynQuery->str );
if ( !(nReturn= exec_stmt_query(stmt, dynQuery->str, dynQuery->length)) )
affected_rows+= stmt->dbc->mysql.affected_rows;
@@ -1041,7 +1042,7 @@
if ( !SQL_SUCCEEDED( nReturn ) )
return nReturn;
- MYODBCDbgPrint("SQLPOS_UPDATE:",("%s",dynQuery->str));
+ MYODBCDbgInfo( "SQLPOS_UPDATE: %s", dynQuery->str );
if ( !(nReturn= exec_stmt_query(stmt, dynQuery->str, dynQuery->length)) )
affected_rows+= stmt->dbc->mysql.affected_rows;
@@ -1181,7 +1182,7 @@
} /* END OF while(count < insert_count) */
ext_query->str[--ext_query->length]= '\0';
- MYODBCDbgPrint("batch_insert:",("%s",ext_query->str));
+ MYODBCDbgInfo( "batch_insert: %s", ext_query->str );
if ( exec_stmt_query(stmt, ext_query->str, ext_query->length) !=
SQL_SUCCESS )
return(SQL_ERROR);
@@ -1227,37 +1228,40 @@
STMT FAR *stmt= (STMT FAR*) hstmt;
SQLRETURN sqlRet= SQL_SUCCESS;
MYSQL_RES *result= stmt->result;
- MYODBCDbgEnter("SQLSetPos");
- MYODBCDbgPrint("enter",("irow: %d fOption: %s Lock: %d",
- irow,MYODBCDbgPosTypeString(fOption),fLock));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "irow: %d", irow );
+ MYODBCDbgInfo( "fOption: %s", MYODBCDbgPosTypeString( fOption ) );
+ MYODBCDbgInfo( "Lock: %d", fLock );
+
CLEAR_STMT_ERROR(stmt);
if ( !result )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1010,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1010,NULL,0) );
/* If irow > maximum rows in the resultset */
if ( fOption != SQL_ADD && irow > result->row_count )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1107,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1107,NULL,0) );
/* Not a valid lock type ..*/
if ( fLock != SQL_LOCK_NO_CHANGE )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1C00,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1C00,NULL,0) );
switch ( fOption )
{
case SQL_POSITION:
{
if ( irow == 0 )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1109,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1109,NULL,0) );
if ( irow > stmt->rows_found_in_set )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1107,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1107,NULL,0) );
/* If Dynamic cursor, fetch the latest resultset */
if ( if_dynamic_cursor(stmt) && set_dynamic_result(stmt) )
{
- MYODBCDbgReturn(set_error(stmt,MYERR_S1000, alloc_error, 0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1000, alloc_error, 0) );
}
pthread_mutex_lock(&stmt->dbc->lock);
@@ -1280,19 +1284,17 @@
DYNAMIC_STRING dynQuery;
if ( irow > stmt->rows_found_in_set )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1107,NULL,0));
+ MYODBCDbgReturnReturn( 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));
+ MYODBCDbgReturnReturn( 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));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1001,NULL,4001) );
-/* 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;
}
@@ -1302,14 +1304,14 @@
DYNAMIC_STRING dynQuery;
if ( irow > stmt->rows_found_in_set )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1107,NULL,0));
+ MYODBCDbgReturnReturn( 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));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1000, alloc_error, 0) );
if ( init_dynamic_string(&dynQuery, "UPDATE ", 1024, 1024) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1001,NULL,4001) );
sqlRet= setpos_update(stmt,irow,&dynQuery);
dynstr_free(&dynQuery);
@@ -1323,14 +1325,14 @@
SQLUSMALLINT nCol = 0;
if ( if_dynamic_cursor(stmt) && set_dynamic_result(stmt) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1000, alloc_error, 0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1000, alloc_error, 0) );
result= stmt->result;
if ( !(table_name= find_used_table(stmt)) )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
if ( init_dynamic_string(&dynQuery, "INSERT INTO ", 1024,1024) )
- MYODBCDbgReturn(set_stmt_error(stmt,"S1001","Not enough
memory",4001));
+ MYODBCDbgReturnReturn( set_stmt_error(stmt,"S1001","Not enough
memory",4001) );
dynstr_append_quoted_name(&dynQuery,table_name);
dynstr_append_mem(&dynQuery,"(",1);
@@ -1373,9 +1375,9 @@
}
default:
- MYODBCDbgReturn(set_error(stmt,MYERR_S1009,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1009,NULL,0) );
}
- MYODBCDbgReturn(sqlRet);
+ MYODBCDbgReturnReturn( sqlRet );
}
@@ -1390,28 +1392,29 @@
SQLSMALLINT cbCursor)
{
STMT FAR *stmt= (STMT FAR*) hstmt;
- MYODBCDbgEnter("SQLSetCursorName");
+ MYODBCDbgEnter;
+
CLEAR_STMT_ERROR(stmt);
if ( !szCursor )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1009,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1009,NULL,0) );
if ( cbCursor == SQL_NTS )
cbCursor= (SQLSMALLINT) strlen((char*) szCursor);
if ( cbCursor < 0 )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1090,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1090,NULL,0) );
if ( (cbCursor == 0) ||
(cbCursor > MYSQL_MAX_CURSOR_LEN) ||
(myodbc_casecmp((char*) szCursor, "SQLCUR", 6) == 0) ||
(myodbc_casecmp((char*) szCursor, "SQL_CUR", 7) == 0) )
- MYODBCDbgReturn(set_error(stmt,MYERR_34000,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_34000,NULL,0) );
x_free((gptr) stmt->cursor.name);
stmt->cursor.name= dupp_str((char*) szCursor,cbCursor);
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
@@ -1427,12 +1430,13 @@
STMT FAR *stmt= (STMT FAR*) hstmt;
SQLINTEGER nLength;
SQLSMALLINT nDummyLength;
- MYODBCDbgEnter("SQLGetCursorName");
+ MYODBCDbgEnter;
+
CLEAR_STMT_ERROR(stmt);
if ( cbCursorMax < 0 )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1090,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1090,NULL,0) );
if ( !pcbCursor )
pcbCursor= &nDummyLength;
@@ -1450,9 +1454,9 @@
nLength= min(*pcbCursor , cbCursorMax);
if ( nLength != *pcbCursor )
- MYODBCDbgReturn(set_error(stmt,MYERR_01004,NULL,0));
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_01004,NULL,0) );
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
@@ -1477,12 +1481,12 @@
SQLRETURN SQL_API SQLBulkOperations(SQLHSTMT Handle, SQLSMALLINT Operation)
{
- MYODBCDbgEnter("SQLBulkOperations");
+ MYODBCDbgEnter;
if ( Operation == SQL_ADD )
- MYODBCDbgReturn(my_SQLSetPos(Handle, 0, SQL_ADD, SQL_LOCK_NO_CHANGE));
+ MYODBCDbgReturnReturn( my_SQLSetPos(Handle, 0, SQL_ADD, SQL_LOCK_NO_CHANGE) );
- MYODBCDbgReturn(set_error(Handle,MYERR_S1C00,NULL,0));
+ MYODBCDbgReturnReturn( set_error(Handle,MYERR_S1C00,NULL,0) );
}
@@ -1494,6 +1498,6 @@
SQLRETURN SQL_API SQLCloseCursor(SQLHSTMT Handle)
{
- MYODBCDbgEnter("SQLCloseCursor");
- MYODBCDbgReturn(my_SQLFreeStmt(Handle, SQL_CLOSE));
+ MYODBCDbgEnter;
+ MYODBCDbgReturnReturn( my_SQLFreeStmt(Handle, SQL_CLOSE) );
}
Modified: trunk/myodbc3/dll.c
===================================================================
--- trunk/myodbc3/dll.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/dll.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -46,7 +46,7 @@
static sig_handler
myodbc_pipe_sig_handler(int sig __attribute__((unused)))
{
- MYODBCDbgPrint("info",("Hit by signal %d",sig));
+ MYODBCDbgInfo( "Hit by signal %d", sig );
#ifdef DONT_REMEMBER_SIGNAL
(void) signal(SIGPIPE,myodbc_pipe_sig_handler);
#endif
Modified: trunk/myodbc3/error.c
===================================================================
--- trunk/myodbc3/error.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/error.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -199,14 +199,15 @@
const char * message,
uint errcode )
{
- MYODBCDbgEnter("set_stmt_error");
- MYODBCDbgPrint("error",("message: %s",message));
+ MYODBCDbgEnter;
+ MYODBCDbgError( "message: %s", message );
+
strmov( stmt->error.sqlstate, state );
strxmov( stmt->error.message, stmt->dbc->st_error_prefix, message, NullS );
stmt->error.native_error = errcode;
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
}
@@ -276,20 +277,22 @@
SQLCHAR *errmsg;
SQLINTEGER code;
- MYODBCDbgEnter("copy_error");
+ MYODBCDbgEnter;
errmsg= (errtext ? (SQLCHAR *)errtext :
(SQLCHAR *)myodbc3_errors[errid].message);
code= errcode ? (myodbc_errid) errcode : errid + MYODBC_ERROR_CODE_START;
- MYODBCDbgPrint("error",("code :%d, state: %s, err :%s",
- code, myodbc3_errors[errid].sqlstate, errtext));
+ MYODBCDbgError( "code :%d", code );
+ MYODBCDbgError( "state: %s", myodbc3_errors[errid].sqlstate );
+ MYODBCDbgError( "err :%s", errtext );
sqlreturn= error->retcode= myodbc3_errors[errid].retcode; /* RETCODE */
error->native_error= code; /* NATIVE */
strmov(error->sqlstate, myodbc3_errors[errid].sqlstate); /* SQLSTATE */
strxmov(error->message,prefix,errmsg,NullS); /* MESSAGE */
- MYODBCDbgReturn(sqlreturn);
+
+ MYODBCDbgReturnReturn( sqlreturn );
}
@@ -380,12 +383,17 @@
char *errmsg,tmp_state[6];
SQLSMALLINT tmp_size;
SQLINTEGER tmp_error;
- MYODBCDbgEnter("SQLGetDiagRec");
- MYODBCDbgPrint("enter",
- ("HandleType: %d, RecNumber: %d, SqlState: 0x%x, NativeErrorPtr: 0x%x,
MessageText: 0x%x, BufferLength: %d, TextLenPtr: 0x%x",
- HandleType, RecNumber, Sqlstate, NativeErrorPtr,
- MessageText, BufferLength, TextLengthPtr));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "HandleType: %d", HandleType );
+ MYODBCDbgInfo( "RecNumber: %d", RecNumber );
+ MYODBCDbgInfo( "SqlState: 0x%x", Sqlstate );
+ MYODBCDbgInfo( "NativeErrorPtr: 0x%x", NativeErrorPtr );
+ MYODBCDbgInfo( "MessageText: 0x%x", MessageText );
+ MYODBCDbgInfo( "BufferLength: %d", BufferLength );
+ MYODBCDbgInfo( "TextLenPtr: 0x%x", TextLengthPtr );
+
if ( !TextLengthPtr )
TextLengthPtr= &tmp_size;
@@ -396,7 +404,7 @@
NativeErrorPtr= &tmp_error;
if ( RecNumber <= 0 || BufferLength < 0 || !Handle )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
/*
Currently we are not supporting error list, so
@@ -404,7 +412,7 @@
*/
if ( RecNumber > 1 )
- MYODBCDbgReturn(SQL_NO_DATA_FOUND);
+ MYODBCDbgReturnReturn( SQL_NO_DATA_FOUND );
switch ( HandleType )
{
@@ -428,16 +436,16 @@
break;
default:
- MYODBCDbgReturn(SQL_INVALID_HANDLE);
+ MYODBCDbgReturnReturn( SQL_INVALID_HANDLE );
}
if ( !errmsg || !errmsg[0] )
{
*TextLengthPtr= 0;
strmov((char*) Sqlstate, "00000");
- MYODBCDbgReturn(SQL_NO_DATA_FOUND);
+ MYODBCDbgReturnReturn( SQL_NO_DATA_FOUND );
}
- MYODBCDbgReturn( copy_str_data( HandleType,
+ MYODBCDbgReturnReturn( copy_str_data( HandleType,
Handle,
MessageText,
BufferLength,
@@ -464,12 +472,16 @@
SQLRETURN error= SQL_SUCCESS;
SQLPOINTER szDiagInfo= NULL;
SQLSMALLINT tmp_size;
- MYODBCDbgEnter("SQLGetDiagField");
- MYODBCDbgPrint("enter",
- ("HandleType: %d, RecNumber: %d, DiagIdentifier: %d, DiagInfoPtr: 0x%x,
BufferLength: %d, StringLengthPtr: 0x%x",
- HandleType, RecNumber, DiagIdentifier, DiagInfoPtr,
- BufferLength, StringLengthPtr));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "HandleType: %d", HandleType );
+ MYODBCDbgInfo( "RecNumber: %d", RecNumber );
+ MYODBCDbgInfo( "DiagIdentifier: %d", DiagIdentifier );
+ MYODBCDbgInfo( "DiagInfoPtr: 0x%x", DiagInfoPtr );
+ MYODBCDbgInfo( "BufferLength: %d", BufferLength );
+ MYODBCDbgInfo( "StringLengthPtr: 0x%x", StringLengthPtr );
+
if ( !StringLengthPtr )
StringLengthPtr= &tmp_size;
@@ -480,17 +492,17 @@
!(HandleType == SQL_HANDLE_STMT ||
HandleType == SQL_HANDLE_DBC ||
HandleType == SQL_HANDLE_ENV) )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
if ( RecNumber > 1 )
- MYODBCDbgReturn(SQL_NO_DATA_FOUND);
+ MYODBCDbgReturnReturn( SQL_NO_DATA_FOUND );
/*
If record number is 0 and if it is not a
diag header field request, return error
*/
if ( RecNumber == 0 && DiagIdentifier > 0 )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
switch ( DiagIdentifier )
{
@@ -498,7 +510,7 @@
/* DIAG HEADER FIELDS SECTION */
case SQL_DIAG_DYNAMIC_FUNCTION:
if ( HandleType != SQL_HANDLE_STMT )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
error= copy_str_data(HandleType, Handle, DiagInfoPtr, BufferLength,
StringLengthPtr, "");
@@ -529,7 +541,7 @@
case SQL_DIAG_CURSOR_ROW_COUNT:/* at present, return total rows in rs */
if ( HandleType != SQL_HANDLE_STMT )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
if ( !((STMT FAR*) Handle)->result )
*(SQLINTEGER *) DiagInfoPtr= 0;
@@ -541,7 +553,7 @@
case SQL_DIAG_ROW_COUNT:
if ( HandleType != SQL_HANDLE_STMT )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
*(SQLINTEGER *) DiagInfoPtr= (SQLINTEGER)
((STMT FAR*) Handle)->affected_rows;
@@ -643,9 +655,9 @@
break;
default:
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn( SQL_ERROR );
}
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn( error );
}
@@ -682,8 +694,9 @@
SQLSMALLINT FAR *pcbErrorMsg)
{
SQLRETURN error= SQL_INVALID_HANDLE;
- MYODBCDbgEnter("SQLError");
+ MYODBCDbgEnter;
+
if ( hstmt )
{
error= my_SQLGetDiagRec(SQL_HANDLE_STMT,hstmt,1,szSqlState,
@@ -708,5 +721,5 @@
if ( error == SQL_SUCCESS )
CLEAR_ENV_ERROR(henv);
}
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn( error );
}
Modified: trunk/myodbc3/execute.c
===================================================================
--- trunk/myodbc3/execute.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/execute.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -52,10 +52,11 @@
SQLRETURN do_query(STMT FAR *stmt,char *query)
{
int error= SQL_ERROR;
- MYODBCDbgEnter("do_query");
+ MYODBCDbgEnter;
+
if ( !query )
- MYODBCDbgReturn(error); /* Probably error from insert_param */
+ MYODBCDbgReturnReturn(error); /* Probably error from insert_param */
if ( stmt->stmt_options.max_rows && stmt->stmt_options.max_rows !=
(SQLINTEGER) ~0L )
@@ -109,16 +110,16 @@
error= SQL_SUCCESS; /* no result set */
stmt->state= ST_EXECUTED;
stmt->affected_rows= mysql_affected_rows(&stmt->dbc->mysql);
- MYODBCDbgPrint("info",("affected rows: %d",stmt->affected_rows));
+ MYODBCDbgInfo( "affected rows: %d", stmt->affected_rows );
goto exit;
}
- MYODBCDbgPrint("error",("client failed to return resultset"));
+ MYODBCDbgInfo( "%s", "client failed to return resultset" );
set_error(stmt,MYERR_S1000,mysql_error(&stmt->dbc->mysql),
mysql_errno(&stmt->dbc->mysql));
goto exit;
}
- MYODBCDbgPrint("info",("result set columns: %d, rows: %lld",
- stmt->result->field_count,
stmt->result->row_count));
+ MYODBCDbgInfo( "result set columns: %d", stmt->result->field_count );
+ MYODBCDbgInfo( "result set rows: %lld", stmt->result->row_count );
fix_result_types(stmt);
error= SQL_SUCCESS;
@@ -126,7 +127,8 @@
pthread_mutex_unlock(&stmt->dbc->lock);
if ( query != stmt->query )
my_free((gptr) query,MYF(0));
- MYODBCDbgReturn(error);
+
+ MYODBCDbgReturnReturn( error );
}
@@ -139,23 +141,24 @@
char *extend_buffer(NET *net, char *to, ulong length)
{
ulong need= 0;
- MYODBCDbgEnter("extend_buffer");
- MYODBCDbgPrint("enter",("current_length: %ld length: %ld buffer_length: %ld",
- (ulong) (to - (char *)net->buff),
- (ulong) length,
- (ulong) net->max_packet));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "current_length: %ld", (ulong)(to - (char *)net->buff) );
+ MYODBCDbgInfo( "length: %ld", (ulong) length );
+ MYODBCDbgInfo( "buffer_length: %ld", (ulong) net->max_packet );
+
if (!to ||
(need= (ulong)(to - (char *)net->buff) + length) > net->max_packet - 10)
{
if (net_realloc(net, need))
{
- MYODBCDbgReturn2(0);
+ MYODBCDbgReturn(0);
}
to= (char *)net->buff + need - length;
}
- MYODBCDbgReturn2(to);
+ MYODBCDbgReturn(to);
}
@@ -166,13 +169,16 @@
char *add_to_buffer(NET *net,char *to,char *from,ulong length)
{
- MYODBCDbgEnter("add_to_buffer");
- MYODBCDbgPrint("enter",("from: '%-.32s' length: %ld",
- from ? from: "<null>", (long int) length));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "from: '%-.32s'", from ? from: "<null>" );
+ MYODBCDbgInfo( "length: %ld", (long int) length );
if ( !(to= extend_buffer(net,to,length)) )
- MYODBCDbgReturn2(0);
+ MYODBCDbgReturn(0);
+
memcpy(to,from,length);
- MYODBCDbgReturn2(to+length);
+
+ MYODBCDbgReturn( to+length );
}
@@ -210,8 +216,9 @@
char *query= stmt->query,*to;
uint i,length;
NET *net;
- MYODBCDbgEnter("insert_params");
+ MYODBCDbgEnter;
+
pthread_mutex_lock(&stmt->dbc->lock);
net= &stmt->dbc->mysql.net;
to= (char*) net->buff;
@@ -228,11 +235,12 @@
setlocale(LC_NUMERIC,default_locale);
set_error(stmt,MYERR_07001,NULL,0);
pthread_mutex_unlock(&stmt->dbc->lock);
- MYODBCDbgReturn2(0);
+ MYODBCDbgReturn(0);
}
pos= param->pos_in_query;
length= (uint) (pos-query);
- MYODBCDbgPrint("info",("pos_in_query: %p query: %p", pos, query));
+ MYODBCDbgInfo( "pos_in_query: %p", pos );
+ MYODBCDbgInfo( "query: %p", query );
if ( !(to= add_to_buffer(net,to,query,length)) )
goto error;
query= pos+1; /* Skipp '?' */
@@ -249,7 +257,7 @@
setlocale(LC_NUMERIC,default_locale);
set_error(stmt,MYERR_S1001,NULL,4001);
pthread_mutex_unlock(&stmt->dbc->lock);
- MYODBCDbgReturn2(0);
+ MYODBCDbgReturn(0);
}
if ( stmt->stmt_options.paramProcessedPtr )
@@ -258,14 +266,14 @@
pthread_mutex_unlock(&stmt->dbc->lock);
if ( !(stmt->dbc->flag & FLAG_NO_LOCALE) )
setlocale(LC_NUMERIC,default_locale);
- MYODBCDbgReturn2(to);
+ MYODBCDbgReturn(to);
error: /* Too much data */
pthread_mutex_unlock(&stmt->dbc->lock);
if ( !(stmt->dbc->flag & FLAG_NO_LOCALE) )
setlocale(LC_NUMERIC,default_locale);
set_error(stmt,MYERR_S1001,NULL,4001);
- MYODBCDbgReturn2(0);
+ MYODBCDbgReturn(0);
}
@@ -302,7 +310,7 @@
}
else
{
- MYODBCDbgPrint("warning",("data is a null pointer"));
+ MYODBCDbgWarning( "%s", "data is a null pointer" );
length= 0; /* This is actually an error */
}
}
@@ -322,11 +330,13 @@
data= param->buffer;
length= *param->actual_len;
}
- MYODBCDbgPrint("info",
- ("param: 0x%lx ctype: %d SqlType: %d data: 0x%lx length: %d
actual_len: %d pos_in_query: %p",
- param,param->CType,param->SqlType,data,length,
- param->actual_len ? *param->actual_len : 0,
- param->pos_in_query));
+ MYODBCDbgInfo( "param: 0x%lx", param );
+ MYODBCDbgInfo( "ctype: %d", param->CType );
+ MYODBCDbgInfo( "SqlType: %d", param->SqlType );
+ MYODBCDbgInfo( "data: 0x%lx", data );
+ MYODBCDbgInfo( "length: %d", length );
+ MYODBCDbgInfo( "actual_len: %d", param->actual_len ? *param->actual_len : 0 );
+ MYODBCDbgInfo( "pos_in_query: %p", param->pos_in_query );
switch ( param->CType )
{
@@ -589,20 +599,21 @@
PARAM_BIND *param;
STMT FAR * pStmtCursor = pStmt;
- MYODBCDbgEnter( "SQLExecute" );
- MYODBCDbgPrint( "enter", ("pStmt: 0x%lx", pStmt) );
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "pStmt: 0x%lx", pStmt );
+
if ( !pStmt )
- MYODBCDbgReturn( SQL_ERROR );
+ MYODBCDbgReturnReturn( SQL_ERROR );
CLEAR_STMT_ERROR( pStmt );
if ( !pStmt->query )
- MYODBCDbgReturn( set_error( pStmt, MYERR_S1010, "No previous SQLPrepare done", 0
) );
+ MYODBCDbgReturnReturn( set_error( pStmt, MYERR_S1010, "No previous SQLPrepare
done", 0 ) );
if ( check_if_positioned_cursor_exists( pStmt, &pStmtCursor ) )
{
- MYODBCDbgReturn( do_my_pos_cursor( pStmt, pStmtCursor ) );
+ MYODBCDbgReturnReturn( do_my_pos_cursor( pStmt, pStmtCursor ) );
}
for ( nIndex= 0 ; nIndex < pStmt->param_count ; )
@@ -622,7 +633,7 @@
if ( pStmt->state == ST_PRE_EXECUTED )
{
pStmt->state= ST_EXECUTED;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
my_SQLFreeStmt((SQLHSTMT)pStmt,MYSQL_RESET_BUFFERS);
query= pStmt->query;
@@ -646,13 +657,13 @@
pStmt->current_param= i; /* Fix by Giovanni */
param->value= 0;
param->alloced= 0;
- MYODBCDbgReturn(SQL_NEED_DATA);
+ MYODBCDbgReturnReturn(SQL_NEED_DATA);
}
}
query= insert_params(pStmt); /* Checked in do_query */
}
- MYODBCDbgReturn(do_query(pStmt, query));
+ MYODBCDbgReturnReturn(do_query(pStmt, query));
}
@@ -668,13 +679,14 @@
SQLINTEGER cbSqlStr)
{
int error;
- MYODBCDbgEnter("SQLExecDirect");
+ MYODBCDbgEnter;
+
if ( (error= my_SQLPrepare(hstmt,szSqlStr,cbSqlStr)) )
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn(error);
error= my_SQLExecute( (STMT FAR*)hstmt );
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn(error);
}
@@ -691,8 +703,10 @@
SQLINTEGER *pcbSqlStr)
{
ulong offset= 0;
- MYODBCDbgEnter("SQLNativeSql");
- MYODBCDbgReturn(copy_lresult(SQL_HANDLE_DBC, hdbc,
+
+ MYODBCDbgEnter;
+
+ MYODBCDbgReturnReturn( copy_lresult(SQL_HANDLE_DBC, hdbc,
szSqlStr,cbSqlStrMax,
(SQLLEN *)pcbSqlStr,
(char*) szSqlStrIn, cbSqlStrIn,0L,0L,
@@ -710,7 +724,9 @@
{
STMT FAR *stmt= (STMT FAR*) hstmt;
uint i;
- MYODBCDbgEnter("SQLParamData");
+
+ MYODBCDbgEnter;
+
for ( i= stmt->current_param; i < stmt->param_count; i++ )
{
PARAM_BIND *param= dynamic_element(&stmt->params,i,PARAM_BIND*);
@@ -723,10 +739,10 @@
*prbgValue= param->buffer;
param->value= 0;
param->alloced= 0;
- MYODBCDbgReturn(SQL_NEED_DATA);
+ MYODBCDbgReturnReturn(SQL_NEED_DATA);
}
}
- MYODBCDbgReturn(do_query(stmt,insert_params(stmt)));
+ MYODBCDbgReturnReturn(do_query(stmt,insert_params(stmt)));
}
@@ -744,10 +760,11 @@
{
STMT FAR *stmt= (STMT FAR*) hstmt;
PARAM_BIND *param;
- MYODBCDbgEnter("SQLPutData");
+ MYODBCDbgEnter;
+
if ( !stmt )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
if ( cbValue == SQL_NTS )
cbValue= strlen(rgbValue);
@@ -758,7 +775,7 @@
my_free(param->value,MYF(0));
param->alloced= 0;
param->value= 0;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
if ( param->value )
{
@@ -768,14 +785,14 @@
if ( !(param->value= my_realloc(param->value,
param->value_length + cbValue + 1,
MYF(0))) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1001,NULL,4001));
}
else
{
/* This should never happen */
gptr old_pos= param->value;
if ( !(param->value= my_malloc(param->value_length+cbValue+1,MYF(0))) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1001,NULL,4001));
memcpy(param->value,old_pos,param->value_length);
}
memcpy(param->value+param->value_length,rgbValue,cbValue);
@@ -787,13 +804,13 @@
{
/* New value */
if ( !(param->value= my_malloc(cbValue+1,MYF(0))) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1001,NULL,4001));
memcpy(param->value,rgbValue,cbValue);
param->value_length= cbValue;
param->value[param->value_length]= 0;
param->alloced= 1;
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -804,6 +821,6 @@
SQLRETURN SQL_API SQLCancel(SQLHSTMT hstmt)
{
- MYODBCDbgEnter("SQLCancel");
- MYODBCDbgReturn(my_SQLFreeStmt(hstmt,SQL_CLOSE));
+ MYODBCDbgEnter;
+ MYODBCDbgReturnReturn(my_SQLFreeStmt(hstmt,SQL_CLOSE));
}
Modified: trunk/myodbc3/handle.c
===================================================================
--- trunk/myodbc3/handle.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/handle.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -57,7 +57,7 @@
myodbc_init(); /* This is done in LibMain on XP so it probably needs to be in this
func only when in UNIX - PAH */
#endif
- MYODBCDbgEnter("my_SQLAllocEnv");
+ MYODBCDbgEnter;
#ifndef _UNIX_
{
@@ -66,14 +66,14 @@
{
GlobalFree (henv); /* Free it if lock fails */
*phenv= SQL_NULL_HENV;
- MYODBCDbgReturn( SQL_ERROR );
+ MYODBCDbgReturnReturn( SQL_ERROR );
}
}
#else
if (!(*phenv= (SQLHENV) my_malloc(sizeof(ENV),MYF(MY_ZEROFILL))))
{
*phenv= SQL_NULL_HENV;
- MYODBCDbgReturn( SQL_ERROR );
+ MYODBCDbgReturnReturn( SQL_ERROR );
}
#endif /* _UNIX_ */
@@ -84,7 +84,7 @@
((ENV FAR*) *phenv)->odbc_ver= SQL_OV_ODBC2;
#endif /* WIN32 */
- MYODBCDbgReturn( SQL_SUCCESS );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
@@ -239,8 +239,9 @@
SQLRETURN SQL_API my_SQLFreeConnect(SQLHDBC hdbc)
{
DBC FAR *dbc= (DBC FAR*) hdbc;
- MYODBCDbgEnter("SQLFreeConnect");
+ MYODBCDbgEnter;
+
dbc->env->connections=
list_delete(dbc->env->connections,&dbc->list);
my_free(dbc->dsn,MYF(MY_ALLOW_ZERO_PTR));
my_free(dbc->database,MYF(MY_ALLOW_ZERO_PTR));
@@ -255,7 +256,7 @@
#else
my_free((char*) hdbc,MYF(0));
#endif
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -282,22 +283,23 @@
#endif
STMT FAR *stmt;
DBC FAR *dbc= (DBC FAR*) hdbc;
- MYODBCDbgEnter("SQLAllocStmt");
+ MYODBCDbgEnter;
+
#ifndef _UNIX_
hstmt= GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(STMT));
if (!hstmt || (*phstmt= (SQLHSTMT)GlobalLock(hstmt)) == SQL_NULL_HSTMT)
{
GlobalFree(hstmt);
*phstmt= SQL_NULL_HSTMT;
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
#else
*phstmt= (SQLHSTMT) my_malloc(sizeof (STMT), MYF(MY_ZEROFILL | MY_WME));
if (*phstmt == SQL_NULL_HSTMT)
{
*phstmt= SQL_NULL_HSTMT;
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
#endif /* IS UNIX */
stmt= (STMT FAR*) *phstmt;
@@ -311,7 +313,7 @@
#else
init_dynamic_array(&stmt->params,sizeof(PARAM_BIND),32,64);
#endif
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -361,16 +363,18 @@
{
STMT FAR *stmt= (STMT FAR*) hstmt;
uint i;
- MYODBCDbgEnter("SQLFreeStmt");
- MYODBCDbgPrint("enter",("stmt: 0x%lx option: %s", hstmt,
- MYODBCDbgStmtTypeString(fOption)));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "stmt: 0x%lx", hstmt );
+ MYODBCDbgInfo( "option: %s", MYODBCDbgStmtTypeString(fOption) );
+
if (fOption == SQL_UNBIND)
{
x_free(stmt->bind);
stmt->bind= 0;
stmt->bound_columns= 0;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
for (i= 0 ; i < stmt->params.elements ; i++)
{
@@ -387,7 +391,7 @@
}
}
if (fOption == SQL_RESET_PARAMS)
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
mysql_free_result(stmt->result);
x_free((gptr) stmt->fields);
@@ -407,7 +411,7 @@
stmt->state= ST_UNKNOWN;
if (fOption == MYSQL_RESET_BUFFERS)
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
x_free((gptr) stmt->table_name);
stmt->table_name= 0;
@@ -419,7 +423,7 @@
stmt->cursor.pk_count= 0;
if (fOption == SQL_CLOSE)
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
/* At this point, only MYSQL_RESET and SQL_DROP left out */
x_free((gptr) stmt->query);
@@ -427,7 +431,7 @@
stmt->param_count= 0;
if (fOption == MYSQL_RESET)
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
odbc_reset_stmt_options(&stmt->stmt_options);
@@ -441,7 +445,7 @@
#else
my_free((char*) hstmt,MYF(0));
#endif /* _UNIX_*/
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
Modified: trunk/myodbc3/info.c
===================================================================
--- trunk/myodbc3/info.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/info.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -75,7 +75,7 @@
*pcbInfoValue= 0; \
strmake((char*)rgbInfoValue,"",cbInfoValueMax); \
} \
- MYODBCDbgReturn(*pcbInfoValue >= cbInfoValueMax ? \
+ MYODBCDbgReturnReturn(*pcbInfoValue >= cbInfoValueMax ? \
SQL_SUCCESS_WITH_INFO: \
SQL_SUCCESS); \
}
@@ -84,7 +84,7 @@
{ \
*pcbInfoValue= len; \
strmake((char*)rgbInfoValue,val,cbInfoValueMax); \
- MYODBCDbgReturn(len >= cbInfoValueMax ? \
+ MYODBCDbgReturnReturn(len >= cbInfoValueMax ? \
SQL_SUCCESS_WITH_INFO: \
SQL_SUCCESS); \
}
@@ -107,11 +107,14 @@
char dummy2[255];
SQLSMALLINT dummy;
my_bool using_322;
- MYODBCDbgEnter("SQLGetInfo");
- MYODBCDbgPrint("enter",
- ("fInfoType: %d, rgbInfoValue: 0x%x, cbInfoValueMax :%d, pcbInfoValue:
0x%x",
- fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "fInfoType: %d", fInfoType );
+ MYODBCDbgInfo( "rgbInfoValue: 0x%x", rgbInfoValue );
+ MYODBCDbgInfo( "cbInfoValueMax :%d", cbInfoValueMax );
+ MYODBCDbgInfo( "pcbInfoValue: 0x%x", pcbInfoValue );
+
if ( cbInfoValueMax )
cbInfoValueMax--;
@@ -869,10 +872,10 @@
{
char buff[80];
sprintf(buff,"Unsupported option: %d to SQLGetInfo",fInfoType);
- MYODBCDbgReturn(set_conn_error(hdbc,MYERR_S1C00,buff,4000));
+ MYODBCDbgReturnReturn(set_conn_error(hdbc,MYERR_S1C00,buff,4000));
}
}/* end of switch */
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -1071,9 +1074,11 @@
{
STMT FAR *stmt= (STMT FAR*) hstmt;
uint i;
- MYODBCDbgEnter( "SQLGetTypeInfo" );
- MYODBCDbgPrint( "enter", ("fSqlType: %d",fSqlType) );
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "fSqlType: %d",fSqlType );
+
my_SQLFreeStmt( hstmt, MYSQL_RESET );
/* Set up result Data dictionary. */
@@ -1102,7 +1107,7 @@
}
mysql_link_fields( stmt, SQL_GET_TYPE_INFO_fields, SQL_GET_TYPE_INFO_FIELDS );
- MYODBCDbgReturn( SQL_SUCCESS );
+ MYODBCDbgReturnReturn( SQL_SUCCESS );
}
@@ -1315,9 +1320,11 @@
{
SQLINTEGER index;
SQLINTEGER myodbc_func_size;
- MYODBCDbgEnter("SQLGetFunctions");
- MYODBCDbgPrint("enter",("fFunction: %d",fFunction));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "fFunction: %d",fFunction );
+
myodbc_func_size= (sizeof(myodbc3_functions)/
sizeof(myodbc3_functions[0]));
@@ -1328,7 +1335,7 @@
int id= myodbc3_functions[index];
pfExists[id >> 4] |= (1 << (id & 0x000F));
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
if ( fFunction == SQL_API_ALL_FUNCTIONS )
{
@@ -1337,7 +1344,7 @@
if ( myodbc3_functions[index] < 100 )
pfExists[myodbc3_functions[index]]= SQL_TRUE;
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
*pfExists= SQL_FALSE;
for ( index= 0; index < myodbc_func_size; index ++ )
@@ -1348,5 +1355,5 @@
break;
}
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
Modified: trunk/myodbc3/myodbc3.h
===================================================================
--- trunk/myodbc3/myodbc3.h 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/myodbc3.h 2006-10-07 21:07:10 UTC (rev 127)
@@ -86,27 +86,27 @@
#if defined(__APPLE__)
#define DRIVER_DLL_NAME "libmyodbc3.dylib"
-#ifndef DBUG_OFF
+#ifdef MYODBC_DBG
#define DRIVER_QUERY_LOGFILE "/tmp/myodbc.sql"
#endif
#elif defined(_UNIX_)
#define DRIVER_DLL_NAME "libmyodbc3.so"
-#ifndef DBUG_OFF
+#ifdef MYODBC_DBG
#define DRIVER_QUERY_LOGFILE "/tmp/myodbc.sql"
#endif
#else
#define DRIVER_DLL_NAME "myodbc3.dll"
-#ifndef DBUG_OFF
+#ifdef MYODBC_DBG
#define DRIVER_QUERY_LOGFILE "c:\\myodbc.sql"
#endif
#endif
-#ifndef DBUG_OFF
+#ifdef MYODBC_DBG
#define CHECK_EXTRA_ARGUMENTS
#endif
Modified: trunk/myodbc3/myodbc3.pro
===================================================================
--- trunk/myodbc3/myodbc3.pro 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/myodbc3.pro 2006-10-07 21:07:10 UTC (rev 127)
@@ -140,7 +140,6 @@
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgDiagFieldString.c \
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgEnvAttrString.c \
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgFunctionsString.c \
- ../MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c \
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgHandleTypeString.c \
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgInfoTypeString.c \
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgPosTypeString.c \
Modified: trunk/myodbc3/myutil.h
===================================================================
--- trunk/myodbc3/myutil.h 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/myutil.h 2006-10-07 21:07:10 UTC (rev 127)
@@ -47,7 +47,7 @@
#define binary_field(fld) ((fld)->flags & BINARY_FLAG)
#define num_field(fld) ((fld)->flags & NUM_FLAG)
-#if !defined(DBUG_OFF)
+#ifdef MYODBC_DBG
#define MYLOG_QUERY(A,B) if ((A)->dbc->flag & FLAG_LOG_QUERY) \
query_print((A)->dbc->query_log,(char*) B)
@@ -162,7 +162,7 @@
my_bool reget_current_catalog(DBC FAR *dbc);
/* Functions used when debugging */
-#ifndef DBUG_OFF
+#ifdef MYODBC_DBG
void query_print(FILE *log_file,char *query);
FILE *init_query_log(void);
void end_query_log(FILE *query_log);
Modified: trunk/myodbc3/options.c
===================================================================
--- trunk/myodbc3/options.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/options.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -59,21 +59,20 @@
SQLINTEGER Attribute,
SQLPOINTER ValuePtr)
{
- MYODBCDbgEnter("set_constmt_attr");
+ MYODBCDbgEnter;
switch (Attribute)
{
-
case SQL_ATTR_ASYNC_ENABLE:
if (ValuePtr == (SQLPOINTER) SQL_ASYNC_ENABLE_ON)
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
"Doesn't support asynchronous, changed
to default",0));
break;
case SQL_ATTR_CURSOR_SENSITIVITY:
if (ValuePtr != (SQLPOINTER) SQL_UNSPECIFIED)
{
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
"Option value changed to default cursor
sensitivity(unspecified)",0));
}
break;
@@ -83,7 +82,7 @@
{
options->cursor_type= SQL_CURSOR_FORWARD_ONLY;
if (ValuePtr != (SQLPOINTER)SQL_CURSOR_FORWARD_ONLY)
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
"Forcing the use of forward-only
cursor)",0));
}
else if (((STMT FAR*)Handle)->dbc->flag & FLAG_DYNAMIC_CURSOR)
@@ -94,7 +93,7 @@
else
{
options->cursor_type= SQL_CURSOR_STATIC;
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
"Option value changed to default
static cursor",0));
}
}
@@ -107,7 +106,7 @@
else
{
options->cursor_type= SQL_CURSOR_STATIC;
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
"Option value changed to default
static cursor",0));
}
}
@@ -123,12 +122,12 @@
case SQL_ATTR_METADATA_ID:
if (ValuePtr == (SQLPOINTER) SQL_TRUE)
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
"Doesn't support SQL_ATTR_METADATA_ID to
true, changed to default",0));
break;
case SQL_ATTR_RETRIEVE_DATA:
- MYODBCDbgPrint("info",("SQL_ATTR_RETRIEVE_DATA value is ignored"));
+ MYODBCDbgInfo( "%s", "SQL_ATTR_RETRIEVE_DATA value is ignored" );
break;
case SQL_ATTR_ROW_BIND_TYPE:
@@ -137,7 +136,7 @@
case SQL_ATTR_SIMULATE_CURSOR:
if (ValuePtr != (SQLPOINTER) SQL_SC_TRY_UNIQUE)
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_01S02,
"Option value changed to default cursor
simulation",0));
break;
@@ -155,19 +154,19 @@
case SQL_ATTR_CONCURRENCY:
case SQL_ATTR_NOSCAN:
case SQL_ATTR_ROW_OPERATION_PTR: /* need to support this ....*/
- MYODBCDbgPrint("info",("Attribute, %d is ignored", Attribute));
+ MYODBCDbgInfo( "Attribute, %d is ignored", Attribute );
break;
case SQL_ATTR_FETCH_BOOKMARK_PTR:
case SQL_ATTR_USE_BOOKMARKS:
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_S1C00,NULL,0));
+
MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_S1C00,NULL,0));
break;
default:
- MYODBCDbgPrint("info",("Attribute, %d is ignored", Attribute));
+ MYODBCDbgInfo( "Attribute, %d is ignored", Attribute );
break;
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -184,7 +183,7 @@
SQLPOINTER ValuePtr,
SQLINTEGER *StringLengthPtr __attribute__((unused)))
{
- MYODBCDbgEnter("get_constmt_attr");
+ MYODBCDbgEnter;
switch (Attribute)
{
@@ -252,12 +251,12 @@
break;
case SQL_ATTR_ROW_OPERATION_PTR: /* need to support this ....*/
- MYODBCDbgPrint("info",("Attribute, %d is ignored", Attribute));
- MYODBCDbgReturn(SQL_SUCCESS_WITH_INFO);
+ MYODBCDbgInfo( "Attribute, %d is ignored", Attribute );
+ MYODBCDbgReturnReturn(SQL_SUCCESS_WITH_INFO);
case SQL_ATTR_FETCH_BOOKMARK_PTR:
case SQL_ATTR_USE_BOOKMARKS:
- MYODBCDbgReturn(set_handle_error(HandleType,Handle,MYERR_S1C00,NULL,0));
+
MYODBCDbgReturnReturn(set_handle_error(HandleType,Handle,MYERR_S1C00,NULL,0));
case 1226:/* MS SQL Server Extension */
case 1227:
@@ -265,9 +264,9 @@
break;
default:
- MYODBCDbgPrint("error",("Invalid attribute/option identifier:%d",
Attribute));
+ MYODBCDbgError( "Invalid attribute/option identifier:%d", Attribute );
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -283,15 +282,18 @@
SQLINTEGER StringLengthPtr)
{
DBC FAR *dbc= (DBC FAR*) hdbc;
- MYODBCDbgEnter("SQLSetConnectAttr");
- MYODBCDbgPrint("enter",("Atrr: %d, ValuePtr: 0x%lx, StrLenPtr:
%d",Attribute,ValuePtr,StringLengthPtr));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "Atrr: %d", Attribute );
+ MYODBCDbgInfo( "ValuePtr: 0x%lx", ValuePtr );
+ MYODBCDbgInfo( "StrLenPtr: %d", StringLengthPtr );
+
switch (Attribute)
{
case SQL_ATTR_ACCESS_MODE:
- MYODBCDbgPrint("info",("SQL_ATTR_ACCESS_MODE %ld ignored",
- (SQLUINTEGER)ValuePtr));
+ MYODBCDbgInfo( "SQL_ATTR_ACCESS_MODE %ld ignored", (SQLUINTEGER)ValuePtr );
break;
case SQL_ATTR_AUTOCOMMIT:
@@ -300,28 +302,28 @@
if (!dbc->server) /* no connection yet */
{
dbc->commit_flag= CHECK_AUTOCOMMIT_OFF;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
if (!(trans_supported(dbc)) || (dbc->flag & FLAG_NO_TRANSACTIONS))
- MYODBCDbgReturn(set_conn_error(dbc,MYERR_S1C00,
+ MYODBCDbgReturnReturn(set_conn_error(dbc,MYERR_S1C00,
"Transactions are not enabled",
4000));
if (autocommit_on(dbc))
- MYODBCDbgReturn(odbc_stmt(dbc,"SET AUTOCOMMIT=0"));
+ MYODBCDbgReturnReturn(odbc_stmt(dbc,"SET AUTOCOMMIT=0"));
}
else if (!dbc->server) /* no connection yet */
{
dbc->commit_flag= CHECK_AUTOCOMMIT_ON;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
else if (trans_supported(dbc) && !(autocommit_on(dbc)))
- MYODBCDbgReturn(odbc_stmt(dbc,"SET AUTOCOMMIT=1"));
+ MYODBCDbgReturnReturn(odbc_stmt(dbc,"SET AUTOCOMMIT=1"));
break;
case SQL_ATTR_CONNECTION_TIMEOUT:
{
uint timeout= (SQLUINTEGER)ValuePtr;
- MYODBCDbgReturn(mysql_options(&dbc->mysql,
MYSQL_OPT_CONNECT_TIMEOUT,
+ MYODBCDbgReturnReturn(mysql_options(&dbc->mysql,
MYSQL_OPT_CONNECT_TIMEOUT,
(const char *)&timeout));
}
break;
@@ -337,7 +339,7 @@
char ldb[NAME_LEN+1], *db;
if (!(db= fix_str((char *)ldb, (char *)ValuePtr, StringLengthPtr)))
- MYODBCDbgReturn(set_conn_error(hdbc,MYERR_S1009,NULL, 0));
+ MYODBCDbgReturnReturn(set_conn_error(hdbc,MYERR_S1009,NULL, 0));
pthread_mutex_lock(&dbc->lock);
if ( dbc->mysql.net.vio )
@@ -346,7 +348,7 @@
{
set_conn_error(dbc,MYERR_S1000,mysql_error(&dbc->mysql),mysql_errno(&dbc->mysql));
pthread_mutex_unlock(&dbc->lock);
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
}
my_free((gptr) dbc->database,MYF(0));
@@ -362,7 +364,7 @@
case SQL_ATTR_ODBC_CURSORS:
if ((dbc->flag & FLAG_FORWARD_CURSOR) &&
ValuePtr != (SQLPOINTER) SQL_CUR_USE_ODBC)
- MYODBCDbgReturn(set_conn_error(hdbc,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_conn_error(hdbc,MYERR_01S02,
"Forcing the Driver Manager to use ODBC
cursor library",0));
break;
@@ -374,18 +376,18 @@
{
char buff[100];
sprintf(buff,"Suppose to set this attribute '%d' through driver manager,
not by the driver",(int) Attribute);
- MYODBCDbgReturn(set_conn_error(hdbc,MYERR_01S02,buff,0));
+ MYODBCDbgReturnReturn(set_conn_error(hdbc,MYERR_01S02,buff,0));
}
case SQL_ATTR_PACKET_SIZE:
- MYODBCDbgPrint("info",("SQL_ATTR_PACKET_SIZE %ld
ignored",(SQLUINTEGER)ValuePtr));
+ MYODBCDbgInfo( "SQL_ATTR_PACKET_SIZE %ld ignored", (SQLUINTEGER)ValuePtr );
break;
case SQL_ATTR_TXN_ISOLATION:
if (!dbc->server) /* no connection yet */
{
dbc->txn_isolation= (SQLINTEGER)ValuePtr;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
if (trans_supported(dbc))
{
@@ -405,7 +407,7 @@
dbc->txn_isolation= (SQLINTEGER)ValuePtr;
}
else
- MYODBCDbgPrint("info",("SQL_ATTR_TXN_ISOLATION %ld
ignored",(SQLINTEGER)ValuePtr));
+ MYODBCDbgInfo( "SQL_ATTR_TXN_ISOLATION %ld ignored", (SQLINTEGER)ValuePtr
);
break;
/*
@@ -414,9 +416,9 @@
works fine...lets support it..nothing to loose..
*/
default:
-
MYODBCDbgReturn(set_constmt_attr(2,dbc,&dbc->stmt_options,Attribute,ValuePtr));
+
MYODBCDbgReturnReturn(set_constmt_attr(2,dbc,&dbc->stmt_options,Attribute,ValuePtr));
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -435,11 +437,14 @@
SQLRETURN result= SQL_SUCCESS;
SQLINTEGER strlen;
SQLPOINTER vparam= 0;
- MYODBCDbgEnter("SQLGetConnectAttr");
- MYODBCDbgPrint("enter",
- ("Atrr: %d, ValuePtr: 0x%lx, BufLen: %d, StrLenPtr: 0x%lx",
- Attribute,ValuePtr,BufferLength, StringLengthPtr));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "Atrr: %d", Attribute );
+ MYODBCDbgInfo( "ValuePtr: 0x%lx", ValuePtr );
+ MYODBCDbgInfo( "BufLen: %d", BufferLength );
+ MYODBCDbgInfo( "StrLenPtr: 0x%lx", StringLengthPtr );
+
if (!ValuePtr)
ValuePtr= vparam;
@@ -538,7 +543,7 @@
Attribute,ValuePtr,
StringLengthPtr);
}
- MYODBCDbgReturn(result);
+ MYODBCDbgReturnReturn(result);
}
@@ -556,11 +561,13 @@
STMT FAR *stmt= (STMT FAR*) hstmt;
SQLRETURN result= SQL_SUCCESS;
STMT_OPTIONS *options= &stmt->stmt_options;
- MYODBCDbgEnter("SQLSetStmtAttr");
- MYODBCDbgPrint("enter",
- ("Atrr: %d, ValuePtr: 0x%lx, StrLenPtr: %d",
- Attribute,ValuePtr,StringLengthPtr));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "Atrr: %d", Attribute );
+ MYODBCDbgInfo( "ValuePtr: 0x%lx", ValuePtr );
+ MYODBCDbgInfo( "StrLenPtr: %d", StringLengthPtr );
+
switch (Attribute)
{
@@ -576,7 +583,7 @@
case SQL_ATTR_AUTO_IPD:
if (ValuePtr != (SQLPOINTER)SQL_FALSE)
- MYODBCDbgReturn(set_error(hstmt,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_error(hstmt,MYERR_01S02,
"Option value changed to default auto ipd",0));
break;
@@ -590,7 +597,7 @@
case SQL_ATTR_PARAMSET_SIZE:
if (ValuePtr != (SQLPOINTER)1)
- MYODBCDbgReturn(set_error(hstmt,MYERR_01S02,
+ MYODBCDbgReturnReturn(set_error(hstmt,MYERR_01S02,
"Option value changed to default parameter
size",
0));
break;
@@ -601,7 +608,7 @@
break;
case SQL_ATTR_ROW_NUMBER:
- MYODBCDbgReturn(set_error(hstmt,MYERR_S1000,
+ MYODBCDbgReturnReturn(set_error(hstmt,MYERR_S1000,
"Trying to set read-only attribute",0));
break;
@@ -630,7 +637,7 @@
result= set_constmt_attr(3,hstmt,options,
Attribute,ValuePtr);
}
- MYODBCDbgReturn(result);
+ MYODBCDbgReturnReturn(result);
}
@@ -650,11 +657,13 @@
STMT_OPTIONS *options= &stmt->stmt_options;
SQLPOINTER vparam;
SQLINTEGER strlen;
- MYODBCDbgEnter("SQLGetStmtAttr");
- MYODBCDbgPrint("enter",
- ("Atrr: %d, ValuePtr: 0x%lx, BufLen: %d, StrLenPtr: 0x%lx",
- Attribute,ValuePtr,BufferLength,StringLengthPtr));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "Atrr: %d", Attribute );
+ MYODBCDbgInfo( "ValuePtr: 0x%lx", ValuePtr );
+ MYODBCDbgInfo( "BufLen: %d", BufferLength );
+ MYODBCDbgInfo( "StrLenPtr: 0x%lx", StringLengthPtr );
+
if (!ValuePtr)
ValuePtr= &vparam;
@@ -748,7 +757,7 @@
StringLengthPtr);
}
- MYODBCDbgReturn(result);
+ MYODBCDbgReturnReturn(result);
}
@@ -762,10 +771,12 @@
SQLULEN vParam )
{
SQLRETURN result= SQL_SUCCESS;
- MYODBCDbgEnter("SQLSetConnectOption");
+ MYODBCDbgEnter;
+
result= set_con_attr(hdbc,fOption,(SQLPOINTER)vParam,SQL_NTS);
- MYODBCDbgReturn(result);
+
+ MYODBCDbgReturnReturn(result);
}
@@ -778,10 +789,12 @@
SQLPOINTER vParam)
{
SQLRETURN result= SQL_SUCCESS;
- MYODBCDbgEnter("SQLGetConnectOption");
+ MYODBCDbgEnter;
+
result= get_con_attr(hdbc,fOption,vParam,SQL_NTS,(SQLINTEGER *)NULL);
- MYODBCDbgReturn(result);
+
+ MYODBCDbgReturnReturn(result);
}
@@ -795,10 +808,12 @@
SQLULEN vParam )
{
SQLRETURN result= SQL_SUCCESS;
- MYODBCDbgEnter("SQLSetStmtOption");
+ MYODBCDbgEnter;
+
result= set_stmt_attr(hstmt,fOption,(SQLPOINTER)vParam,SQL_NTS);
- MYODBCDbgReturn(result);
+
+ MYODBCDbgReturnReturn(result);
}
@@ -811,10 +826,12 @@
SQLPOINTER vParam)
{
SQLRETURN result= SQL_SUCCESS;
- MYODBCDbgEnter("SQLGetStmtOption");
+ MYODBCDbgEnter;
+
result= get_stmt_attr(hstmt,fOption,vParam,SQL_NTS,(SQLINTEGER *)NULL);
- MYODBCDbgReturn(result);
+
+ MYODBCDbgReturnReturn(result);
}
@@ -829,11 +846,12 @@
SQLPOINTER ValuePtr,
SQLINTEGER StringLength __attribute__((unused)))
{
- MYODBCDbgEnter("SQLSetEnvAttr");
- MYODBCDbgPrint("enter",("Atrr: %d, ValuePtr: 0x%lx",Attribute,ValuePtr));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "Atrr: %d", Attribute );
+ MYODBCDbgInfo( "ValuePtr: 0x%lx", ValuePtr );
if (((ENV FAR *)henv)->connections)
- MYODBCDbgReturn(set_env_error(henv,MYERR_S1010,NULL,0));
+ MYODBCDbgReturnReturn( set_env_error(henv,MYERR_S1010,NULL,0) );
switch (Attribute)
{
@@ -847,9 +865,9 @@
break;
default:
- MYODBCDbgReturn(set_env_error(henv,MYERR_S1C00,NULL,0));
+ MYODBCDbgReturnReturn(set_env_error(henv,MYERR_S1C00,NULL,0));
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -865,8 +883,8 @@
SQLINTEGER BufferLength __attribute__((unused)),
SQLINTEGER *StringLengthPtr __attribute__((unused)))
{
- MYODBCDbgEnter("SQLGetEnvAttr");
- MYODBCDbgPrint("enter",("Atrr: %d",Attribute));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "Atrr: %d", Attribute );
switch ( Attribute )
{
@@ -883,9 +901,9 @@
break;
default:
- MYODBCDbgReturn(set_env_error(henv,MYERR_S1C00,NULL,0));
+ MYODBCDbgReturnReturn(set_env_error(henv,MYERR_S1C00,NULL,0));
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
Modified: trunk/myodbc3/prepare.c
===================================================================
--- trunk/myodbc3/prepare.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/prepare.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -77,7 +77,7 @@
int bEmbraced = 0;
char *pcLastCloseBrace = 0;
- MYODBCDbgEnter("SQLPrepare");
+ MYODBCDbgEnter;
LINT_INIT(end);
@@ -89,8 +89,8 @@
#endif
if (!(stmt->query= dupp_str((char*) szSqlStr, cbSqlStr)))
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
- MYODBCDbgPrint("enter",("%s",stmt->query));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgInfo( "%s", stmt->query );
/* Count number of parameters and save position for each parameter */
in_string= 0;
@@ -167,7 +167,7 @@
bzero((gptr) &tmp_param,sizeof(tmp_param));
if (push_dynamic(&stmt->params,(gptr) &tmp_param))
{
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1001,NULL,4001));
}
}
param= dynamic_element(&stmt->params,param_count,PARAM_BIND*);
@@ -184,8 +184,8 @@
stmt->param_count= param_count;
stmt->query_end= pos;
stmt->state= ST_PREPARED;
- MYODBCDbgPrint("info",("Parameter count: %ld",stmt->param_count));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "Parameter count: %ld", stmt->param_count );
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -207,24 +207,28 @@
{
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));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "ipar: %d", ipar );
+ MYODBCDbgInfo( "Ctype: %d", fCType );
+ MYODBCDbgInfo( "SQLtype: %d", fSqlType );
+ MYODBCDbgInfo( "rgbValue: 0x%lx", rgbValue );
+ MYODBCDbgInfo( "ValueMax: %ld", cbValueMax );
+ MYODBCDbgInfo( "Valueptr: 0x%lx", pcbValue );
+ MYODBCDbgInfo( "Value: %ld", pcbValue ? *pcbValue : 0L );
+
CLEAR_STMT_ERROR(stmt);
if (ipar-- < 1)
{
set_error(stmt,MYERR_S1093,NULL,0);
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(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);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
if (stmt->params.elements > ipar)
{
@@ -251,9 +255,9 @@
if (set_dynamic(&stmt->params,(gptr) ¶m,ipar))
{
set_error(stmt,MYERR_S1001,NULL,4001);
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -300,14 +304,17 @@
SQLSMALLINT FAR *pfNullable )
{
STMT FAR *stmt= (STMT FAR*) hstmt;
- MYODBCDbgEnter("SQLDescribeParam");
+
+ MYODBCDbgEnter;
+
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);
+
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -326,7 +333,7 @@
SQLUINTEGER *pirow __attribute__((unused)) )
#endif
{
- MYODBCDbgEnter("SQLParamOptions");
+ MYODBCDbgEnter;
if (crow != 1)
{
@@ -337,7 +344,7 @@
return(set_error(hstmt,MYERR_01S02,
"Option value changed to default parameter size",0));
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -349,10 +356,13 @@
SQLRETURN SQL_API SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT FAR *pcpar)
{
STMT FAR *stmt= (STMT FAR*) hstmt;
- MYODBCDbgEnter("SQLNumParams");
+
+ MYODBCDbgEnter;
+
if (pcpar)
*pcpar= stmt->param_count;
- MYODBCDbgReturn(SQL_SUCCESS);
+
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -367,7 +377,10 @@
SQLUSMALLINT crowRowset )
{
STMT FAR *stmt= (STMT FAR*) hstmt;
- MYODBCDbgEnter("SQLSetScrollOptions");
+
+ MYODBCDbgEnter;
+
stmt->stmt_options.rows_in_set= crowRowset;
- MYODBCDbgReturn(SQL_SUCCESS);
+
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
Modified: trunk/myodbc3/results.c
===================================================================
--- trunk/myodbc3/results.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/results.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -187,24 +187,25 @@
{
SQLRETURN error;
STMT FAR *stmt= (STMT FAR*) hstmt;
- MYODBCDbgEnter("SQLNumResultCols");
+ MYODBCDbgEnter;
+
if ( stmt->param_count > 0 && stmt->dummy_state == ST_DUMMY_UNKNOWN
&&
(stmt->state != ST_PRE_EXECUTED || stmt->state != ST_EXECUTED) )
{
if ( do_dummy_parambind(hstmt) != SQL_SUCCESS )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
if ( (error= check_result(stmt)) != SQL_SUCCESS )
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn(error);
if ( !stmt->result )
*pccol= 0; /* Not a select */
else
*pccol= stmt->result->field_count;
- MYODBCDbgPrint("info",("columns: %d",*pccol));
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgInfo( "columns: %d", *pccol );
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
/*
@@ -228,16 +229,17 @@
STMT FAR *stmt= (STMT FAR*) hstmt;
ulong transfer_length,precision,display_size;
int type;
- MYODBCDbgEnter("SQLDescribeCol");
+ MYODBCDbgEnter;
+
if ( (error= check_result(stmt)) != SQL_SUCCESS )
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn(error);
if ( ! stmt->result )
- MYODBCDbgReturn(set_stmt_error(stmt,"07005","No result set",0));
+ MYODBCDbgReturnReturn(set_stmt_error(stmt,"07005","No result set",0));
mysql_field_seek(stmt->result,icol-1);
if ( !(field= mysql_fetch_field(stmt->result)) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1002,"Invalid column number",0));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1002,"Invalid column number",0));
type=
unireg_to_sql_datatype(stmt,field,0,&transfer_length,&precision,&display_size
);
/*
@@ -254,8 +256,10 @@
NOT_NULL_FLAG) ?
SQL_NO_NULLS :
SQL_NULLABLE);
- MYODBCDbgPrint("info",("col: %d type: %d precision: %ld decimals: %d",
- icol,type,precision,field->decimals));
+ MYODBCDbgInfo( "col: %d", icol );
+ MYODBCDbgInfo( "type: %d", type );
+ MYODBCDbgInfo( "precision: %ld", precision );
+ MYODBCDbgInfo( "decimals: %d", field->decimals );
if ( stmt->dbc->flag & FLAG_FULL_COLUMN_NAMES && field->table )
{
@@ -264,15 +268,15 @@
SQLRETURN error;
if ( !tmp )
{
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1001,NULL,4001));
}
strxmov(tmp,field->table,".",field->name,NullS);
error= copy_str_data(SQL_HANDLE_STMT, stmt, szColName,
cbColNameMax, pcbColName, tmp);
my_free((gptr) tmp,MYF(0));
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn(error);
}
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt, szColName,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt, szColName,
cbColNameMax, pcbColName, field->name));
}
@@ -297,17 +301,19 @@
SQLPOINTER nparam= 0;
ulong transfer_length,precision,display_size;
SQLRETURN error;
- MYODBCDbgEnter("SQLColAttribute");
- MYODBCDbgPrint("enter",("column: %d type: %d",ColumnNumber, FieldIdentifier));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "column: %d", ColumnNumber );
+ MYODBCDbgInfo( "type: %d", FieldIdentifier );
+
if ( check_result(stmt) != SQL_SUCCESS )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
if ( !stmt->result )
- MYODBCDbgReturn(set_stmt_error(stmt,"07005","No result set",0));
+ MYODBCDbgReturnReturn(set_stmt_error(stmt,"07005","No result set",0));
#ifdef CHECK_EXTRA_ARGUMENTS
if ( ColumnNumber > stmt->result->field_count )
- MYODBCDbgReturn(set_error(StatementHandle, MYERR_07009,NULL,0));
+ MYODBCDbgReturnReturn(set_error(StatementHandle, MYERR_07009,NULL,0));
#endif
if ( !StringLengthPtr )
StringLengthPtr= &str_length;
@@ -319,22 +325,22 @@
NumericAttributePtr= strparam;
if ( (error= check_result(stmt)) != SQL_SUCCESS )
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn(error);
if ( FieldIdentifier == SQL_DESC_COUNT ||
FieldIdentifier == SQL_COLUMN_COUNT )
{
*(SQLINTEGER *)NumericAttributePtr= stmt->result->field_count;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
if ( FieldIdentifier == SQL_DESC_TYPE && ColumnNumber == 0 )
{
*(SQLINTEGER *) NumericAttributePtr= SQL_INTEGER;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
mysql_field_seek(stmt->result,ColumnNumber-1);
if ( !(field= mysql_fetch_field(stmt->result)) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1002,"Invalid column number",0));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1002,"Invalid column number",0));
switch ( FieldIdentifier )
{
@@ -349,14 +355,14 @@
case SQL_DESC_LABEL:
case SQL_DESC_NAME:
case SQL_COLUMN_NAME:
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength,StringLengthPtr,
field->name));
case SQL_DESC_BASE_TABLE_NAME:
case SQL_DESC_TABLE_NAME:
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength,StringLengthPtr,
field->table ? field->table : ""));
@@ -368,14 +374,14 @@
case SQL_DESC_CATALOG_NAME:
#if MYSQL_VERSION_ID < 40100
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength, StringLengthPtr,
stmt->dbc->database));
#else
{
char *ldb= (field->db && field->db[0] != '\0') ?
field->db : stmt->dbc->database;
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength, StringLengthPtr,
ldb));
@@ -414,7 +420,7 @@
case FIELD_TYPE_TINY_BLOB:
case FIELD_TYPE_MEDIUM_BLOB:
case FIELD_TYPE_BLOB:
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength,StringLengthPtr,"0x"));
@@ -426,12 +432,12 @@
case FIELD_TYPE_TIMESTAMP:
case FIELD_TYPE_TIME:
case FIELD_TYPE_YEAR:
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength,StringLengthPtr,"'"));
default:
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength,StringLengthPtr,""));
}
@@ -482,7 +488,7 @@
break;
case SQL_DESC_SCHEMA_NAME:
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength,StringLengthPtr, ""));
@@ -502,7 +508,7 @@
char buff[40];
(void)unireg_to_sql_datatype(stmt,field,(char
*)buff,&transfer_length,
&precision, &display_size);
- MYODBCDbgReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
+ MYODBCDbgReturnReturn(copy_str_data(SQL_HANDLE_STMT, stmt,
CharacterAttributePtr,
BufferLength,StringLengthPtr, buff));
}
@@ -534,10 +540,9 @@
break;
default:
- MYODBCDbgPrint("warning",("Type: %d is not supported by the driver",
- FieldIdentifier));
+ MYODBCDbgWarning( "Type: %d is not supported by the driver", FieldIdentifier
);
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -581,8 +586,8 @@
SQLSMALLINT FAR *pcbDesc,
SQLLEN *pfDesc )
{
- MYODBCDbgEnter("SQLColAttributes");
- MYODBCDbgReturn(get_col_attr( hstmt,
+ MYODBCDbgEnter;
+ MYODBCDbgReturnReturn(get_col_attr( hstmt,
icol,
fDescType,
rgbDesc,
@@ -607,12 +612,14 @@
BIND *bind;
STMT FAR *stmt= (STMT FAR*) hstmt;
SQLRETURN error;
- MYODBCDbgEnter("SQLBindCol");
- MYODBCDbgPrint("enter",
- ("icol: %d Type: %d ValueMax: %ld Valueptr: 0x%lx pcbValue: %ld",
- icol,fCType,(long) cbValueMax, pcbValue,
- (long) (pcbValue ? *pcbValue : 0L)));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "icol: %d", icol );
+ MYODBCDbgInfo( "Type: %d", fCType );
+ MYODBCDbgInfo( "ValueMax: %ld", cbValueMax );
+ MYODBCDbgInfo( "Valueptr: 0x%lx", pcbValue );
+ MYODBCDbgInfo( "pcbValue: %ld", (long) (pcbValue ? *pcbValue : 0L) );
+
icol--;
/*
The next case if because of VB 5.0 that binds columns before preparing
@@ -621,13 +628,12 @@
if ( stmt->state == ST_UNKNOWN )
{
- MYODBCDbgPrint("info",
- ("Binding columns without a statement; Hope you know what you are
doing"));
+ MYODBCDbgInfo( "%s", "Binding columns without a statement; Hope you know what you
are doing" );
if ( fCType == SQL_C_NUMERIC ) /* We don't support this */
{
set_error(stmt,MYERR_07006,
"Restricted data type attribute violation(SQL_C_NUMERIC)",0);
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
if ( icol >= stmt->bound_columns )
{
@@ -637,7 +643,7 @@
MY_FREE_ON_ERROR))) )
{
stmt->bound_columns= 0;
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1001,NULL,4001));
}
bzero((gptr) (stmt->bind+stmt->bound_columns),
(icol+1-stmt->bound_columns)*sizeof(BIND));
@@ -652,28 +658,28 @@
(stmt->state != ST_PRE_EXECUTED || stmt->state != ST_EXECUTED) )
{
if ( do_dummy_parambind(hstmt) != SQL_SUCCESS )
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
if ( fCType == SQL_C_NUMERIC ) /* We don't support this */
{
set_error(stmt,MYERR_07006,
"Restricted data type attribute violation(SQL_C_NUMERIC)",0);
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
if ( (error= check_result(stmt)) != SQL_SUCCESS )
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn(error);
if ( !stmt->result || (uint) icol >= stmt->result->field_count )
{
set_error(stmt,MYERR_S1002,"Invalid column number",0);
- MYODBCDbgReturn(error);
+ MYODBCDbgReturnReturn(error);
}
if ( !stmt->bind )
{
if ( !(stmt->bind= (BIND*) my_malloc(sizeof(BIND)*
stmt->result->field_count,
MYF(MY_ZEROFILL))) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1001,NULL,4001));
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1001,NULL,4001));
stmt->bound_columns= stmt->result->field_count;
}
mysql_field_seek(stmt->result,icol);
@@ -686,7 +692,7 @@
bind->rgbValue= rgbValue;
bind->cbValueMax= bind_length(bind->fCType,cbValueMax);
bind->pcbValue= pcbValue;
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -737,21 +743,25 @@
{
STMT FAR *stmt= (STMT FAR*) hstmt;
SQLRETURN result;
- MYODBCDbgEnter("SQLGetData");
- MYODBCDbgPrint("enter",("icol:%d, ctype:%d, rgb:0x%x, len:%d, pcb:0x%x)",
- icol,fCType,rgbValue,cbValueMax,pcbValue));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "icol:%d", icol );
+ MYODBCDbgInfo( "ctype:%d", fCType );
+ MYODBCDbgInfo( "rgb:0x%x", rgbValue );
+ MYODBCDbgInfo( "len:%d", cbValueMax );
+ MYODBCDbgInfo( "pcb:0x%x", pcbValue );
+
if ( !stmt->result || !stmt->current_values )
{
set_stmt_error(stmt,"24000","SQLGetData without a preceding SELECT",0);
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
if ( fCType == SQL_C_NUMERIC ) /* We don't support this */
{
set_error(stmt,MYERR_07006,
"Restricted data type attribute violation(SQL_C_NUMERIC)",0);
- MYODBCDbgReturn(SQL_ERROR);
+ MYODBCDbgReturnReturn(SQL_ERROR);
}
icol--; /* Easier code if start from 0 */
if ( icol != stmt->last_getdata_col )
@@ -761,11 +771,10 @@
}
#ifdef LOG_ALL
- MYODBCDbgPrint("QQ",("icol: %d fCType: %d default: %d value: %.10s",
- icol+1,fCType,
- stmt->odbc_types[icol],
- (stmt->current_values[icol] ? stmt->current_values[icol] :
- "NULL")));
+ MYODBCDbgInfo( "icol: %d", icol+1 );
+ MYODBCDbgInfo( "fCType: %d", fCType );
+ MYODBCDbgInfo( "default: %d", stmt->odbc_types[icol] );
+ MYODBCDbgInfo( "value: %.10s", (stmt->current_values[icol] ?
stmt->current_values[icol] : "NULL") );
#endif
if ( !(stmt->dbc->flag & FLAG_NO_LOCALE) )
setlocale(LC_NUMERIC,"English");
@@ -781,9 +790,11 @@
if ( !(stmt->dbc->flag & FLAG_NO_LOCALE) )
setlocale(LC_NUMERIC,default_locale);
- MYODBCDbgPrint("exit",("return:%d, rgb:0x%x, pcb:0x%x)",
- result,rgbValue,pcbValue));
- MYODBCDbgReturn(result);
+ MYODBCDbgInfo( "return:%d ", result );
+ MYODBCDbgInfo( "rgb:0x%x", rgbValue );
+ MYODBCDbgInfo( "pcb:0x%x", pcbValue );
+
+ MYODBCDbgReturnReturn(result);
}
@@ -1068,7 +1079,7 @@
int nRetVal;
SQLRETURN nReturn = SQL_SUCCESS;
- MYODBCDbgEnter( "SQLMoreResults" );
+ MYODBCDbgEnter;
pthread_mutex_lock( &pStmt->dbc->lock );
@@ -1129,21 +1140,22 @@
{
pStmt->state = ST_EXECUTED;
pStmt->affected_rows = mysql_affected_rows( &pStmt->dbc->mysql
);
- MYODBCDbgPrint( "info", ("affected rows: %d", pStmt->affected_rows ) );
+ MYODBCDbgInfo( "affected rows: %d", pStmt->affected_rows );
goto exitSQLMoreResults;
}
/* we have fields but no resultset (not even an empty one) - this is bad */
- MYODBCDbgPrint( "error", ("client failed to return resultset") );
+ MYODBCDbgError( "%s", "client failed to return resultset" );
nReturn = set_stmt_error( pStmt, "HY000", mysql_error(
&pStmt->dbc->mysql ), mysql_errno( &pStmt->dbc->mysql ) );
goto exitSQLMoreResults;
}
- MYODBCDbgPrint( "info", ("result set columns: %d, rows: %lld",
pStmt->result->field_count, pStmt->result->row_count ) );
+ MYODBCDbgInfo( "result set columns: %d", pStmt->result->field_count );
+ MYODBCDbgInfo( "result set rows: %lld", pStmt->result->row_count );
fix_result_types( pStmt );
exitSQLMoreResults:
pthread_mutex_unlock( &pStmt->dbc->lock );
- MYODBCDbgReturn( nReturn );
+ MYODBCDbgReturnReturn( nReturn );
}
@@ -1159,18 +1171,20 @@
SQLLEN * pcrow )
{
STMT FAR *stmt= (STMT FAR*) hstmt;
- MYODBCDbgEnter("SQLRowCount");
+
+ MYODBCDbgEnter;
+
if ( stmt->result )
{
*pcrow= (SQLINTEGER) mysql_affected_rows(&stmt->dbc->mysql);
- MYODBCDbgPrint("info",("Rows in set: %ld",*pcrow));
+ MYODBCDbgInfo( "Rows in set: %ld", *pcrow );
}
else
{
*pcrow= (SQLINTEGER) stmt->affected_rows;
- MYODBCDbgPrint("info",("Affected rows: %ld",*pcrow));
+ MYODBCDbgInfo( "Affected rows: %ld", *pcrow );
}
- MYODBCDbgReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(SQL_SUCCESS);
}
@@ -1195,21 +1209,23 @@
MYSQL_ROW values= 0;
MYSQL_ROW_OFFSET save_position;
SQLUINTEGER dummy_pcrow;
- MYODBCDbgEnter("SQLExtendedFetch");
+ MYODBCDbgEnter;
+
LINT_INIT(save_position);
if ( !stmt->result )
- MYODBCDbgReturn(set_stmt_error(stmt,"24000","Fetch without a SELECT",
+ MYODBCDbgReturnReturn(set_stmt_error(stmt,"24000","Fetch without a SELECT",
0));
- MYODBCDbgPrint("enter",
- ("fetchtype: %d row: %ld current top-row: %ld rows_found: %ld",
- fFetchType,irow,stmt->current_row,stmt->rows_found_in_set));
+ MYODBCDbgInfo( "fetchtype: %d", fFetchType );
+ MYODBCDbgInfo( "row: %ld", irow );
+ MYODBCDbgInfo( "current top-row: %ld", stmt->current_row );
+ MYODBCDbgInfo( "rows_found: %ld", stmt->rows_found_in_set );
if ( stmt->stmt_options.cursor_type == SQL_CURSOR_FORWARD_ONLY )
{
if ( fFetchType != SQL_FETCH_NEXT && !(stmt->dbc->flag &
FLAG_SAFE) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1106,
+ MYODBCDbgReturnReturn( set_error(stmt,MYERR_S1106,
"Wrong fetchtype with FORWARD ONLY cursor",
0));
@@ -1218,7 +1234,7 @@
}
if ( if_dynamic_cursor(stmt) && set_dynamic_result(stmt) )
- MYODBCDbgReturn(set_error(stmt,MYERR_S1000,
+ MYODBCDbgReturnReturn(set_error(stmt,MYERR_S1000,
"Driver Failed to set the internal dynamic result",
0));
@@ -1273,7 +1289,7 @@
break;
default:
- MYODBCDbgReturn( set_error( stmt, MYERR_S1106, "Fetch type out of range", 0 )
);
+ MYODBCDbgReturnReturn( set_error( stmt, MYERR_S1106, "Fetch type out of
range", 0 ) );
}
if ( cur_row < 0 )
@@ -1281,7 +1297,7 @@
stmt->current_row= -1; /* Before first row */
stmt->rows_found_in_set= 0;
mysql_data_seek(stmt->result,0L);
- MYODBCDbgReturn(SQL_NO_DATA_FOUND);
+ MYODBCDbgReturnReturn(SQL_NO_DATA_FOUND);
}
if ( cur_row > max_row )
cur_row= max_row;
@@ -1309,7 +1325,7 @@
stmt->rows_found_in_set= 0;
if ( upd_status && stmt->stmt_options.rowsFetchedPtr )
*stmt->stmt_options.rowsFetchedPtr= 0;
- MYODBCDbgReturn(SQL_NO_DATA_FOUND);
+ MYODBCDbgReturnReturn(SQL_NO_DATA_FOUND);
}
if ( !(stmt->dbc->flag & FLAG_NO_LOCALE) )
@@ -1419,7 +1435,7 @@
if ( !(stmt->dbc->flag & FLAG_NO_LOCALE) )
setlocale(LC_NUMERIC,default_locale);
- MYODBCDbgReturn(res);
+ MYODBCDbgReturnReturn(res);
}
@@ -1461,15 +1477,16 @@
{
SQLRETURN result;
STMT_OPTIONS *options= &((STMT FAR *)StatementHandle)->stmt_options;
- MYODBCDbgEnter("SQLFetchScroll");
+ MYODBCDbgEnter;
+
result= my_SQLExtendedFetch( StatementHandle,
FetchOrientation,
FetchOffset,
options->rowsFetchedPtr,
options->rowStatusPtr,
0 );
- MYODBCDbgReturn( result );
+ MYODBCDbgReturnReturn( result );
}
/*
@@ -1482,12 +1499,13 @@
{
SQLRETURN result;
STMT_OPTIONS *options= &((STMT FAR *)StatementHandle)->stmt_options;
- MYODBCDbgEnter("SQLFetch");
+ MYODBCDbgEnter;
+
result= my_SQLExtendedFetch(StatementHandle, SQL_FETCH_NEXT,
0,
options->rowsFetchedPtr,
options->rowStatusPtr, 0);
- MYODBCDbgReturn(result);
+ MYODBCDbgReturnReturn(result);
}
Modified: trunk/myodbc3/transact.c
===================================================================
--- trunk/myodbc3/transact.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/transact.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -103,11 +103,13 @@
SQLRETURN result= SQL_SUCCESS;
ENV FAR *henv;
LIST *current;
- MYODBCDbgEnter("SQLEndTran");
- MYODBCDbgPrint("enter",("type: %s, handle: 0x%x, option: %d",
- MYODBCDbgHandleTypeString(HandleType),Handle,
- MYODBCDbgTransactionTypeString(CompletionType)));
+ MYODBCDbgEnter;
+
+ MYODBCDbgInfo( "type: %s", MYODBCDbgHandleTypeString( HandleType ) );
+ MYODBCDbgInfo( "handle: 0x%x", Handle );
+ MYODBCDbgInfo( "option: %s", MYODBCDbgTransactionTypeString( CompletionType ) );
+
switch (HandleType) {
case SQL_HANDLE_ENV:
henv = (ENV*)Handle;
@@ -127,7 +129,7 @@
set_error(Handle,MYERR_S1092,NULL,0);
break;
}
- MYODBCDbgReturn(result);
+ MYODBCDbgReturnReturn(result);
}
@@ -144,11 +146,14 @@
SQLUSMALLINT fType)
{
SQLRETURN result= SQL_SUCCESS;
- MYODBCDbgEnter("SQLTransact");
- MYODBCDbgPrint("enter",("henv: 0x%x, hdbc: 0x%x, option: %d",henv,hdbc,fType));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "henv: 0x%x", henv );
+ MYODBCDbgInfo( "hdbc: 0x%x", hdbc );
+ MYODBCDbgInfo( "option: %d", fType );
+
if (hdbc)
result= my_transact(hdbc,fType);
- MYODBCDbgReturn(result);
+ MYODBCDbgReturnReturn(result);
}
Modified: trunk/myodbc3/utility.c
===================================================================
--- trunk/myodbc3/utility.c 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/myodbc3/utility.c 2006-10-07 21:07:10 UTC (rev 127)
@@ -46,9 +46,10 @@
SQLRETURN odbc_stmt(DBC FAR *dbc, const char *query)
{
SQLRETURN result= SQL_SUCCESS;
- MYODBCDbgEnter("odbc_stmt");
- MYODBCDbgPrint("enter",("stmt: %s",query));
+ MYODBCDbgEnter;
+ MYODBCDbgInfo( "stmt: %s", query );
+
pthread_mutex_lock(&dbc->lock);
if ( check_if_server_is_alive(dbc) ||
mysql_real_query(&dbc->mysql,query,strlen(query)) )
@@ -57,7 +58,7 @@
mysql_errno(&dbc->mysql));
}
pthread_mutex_unlock(&dbc->lock);
- MYODBCDbgReturn(result);
+ MYODBCDbgReturnReturn(result);
}
/*
@@ -87,8 +88,9 @@
{
uint i;
MYSQL_RES *result= stmt->result;
- MYODBCDbgEnter("fix_result_types");
+ MYODBCDbgEnter;
+
stmt->state= ST_EXECUTED; /* Mark set found */
if ( (stmt->odbc_types= (SQLSMALLINT*)
my_malloc(sizeof(SQLSMALLINT)*result->field_count, MYF(0))) )
@@ -113,7 +115,7 @@
{
/* We should in principle give an error here */
stmt->bound_columns= 0;
- MYODBCDbgReturn3;
+ MYODBCDbgReturnVoid;
}
bzero((gptr) (stmt->bind+stmt->bound_columns),
(result->field_count -stmt->bound_columns)*sizeof(BIND));
@@ -129,7 +131,7 @@
stmt->bind[i].field= mysql_fetch_field(result);
}
}
- MYODBCDbgReturn3;
+ MYODBCDbgReturnVoid;
}
@@ -290,8 +292,8 @@
}
if ( arg_length && cbValueMax >= fill_length )
return SQL_SUCCESS;
- MYODBCDbgPrint("info",("Returned %ld characters from offset: %lu",
- length,*offset - length));
+ MYODBCDbgInfo( "Returned %ld characters from", length );
+ MYODBCDbgInfo( "offset: %lu", *offset - length );
set_handle_error(HandleType,Handle,MYERR_01004,NULL,0);
return SQL_SUCCESS_WITH_INFO;
}
@@ -349,8 +351,8 @@
}
if ( (ulong) cbValueMax > length*2 )
return SQL_SUCCESS;
- MYODBCDbgPrint("info",("Returned %ld characters from offset: %ld",
- length,*offset - length));
+ MYODBCDbgInfo( "Returned %ld characters from", length );
+ MYODBCDbgInfo( "offset: %ld", *offset - length );
set_handle_error(HandleType,Handle,MYERR_01004,NULL,0);
return SQL_SUCCESS_WITH_INFO;
@@ -1104,7 +1106,7 @@
@purpose : logs the queries sent to server
*/
-#ifndef DBUG_OFF
+#ifdef MYODBC_DBG
void query_print(FILE *log_file,char *query)
{
if ( log_file && query )
Modified: trunk/mysql.pri
===================================================================
--- trunk/mysql.pri 2006-10-07 09:05:28 UTC (rev 126)
+++ trunk/mysql.pri 2006-10-07 21:07:10 UTC (rev 127)
@@ -28,7 +28,6 @@
# WIN32
# #########################################################
win32 {
- DEFINES += DBUG_OFF _DBUG_OFF NDEBUG _NDEBUG
DEFINES += _WIN32 WIN32 _WINDOWS __WIN__
INCLUDEPATH += $(MYSQL_DIR)\include
LIBS += -L$(MYSQL_DIR)\lib\opt mysqlclient.lib zlib.lib
| Thread |
|---|
| • Connector/ODBC 3.51 commit: r127 - in trunk: . MYODBCDbg/MYODBCDbgLib MYODBCDbg/include myodbc3 | pharvey | 7 Oct |