From d968e23b1e8700898c04a0b0a6e746f5f29edfac Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 20 May 2009 21:32:50 +0000 Subject: [PATCH] 2009-05-20 23:32 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/rddsql/sddodbc/Makefile ! Applied logic from contrib/hbodbc/Makefile. * contrib/rddsql/sddodbc/odbcdd.c ! Fixed three warnings (2 casts + 1 uninit var) with MSVC. ; TOFIX: These errors are shown when trying to compiler in UNICODE mode: ../../odbcdd.c(168) : error C2664: 'SQLDriverConnectW' : cannot convert parameter 3 from 'SQLCHAR *' to 'SQLWCHAR *' ../../odbcdd.c(204) : error C2664: 'SQLExecDirectW' : cannot convert parameter 2 from 'SQLCHAR *' to 'SQLWCHAR *' ../../odbcdd.c(239) : error C2664: 'SQLExecDirectW' : cannot convert parameter 2 from 'SQLCHAR *' to 'SQLWCHAR *' ../../odbcdd.c(263) : error C2664: 'SQLDescribeColW' : cannot convert parameter 3 from 'SQLCHAR *' to 'SQLWCHAR *' --- harbour/ChangeLog | 13 +++++++++++++ harbour/contrib/rddsql/sddodbc/Makefile | 25 ++++++++++++++++++++++++- harbour/contrib/rddsql/sddodbc/odbcdd.c | 13 ++++++++++--- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6b11e5d312..4122924608 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,19 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-20 23:32 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/rddsql/sddodbc/Makefile + ! Applied logic from contrib/hbodbc/Makefile. + + * contrib/rddsql/sddodbc/odbcdd.c + ! Fixed three warnings (2 casts + 1 uninit var) with MSVC. + + ; TOFIX: These errors are shown when trying to compiler in UNICODE mode: + ../../odbcdd.c(168) : error C2664: 'SQLDriverConnectW' : cannot convert parameter 3 from 'SQLCHAR *' to 'SQLWCHAR *' + ../../odbcdd.c(204) : error C2664: 'SQLExecDirectW' : cannot convert parameter 2 from 'SQLCHAR *' to 'SQLWCHAR *' + ../../odbcdd.c(239) : error C2664: 'SQLExecDirectW' : cannot convert parameter 2 from 'SQLCHAR *' to 'SQLWCHAR *' + ../../odbcdd.c(263) : error C2664: 'SQLDescribeColW' : cannot convert parameter 3 from 'SQLCHAR *' to 'SQLWCHAR *' + 2009-05-20 21:32 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * INSTALL + Added typical ("FAQ") error message encountered with old, diff --git a/harbour/contrib/rddsql/sddodbc/Makefile b/harbour/contrib/rddsql/sddodbc/Makefile index 1fe8173906..ab5e7f3396 100644 --- a/harbour/contrib/rddsql/sddodbc/Makefile +++ b/harbour/contrib/rddsql/sddodbc/Makefile @@ -6,6 +6,20 @@ ROOT = ../../../ LIBNAME=sddodbc +ifeq ($(HB_COMPILER),rsxnt) +HB_WITHOUT_ODBC=yes +endif +ifeq ($(HB_ARCHITECTURE),dos) +HB_WITHOUT_ODBC=yes +endif +ifeq ($(HB_ARCHITECTURE),os2) +HB_WITHOUT_ODBC=yes +endif + +ifneq ($(HB_ARCHITECTURE),win) +ifneq ($(HB_ARCHITECTURE),wce) +ifeq ($(HB_WITHOUT_ODBC),) + ifeq ($(HB_INC_ODBC),) ifeq ($(HB_XBUILD),) HB_INC_ODBC = /usr/include /usr/local/include @@ -15,13 +29,22 @@ endif HB_INC_ODBC_OK += $(foreach d, $(HB_INC_ODBC), $(if $(wildcard $(d)/sql.h),$(d),)) ifneq ($(strip $(HB_INC_ODBC_OK)),) - HB_USER_CFLAGS += $(foreach d, $(HB_INC_ODBC_OK), -I$(d)) +else +HB_WITHOUT_ODBC=yes +endif + +endif +endif +endif + +ifneq ($(HB_WITHOUT_ODBC),yes) C_SOURCES=\ odbcdd.c \ include $(TOP)$(ROOT)config/lib.cf + else include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/rddsql/sddodbc/odbcdd.c b/harbour/contrib/rddsql/sddodbc/odbcdd.c index 403e370a7f..13447acb3f 100644 --- a/harbour/contrib/rddsql/sddodbc/odbcdd.c +++ b/harbour/contrib/rddsql/sddodbc/odbcdd.c @@ -158,8 +158,14 @@ static HB_ERRCODE odbcConnect( SQLDDCONNECTION* pConnection, PHB_ITEM pItem ) { cBuffer[ 0 ] ='\0'; - if( SQL_SUCCEEDED( SQLDriverConnect( hConnect, NULL, ( SQLCHAR* ) hb_arrayGetCPtr( pItem, 2 ), hb_arrayGetCLen( pItem, 2 ), - cBuffer, 1024, &iLen, SQL_DRIVER_NOPROMPT ) ) ) + if( SQL_SUCCEEDED( SQLDriverConnect( hConnect, + NULL, + ( SQLCHAR* ) hb_arrayGetCPtr( pItem, 2 ), + ( SQLSMALLINT ) hb_arrayGetCLen( pItem, 2 ), + cBuffer, + HB_SIZEOFARRAY( cBuffer ), + &iLen, + SQL_DRIVER_NOPROMPT ) ) ) { pConnection->hConnection = ( void* ) hConnect; pConnection->hCargo = ( void* ) hEnv; @@ -266,7 +272,7 @@ static HB_ERRCODE odbcOpen( SQLBASEAREAP pArea ) pFieldInfo.atomName[ MAX_FIELD_NAME ] = '\0'; hb_strUpper( (char *) pFieldInfo.atomName, MAX_FIELD_NAME + 1 ); - pFieldInfo.uiLen = uiSize; + pFieldInfo.uiLen = ( USHORT ) uiSize; pFieldInfo.uiDec = iDec; /* HB_TRACE( HB_TR_ALWAYS, ("field: name=%s type=%d len=%d dec=%d null=%d", pFieldInfo.atomName, iDataType, uiSize, iDec, iNull ) ); */ @@ -448,6 +454,7 @@ static HB_ERRCODE odbcGoTo( SQLBASEAREAP pArea, ULONG ulRecNo ) pArray = hb_itemArrayNew( pArea->uiFieldCount ); for ( ui = 1; ui <= pArea->uiFieldCount; ui++ ) { + iLen = SQL_NULL_DATA; pItem = NULL; res = 0; pField = pArea->lpFields + ui - 1;