List:Commits« Previous MessageNext Message »
From:pharvey Date:December 24 2005 7:25pm
Subject:Connector/ODBC 5 commit: r14 - / MYODBCC/MYODBCCTest MYODBCDbg MYODBCDbg/MYODBCDbgLib MYODBCDbg/MYODBCDbgTest MYODBCDbg/include
View as plain text  
Added:
   MYODBCDbg/MYODBCDbgTest/
   MYODBCDbg/MYODBCDbgTest/CMakeLists.txt
   MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.cpp
   MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.pro
   MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.vpj
Modified:
   MYODBCC/MYODBCCTest/MYODBCCTest.pro
   MYODBCDbg/CMakeLists.txt
   MYODBCDbg/MYODBCDbg.pro
   MYODBCDbg/MYODBCDbgLib/MYODBCDbg.cpp
   MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro
   MYODBCDbg/include/MYODBCDbg.h
   connector-odbc.vpw
   root.pro
Log:
Add qt based solution to address; unicode and advanced string and struct
manage needs with option to replace qt with home brew code at later
date. More of this to come in coming days to be ref to as 'unicode'
solution.


Modified: MYODBCC/MYODBCCTest/MYODBCCTest.pro
===================================================================
--- MYODBCC/MYODBCCTest/MYODBCCTest.pro	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCC/MYODBCCTest/MYODBCCTest.pro	2005-12-24 19:25:17 UTC (rev 14)
@@ -3,10 +3,11 @@
 # #########################################################
 TEMPLATE	= app
 TARGET          = MYODBCCTest
-CONFIG          += console
+DESTDIR		= ../../bin
+include( ../../common.pri )
 include( ../../config.pri )
 include( ../../defines.pri )
-DESTDIR		= ../../bin
+CONFIG          += console
 INCLUDEPATH	+= ../include
 LIBS		+= -L../../lib -lMYODBCC
 
@@ -14,6 +15,7 @@
 # FILES
 # #########################################################
 HEADERS		= 
+
 SOURCES		= \
 		MYODBCCTest.c
 

Modified: MYODBCDbg/CMakeLists.txt
===================================================================
--- MYODBCDbg/CMakeLists.txt	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/CMakeLists.txt	2005-12-24 19:25:17 UTC (rev 14)
@@ -1,3 +1,4 @@
 PROJECT( MYODBCDbg )
 ADD_SUBDIRECTORY( MYODBCDbgLib )
+ADD_SUBDIRECTORY( MYODBCDbgTest )
 

Modified: MYODBCDbg/MYODBCDbg.pro
===================================================================
--- MYODBCDbg/MYODBCDbg.pro	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/MYODBCDbg.pro	2005-12-24 19:25:17 UTC (rev 14)
@@ -1,4 +1,5 @@
 TEMPLATE        = subdirs
 SUBDIRS		= \
-		MYODBCDbgLib	
+		MYODBCDbgLib \
+		MYODBCDbgTest
 

Modified: MYODBCDbg/MYODBCDbgLib/MYODBCDbg.cpp
===================================================================
--- MYODBCDbg/MYODBCDbgLib/MYODBCDbg.cpp	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/MYODBCDbgLib/MYODBCDbg.cpp	2005-12-24 19:25:17 UTC (rev 14)
@@ -42,10 +42,11 @@
     \sa     ZZZZ
             ZZZZ
 */
-void MYODBCDbg::MYODBCDbg( const QString &stringFileName )
+MYODBCDbg::MYODBCDbg( const QString &stringFileName )
 {
     fileOutput.setFileName( stringFileName );
-    fileOutput.open( QIODevice::WriteOnly | QIODevice::Text );
+    if ( fileOutput.open( QIODevice::WriteOnly | QIODevice::Text ) )
+        textstreamOutput.setDevice( &fileOutput );
 }
 
 /*! 
@@ -76,7 +77,7 @@
 */
 void MYODBCDbg::doWrite( const QString &stringMessage )
 {
-    fileOutput.write( stringMessage.);
+    textstreamOutput << stringMessage << endl;
 }
 
 /*! 
@@ -98,11 +99,8 @@
 {
     QString stringMessage;
 
-    stringMessage.sprintf( "[RETURN][%s] %s(%d)\n", stringFunction, stringFile, nLine );
-    write( stringMessage ); 
-    stringMessage.sprintf( "\t%s\n", getReturnString( nReturn ) );
-    write( stringMessage ); 
-    gpMYODBCDbg->flush();
+    stringMessage.sprintf( "%s:%d: %s\n\t[RETURN ] ", pszFile, nLine, pszFunction );
+    textstreamOutput << stringMessage << getReturnString( nReturn ) <<
endl;
 
     return nReturn;
 }
@@ -209,7 +207,7 @@
             return "SQL_TXN_ISOLATION";
         default:
             /* in 2.x stm attr can be set (as default) in dbc */
-            return MYODBCDbgStmtAttrString( (SQLINTEGER)nOption );
+            return getStmtAttrString( (SQLINTEGER)nOption );
     }
 
     return "unknown";

Modified: MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro
===================================================================
--- MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.pro	2005-12-24 19:25:17 UTC (rev 14)
@@ -7,6 +7,7 @@
 include( ../../common.pri )
 include( ../../config.pri )
 include( ../../defines.pri )
+include( ../../odbc.pri )
 CONFIG		+= staticlib
 CONFIG          += console
 INCLUDEPATH	+= ../../MYODBCC/include

Added: MYODBCDbg/MYODBCDbgTest/CMakeLists.txt
===================================================================
--- MYODBCDbg/MYODBCDbgTest/CMakeLists.txt	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/MYODBCDbgTest/CMakeLists.txt	2005-12-24 19:25:17 UTC (rev 14)
@@ -0,0 +1,15 @@
+PROJECT( MYODBCDbgTest )
+
+ADD_EXECUTABLE( MYODBCDbgTest MYODBCDbgTest.c )
+
+INCLUDE( ../../defines.cmake )
+
+INCLUDE_DIRECTORIES( ../include )
+
+LINK_DIRECTORIES( ../../lib )
+
+TARGET_LINK_LIBRARIES( MYODBCDbgTest MYODBCDbg )
+
+
+
+

Added: MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.cpp
===================================================================
--- MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.cpp	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.cpp	2005-12-24 19:25:17 UTC (rev 14)
@@ -0,0 +1,86 @@
+/*! 
+    \file     MYODBCDbgTest.c
+    \author   Peter Harvey <pharvey@stripped>
+              Copyright (C) MySQL AB 2004-2005, Released under GPL.
+    \version  Connector/ODBC v5
+    \date     2005          
+    \brief    Code to test MYODBCDbg library. 
+    
+    \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 <MYODBCDbg.h>
+
+typedef struct tTEST
+{
+    char *      name;
+    int (*pfunc)();
+} TEST;
+
+/* MYODBCDbg */
+int test1()
+{
+
+    MYODBCDbgEnter();
+
+    MYODBCDbgPrint();
+    MYODBCDbgPrint( "Got here" );
+    MYODBCDbgPrint2( "gpMYODBCDbg = %p", gpMYODBCDbg )
+    MYODBCDbgError( "Ooops" );
+    MYODBCDbgWarning( "That smarts");
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+/* \todo The main thing here is that we build and execute ok - but in future read output
file to ensure that it is what we expect */
+int main()
+{
+    TEST tests[2]=
+    {
+        {"MYODBCDbg", test1},
+        {NULL, NULL}
+    };
+    int n;
+    int nReturn = 0;
+
+    gpMYODBCDbg = new MYODBCDbg( "MYODBCDbg.out" );
+
+    for ( n = 0; tests[n].name; n++ )
+    {
+        printf( "%-40s", tests[n].name ); 
+        if ( tests[n].pfunc() == SQL_SUCCESS )
+            printf( "[  OK  ]\n" );
+        else
+        {
+            printf( "[FAILED]\n" ); 
+            nReturn = 1;
+            goto testExit1;
+        }
+    }
+
+testExit1:
+    delete gpMYODBCDbg;
+    gpMYODBCDbg = NULL;
+
+    return nReturn;
+}  
+
+

Added: MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.pro
===================================================================
--- MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.pro	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.pro	2005-12-24 19:25:17 UTC (rev 14)
@@ -0,0 +1,23 @@
+# #########################################################
+# COMMON
+# #########################################################
+TEMPLATE	= app
+TARGET          = MYODBCDbgTest
+DESTDIR		= ../../bin
+include( ../../common.pri )
+include( ../../config.pri )
+include( ../../defines.pri )
+CONFIG          += console
+INCLUDEPATH	+= ../../MYODBCC/include
+INCLUDEPATH	+= ../include
+LIBS		+= -L../../lib
+LIBS		+= -lMYODBCDbg -lMYODBCC
+
+# #########################################################
+# FILES
+# #########################################################
+HEADERS		= 
+
+SOURCES		= \
+		MYODBCDbgTest.cpp
+

Added: MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.vpj
===================================================================
--- MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.vpj	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.vpj	2005-12-24 19:25:17 UTC (rev 14)
@@ -0,0 +1,77 @@
+<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
+<Project
+	Version="10.0"
+	VendorName="SlickEdit"
+	WorkingDir="."
+	VCSProject="Subversion:">
+	<Config
+		Name="Release"
+		OutputFile=""
+		CompilerConfigName="Latest Version">
+		<Menu>
+			<Target
+				Name="Compile"
+				MenuCaption="&amp;Compile"
+				CaptureOutputWith="ProcessBuffer"
+				SaveOption="SaveCurrent"
+				RunFromDir="%rw">
+				<Exec CmdLine="make"/>
+			</Target>
+			<Target
+				Name="Build"
+				MenuCaption="&amp;Build"
+				CaptureOutputWith="ProcessBuffer"
+				SaveOption="SaveWorkspaceFiles"
+				RunFromDir="%rw">
+				<Exec CmdLine="make"/>
+			</Target>
+			<Target
+				Name="Rebuild"
+				MenuCaption="&amp;Rebuild"
+				CaptureOutputWith="ProcessBuffer"
+				SaveOption="SaveWorkspaceFiles"
+				RunFromDir="%rw">
+				<Exec/>
+			</Target>
+			<Target
+				Name="Debug"
+				MenuCaption="&amp;Debug"
+				SaveOption="SaveNone"
+				RunFromDir="%rw">
+				<Exec/>
+			</Target>
+			<Target
+				Name="Execute"
+				MenuCaption="E&amp;xecute"
+				SaveOption="SaveNone"
+				RunFromDir="%rw">
+				<Exec CmdLine='"myodbc-3.exe"'/>
+			</Target>
+		</Menu>
+	</Config>
+	<Files>
+		<Folder
+			Name="Source Files"
+			Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl">
+			<F N="MYODBCDbgTest.cpp"/>
+		</Folder>
+		<Folder
+			Name="Header Files"
+			Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if"/>
+		<Folder
+			Name="Resource Files"
+			Filters="*.ico;*.cur;*.dlg"/>
+		<Folder
+			Name="Bitmaps"
+			Filters="*.bmp"/>
+		<Folder
+			Name="Other Files"
+			Filters="">
+			<F N="CMakeLists.txt"/>
+			<F N="MYODBCDbgTest.pro"/>
+		</Folder>
+	</Files>
+	<CompatibleVersions>
+		<PrevVersion VersionNumber="9.1"/>
+	</CompatibleVersions>
+</Project>

Modified: MYODBCDbg/include/MYODBCDbg.h
===================================================================
--- MYODBCDbg/include/MYODBCDbg.h	2005-12-24 06:04:53 UTC (rev 13)
+++ MYODBCDbg/include/MYODBCDbg.h	2005-12-24 19:25:17 UTC (rev 14)
@@ -29,8 +29,12 @@
 #ifndef MYODBC_DBG_H
 #define MYODBC_DBG_H
 
+#include <MYODBCC.h>
+
+/* This is where we introduce Qt. */
 #include <QString>
 #include <QFile>
+#include <QTextStream>
 
 class MYODBCDbg
 {
@@ -53,7 +57,8 @@
     static QString getStmtOptionString( SQLUSMALLINT nOption );
 
 protected:
-    QFile   fileOutput;
+    QFile       fileOutput;
+    QTextStream textstreamOutput;
 };
 
 /*! 
@@ -89,7 +94,7 @@
 if ( gpMYODBCDbg )\
 {\
     QString stringMessage; \
-    stringMessage.sprintf( "[ENTER ][%s] %s(%d)\n", __FUNCTION__, __FILE__, __LINE__ ); \
+    stringMessage.sprintf( "%s:%d: %s\n\t[ENTER  ] " A, __FILE__, __LINE__, __FUNCTION__
); \
     gpMYODBCDbg->doWrite( stringMessage ); \
 }\
 }
@@ -104,12 +109,12 @@
             
     \sa     MYODBCDbgEnter MYODBCDbgReturn            
 */
-#define MYODBCDbgPrint()\
+#define MYODBCDbgPrint(A)\
 {\
 if ( gpMYODBCDbg )\
 {\
     QString stringMessage; \
-    stringMessage.sprintf( "[PRINT ][%s] %s(%d)\n", __FUNCTION__, __FILE__, __LINE__ ); \
+    stringMessage.sprintf( "%s:%d: %s\n\t\t[INFO   ] " A, __FILE__, __LINE__,
__FUNCTION__ ); \
     gpMYODBCDbg->doWrite( stringMessage ); \
 }\
 }
@@ -119,10 +124,31 @@
 if ( gpMYODBCDbg )\
 {\
     QString stringMessage; \
-    stringMessage.sprintf( A, B ); \
+    stringMessage.sprintf( "%s:%d: %s\n\t\t[INFO   ] " A, __FILE__, __LINE__,
__FUNCTION__, B ); \
     gpMYODBCDbg->doWrite( stringMessage ); \
 }\
 }
+
+#define MYODBCDbgError(A)\
+{\
+if ( gpMYODBCDbg )\
+{\
+    QString stringMessage; \
+    stringMessage.sprintf( "%s:%d: %s\n\t\t[ERROR  ] " A, __FILE__, __LINE__,
__FUNCTION__ ); \
+    gpMYODBCDbg->doWrite( stringMessage ); \
+}\
+}
+
+#define MYODBCDbgWarning(A)\
+{\
+if ( gpMYODBCDbg )\
+{\
+    QString stringMessage; \
+    stringMessage.sprintf( "%s:%d: %s\n\t\t[WARNING] " A, __FILE__, __LINE__,
__FUNCTION__ ); \
+    gpMYODBCDbg->doWrite( stringMessage ); \
+}\
+}
+
 /*! 
     \brief  Provides debug info indicating function exit.
     
@@ -137,8 +163,10 @@
 
 #else
 #define MYODBCDbgEnter(A)    {}
-#define MYODBCDbgPrint()     {}
+#define MYODBCDbgPrint(A)    {}
 #define MYODBCDbgPrint2(A,B) {}
+#define MYODBCDbgError(A)    {}
+#define MYODBCDbgWarning(A)  {}
 #define MYODBCDbgReturn(A) return(A)
 #endif
 

Modified: connector-odbc.vpw
===================================================================
--- connector-odbc.vpw	2005-12-24 06:04:53 UTC (rev 13)
+++ connector-odbc.vpw	2005-12-24 19:25:17 UTC (rev 14)
@@ -10,6 +10,7 @@
 		<Project File="MYODBCC/MYODBCCTest/MYODBCCTest.vpj"/>
 		<Project File="MYODBCDbg/MYODBCDbg.vpj"/>
 		<Project File="MYODBCDbg/MYODBCDbgLib/MYODBCDbgLib.vpj"/>
+		<Project File="MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.vpj"/>
 		<Project File="MYODBCDes/MYODBCDes.vpj"/>
 		<Project File="MYODBCDes/MYODBCDesLib/MYODBCDesLib.vpj"/>
 		<Project File="MYODBCDes/MYODBCDesTest/MYODBCDesTest.vpj"/>
@@ -32,7 +33,6 @@
 		<Project File="MYODBCRtti/MYODBCRtti.vpj"/>
 		<Project File="MYODBCSetup/MYODBCSetup.vpj"/>
 		<Project File="MYODBCSetup/MYODBCSetupLib/MYODBCSetupLib.vpj"/>
-		<Project
File="MYODBCSetup/MYODBCSetupLib/MYODBCSetupLibMFC/MYODBCSetupLibMFC.vpj"/>
 		<Project File="MYODBCSetup/MYODBCSetupTest/MYODBCSetupTest.vpj"/>
 		<Project File="MYODBCShell/MYODBCShell.vpj"/>
 		<Project File="MYODBCTst/MYODBCTst.vpj"/>

Modified: root.pro
===================================================================
--- root.pro	2005-12-24 06:04:53 UTC (rev 13)
+++ root.pro	2005-12-24 19:25:17 UTC (rev 14)
@@ -47,7 +47,7 @@
 #		MYODBCC \
 		MYODBCDbg
 #		MYODBCRtti (nothing to build here) \
-#		MYODBCTst \
+		MYODBCTst \
 #		MYODBCArray \
 #		MYODBCList \
 #		MYODBCIns \

Thread
Connector/ODBC 5 commit: r14 - / MYODBCC/MYODBCCTest MYODBCDbg MYODBCDbg/MYODBCDbgLib MYODBCDbg/MYODBCDbgTest MYODBCDbg/includepharvey24 Dec