Files
harbour-core/harbour/contrib/hbodbc/tests/testodbc.prg
Viktor Szakats f636b56131 2008-07-08 07:56 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbodbc/odbc.c
     ! Fixed all ODBC handles to be pointers. This way it's Win64 
       compatible. This is an INCOMPATIBLE change. Since normal 
       app code is using ODBC error values to check for error 
       conditions, the type of handles shouldn't be a concern for 
       most app code.
       I'd ask everyone using hbodbc to do some tests.
     + TOFIXes added where deprecated (and potentially dangerous) 
       APIs are used.

   * contrib/hbw32/dllcall.c
     ! Using hb_parnint()/hb_retnint() instead of hb_parnl()/hb_retnl() 
       to make Harbour level .dll functions compatible with Win64, and 
       at the same time stay compatible with XBase++.

   * contrib/rddado/adordd.prg
     ! Fixed a few places where _SET_EXACT dependent string 
       comparisons were used. One of them could cause
       problems updating field values.

   * contrib/hbodbc/todbc.prg
     * Formatting.

   * contrib/hbodbc/tests/odbcdemo.prg
   * contrib/hbodbc/tests/odbccall.prg
   * contrib/hbodbc/tests/testodbc.prg
     ! Made them work out of the box.
     ; TOFIX: All of them gives "unrecognized database format" for harbour.mdb.
2008-07-08 06:06:06 +00:00

61 lines
1.4 KiB
Plaintext

/*
* $Id$
*/
#include "sql.ch"
#xcommand GET ROW <nRow> INTO <cVar> => ;
<cVar> := space( 128 ) ;;
SQLGetData( hStmt, <nRow>, SQL_CHAR, len( <cVar> ), @<cVar> )
FUNCTION Main()
LOCAL hEnv := 0
LOCAL hDbc := 0
LOCAL hStmt := 0
LOCAL cConstrin
LOCAL cConstrout := SPACE(1024)
LOCAL nRows := 0
LOCAL cCode, cFunc, cState, cComm
LOCAL cDir
hb_FNameSplit( hb_ArgV( 0 ), @cDir )
cConstrin := "DBQ=" + hb_FNameMerge( cDir, "harbour.mdb" ) + ";Driver={Microsoft Access Driver (*.mdb)}"
? padc( "*** ODBC ACCESS TEST ***", 80 )
?
? "Allocating environment... "
SQLAllocEn( @hEnv )
? "Allocating connection... "
SQLAllocCo( hEnv, @hDbc )
? "Connecting to driver " + cConstrin + "... "
SQLDriverC( hDbc, cConstrin, @cConstrout )
? "Allocating statement... "
SQLAllocSt( hDbc, @hStmt )
?
? "SQL: SELECT * FROM FUNCTIONS"
SQLExecDir( hStmt, "select * from functions" )
?
WHILE SQLFetch( hStmt ) == 0
nRows++
GET ROW 1 INTO cCode
GET ROW 2 INTO cFunc
GET ROW 3 INTO cState
GET ROW 4 INTO cComm
? cCode, padr( cFunc, 20 ), cState, cComm
ENDDO
? "------------------------------------------------------------------------------"
? str( nRows, 4 ), " row(s) affected."
SQLFreeStm( hStmt, SQL_DROP )
SQLDisconn( hDbc )
SQLFreeCon( hDbc )
SQLFreeEnv( hEnv )
RETURN NIL