2010-02-26 21:44 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* INSTALL
  * bin/hb-mkimp.bat
  + contrib/rddsql/sddoci
  + contrib/rddsql/sddoci/Makefile
  + contrib/rddsql/sddoci/ocidd.c
  + contrib/rddsql/sddoci/sddoci.hbc
  + contrib/rddsql/sddoci/tests
  + contrib/rddsql/sddoci/tests/hbmk.hbm
  + contrib/rddsql/sddoci/tests/test1.prg
  * contrib/rddsql/Makefile
    + Added support for direct connection to Oracle
      databases via OCILIB library.
      UNICODE, ANSI (default) and MIXED modes are supported.
      For mingw targets, the library will be linked
      statically, for the rest dynamically.
      You need to have Oracle client (oci.dll and the 
      rest of the package) installed to use it.
    ; TODO: Finish type conversion and mapping.

  * contrib/rddsql/sddmy/mysqldd.c
  * contrib/rddsql/sddpg/pgsqldd.c
  * contrib/rddsql/sddfb/fbirddd.c
  * contrib/rddsql/sddodbc/odbcdd.c
    ! HB_ULONG -> HB_SIZE

  ; TOFIX: To Mindaugas: Current SDD architecture will crash with GPF
           if dbUseArea() is attempted after a failed RDDI_CONNECT
           call. You can check it f.e. with sddodbc's test1.prg, by
           modifying test.mdb to test_.mdb, and simply run it.
This commit is contained in:
Viktor Szakats
2010-02-26 20:47:35 +00:00
parent ce72edafe3
commit 37135ca341
13 changed files with 811 additions and 12 deletions

View File

@@ -17,6 +17,37 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-02-26 21:44 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* INSTALL
* bin/hb-mkimp.bat
+ contrib/rddsql/sddoci
+ contrib/rddsql/sddoci/Makefile
+ contrib/rddsql/sddoci/ocidd.c
+ contrib/rddsql/sddoci/sddoci.hbc
+ contrib/rddsql/sddoci/tests
+ contrib/rddsql/sddoci/tests/hbmk.hbm
+ contrib/rddsql/sddoci/tests/test1.prg
* contrib/rddsql/Makefile
+ Added support for direct connection to Oracle
databases via OCILIB library.
UNICODE, ANSI (default) and MIXED modes are supported.
For mingw targets, the library will be linked
statically, for the rest dynamically.
You need to have Oracle client (oci.dll and the
rest of the package) installed to use it.
; TODO: Finish type conversion and mapping.
* contrib/rddsql/sddmy/mysqldd.c
* contrib/rddsql/sddpg/pgsqldd.c
* contrib/rddsql/sddfb/fbirddd.c
* contrib/rddsql/sddodbc/odbcdd.c
! HB_ULONG -> HB_SIZE
; TOFIX: To Mindaugas: Current SDD architecture will crash with GPF
if dbUseArea() is attempted after a failed RDDI_CONNECT
call. You can check it f.e. with sddodbc's test1.prg, by
modifying test.mdb to test_.mdb, and simply run it.
2010-02-26 11:13 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbxpp/Makefile
+ contrib/hbxpp/thread.ch

View File

@@ -308,6 +308,7 @@ HARBOUR
HB_WITH_JPEG=C:\jpeglib (defaults to locally hosted version if not found)
HB_WITH_LIBHARU=C:\libharu\include (defaults to locally hosted version)
HB_WITH_MYSQL=C:\mysql\include
HB_WITH_OCILIB=C:\ocilib\include
HB_WITH_ODBC= (may only be needed on non-Windows systems)
HB_WITH_OPENSSL=C:\openssl\inc32 OR C:\openssl\include
HB_WITH_PCRE=C:\pcre (defaults to locally hosted version if not found)
@@ -903,6 +904,7 @@ HARBOUR
set HB_WITH_FREEIMAGE=C:\FreeImage\Dist
set HB_WITH_GD=C:\gd\include
set HB_WITH_MYSQL=C:\mysql\include
set HB_WITH_OCILIB=C:\ocilib\include
set HB_WITH_OPENSSL=C:\openssl\inc32
set HB_WITH_PGSQL=C:\pgsql\include
set HB_WITH_QT=C:\Qt\include
@@ -1335,6 +1337,8 @@ HARBOUR
http://libharu.org/
HB_WITH_MYSQL - MySQL [multiplatform, free, open-source]
http://dev.mysql.com/downloads/
HB_WITH_OCILIB - OCILIB (C Driver for Oracle) [multiplatform, free, open-source]
http://orclib.sourceforge.net/
HB_WITH_OPENSSL - OpenSSL [multiplatform, free, open-source]
http://www.openssl.org/
HB_WITH_PCRE - Perl Compatible Regular Expressions [multiplatform, free, open-source]

View File

@@ -43,6 +43,9 @@ if not "%HB_LIB_INSTALL%" == "" (
if exist "%HB_WITH_LIBHARU%\..\libhpdf.dll" implib "%HB_LIB_INSTALL%\libhpdf.lib" "%HB_WITH_LIBHARU%\..\libhpdf.dll"
if exist "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.dll" implib "%HB_LIB_INSTALL%\libhpdf.lib" "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.dll"
if exist "%HB_WITH_MYSQL%\..\bin\libmySQL.dll" implib "%HB_LIB_INSTALL%\libmysql.lib" "%HB_WITH_MYSQL%\..\bin\libmySQL.dll"
if exist "%HB_WITH_OCILIB%\..\lib32\ociliba.dll" implib "%HB_LIB_INSTALL%\ociliba.lib" "%HB_WITH_OCILIB%\..\lib32\ociliba.dll"
if exist "%HB_WITH_OCILIB%\..\lib32\ocilibm.dll" implib "%HB_LIB_INSTALL%\ocilibm.lib" "%HB_WITH_OCILIB%\..\lib32\ocilibm.dll"
if exist "%HB_WITH_OCILIB%\..\lib32\ocilibw.dll" implib "%HB_LIB_INSTALL%\ocilibw.lib" "%HB_WITH_OCILIB%\..\lib32\ocilibw.dll"
if exist "%HB_WITH_OPENSSL%\..\out32dll\libeay32.dll" implib -a "%HB_LIB_INSTALL%\libeay32.lib" "%HB_WITH_OPENSSL%\..\out32dll\libeay32.dll"
if exist "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.dll" implib -a "%HB_LIB_INSTALL%\ssleay32.lib" "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.dll"
if exist "%HB_WITH_OPENSSL%\..\dll\libeay32.dll" implib -a "%HB_LIB_INSTALL%\libeay32.lib" "%HB_WITH_OPENSSL%\..\dll\libeay32.dll"
@@ -72,6 +75,9 @@ if not "%HB_LIB_INSTALL%" == "" (
if exist "%HB_WITH_LIBHARU%\..\libhpdf.lib" copy /b /y "%HB_WITH_LIBHARU%\..\libhpdf.lib" "%HB_LIB_INSTALL%\libhpdf.lib"
if exist "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.lib" copy /b /y "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.lib" "%HB_LIB_INSTALL%\libhpdf.lib"
if exist "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" copy /b /y "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" "%HB_LIB_INSTALL%\libmySQL.lib"
if exist "%HB_WITH_OCILIB%\..\lib32\ociliba.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib32\ociliba.lib" "%HB_LIB_INSTALL%\ociliba.lib"
if exist "%HB_WITH_OCILIB%\..\lib32\ocilibm.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib32\ocilibm.lib" "%HB_LIB_INSTALL%\ocilibm.lib"
if exist "%HB_WITH_OCILIB%\..\lib32\ocilibw.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib32\ocilibw.lib" "%HB_LIB_INSTALL%\ocilibw.lib"
if exist "%HB_WITH_OPENSSL%\..\out32dll\libeay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\out32dll\libeay32.lib" "%HB_LIB_INSTALL%\libeay32.lib"
if exist "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.lib" "%HB_LIB_INSTALL%\ssleay32.lib"
if exist "%HB_WITH_OPENSSL%\..\dll\libeay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\dll\libeay32.lib" "%HB_LIB_INSTALL%\libeay32.lib"
@@ -92,6 +98,9 @@ if not "%HB_LIB_INSTALL%" == "" (
if exist "%HB_WITH_CURL%\..\bin\libcurl.dll" call :P_MSVC_IMPLIB x64 "%HB_WITH_CURL%\..\bin\libcurl.dll" "%HB_LIB_INSTALL%\libcurl.lib"
if exist "%HB_WITH_FIREBIRD%\..\lib\fbclient_ms.lib" copy /b /y "%HB_WITH_FIREBIRD%\..\lib\fbclient_ms.lib" "%HB_LIB_INSTALL%\fbclient.lib"
if exist "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" copy /b /y "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" "%HB_LIB_INSTALL%\libmySQL.lib"
if exist "%HB_WITH_OCILIB%\..\lib64\ociliba.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib64\ociliba.lib" "%HB_LIB_INSTALL%\ociliba.lib"
if exist "%HB_WITH_OCILIB%\..\lib64\ocilibm.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib64\ocilibm.lib" "%HB_LIB_INSTALL%\ocilibm.lib"
if exist "%HB_WITH_OCILIB%\..\lib64\ocilibw.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib64\ocilibw.lib" "%HB_LIB_INSTALL%\ocilibw.lib"
goto END
)
@@ -112,6 +121,9 @@ if not "%HB_LIB_INSTALL%" == "" (
if exist "%HB_WITH_LIBHARU%\..\libhpdf.lib" copy /b /y "%HB_WITH_LIBHARU%\..\libhpdf.lib" "%HB_LIB_INSTALL%\liblibhpdf.a"
if exist "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.lib" copy /b /y "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.lib" "%HB_LIB_INSTALL%\liblibhpdf.a"
if exist "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" copy /b /y "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" "%HB_LIB_INSTALL%\liblibmysql.a"
if exist "%HB_WITH_OCILIB%\..\lib32\libociliba.a" copy /b /y "%HB_WITH_OCILIB%\..\lib32\libociliba.a" "%HB_LIB_INSTALL%\libociliba.a"
if exist "%HB_WITH_OCILIB%\..\lib32\libocilibm.a" copy /b /y "%HB_WITH_OCILIB%\..\lib32\libocilibm.a" "%HB_LIB_INSTALL%\libocilibm.a"
if exist "%HB_WITH_OCILIB%\..\lib32\libocilibw.a" copy /b /y "%HB_WITH_OCILIB%\..\lib32\libocilibw.a" "%HB_LIB_INSTALL%\libocilibw.a"
if exist "%HB_WITH_OPENSSL%\..\out32dll\libeay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\out32dll\libeay32.lib" "%HB_LIB_INSTALL%\liblibeay32.a"
if exist "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.lib" "%HB_LIB_INSTALL%\libssleay32.a"
if exist "%HB_WITH_OPENSSL%\..\dll\libeay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\dll\libeay32.lib" "%HB_LIB_INSTALL%\liblibeay32.a"
@@ -131,6 +143,9 @@ if not "%HB_LIB_INSTALL%" == "" (
if exist "%HB_WITH_CURL%\..\lib\libcurldll.a" copy /b /y "%HB_WITH_CURL%\..\lib\libcurldll.a" "%HB_LIB_INSTALL%\libcurldll.a"
if exist "%HB_WITH_FIREBIRD%\..\lib\fbclient_ms.lib" copy /b /y "%HB_WITH_FIREBIRD%\..\lib\fbclient_ms.lib" "%HB_LIB_INSTALL%\libfbclient.a"
if exist "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" copy /b /y "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" "%HB_LIB_INSTALL%\liblibmysql.a"
if exist "%HB_WITH_OCILIB%\..\lib64\ociliba.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib64\ociliba.lib" "%HB_LIB_INSTALL%\libociliba.a"
if exist "%HB_WITH_OCILIB%\..\lib64\ocilibm.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib64\ocilibm.lib" "%HB_LIB_INSTALL%\libocilibm.a"
if exist "%HB_WITH_OCILIB%\..\lib64\ocilibw.lib" copy /b /y "%HB_WITH_OCILIB%\..\lib64\ocilibw.lib" "%HB_LIB_INSTALL%\libocilibw.a"
goto END
)
@@ -153,6 +168,9 @@ if not "%HB_LIB_INSTALL%" == "" (
if exist "%HB_WITH_LIBHARU%\..\libhpdf.lib" copy /b /y "%HB_WITH_LIBHARU%\..\libhpdf.lib" "%HB_LIB_INSTALL%\libhpdf.lib"
if exist "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.lib" copy /b /y "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.lib" "%HB_LIB_INSTALL%\libhpdf.lib"
if exist "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" copy /b /y "%HB_WITH_MYSQL%\..\lib\opt\libmySQL.lib" "%HB_LIB_INSTALL%\libmySQL.lib"
if exist "%HB_WITH_OCILIB%\..\lib32\ociliba.lib" copy /b /y "%HB_WITH_OCILIB%\ociliba.lib" "%HB_LIB_INSTALL%\ociliba.lib"
if exist "%HB_WITH_OCILIB%\..\lib32\ocilibm.lib" copy /b /y "%HB_WITH_OCILIB%\ocilibm.lib" "%HB_LIB_INSTALL%\ocilibm.lib"
if exist "%HB_WITH_OCILIB%\..\lib32\ocilibw.lib" copy /b /y "%HB_WITH_OCILIB%\ocilibw.lib" "%HB_LIB_INSTALL%\ocilibw.lib"
if exist "%HB_WITH_OPENSSL%\..\out32dll\libeay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\out32dll\libeay32.lib" "%HB_LIB_INSTALL%\libeay32.lib"
if exist "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.lib" "%HB_LIB_INSTALL%\ssleay32.lib"
if exist "%HB_WITH_OPENSSL%\..\dll\libeay32.lib" copy /b /y "%HB_WITH_OPENSSL%\..\dll\libeay32.lib" "%HB_LIB_INSTALL%\libeay32.lib"
@@ -184,6 +202,9 @@ if not "%HB_LIB_INSTALL%" == "" (
if exist "%HB_WITH_LIBHARU%\..\libhpdf.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\libhpdf.lib" "%HB_WITH_LIBHARU%\..\libhpdf.dll"
if exist "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\libhpdf.lib" "%HB_WITH_LIBHARU%\..\lib_dll\libhpdf.dll"
if exist "%HB_WITH_MYSQL%\..\bin\libmySQL.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\libmySQL.lib" "%HB_WITH_MYSQL%\..\bin\libmySQL.dll"
if exist "%HB_WITH_OCILIB%\..\lib32\ociliba.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\ociliba.lib" "%HB_WITH_OCILIB%\..\lib32\ociliba.dll"
if exist "%HB_WITH_OCILIB%\..\lib32\ocilibm.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\ocilibm.lib" "%HB_WITH_OCILIB%\..\lib32\ocilibm.dll"
if exist "%HB_WITH_OCILIB%\..\lib32\ocilibw.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\ocilibw.lib" "%HB_WITH_OCILIB%\..\lib32\ocilibw.dll"
if exist "%HB_WITH_OPENSSL%\..\out32dll\libeay32.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\libeay32.lib" "%HB_WITH_OPENSSL%\..\out32dll\libeay32.dll"
if exist "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\ssleay32.lib" "%HB_WITH_OPENSSL%\..\out32dll\ssleay32.dll"
if exist "%HB_WITH_OPENSSL%\..\dll\libeay32.dll" wlib.exe -q -o="%HB_LIB_INSTALL%\libeay32.lib" "%HB_WITH_OPENSSL%\..\dll\libeay32.dll"

View File

@@ -17,6 +17,7 @@ DIRS := \
sddmy \
sddpg \
sddfb \
sddoci \
sddodbc \
include $(TOP)$(ROOT)config/header.mk

View File

@@ -144,7 +144,7 @@ static HB_ERRCODE fbConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem )
isc_db_handle db = ( isc_db_handle ) 0;
char parambuf[ 520 ];
int i;
HB_ULONG ul;
HB_SIZE ul;
i = 0;
parambuf[ i++ ] = isc_dpb_version1;

View File

@@ -461,7 +461,7 @@ static HB_ERRCODE mysqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
char szBuffer[ 64 ];
HB_BOOL bError;
PHB_ITEM pError;
HB_ULONG ulLen;
HB_SIZE ulLen;
bError = HB_FALSE;
uiIndex--;
@@ -489,7 +489,7 @@ static HB_ERRCODE mysqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
if ( pValue )
memcpy( pStr, pValue, ulLen );
if ( ( HB_ULONG )pField->uiLen > ulLen )
if ( ( HB_SIZE ) pField->uiLen > ulLen )
memset( pStr + ulLen, ' ', pField->uiLen - ulLen );
pStr[ pField->uiLen ] = '\0';

View File

@@ -0,0 +1,38 @@
#
# $Id$
#
ROOT := ../../../
include $(TOP)$(ROOT)config/global.mk
LIBNAME := sddoci
C_SOURCES := \
ocidd.c \
_DET_DSP_NAME := ocilib
_DET_VAR_INC_ := HB_INC_OCILIB
_DET_VAR_HAS_ := HB_HAS_OCILIB
_DET_FLT_PLAT := !dos !os2 !wce
_DET_FLT_COMP :=
_DET_INC_DEFP := /usr/include /usr/local/include
_DET_INC_HEAD := /ocilib.h
include $(TOP)$(ROOT)config/detfun.mk
ifneq ($(HB_HAS_OCILIB),)
HB_CFLAGS += $(foreach d,$(HB_HAS_OCILIB),-I$(d))
# Using prebuilt static libs with MinGW
ifeq ($(HB_COMPILER),mingw)
HB_CFLAGS += -DOCI_API=_stdcall
endif
ifneq ($(HB_WITH_OCILIB_UNICODE),)
HB_CFLAGS += -DOCI_CHARSET_UNICODE
else ifneq ($(HB_WITH_OCILIB_MIXED),)
HB_CFLAGS += -DOCI_CHARSET_MIXED
endif
include $(TOP)$(ROOT)config/lib.mk
else
HB_SKIP_REASON := $(_DET_RES_TEXT)
include $(TOP)$(ROOT)config/none.mk
endif

View File

@@ -0,0 +1,651 @@
/*
* $Id$
*/
/*
* Oracle (via OCILIB) Database Driver
*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
* www - http://www.harbour-project.org
*
* 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, or (at your option)
* any later version.
*
* 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbdate.h"
#include "hbvm.h"
#if defined( __XCC__ ) || defined( __LCC__ )
# include "hbrddsql.h"
#else
# include "../hbrddsql.h"
#endif
#include <ocilib.h>
#if defined( OCI_CHARSET_UNICODE )
#define HB_MTEXT_CPTO(d,s,l) hb_mbtowccpy(d,s,l)
#define HB_MTEXT_GETFROM(d,s,l) hb_wctombget(d,s,l)
#define HB_MTEXT_SETTO(d,s,l) hb_mbtowcset(d,s,l)
#define HB_MTEXT_CONVTO(s) hb_mbtowc(s)
#define HB_MTEXT_CONVFROM(s) hb_wctomb(s)
#define HB_MTEXT_CONVNTO(s,l) hb_mbntowc(s,l)
#define HB_MTEXT_CONVNFROM(s,l) hb_wcntomb(s,l)
#define HB_MTEXT_CONVNREV(d,s,l) do { hb_wctombget(d,s,l); hb_xfree(s); } while( 0 )
#define HB_MTEXT_FREE(s) hb_xfree(s)
#else
#define HB_MTEXT_CPTO(d,s,l) hb_strncpy(d,s,l)
#define HB_MTEXT_SETTO(d,s,l) memcpy(d,s,l)
#define HB_MTEXT_GETFROM(d,s,l) memcpy(d,s,l)
#define HB_MTEXT_CONVTO(s) ((char *)(s))
#define HB_MTEXT_CONVFROM(s) ((char *)(s))
#define HB_MTEXT_CONVNTO(s,l) ((char *)(s))
#define HB_MTEXT_CONVNFROM(s,l) ((char *)(s))
#define HB_MTEXT_CONVNREV(d,s,l) do { ; } while( 0 )
#define HB_MTEXT_FREE(s) HB_SYMBOL_UNUSED(s)
#endif
#if defined( OCI_CHARSET_UNICODE ) || defined( OCI_CHARSET_MIXED )
#define HB_DTEXT_CPTO(d,s,l) hb_mbtowccpy(d,s,l)
#define HB_DTEXT_GETFROM(d,s,l) hb_wctombget(d,s,l)
#define HB_DTEXT_SETTO(d,s,l) hb_mbtowcset(d,s,l)
#define HB_DTEXT_CONVTO(s) hb_mbtowc(s)
#define HB_DTEXT_CONVFROM(s) hb_wctomb(s)
#define HB_DTEXT_CONVNTO(s,l) hb_mbntowc(s,l)
#define HB_DTEXT_CONVNFROM(s,l) hb_wcntomb(s,l)
#define HB_DTEXT_CONVNREV(d,s,l) do { hb_wctombget(d,s,l); hb_xfree(s); } while( 0 )
#define HB_DTEXT_FREE(s) hb_xfree(s)
#else
#define HB_DTEXT_CPTO(d,s,l) hb_strncpy(d,s,l)
#define HB_DTEXT_SETTO(d,s,l) memcpy(d,s,l)
#define HB_DTEXT_GETFROM(d,s,l) memcpy(d,s,l)
#define HB_DTEXT_CONVTO(s) ((char *)(s))
#define HB_DTEXT_CONVFROM(s) ((char *)(s))
#define HB_DTEXT_CONVNTO(s,l) ((char *)(s))
#define HB_DTEXT_CONVNFROM(s,l) ((char *)(s))
#define HB_DTEXT_CONVNREV(d,s,l) do { ; } while( 0 )
#define HB_DTEXT_FREE(s) HB_SYMBOL_UNUSED(s)
#endif
static HB_ERRCODE ocilibConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem );
static HB_ERRCODE ocilibDisconnect( SQLDDCONNECTION * pConnection );
static HB_ERRCODE ocilibExecute( SQLDDCONNECTION * pConnection, PHB_ITEM pItem );
static HB_ERRCODE ocilibOpen( SQLBASEAREAP pArea );
static HB_ERRCODE ocilibClose( SQLBASEAREAP pArea );
static HB_ERRCODE ocilibGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo );
static SDDNODE ocidd =
{
NULL,
"OCILIB",
( SDDFUNC_CONNECT ) ocilibConnect,
( SDDFUNC_DISCONNECT ) ocilibDisconnect,
( SDDFUNC_EXECUTE ) ocilibExecute,
( SDDFUNC_OPEN ) ocilibOpen,
( SDDFUNC_CLOSE ) ocilibClose,
( SDDFUNC_GOTO ) ocilibGoTo,
( SDDFUNC_GETVALUE ) NULL,
( SDDFUNC_GETVARLEN ) NULL
};
HB_FUNC_EXTERN( SQLBASE );
static void hb_ocidd_init( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
OCI_Initialize( NULL, NULL, OCI_ENV_DEFAULT );
if( ! hb_sddRegister( &ocidd ) )
{
hb_errInternal( HB_EI_RDDINVALID, NULL, NULL, NULL );
HB_FUNC_EXEC( SQLBASE ); /* force SQLBASE linking */
}
}
static void hb_ocidd_exit( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
OCI_Cleanup();
printf( "CLEANUP!\n" );
}
HB_FUNC( SDDOCI ) {;}
HB_INIT_SYMBOLS_BEGIN( ocidd__InitSymbols )
{ "SDDOCI", {HB_FS_PUBLIC}, {HB_FUNCNAME( SDDOCI )}, NULL },
HB_INIT_SYMBOLS_END( ocidd__InitSymbols )
HB_CALL_ON_STARTUP_BEGIN( _hb_ocidd_init_ )
hb_vmAtInit( hb_ocidd_init, NULL );
hb_vmAtExit( hb_ocidd_exit, NULL );
HB_CALL_ON_STARTUP_END( _hb_ocidd_init_ )
#if defined( HB_PRAGMA_STARTUP )
#pragma startup ocidd__InitSymbols
#pragma startup _hb_ocidd_init_
#elif defined( HB_DATASEG_STARTUP )
#define HB_DATASEG_BODY HB_DATASEG_FUNC( ocidd__InitSymbols ) \
HB_DATASEG_FUNC( _hb_ocidd_init_ )
#include "hbiniseg.h"
#endif
/*=====================================================================================*/
static HB_USHORT hb_errRT_OCIDD( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode )
{
HB_USHORT uiAction;
PHB_ITEM pError;
pError = hb_errRT_New( ES_ERROR, "SDDOCI", errGenCode, errSubCode, szDescription, szOperation, errOsCode, EF_NONE );
uiAction = hb_errLaunch( pError );
hb_itemRelease( pError );
return uiAction;
}
static char * ocilibGetError( HB_ERRCODE * pErrCode )
{
OCI_Error * err = OCI_GetLastError();
char * szRet;
int iNativeErr = 9999;
if( err )
{
iNativeErr = OCI_ErrorGetOCICode( err );
szRet = hb_strdup( OCI_ErrorGetString( err ) );
}
else
szRet = hb_strdup( "HY000 Unable to get error message" );
if( pErrCode )
*pErrCode = ( HB_ERRCODE ) iNativeErr;
return szRet;
}
/*============= SDD METHODS =============================================================*/
static HB_ERRCODE ocilibConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem )
{
OCI_Connection * cn;
mtext * szConn = ( mtext * ) HB_MTEXT_CONVTO( hb_arrayGetCPtr( pItem, 2 ) );
mtext * szUser = ( mtext * ) HB_MTEXT_CONVTO( hb_arrayGetCPtr( pItem, 3 ) );
mtext * szPass = ( mtext * ) HB_MTEXT_CONVTO( hb_arrayGetCPtr( pItem, 4 ) );
cn = OCI_ConnectionCreate( szConn, szUser, szPass, OCI_SESSION_DEFAULT );
HB_MTEXT_FREE( szConn );
HB_MTEXT_FREE( szUser );
HB_MTEXT_FREE( szPass );
if( cn )
{
pConnection->hConnection = ( void * ) cn;
return HB_SUCCESS;
}
else
pConnection->hConnection = NULL;
return HB_FAILURE;
}
static HB_ERRCODE ocilibDisconnect( SQLDDCONNECTION * pConnection )
{
return OCI_ConnectionFree( ( OCI_Connection * ) pConnection->hConnection ) ? HB_SUCCESS : HB_FAILURE;
}
static HB_ERRCODE ocilibExecute( SQLDDCONNECTION * pConnection, PHB_ITEM pItem )
{
OCI_Statement * st = OCI_StatementCreate( ( OCI_Connection * ) pConnection->hConnection );
mtext * szStatement;
char * szError;
HB_ERRCODE errCode;
if( ! st )
{
szError = ocilibGetError( &errCode );
hb_errRT_OCIDD( EG_OPEN, ESQLDD_STMTALLOC, szError, hb_itemGetCPtr( pItem ), errCode );
hb_xfree( szError );
return HB_FAILURE;
}
szStatement = ( mtext * ) HB_MTEXT_CONVTO( hb_itemGetCPtr( pItem ) );
if( OCI_ExecuteStmt( st, szStatement ) )
{
HB_MTEXT_FREE( szStatement );
/* TODO: new id */
hb_rddsqlSetError( 0, NULL, hb_itemGetCPtr( pItem ), NULL, ( unsigned long ) OCI_GetAffectedRows( st ) );
OCI_StatementFree( st );
return HB_SUCCESS;
}
else
HB_MTEXT_FREE( szStatement );
szError = ocilibGetError( &errCode );
hb_rddsqlSetError( errCode, szError, hb_itemGetCPtr( pItem ), NULL, errCode );
hb_xfree( szError );
OCI_StatementFree( st );
return HB_FAILURE;
}
static HB_ERRCODE ocilibOpen( SQLBASEAREAP pArea )
{
OCI_Statement * st = OCI_StatementCreate( ( OCI_Connection * ) pArea->pConnection->hConnection );
OCI_Resultset * rs;
mtext * szQuery;
HB_USHORT uiFields, uiIndex;
PHB_ITEM pItemEof, pItem;
HB_ERRCODE errCode;
char * szError;
HB_BOOL bError;
if( ! st )
{
szError = ocilibGetError( &errCode );
hb_errRT_OCIDD( EG_OPEN, ESQLDD_STMTALLOC, szError, pArea->szQuery, errCode );
hb_xfree( szError );
return HB_FAILURE;
}
szQuery = ( mtext * ) HB_MTEXT_CONVTO( pArea->szQuery );
if( ! OCI_ExecuteStmt( st, szQuery ) )
{
HB_MTEXT_FREE( szQuery );
szError = ocilibGetError( &errCode );
OCI_StatementFree( st );
hb_errRT_OCIDD( EG_OPEN, ESQLDD_INVALIDQUERY, szError, pArea->szQuery, errCode );
hb_xfree( szError );
return HB_FAILURE;
}
else
HB_MTEXT_FREE( szQuery );
rs = OCI_GetResultset( st );
uiFields = ( HB_USHORT ) OCI_GetColumnCount( rs );
SELF_SETFIELDEXTENT( ( AREAP ) pArea, uiFields );
pItemEof = hb_itemArrayNew( uiFields );
/* HB_TRACE( HB_TR_ALWAYS, ("fieldcount=%d", iNameLen) ); */
errCode = 0;
bError = HB_FALSE;
for( uiIndex = 0; uiIndex < uiFields; ++uiIndex )
{
OCI_Column * col = OCI_GetColumn( rs, uiIndex + 1 );
const mtext * szName;
unsigned int uiDataType;
unsigned int uiSize;
int iDec;
HB_BOOL bNullable;
char * szOurName;
DBFIELDINFO pFieldInfo;
if( ! col )
{
hb_itemRelease( pItemEof );
szError = ocilibGetError( NULL );
OCI_StatementFree( st );
hb_errRT_OCIDD( EG_OPEN, ESQLDD_STMTDESCR + 1001, szError, pArea->szQuery, 0 );
hb_xfree( szError );
return HB_FAILURE;
}
szName = OCI_ColumnGetName( col );
uiDataType = OCI_ColumnGetType( col );
uiSize = OCI_ColumnGetSize( col );
iDec = OCI_ColumnGetPrecision( col );
bNullable = ( HB_BOOL ) OCI_ColumnGetNullable( col );
HB_SYMBOL_UNUSED( bNullable );
szOurName = ( char * ) hb_xgrab( ( 256 + 1 ) * sizeof( char ) );
HB_MTEXT_CPTO( szOurName, szName, 256 );
szOurName[ MAX_FIELD_NAME ] = '\0';
hb_strUpper( szOurName, MAX_FIELD_NAME );
pFieldInfo.atomName = szOurName;
pFieldInfo.uiLen = ( HB_USHORT ) uiSize;
pFieldInfo.uiDec = ( HB_USHORT ) iDec;
HB_TRACE( HB_TR_ALWAYS, ("field: name=%s type=%d len=%d dec=%d nullable=%d", pFieldInfo.atomName, uiDataType, uiSize, iDec, bNullable ) );
switch( uiDataType )
{
/* TOFIX/TODO: Type mapping */
case OCI_CDT_TEXT:
pFieldInfo.uiType = HB_FT_STRING;
break;
case OCI_CDT_NUMERIC:
pFieldInfo.uiType = HB_FT_INTEGER;
break;
case OCI_CDT_DATETIME:
case OCI_CDT_TIMESTAMP:
pFieldInfo.uiType = HB_FT_TIMESTAMP;
break;
default:
/* HB_TRACE( HB_TR_ALWAYS, ("new sql type=%d", uiDataType) ); */
bError = HB_TRUE;
errCode = ( HB_ERRCODE ) uiDataType;
pFieldInfo.uiType = 0;
pFieldInfo.uiType = HB_FT_STRING;
break;
}
if( ! bError )
{
switch( pFieldInfo.uiType )
{
case HB_FT_STRING:
{
char * pStr;
pStr = ( char * ) hb_xgrab( ( HB_SIZE ) pFieldInfo.uiLen + 1 );
memset( pStr, ' ', pFieldInfo.uiLen );
pStr[ pFieldInfo.uiLen ] = '\0';
pItem = hb_itemPutCL( NULL, pStr, pFieldInfo.uiLen );
hb_xfree( pStr );
break;
}
case HB_FT_MEMO:
pItem = hb_itemPutC( NULL, NULL );
break;
case HB_FT_INTEGER:
pItem = hb_itemPutNI( NULL, 0 );
break;
case HB_FT_LONG:
if( pFieldInfo.uiDec == 0 )
pItem = hb_itemPutNLLen( NULL, 0, pFieldInfo.uiLen );
else
pItem = hb_itemPutNDLen( NULL, 0.0, pFieldInfo.uiLen, pFieldInfo.uiDec );
break;
case HB_FT_DOUBLE:
pItem = hb_itemPutNDLen( NULL, 0.0, pFieldInfo.uiLen, pFieldInfo.uiDec );
break;
case HB_FT_LOGICAL:
pItem = hb_itemPutL( NULL, HB_FALSE );
break;
case HB_FT_DATE:
pItem = hb_itemPutDL( NULL, 0 );
break;
case HB_FT_TIME:
pItem = hb_itemPutTDT( NULL, 0, 0 );
break;
case HB_FT_TIMESTAMP:
pItem = hb_itemPutTDT( NULL, 0, 0 );
break;
default:
pItem = hb_itemNew( NULL );
bError = HB_TRUE;
break;
}
hb_arraySetForward( pItemEof, uiIndex + 1, pItem );
hb_itemRelease( pItem );
if( ! bError )
bError = ( SELF_ADDFIELD( ( AREAP ) pArea, &pFieldInfo ) == HB_FAILURE );
}
if( bError )
break;
}
if( bError )
{
hb_itemRelease( pItemEof );
OCI_StatementFree( st );
hb_errRT_OCIDD( EG_CORRUPTION, ESQLDD_INVALIDFIELD, "Invalid field type", pArea->szQuery, errCode );
return HB_FAILURE;
}
pArea->ulRecCount = 0;
pArea->ulRecMax = SQLDD_ROWSET_INIT;
pArea->pRow = ( void ** ) hb_xgrab( SQLDD_ROWSET_INIT * sizeof( void * ) );
memset( pArea->pRow, 0, SQLDD_ROWSET_INIT * sizeof( void * ) );
pArea->pRowFlags = ( HB_BYTE * ) hb_xgrab( SQLDD_ROWSET_INIT * sizeof( HB_BYTE ) );
memset( pArea->pRowFlags, 0, SQLDD_ROWSET_INIT * sizeof( HB_BYTE ) );
pArea->pRow[ 0 ] = pItemEof;
pArea->pRowFlags[ 0 ] = SQLDD_FLAG_CACHED;
pArea->pStmt = ( void * ) st;
return HB_SUCCESS;
}
static HB_ERRCODE ocilibClose( SQLBASEAREAP pArea )
{
if( pArea->pStmt )
{
OCI_StatementFree( ( OCI_Statement * ) pArea->pStmt );
pArea->pStmt = NULL;
}
return HB_SUCCESS;
}
static HB_ERRCODE ocilibGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo )
{
OCI_Statement * st = ( OCI_Statement * ) pArea->pStmt;
OCI_Resultset * rs = OCI_GetResultset( st );
PHB_ITEM pArray, pItem;
LPFIELD pField;
HB_USHORT ui;
while( ulRecNo > pArea->ulRecCount && ! pArea->fFetched )
{
if( ! OCI_FetchNext( rs ) )
{
pArea->fFetched = HB_TRUE;
break;
}
pArray = hb_itemArrayNew( pArea->area.uiFieldCount );
for( ui = 1; ui <= pArea->area.uiFieldCount; ui++ )
{
pItem = NULL;
if( ! OCI_IsNull( rs, ui ) )
{
pField = pArea->area.lpFields + ui - 1;
switch( pField->uiType )
{
case HB_FT_STRING:
{
const dtext * val;
if( ( val = OCI_GetString( rs, ui ) ) != NULL )
{
HB_SIZE nLen = ( HB_SIZE ) dtslen( val );
char * szVal = ( char * ) hb_xgrab( ( nLen + 1 ) * sizeof( char ) );
HB_MTEXT_CPTO( szVal, val, nLen );
szVal[ nLen ] = '\0';
pItem = hb_itemPutCLPtr( NULL, szVal, nLen );
}
break;
}
case HB_FT_INTEGER:
{
pItem = hb_itemPutNLLen( NULL, OCI_GetInt( rs, ui ), pField->uiLen );
break;
}
/* TODO: Type conversions */
/*
case HB_FT_LONG:
if( pField->uiDec == 0 )
{
long int val = 0;
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, SQL_C_LONG, &val, sizeof( val ), &iLen ) ) )
{
pItem = hb_itemPutNLLen( NULL, val, pField->uiLen );
}
}
else
{
double val = 0.0;
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, SQL_C_DOUBLE, &val, sizeof( val ), &iLen ) ) )
{
pItem = hb_itemPutNDLen( NULL, val, pField->uiLen, pField->uiDec );
}
}
break;
case HB_FT_DOUBLE:
{
double val = 0.0;
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, SQL_C_DOUBLE, &val, sizeof( val ), &iLen ) ) )
{
pItem = hb_itemPutNDLen( NULL, val, pField->uiLen, pField->uiDec );
}
break;
}
case HB_FT_LOGICAL:
{
unsigned char val = 0;
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, SQL_C_BIT, &val, sizeof( val ), &iLen ) ) )
{
pItem = hb_itemPutL( NULL, val != 0 );
}
break;
}
case HB_FT_DATE:
{
DATE_STRUCT val = {0,0,0};
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, SQL_C_DATE, &val, sizeof( val ), &iLen ) ) )
{
pItem = hb_itemPutD( NULL, val.year, val.month, val.day );
}
break;
}
case HB_FT_TIME:
{
TIME_STRUCT val = {0,0,0};
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, SQL_C_TIME, &val, sizeof( val ), &iLen ) ) )
{
pItem = hb_itemPutTDT( NULL, 0, hb_timeEncode( val.hour, val.minute, val.second, 0 ) );
}
break;
}
case HB_FT_TIMESTAMP:
{
TIMESTAMP_STRUCT val = { 0, 0, 0, 0, 0, 0, 0 };
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, SQL_C_TIMESTAMP, &val, sizeof( val ), &iLen ) ) )
{
pItem = hb_itemPutTDT( NULL, hb_dateEncode( val.year, val.month, val.day ),
hb_timeEncode( val.hour, val.minute, val.second, val.fraction / 1000000 ) );
}
break;
}
*/
}
}
if( pItem )
{
hb_arraySetForward( pArray, ui, pItem );
hb_itemRelease( pItem );
}
}
if( pArea->ulRecCount + 1 <= pArea->ulRecMax )
{
pArea->pRow = ( void ** ) hb_xrealloc( pArea->pRow, ( pArea->ulRecMax + SQLDD_ROWSET_RESIZE ) * sizeof( void * ) );
pArea->pRowFlags = ( HB_BYTE * ) hb_xrealloc( pArea->pRowFlags, ( pArea->ulRecMax + SQLDD_ROWSET_RESIZE ) * sizeof( HB_BYTE ) );
pArea->ulRecMax += SQLDD_ROWSET_RESIZE;
}
pArea->ulRecCount++;
pArea->pRow[ pArea->ulRecCount ] = pArray;
pArea->pRowFlags[ pArea->ulRecCount ] = SQLDD_FLAG_CACHED;
}
if( ulRecNo == 0 || ulRecNo > pArea->ulRecCount )
{
pArea->pRecord = pArea->pRow[ 0 ];
pArea->bRecordFlags = pArea->pRowFlags[ 0 ];
pArea->fPositioned = HB_FALSE;
}
else
{
pArea->pRecord = pArea->pRow[ ulRecNo ];
pArea->bRecordFlags = pArea->pRowFlags[ ulRecNo ];
pArea->fPositioned = HB_TRUE;
}
return HB_SUCCESS;
}

View File

@@ -0,0 +1,10 @@
#
# $Id$
#
libs=sddoci
{HB_WITH_OCILIB_UNICODE}libs=ocilibw
{HB_WITH_OCILIB_MIXED}libs=ocilibm
{!HB_WITH_OCILIB_UNICODE&!HB_WITH_OCILIB_MIXED}libs=ociliba
libs=../rddsql.hbc

View File

@@ -0,0 +1,5 @@
#
# $Id$
#
../sddoci.hbc

View File

@@ -0,0 +1,38 @@
/*
* $Id$
*/
#include "simpleio.ch"
#include "hbrddsql.ch"
REQUEST SDDOCI, SQLMIX
PROCEDURE Main()
LOCAL tmp
RDDSETDEFAULT( "SQLMIX" )
SET( _SET_DATEFORMAT, "yyyy-mm-dd" )
AEVAL( rddList(), {| X | QOut( X ) } )
? "-1-"
? "Connect:", tmp := RDDINFO( RDDI_CONNECT, { "OCILIB", "ORCL", "scott", "tiger" } )
IF tmp == 0
? "Unable connect to the server"
ENDIF
? "-2-"
? "Use:", DBUSEAREA( .T.,, "select * from emp", "emp" )
? "-3-"
? "Alias:", ALIAS()
? "-4-"
? "DB struct:", HB_VALTOEXP( DBSTRUCT() )
? "-5-"
INKEY( 0 )
BROWSE()
INDEX ON FIELD->SAL TO salary
DBGOTOP()
BROWSE()
DBCLOSEAREA()
RETURN

View File

@@ -339,7 +339,7 @@ static HB_ERRCODE odbcOpen( SQLBASEAREAP pArea )
errCode = 0;
bError = HB_FALSE;
for ( uiIndex = 0; uiIndex < uiFields; uiIndex++ )
for ( uiIndex = 0; uiIndex < uiFields; uiIndex++ )
{
if ( ! SQL_SUCCEEDED( SQLDescribeCol( hStmt, ( SQLSMALLINT ) uiIndex + 1, ( SQLTCHAR* ) cName, HB_SIZEOFARRAY( cName ), &iNameLen, &iDataType, &uiSize, &iDec, &iNull ) ) )
{
@@ -424,7 +424,7 @@ static HB_ERRCODE odbcOpen( SQLBASEAREAP pArea )
{
char* pStr;
pStr = ( char * ) hb_xgrab( ( HB_ULONG ) pFieldInfo.uiLen + 1 );
pStr = ( char * ) hb_xgrab( ( HB_SIZE ) pFieldInfo.uiLen + 1 );
memset( pStr, ' ', pFieldInfo.uiLen );
pStr[ pFieldInfo.uiLen ] = '\0';
@@ -487,10 +487,10 @@ static HB_ERRCODE odbcOpen( SQLBASEAREAP pArea )
if ( bError )
{
hb_itemRelease( pItemEof );
SQLFreeStmt( hStmt, SQL_DROP );
hb_errRT_ODBCDD( EG_CORRUPTION, ESQLDD_INVALIDFIELD, "Invalid field type", pArea->szQuery, errCode );
return HB_FAILURE;
hb_itemRelease( pItemEof );
SQLFreeStmt( hStmt, SQL_DROP );
hb_errRT_ODBCDD( EG_CORRUPTION, ESQLDD_INVALIDFIELD, "Invalid field type", pArea->szQuery, errCode );
return HB_FAILURE;
}
pArea->ulRecCount = 0;
@@ -555,7 +555,7 @@ static HB_ERRCODE odbcGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo )
if( SQL_SUCCEEDED( res = SQLGetData( hStmt, ui, SQL_C_CHAR, ( SQLCHAR * ) val, 1024, &iLen ) ) )
{
if( iLen > 0 )
pItem = hb_itemPutCL( NULL, val, ( HB_ULONG ) iLen );
pItem = hb_itemPutCL( NULL, val, ( HB_SIZE ) iLen );
}
hb_xfree( val );
break;

View File

@@ -475,7 +475,7 @@ static HB_ERRCODE pgsqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
char* pValue;
HB_BOOL bError;
PHB_ITEM pError;
HB_ULONG ulLen;
HB_SIZE ulLen;
bError = HB_FALSE;
uiIndex--;
@@ -485,7 +485,7 @@ static HB_ERRCODE pgsqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
return HB_SUCCESS;
pValue = PQgetvalue( ( PGresult * ) pArea->pResult, pArea->ulRecNo - 1, uiIndex );
ulLen = ( HB_ULONG ) PQgetlength( ( PGresult * ) pArea->pResult, pArea->ulRecNo - 1, uiIndex );
ulLen = ( HB_SIZE ) PQgetlength( ( PGresult * ) pArea->pResult, pArea->ulRecNo - 1, uiIndex );
/* printf( "fieldget recno:%d index:%d value:%s len:%d\n", pArea->ulRecNo, uiIndex, pValue, ulLen ); */