From e01e130d48bbe86d9fc45cc2e3f26808c6eb6812 Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Tue, 18 Apr 2006 09:59:41 +0000 Subject: [PATCH] fixes for 64-bit version which is not optimally defined in ODBC. git-svn-id: http://root.cern.ch/svn/root/trunk@14728 27541ba8-7e3a-0410-8455-c3a389f83636 --- odbc/inc/TODBCStatement.h | 7 +++++-- odbc/inc/TODBCTypes.h | 29 +++++++++++++++++++++++++++++ odbc/src/TODBCResult.cxx | 6 ++++-- odbc/src/TODBCRow.cxx | 5 +++-- odbc/src/TODBCStatement.cxx | 15 +++++++-------- 5 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 odbc/inc/TODBCTypes.h diff --git a/odbc/inc/TODBCStatement.h b/odbc/inc/TODBCStatement.h index d40a6703242..5bbef0b21b9 100644 --- a/odbc/inc/TODBCStatement.h +++ b/odbc/inc/TODBCStatement.h @@ -1,4 +1,4 @@ -// @(#)root/odbc:$Name: $:$Id: TODBCStatement.h,v 1.1 2006/02/6 10:00:44 rdm Exp $ +// @(#)root/odbc:$Name: $:$Id: TODBCStatement.h,v 1.1 2006/04/17 14:12:52 rdm Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -15,6 +15,9 @@ #ifndef ROOT_TSQLStatement #include "TSQLStatement.h" #endif +#ifndef ROOT_TODBCTypes +#include "TODBCTypes.h" +#endif #ifdef __CINT__ typedef void * SQLHSTMT; @@ -41,7 +44,7 @@ protected: Int_t sqlctype; void *buffer; Int_t elementsize; - Long_t *lenarray; + ODBCInt_t *lenarray; char *strbuffer; char *namebuffer; }; diff --git a/odbc/inc/TODBCTypes.h b/odbc/inc/TODBCTypes.h new file mode 100644 index 00000000000..55c89bc4ede --- /dev/null +++ b/odbc/inc/TODBCTypes.h @@ -0,0 +1,29 @@ +// @(#)root/odbc:$Name: $:$Id: TODBCRow.h,v 1.1 2006/04/17 14:12:52 rdm Exp $ +// Author: Fons Rademakers 18/04/2006 + +/************************************************************************* + * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_TODBCTypes +#define ROOT_TODBCTypes + +#ifndef ROOT_Rtypes +#include "Rtypes.h" +#endif + +// Microsoft is confused about sizes on different platforms. +#ifdef R__B64 +typedef UInt_t ODBCUInt_t; +typedef Int_t ODBCInt_t; +#else +typedef ULong_t ODBCUInt_t; +typedef Long_t ODBCInt_t; +#endif + +#endif + diff --git a/odbc/src/TODBCResult.cxx b/odbc/src/TODBCResult.cxx index 02b7b8b3768..efffc2891a8 100644 --- a/odbc/src/TODBCResult.cxx +++ b/odbc/src/TODBCResult.cxx @@ -1,4 +1,4 @@ -// @(#)root/odbc:$Name: $:$Id: TODBCResult.cxx,v 1.1.1.1 2000/05/16 17:00:58 rdm Exp $ +// @(#)root/odbc:$Name: $:$Id: TODBCResult.cxx,v 1.1 2006/04/17 14:12:52 rdm Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -11,6 +11,8 @@ #include "TODBCResult.h" #include "TODBCRow.h" +#include "TODBCTypes.h" + ClassImp(TODBCResult) @@ -52,7 +54,7 @@ const char *TODBCResult::GetFieldName(Int_t field) SQLSMALLINT nameLength; SQLSMALLINT dataType; - ULong_t columnSize; + ODBCUInt_t columnSize; SQLSMALLINT decimalDigits; SQLSMALLINT nullable; diff --git a/odbc/src/TODBCRow.cxx b/odbc/src/TODBCRow.cxx index fddc6825a61..dbebefc24f6 100644 --- a/odbc/src/TODBCRow.cxx +++ b/odbc/src/TODBCRow.cxx @@ -1,4 +1,4 @@ -// @(#)root/odbc:$Name: $:$Id: TODBCRow.cxx,v 1.1.1.1 2000/05/16 17:00:58 rdm Exp $ +// @(#)root/odbc:$Name: $:$Id: TODBCRow.cxx,v 1.1 2006/04/17 14:12:52 rdm Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -10,6 +10,7 @@ *************************************************************************/ #include "TODBCRow.h" +#include "TODBCTypes.h" #include <sqlext.h> @@ -75,7 +76,7 @@ const char *TODBCRow::GetField(Int_t field) fBuffer[field] = new char[buffer_len]; - Long_t ressize; + ODBCInt_t ressize; SQLGetData(fHstmt, field+1, SQL_C_CHAR, fBuffer[field], buffer_len, &ressize); diff --git a/odbc/src/TODBCStatement.cxx b/odbc/src/TODBCStatement.cxx index 1deb3fbcca4..8f2afccd08e 100644 --- a/odbc/src/TODBCStatement.cxx +++ b/odbc/src/TODBCStatement.cxx @@ -1,4 +1,4 @@ -// @(#)root/odbc:$Name: $:$Id: TODBCStatement.cxx,v 1.1 2006/02/6 10:00:44 rdm Exp $ +// @(#)root/odbc:$Name: $:$Id: TODBCStatement.cxx,v 1.1 2006/04/17 14:12:52 rdm Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -20,13 +20,12 @@ #include "TODBCStatement.h" - #include "TDataType.h" #include "snprintf.h" +#include "Riostream.h" -#include "sqlext.h" +#include <sqlext.h> -#include "Riostream.h" ClassImp(TODBCStatement) @@ -153,7 +152,7 @@ Bool_t TODBCStatement::Process() Int_t TODBCStatement::GetNumAffectedRows() { - Long_t RowCount; + ODBCInt_t RowCount; SQLRETURN retcode = SQL_SUCCESS; retcode = SQLRowCount(fHstmt, &RowCount); @@ -195,7 +194,7 @@ Bool_t TODBCStatement::StoreResult() SQLCHAR ColumnName[1024]; SQLSMALLINT NameLength; SQLSMALLINT DataType; - ULong_t ColumnSize; + ODBCUInt_t ColumnSize; SQLSMALLINT DecimalDigits; SQLSMALLINT Nullable; @@ -409,7 +408,7 @@ Bool_t TODBCStatement::BindColumn(Int_t ncol, SQLSMALLINT sqltype, SQLUINTEGER s fBuffer[ncol].sqlctype = sqlctype; fBuffer[ncol].buffer = malloc(elemsize * fBufferLength); fBuffer[ncol].elementsize = elemsize; - fBuffer[ncol].lenarray = new Long_t[fBufferLength]; + fBuffer[ncol].lenarray = new ODBCInt_t[fBufferLength]; SQLRETURN retcode = SQLBindCol(fHstmt, ncol+1, sqlctype, fBuffer[ncol].buffer, @@ -455,7 +454,7 @@ Bool_t TODBCStatement::BindParam(Int_t npar, Int_t roottype, Int_t size) } void* buffer = malloc(elemsize * fBufferLength); - Long_t *lenarray = new Long_t[fBufferLength]; + ODBCInt_t *lenarray = new ODBCInt_t[fBufferLength]; SQLRETURN retcode = SQLBindParameter(fHstmt, npar+1, SQL_PARAM_INPUT, -- GitLab