List:Commits« Previous MessageNext Message »
From:pharvey Date:December 29 2005 9:14pm
Subject:Connector/ODBC 5 commit: r23 - in MYODBCDia: MYODBCDiaLib MYODBCDiaTest
View as plain text  
Added:
   MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.cpp
Removed:
   MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.c
Modified:
   MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp
   MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.pro
   MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.vpj
Log:
UNICODE:
- simple test for MYODBCDia (diagnostic) builds/passes
- next - objectify/unicode-enable MYODBCDes (descriptors)

Modified: MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp	2005-12-29 19:48:18 UTC (rev 22)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp	2005-12-29 21:14:40 UTC (rev 23)
@@ -286,10 +286,6 @@
 {
     SQLSMALLINT  nStrLen;
 
-    /* sanity checks */
-    if ( nRecord < 1 )
-        return SQL_ERROR;
-
     /* use dummy when no pnStrLenPtr */
     if ( !pnStrLenPtr )
         pnStrLenPtr = &nStrLen;
@@ -345,6 +341,8 @@
         case SQL_DIAG_SERVER_NAME:
         case SQL_DIAG_SQLSTATE:
         case SQL_DIAG_SUBCLASS_ORIGIN:
+            if ( nRecord < 1 )
+                return SQL_ERROR;
             if ( nRecord > listRecords.count() )
                 return SQL_NO_DATA;
             return listRecords[nRecord]->getField( nField, pBuffer, nBufferLength,
pnStrLenPtr );

Deleted: MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.c
===================================================================
--- MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.c	2005-12-29 19:48:18 UTC (rev 22)
+++ MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.c	2005-12-29 21:14:40 UTC (rev 23)
@@ -1,59 +0,0 @@
-#include <MYODBCDia.h>
-
-typedef struct tTEST
-{
-    char *      name;
-    int (*pfunc)();
-} TEST;
-
-int test1()
-{
-    MYODBC_DIA_HANDLE   hDia        = MYODBCDiaAlloc();
-    SQLINTEGER          nRecords    = 0;
-
-
-    MYODBCDiaAppend( hDia, MYODBC_DIA_01000, 0, "Test of a warning" );
-    MYODBCDiaAppend( hDia, MYODBC_DIA_HY000, 1, "Test of an error" );
-    MYODBCDiaAppend( hDia, MYODBC_DIA_01000, 0, NULL );
-    MYODBCDiaAppend( hDia, MYODBC_DIA_HY000, 1, NULL );
-    MYODBCDiaAppend( hDia, MYODBC_DIA_HY000, 1, NULL );
-    MYODBCDiaAppend2( hDia, MYODBC_DIA_HY105, 1, NULL, 0, 5 );
-
-    MYODBCDiaGetField( hDia, 0, SQL_DIAG_NUMBER, &nRecords, 0, NULL );
-    if ( nRecords != 6 )
-        return 0;
-    MYODBCDiaClear( hDia );
-
-    MYODBCDiaGetField( hDia, 0, SQL_DIAG_NUMBER, &nRecords, 0, NULL );
-    if ( nRecords != 0 )
-        return 0;
-    MYODBCDiaFree( hDia );
-
-    return 1;
-}
-
-int main()
-{
-    TEST tests[2]=
-    {
-        {"test1", test1},
-        {NULL, NULL}
-    };
-    int n;
-
-    for ( n = 0; tests[n].name; n++ )
-    {
-        printf( "%-40s", tests[n].name ); 
-        if ( tests[n].pfunc() )
-            printf( "[  OK  ]\n" );
-        else
-        {
-            printf( "[FAILED]\n" ); 
-            exit( 1 );
-        }
-    }
-
-    return 0;
-}  
-
-

Copied: MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.cpp (from rev 17,
MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.c)
===================================================================
--- MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.c	2005-12-27 03:12:31 UTC (rev 17)
+++ MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.cpp	2005-12-29 21:14:40 UTC (rev 23)
@@ -0,0 +1,69 @@
+#include <MYODBCDia.h>
+
+typedef struct tTEST
+{
+    char *      name;
+    int (*pfunc)();
+} TEST;
+
+MYODBCDia dia;
+
+int test1()
+{
+    SQLINTEGER nRecords = 0;
+
+    dia.doAppend( MYODBC_DIA_01000, 0, "Test of a warning" );
+    dia.doAppend( MYODBC_DIA_HY000, 1, "Test of an error" );
+    dia.doAppend( MYODBC_DIA_01000, 0, NULL );
+    dia.doAppend( MYODBC_DIA_HY000, 1, NULL );
+    dia.doAppend( MYODBC_DIA_HY000, 1, NULL );
+    dia.doAppend( MYODBC_DIA_HY105, 1, NULL, 0, 5 );
+
+    dia.getField( 0, SQL_DIAG_NUMBER, &nRecords, 0, NULL );
+    if ( nRecords != 6 )
+    {
+        MYODBCDbgError( "Expected 6 records but found %1", nRecords );
+        return 0;
+    }
+
+    dia.doClear();
+
+    dia.getField( 0, SQL_DIAG_NUMBER, &nRecords, 0, NULL );
+    if ( nRecords != 0 )
+    {
+        MYODBCDbgError( "Expected 0 records but found %1", nRecords );
+        return 0;
+    }
+
+    return 1;
+}
+
+int main()
+{
+    TEST tests[2]=
+    {
+        {"test1", test1},
+        {NULL, NULL}
+    };
+    int n;
+
+    MYODBCDbgInit( stderr );
+
+    for ( n = 0; tests[n].name; n++ )
+    {
+        printf( "%-40s", tests[n].name ); 
+        if ( tests[n].pfunc() )
+            printf( "[  OK  ]\n" );
+        else
+        {
+            printf( "[FAILED]\n" ); 
+            exit( 1 );
+        }
+    }
+
+    MYODBCDbgFini();
+
+    return 0;
+}  
+
+

Modified: MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.pro
===================================================================
--- MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.pro	2005-12-29 19:48:18 UTC (rev 22)
+++ MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.pro	2005-12-29 21:14:40 UTC (rev 23)
@@ -6,14 +6,14 @@
 DESTDIR		= ../../bin
 include( ../../common.pri )
 include( ../../config.pri )
+include( ../../defines.pri )
+include( ../../odbc.pri )
 CONFIG          += console
 INCLUDEPATH     += ../../MYODBCC/include
-INCLUDEPATH     += ../../MYODBCArray/include
+INCLUDEPATH     += ../../MYODBCDbg/include
 INCLUDEPATH	+= ../include
 LIBS		+= -L../../lib
-LIBS		+= -lMYODBCDia
-LIBS		+= -lMYODBCArray
-LIBS		+= -lMYODBCC 
+LIBS		+= -lMYODBCDia -lMYODBCDbg
 
 # #########################################################
 # FILES
@@ -21,5 +21,5 @@
 HEADERS		=  
 
 SOURCES		= \
-		MYODBCDiaTest.c
+		MYODBCDiaTest.cpp
 

Modified: MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.vpj
===================================================================
--- MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.vpj	2005-12-29 19:48:18 UTC (rev 22)
+++ MYODBCDia/MYODBCDiaTest/MYODBCDiaTest.vpj	2005-12-29 21:14:40 UTC (rev 23)
@@ -41,7 +41,7 @@
 				Deletable="0"
 				SaveOption="SaveWorkspaceFiles"
 				RunFromDir="%rw">
-				<Exec CmdLine="qmake; make"/>
+				<Exec CmdLine="make"/>
 			</Target>
 			<Target
 				Name="Rebuild"
@@ -129,7 +129,7 @@
 				Deletable="0"
 				SaveOption="SaveWorkspaceFiles"
 				RunFromDir="%rw">
-				<Exec CmdLine="qmake; make"/>
+				<Exec CmdLine="make"/>
 			</Target>
 			<Target
 				Name="Rebuild"
@@ -184,7 +184,7 @@
 		<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="MYODBCDiaTest.c"/>
+			<F N="MYODBCDiaTest.cpp"/>
 		</Folder>
 		<Folder
 			Name="Header Files"

Thread
Connector/ODBC 5 commit: r23 - in MYODBCDia: MYODBCDiaLib MYODBCDiaTestpharvey29 Dec