Modified:
MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c
MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro
MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.vpj
MYODBCDbg/include/MYODBCDbg.h
PostBuildTest.bat
README.debug
config.pri
defines.pri
myodbc3/connect.c
myodbc3/dll.c
myodbc3/myodbc3.pro
mysql.pri
test/include/mytest3.h
Log:
- testing out driver trace
- currently segfaults tests
- working to solve
Modified: MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c
===================================================================
--- MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c 2006-03-06 03:49:05 UTC (rev 43)
+++ MYODBCDbg/MYODBCDbgLib/MYODBCDbgGetFileDefault.c 2006-03-06 07:12:03 UTC (rev 44)
@@ -36,10 +36,7 @@
#ifdef _UNIX_
return "d:t:S:O,/tmp/myodbc.log";
#else
- return "d:t:S:O,c::\\myodbc.log";
+ return "d:t:S:O,c:\\myodbc.log";
#endif /* _UNIX */
-
-/* MYODBCDbgPrint( "start", ("Driver name: Connector/ODBC Version: %s", SETUP_VERSION)
); */
}
-#endif
Modified: MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro
===================================================================
--- MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro 2006-03-06 03:49:05 UTC (rev 43)
+++ MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro 2006-03-06 07:12:03 UTC (rev 44)
@@ -39,9 +39,9 @@
MYODBCDbgDiagFieldString.c \
MYODBCDbgEnvAttrString.c \
MYODBCDbgFunctionsString.c \
+ MYODBCDbgGetFileDefault.c \
MYODBCDbgHandleTypeString.c \
MYODBCDbgInfoTypeString.c \
- MYODBCDbgInit.c \
MYODBCDbgPosTypeString.c \
MYODBCDbgReturnString.c \
MYODBCDbgStmtAttrString.c \
Modified: MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.vpj
===================================================================
--- MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.vpj 2006-03-06 03:49:05 UTC (rev 43)
+++ MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.vpj 2006-03-06 07:12:03 UTC (rev 44)
@@ -189,6 +189,7 @@
<F N="MYODBCDbgDiagFieldString.c"/>
<F N="MYODBCDbgEnvAttrString.c"/>
<F N="MYODBCDbgFunctionsString.c"/>
+ <F N="MYODBCDbgGetFileDefault.c"/>
<F N="MYODBCDbgHandleTypeString.c"/>
<F N="MYODBCDbgInfoTypeString.c"/>
<F N="MYODBCDbgPosTypeString.c"/>
Modified: MYODBCDbg/include/MYODBCDbg.h
===================================================================
--- MYODBCDbg/include/MYODBCDbg.h 2006-03-06 03:49:05 UTC (rev 43)
+++ MYODBCDbg/include/MYODBCDbg.h 2006-03-06 07:12:03 UTC (rev 44)
@@ -151,7 +151,12 @@
#ifdef DBUG_OFF
#define MYODBCDbgInit
#else
-void MYODBCDbgInit();
+#define MYODBCDbgInit \
+{ \
+ char *psz = getenv( "MYODBC_LOG" ); \
+ if ( psz && *psz ) \
+ MYODBCDbgSetFile( psz ) \
+}
#endif
/*!
@@ -256,7 +261,12 @@
MYODBCDbgFini
MYODBCDbgPrint
*/
-#define MYODBCDbgSetFile DBUG_PUSH
+#define MYODBCDbgSetFile(A) \
+{ \
+ DBUG_PUSH(A); \
+ DBUG_PROCESS( "MYODBC" ); \
+ MYODBCDbgPrint( "start", ( "Driver name: Connector/ODBC Version: %s", SETUP_VERSION
) ); \
+}
/*!
\brief Inits debug for a function.
@@ -327,15 +337,18 @@
MYODBCDbgReturn3
*/
#ifdef DBUG_OFF
-#define MYODBCDbgReturn(A) return(A);
+#define MYODBCDbgReturn(A) return (A);
#else
-#define MYODBCDbgReturn(STATUS) \
+#define MYODBCDbgReturn(A) \
{ \
- SQLRETURN rc= (STATUS); \
+ SQLRETURN rc= (A); \
MYODBCDbgPrint("exit", ("%s", MYODBCDbgReturnString( rc )) ); \
DBUG_RETURN( rc ); \
}
+#endif
+const char *MYODBCDbgGetFileDefault();
+
/*!
\brief Returns from a function.
@@ -372,4 +385,3 @@
#endif
-
Modified: PostBuildTest.bat
===================================================================
--- PostBuildTest.bat 2006-03-06 03:49:05 UTC (rev 43)
+++ PostBuildTest.bat 2006-03-06 07:12:03 UTC (rev 44)
@@ -24,6 +24,7 @@
ECHO BEGIN: Post build test...
test\bin\connect.exe %1 %2 %3
+EXIT /B 0
test\bin\basics.exe %1 %2 %3
test\bin\param.exe %1 %2 %3
test\bin\result.exe %1 %2 %3
Modified: README.debug
===================================================================
--- README.debug 2006-03-06 03:49:05 UTC (rev 43)
+++ README.debug 2006-03-06 07:12:03 UTC (rev 44)
@@ -79,6 +79,10 @@
is of particular interest to applications which link directly to
the driver but is also very useful complement to the ODBC Trace.
+NOTE: Some platforms will cache dll's in memory so simply
+ replacing them on disk may not mean you are going to
+ use the new dll.
+
The following settings affect the behaviour of the driver trace;
DBUG_OFF
@@ -92,6 +96,26 @@
This is, 99%, implemented in the MySQL client.
+see defines.pri
+
+MYODBC_LOG
+----------
+
+This environment variable, if set, will be used to
+set format information and file name for the trace
+output. For example; "d:t:S:O,c::\\myodbc.log".
+
+Unlike other trace options for the driver - this one enables
+trace when the driver is instantiated. The other options to
+get trace output are connection based and, in some cases, DSN
+based.
+
+Enabling trace with this option effectively causes the other
+options to be ignored.
+
+Even this is meaningless if DBUG_OFF has been set at build-time.
+
+
TRACE
-----
@@ -122,21 +146,17 @@
This is a DSN config option which can be set to turn on trace
output. The location of the trace output is dependent upon
-MYODBC_LOG (or TRACEFILE).
+MYODBC_LOG or failing that - TRACEFILE.
-This is meaningless if DBUG_OFF has been set at build-time.
+In the case where neither MYODBC_LOG nor TRACEFILE have been set
+- the following defaults are used;
-MYODBC_LOG
-----------
-
-This environment variable, if set, will be used to
-set format information and file location/name for the trace
-output. For example; "d:t:S:O,c::\\myodbc.log". The following
-defaults are used;
-
WIN : "d:t:S:O,c::\\myodbc.log"
UNIX: "d:t:S:O,/tmp/myodbc.log"
+This option may be presented as "Trace Driver Calls" in the
+DSN edit.
+
This is meaningless if DBUG_OFF has been set at build-time.
FLAG_LOG_QUERY
@@ -145,9 +165,12 @@
This is a DSN config option which can be set to turn on feature
to log queries to a file.
-The location of the trace output is dependent upon
-DRIVER_QUERY_LOGFILE.
+The location of the trace output is dependent upon the
+DRIVER_QUERY_LOGFILE const.
+This option may be presented as "Save Queries to" in the
+DSN edit.
+
This is meaningless if DBUG_OFF has been set at build-time.
DRIVER_QUERY_LOGFILE
@@ -173,13 +196,21 @@
SUMMARY
---------------------------------------------------------------
-Your priorities in generating useful information for debugging
-a problem using Connector/ODBC;
+Follow these steps to get trace information from the driver;
-1. ODBC Trace
-2. Driver Trace
+1. Ensure the driver was NOT built with DBUG_OFF. In most cases
+ the driver will be ok so if you are not sure - skip this step.
+2. Turn on ODBC Trace using the ODBC Administrator.
+3. Turn on Driver Trace using one of the following;
+ - MYODBC_LOG environment variable
+ - FLAG_DEBUG
+ - FLAG_LOG_QUERY (as needed)
+Look in the resulting files for anything which may provide a
+better understanding of the problem.
+Good hunting!
+
+-------------------------------------------------------------+
| Peter Harvey <pharvey@stripped |
+-------------------------------------------------------------+
Modified: config.pri
===================================================================
--- config.pri 2006-03-06 03:49:05 UTC (rev 43)
+++ config.pri 2006-03-06 07:12:03 UTC (rev 44)
@@ -30,3 +30,5 @@
LIBS += -L$(LIBTOOL_DIR)/lib
}
+
+
Modified: defines.pri
===================================================================
--- defines.pri 2006-03-06 03:49:05 UTC (rev 43)
+++ defines.pri 2006-03-06 07:12:03 UTC (rev 44)
@@ -24,4 +24,15 @@
LIBS += $(LDFLAGS)
}
+# #########################################################
+# Define DBUG_OFF to leave trace code out of the build. The
+# default is to include the trace code.
+# #########################################################
+# DEFINES += DBUG_OFF
+# #########################################################
+# Define the ammount of output from post-build tests. The
+# higher the number the more output.
+# #########################################################
+DEFINES += DEBUG_LEVEL=2
+
Modified: myodbc3/connect.c
===================================================================
--- myodbc3/connect.c 2006-03-06 03:49:05 UTC (rev 43)
+++ myodbc3/connect.c 2006-03-06 07:12:03 UTC (rev 44)
@@ -157,7 +157,7 @@
MYODBCDbgPrint("info",("option_flag: %ld client_flag: %ld", option_flag,
client_flag));
- MYODBCDbgReturn(client_flag);
+ MYODBCDbgReturn2( client_flag );
}
@@ -198,7 +198,7 @@
uint port_nr= 0;
DBC FAR *dbc= (DBC FAR*) hdbc;
MYODBCDbgEnter("SQLConnect");
-
+printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
if (dbc->mysql.net.vio != 0)
MYODBCDbgReturn(set_conn_error(hdbc,MYERR_08002,NULL,0));
@@ -225,22 +225,23 @@
SQLGetPrivateProfileString(dsn_ptr,"stmt", "", init_stmt, sizeof(init_stmt),
MYODBCUtilGetIniFileName( TRUE ) );
#ifndef DBUG_OFF
- if ( flag_nr & FLAG_DEBUG )
+ if ( flag_nr & FLAG_DEBUG && !_db_on_ )
{
- MYODBCDbgSetFile( "1" );
+ char szMYODBC_LOG[FILENAME_MAX+20]= "";
SQLGetPrivateProfileString(dsn_ptr, "TRACE", "", szTRACE, sizeof(szTRACE),
MYODBCUtilGetIniFileName( TRUE ) );
- if ( (szTRACE[0] == 'O' || szTRACE[0] == 'o') && (szTRACE[1] == 'N' ||
szTRACE[1] == 'n')))
+ if ( strcasecmp( szTRACE, "ON" ) == 1 || strcasecmp( szTRACE, "YES" ) == 1 ||
strcasecmp( szTRACE, "Y" ) == 1 || *szTRACE == '1' )
{
char szTRACEFILE[FILENAME_MAX+1]= "";
- char szMYODBC_LOG[FILENAME_MAX+20]= "";
SQLGetPrivateProfileString(dsn_ptr, "TRACEFILE", "", szTRACEFILE,
sizeof(szTRACEFILE), MYODBCUtilGetIniFileName( TRUE ) );
- if (*szTRACEFILE)
- {
+ if ( *szTRACEFILE )
sprintf(szMYODBC_LOG, "d:t:F:L:S:A,%s", szTRACEFILE);
- MYODBCDbgSetFile( szMYODBC_LOG );
- }
}
+
+ if ( *szMYODBC_LOG )
+ MYODBCDbgSetFile( szMYODBC_LOG )
+ else
+ MYODBCDbgSetFile( MYODBCDbgGetFileDefault() )
}
#endif
client_flag= get_client_flag(&dbc->mysql,flag_nr,(uint) dbc->login_timeout,
@@ -418,7 +419,7 @@
#ifndef DBUG_OFF
if ( atol( pDataSource->pszOPTION ) & FLAG_DEBUG && ! _db_on_ )
- MYODBCDbgInit();
+ MYODBCDbgSetFile( MYODBCDbgGetFileDefault() );
MYODBCDbgPrint( "enter",( "fDriverCompletion: %d", fDriverCompletion ) );
#endif
Modified: myodbc3/dll.c
===================================================================
--- myodbc3/dll.c 2006-03-06 03:49:05 UTC (rev 43)
+++ myodbc3/dll.c 2006-03-06 07:12:03 UTC (rev 44)
@@ -68,7 +68,7 @@
my_init();
{
struct lconv *tmp;
- MYODBCDbgInit();
+ MYODBCDbgInit;
init_getfunctions();
default_locale=my_strdup(setlocale(LC_NUMERIC,NullS),MYF(0));
setlocale(LC_NUMERIC,"");
Modified: myodbc3/myodbc3.pro
===================================================================
--- myodbc3/myodbc3.pro 2006-03-06 03:49:05 UTC (rev 43)
+++ myodbc3/myodbc3.pro 2006-03-06 07:12:03 UTC (rev 44)
@@ -52,12 +52,10 @@
debug {
QMAKE_CFLAGS_DEBUG -= -MDd
QMAKE_CFLAGS_DEBUG += -MTd
- DEFINES += DBUG_ON _DBUG_ON DEBUG _DEBUG
}
release {
QMAKE_CFLAGS_RELEASE -= -MD
QMAKE_CFLAGS_RELEASE += -MT
- DEFINES += DBUG_OFF _DBUG_OFF NDEBUG _NDEBUG
}
DEFINES += __WIN__ ENGLISH MYODBC_EXPORTS _USERDLL
DONT_DEFINE_VOID
@@ -141,9 +139,9 @@
../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/MYODBCDbgInit.c \
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgPosTypeString.c \
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgReturnString.c \
../MYODBCDbg/MYODBCDbgLib/MYODBCDbgStmtAttrString.c \
Modified: mysql.pri
===================================================================
--- mysql.pri 2006-03-06 03:49:05 UTC (rev 43)
+++ mysql.pri 2006-03-06 07:12:03 UTC (rev 44)
@@ -19,7 +19,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
Modified: test/include/mytest3.h
===================================================================
--- test/include/mytest3.h 2006-03-06 03:49:05 UTC (rev 43)
+++ test/include/mytest3.h 2006-03-06 07:12:03 UTC (rev 44)
@@ -153,7 +153,7 @@
#define printMessageHeader()\
{\
- g_nCursor = sprintf( g_szHeader, "[%s][%d]", __FILE__, __LINE__ );\
+ g_nCursor = sprintf( g_szHeader, "[%s][%d]\n", __FILE__, __LINE__ );\
fprintf( stdout, g_szHeader );\
}
| Thread |
|---|
| • Connector/ODBC 3.51 commit: r44 - / MYODBCDbg/MYODBCDbgLib MYODBCDbg/include myodbc3 test/include | pharvey | 6 Mar |