[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Sep 11 07:21:29 PDT 2009


 patches/dev300/apply               |   11 
 patches/dev300/new-SQLLEN-m57.diff | 1884 +++++++++++++++++++++++++++++++++++++
 patches/dev300/new-SQLLEN.diff     |   21 
 3 files changed, 1906 insertions(+), 10 deletions(-)

New commits:
commit 1df92cd237755903931259f2e7aa57046191d88a
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Sep 11 10:20:29 2009 -0400

    Disabled quite build patches and branched SQLLEN patch for dev300-m58.
    
    * patches/dev300/apply:
    * patches/dev300/new-SQLLEN-m57.diff:
    * patches/dev300/new-SQLLEN.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 3a76d5a..437911d 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -262,10 +262,15 @@ linkoo-dev300.diff, jholesov
 # until the internal compiler error is fixed
 # buildfix-gcc-4.3-compiler-error.diff, n#370383, pmladek
 
+[ TemporaryHacks < dev300-m58 ]
+
 # Make the historically very verbose build quieter, helps us see warnings.
+# FIXME: This doesn't apply against dev300-m58.
 quiet-build.diff, i#84497, michael
 quiet-build-more.diff, i#84497, thorsten
 
+[ TemporaryHacks ]
+
 # gcc OOMs here otherwise (x86_64)
 writerfilter-qnametostr-NOOPTFILES.diff
 
@@ -455,10 +460,14 @@ sfx2-check-existing-template-dirs.diff, i#100518, pmladek
 # Use the characters after the string to get a better kerning
 vcl-kerning-fix.diff, n#464436, i#26519, cbosdo
 
-[ FedoraLinuxOnlyFixes ]
+[ FedoraLinuxOnlyFixes >= dev300-m58 ]
 # fix for new SQLLEN in unixodbc. Update internal headers.
 new-SQLLEN.diff, i#104088
 
+[ FedoraLinuxOnlyFixes < dev300-m58 ]
+# fix for new SQLLEN in unixodbc. Update internal headers.
+new-SQLLEN-m57.diff, i#104088
+
 [ LinuxOnly ]
 # fix that allows OOo to work with a standard (unpatched) libjpeg,
 jpegc.c.diff, i#80674, n#272574, flr
diff --git a/patches/dev300/new-SQLLEN-m57.diff b/patches/dev300/new-SQLLEN-m57.diff
new file mode 100644
index 0000000..12f74af
--- /dev/null
+++ b/patches/dev300/new-SQLLEN-m57.diff
@@ -0,0 +1,1884 @@
+Index: connectivity/source/inc/odbc/OResultSet.hxx
+===================================================================
+--- connectivity/source/inc/odbc/OResultSet.hxx	(revision 274960)
++++ connectivity/source/inc/odbc/OResultSet.hxx	(working copy)
+@@ -128,7 +128,7 @@
+ 			typedef ::std::vector<ORowSetValue>			TDataRow;
+ 
+ 			TVoidVector									m_aBindVector;
+-			::std::vector<sal_Int32>					m_aLengthVector;
++			::std::vector<SQLLEN>						m_aLengthVector;
+             ::std::map<sal_Int32,SWORD>					m_aODBCColumnTypes;
+ 			::com::sun::star::uno::Sequence<sal_Int8>	m_aBookmark;
+ 
+Index: connectivity/source/inc/odbc/OResultSetMetaData.hxx
+===================================================================
+--- connectivity/source/inc/odbc/OResultSetMetaData.hxx	(revision 274960)
++++ connectivity/source/inc/odbc/OResultSetMetaData.hxx	(working copy)
+@@ -80,13 +80,13 @@
+ 			virtual ~OResultSetMetaData();
+ 
+ 
+-            static  SWORD getNumColAttrib(OConnection* _pConnection
++            static SQLLEN getNumColAttrib(OConnection* _pConnection
+                                               ,SQLHANDLE _aStatementHandle
+                                               ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
+                                               ,sal_Int32 _column
+                                               ,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ 
+-            static SWORD getColumnODBCType(OConnection* _pConnection
++            static SQLSMALLINT getColumnODBCType(OConnection* _pConnection
+                                               ,SQLHANDLE _aStatementHandle
+                                               ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
+                                               ,sal_Int32 column)
+Index: connectivity/source/inc/odbc/OTools.hxx
+===================================================================
+--- connectivity/source/inc/odbc/OTools.hxx	(revision 274960)
++++ connectivity/source/inc/odbc/OTools.hxx	(working copy)
+@@ -197,7 +197,7 @@
+ 			static ::rtl::OUString getStringValue(	OConnection* _pConnection,	
+ 													SQLHANDLE _aStatementHandle,
+ 													sal_Int32 columnIndex,
+-													SWORD  _fSqlType,
++													SQLSMALLINT _fSqlType,
+ 													sal_Bool &_bWasNull,
+ 													const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ 													rtl_TextEncoding _nTextEncoding) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+@@ -205,7 +205,7 @@
+ 			static  ::com::sun::star::uno::Sequence<sal_Int8> getBytesValue(OConnection* _pConnection,	
+ 																			SQLHANDLE _aStatementHandle,
+ 																			sal_Int32 columnIndex,
+-																			SWORD  _fSqlType,
++																			SQLSMALLINT _fSqlType,
+ 																			sal_Bool &_bWasNull,
+ 																			const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ 			static void getValue(	OConnection* _pConnection,	
+@@ -215,7 +215,7 @@
+ 									sal_Bool &_bWasNull,
+ 									const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ 									void* _pValue,
+-									SQLINTEGER _rSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
++									SQLLEN _nSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ 
+ 			/** 
+ 				bindData copies the from pValue to pData
+@@ -229,10 +229,10 @@
+ 			static void bindData(	SQLSMALLINT _nOdbcType,
+ 									sal_Bool _bUseWChar,
+ 									sal_Int8 *&_pData,
+-									SQLINTEGER*& pLen,
++									SQLLEN*& pLen,
+ 									const void* _pValue,
+ 									rtl_TextEncoding _nTextEncoding,
+-									SQLUINTEGER& _nColumnSize);
++									SQLULEN& _nColumnSize);
+ 
+ 			static void bindParameter(	OConnection* _pConnection,	
+ 										SQLHANDLE _hStmt,
+@@ -254,7 +254,7 @@
+ 									SQLSMALLINT _nMaxLen,
+ 									const void* _pValue,
+ 									void*		_pData,
+-									SQLINTEGER *pLen,
++									SQLLEN *pLen,
+ 									const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ 									rtl_TextEncoding _nTextEncoding,
+ 									sal_Bool _bUseOldTimeDate) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+Index: connectivity/source/inc/odbc/OStatement.hxx
+===================================================================
+--- connectivity/source/inc/odbc/OStatement.hxx	(revision 274960)
++++ connectivity/source/inc/odbc/OStatement.hxx	(working copy)
+@@ -130,7 +130,7 @@
+ 			*/
+ 			virtual OResultSet* createResulSet();
+ 
+-            sal_Int32 getRowCount () throw( ::com::sun::star::sdbc::SQLException);
++            SQLLEN getRowCount () throw( ::com::sun::star::sdbc::SQLException);
+ 
+ 
+ 			void disposeResultSet();
+Index: connectivity/source/inc/odbc/OFunctions.hxx
+===================================================================
+--- connectivity/source/inc/odbc/OFunctions.hxx	(revision 274960)
++++ connectivity/source/inc/odbc/OFunctions.hxx	(working copy)
+@@ -187,7 +187,7 @@
+ 													SQLSMALLINT *		StringLengthPtr,
+ 													SQLSMALLINT *		TypePtr,
+ 													SQLSMALLINT *		SubTypePtr,
+-													SQLINTEGER *		LengthPtr,
++													SQLLEN *			LengthPtr,
+ 													SQLSMALLINT *		PrecisionPtr,
+ 													SQLSMALLINT *		ScalePtr,
+ 													SQLSMALLINT *		NullablePtr);
+@@ -203,8 +203,8 @@
+ 													SQLSMALLINT			Precision,
+ 													SQLSMALLINT			Scale,
+ 													SQLPOINTER			DataPtr,
+-													SQLINTEGER *		StringLengthPtr,
+-													SQLINTEGER *		IndicatorPtr);
++													SQLLEN *			StringLengthPtr,
++													SQLLEN *			IndicatorPtr);
+ 
+ 	#define N3SQLSetDescRec(a,b,c,d,e,f,g,h,i,j) (*(T3SQLSetDescRec)getOdbcFunction(ODBC3SQLSetDescRec))(a,b,c,d,e,f,g,h,i,j)
+ 	*/
+@@ -221,11 +221,11 @@
+ 													SQLSMALLINT			InputOutputType,
+ 													SQLSMALLINT			ValueType,
+ 													SQLSMALLINT			ParameterType,
+-													SQLUINTEGER			ColumnSize,
++													SQLULEN				ColumnSize,
+ 													SQLSMALLINT			DecimalDigits,
+ 													SQLPOINTER			ParameterValuePtr,
+-													SQLINTEGER			BufferLength,
+-													SQLINTEGER *		StrLen_or_IndPtr);
++													SQLLEN				BufferLength,
++													SQLLEN *			StrLen_or_IndPtr);
+ 
+ 	#define N3SQLBindParameter(a,b,c,d,e,f,g,h,i,j) (*(T3SQLBindParameter)getOdbcFunction(ODBC3SQLBindParameter))(a,b,c,d,e,f,g,h,i,j)
+ 
+@@ -266,7 +266,7 @@
+ 	typedef SQLRETURN (SQL_API  *T3SQLDescribeParam) (SQLHSTMT			StatementHandle,
+ 													SQLUSMALLINT		ParameterNumber,
+ 													SQLSMALLINT *		DataTypePtr,
+-													SQLUINTEGER *		ParameterSizePtr,
++													SQLULEN *			ParameterSizePtr,
+ 													SQLSMALLINT *		DecimalDigitsPtr,
+ 													SQLSMALLINT *		NullablePtr);
+ 
+@@ -284,13 +284,13 @@
+ 
+ 	typedef SQLRETURN  (SQL_API  *T3SQLPutData) (		SQLHSTMT			StatementHandle,
+ 													SQLPOINTER			DataPtr,
+-													SQLINTEGER			StrLen_or_Ind);
++													SQLLEN				StrLen_or_Ind);
+ 
+ 	#define N3SQLPutData(a,b,c) (*(T3SQLPutData)getOdbcFunction(ODBC3SQLPutData))(a,b,c)
+ 
+ 	// Retrieving results and information about results
+ 	typedef SQLRETURN  (SQL_API  *T3SQLRowCount) (	SQLHSTMT			StatementHandle,
+-													SQLINTEGER *		RowCountPtr);
++													SQLLEN *			RowCountPtr);
+ 
+ 	#define N3SQLRowCount(a,b) (*(T3SQLRowCount)getOdbcFunction(ODBC3SQLRowCount))(a,b)
+ 
+@@ -300,12 +300,12 @@
+ 	#define N3SQLNumResultCols(a,b) (*(T3SQLNumResultCols)getOdbcFunction(ODBC3SQLNumResultCols))(a,b)
+ 
+ 	typedef SQLRETURN  (SQL_API  *T3SQLDescribeCol) (	SQLHSTMT			StatementHandle,
+-													SQLSMALLINT			ColumnNumber,
++													SQLUSMALLINT		ColumnNumber,
+ 													SQLCHAR *			ColumnName,
+ 													SQLSMALLINT			BufferLength,
+ 													SQLSMALLINT *		NameLengthPtr,
+ 													SQLSMALLINT *		DataTypePtr,
+-													SQLUINTEGER *		ColumnSizePtr,
++													SQLULEN *			ColumnSizePtr,
+ 													SQLSMALLINT *		DecimalDigitsPtr,
+ 													SQLSMALLINT *		NullablePtr);
+ 
+@@ -317,7 +317,7 @@
+ 													SQLPOINTER			CharacterAttributePtr,
+ 													SQLSMALLINT			BufferLength,
+ 													SQLSMALLINT *		StringLengthPtr,
+-													SQLPOINTER			NumericAttributePtr);
++													SQLLEN *			NumericAttributePtr);
+ 
+ 	#define N3SQLColAttribute(a,b,c,d,e,f,g) (*(T3SQLColAttribute)getOdbcFunction(ODBC3SQLColAttribute))(a,b,c,d,e,f,g)
+ 
+@@ -325,8 +325,8 @@
+ 													SQLUSMALLINT		ColumnNumber,
+ 													SQLSMALLINT			TargetType,
+ 													SQLPOINTER			TargetValuePtr,
+-													SQLINTEGER			BufferLength,
+-													SQLINTEGER *		StrLen_or_IndPtr);
++													SQLLEN				BufferLength,
++													SQLLEN *			StrLen_or_IndPtr);
+ 
+ 	#define N3SQLBindCol(a,b,c,d,e,f) (*(T3SQLBindCol)getOdbcFunction(ODBC3SQLBindCol))(a,b,c,d,e,f)
+ 
+@@ -336,7 +336,7 @@
+ 
+ 	typedef SQLRETURN  (SQL_API  *T3SQLFetchScroll) (	SQLHSTMT			StatementHandle,
+ 													SQLSMALLINT			FetchOrientation,
+-													SQLINTEGER			FetchOffset);
++													SQLLEN				FetchOffset);
+ 
+ 	#define N3SQLFetchScroll(a,b,c) (*(T3SQLFetchScroll)getOdbcFunction(ODBC3SQLFetchScroll))(a,b,c)
+ 
+@@ -344,20 +344,20 @@
+ 													SQLUSMALLINT		ColumnNumber,
+ 													SQLSMALLINT			TargetType,
+ 													SQLPOINTER			TargetValuePtr,
+-													SQLINTEGER			BufferLength,
+-													SQLINTEGER *		StrLen_or_IndPtr);
++													SQLLEN				BufferLength,
++													SQLLEN *			StrLen_or_IndPtr);
+ 
+ 	#define N3SQLGetData(a,b,c,d,e,f) (*(T3SQLGetData)getOdbcFunction(ODBC3SQLGetData))(a,b,c,d,e,f)
+ 
+ 	typedef SQLRETURN  (SQL_API  *T3SQLSetPos) (		SQLHSTMT			StatementHandle,
+-													SQLUSMALLINT		RowNumber,
++													SQLSETPOSIROW		RowNumber,
+ 													SQLUSMALLINT		Operation,
+ 													SQLUSMALLINT		LockType);
+ 
+ 	#define N3SQLSetPos(a,b,c,d) (*(T3SQLSetPos)getOdbcFunction(ODBC3SQLSetPos))(a,b,c,d)
+ 
+ 	typedef SQLRETURN  (SQL_API  *T3SQLBulkOperations) (	SQLHSTMT		StatementHandle,
+-														SQLUSMALLINT	Operation);
++														SQLSMALLINT	Operation);
+ 
+ 	#define N3SQLBulkOperations(a,b) (*(T3SQLBulkOperations)getOdbcFunction(ODBC3SQLBulkOperations))(a,b)
+ 
+@@ -461,15 +461,15 @@
+ 	#define N3SQLProcedures(a,b,c,d,e,f,g) (*(T3SQLProcedures)getOdbcFunction(ODBC3SQLProcedures))(a,b,c,d,e,f,g)
+ 
+ 	typedef SQLRETURN  (SQL_API  *T3SQLSpecialColumns) (SQLHSTMT			StatementHandle,
+-													SQLSMALLINT			IdentifierType,
++													SQLUSMALLINT		IdentifierType,
+ 													SQLCHAR *			CatalogName,
+ 													SQLSMALLINT			NameLength1,
+ 													SQLCHAR *			SchemaName,
+ 													SQLSMALLINT			NameLength2,
+ 													SQLCHAR *			TableName,
+ 													SQLSMALLINT			NameLength3,
+-													SQLSMALLINT			Scope,
+-													SQLSMALLINT			Nullable);
++													SQLUSMALLINT		Scope,
++													SQLUSMALLINT		Nullable);
+ 
+ 	#define N3SQLSpecialColumns(a,b,c,d,e,f,g,h,i,j) (*(T3SQLSpecialColumns)getOdbcFunction(ODBC3SQLSpecialColumns))(a,b,c,d,e,f,g,h,i,j)
+ 
+Index: connectivity/source/drivers/odbcbase/OConnection.cxx
+===================================================================
+--- connectivity/source/drivers/odbcbase/OConnection.cxx	(revision 274960)
++++ connectivity/source/drivers/odbcbase/OConnection.cxx	(working copy)
+@@ -108,7 +108,7 @@
+ 	SQLRETURN nSQLRETURN = 0;
+ 	SDB_ODBC_CHAR szConnStrOut[4096];
+ 	SDB_ODBC_CHAR szConnStrIn[2048];
+-	SWORD cbConnStrOut;
++	SQLSMALLINT cbConnStrOut;
+ 	memset(szConnStrOut,'\0',4096);
+ 	memset(szConnStrIn,'\0',2048);
+ 	::rtl::OString aConStr(::rtl::OUStringToOString(aConnectStr,getTextEncoding()));
+Index: connectivity/source/drivers/odbcbase/OTools.cxx
+===================================================================
+--- connectivity/source/drivers/odbcbase/OTools.cxx	(revision 274960)
++++ connectivity/source/drivers/odbcbase/OTools.cxx	(working copy)
+@@ -56,16 +56,16 @@
+ 						sal_Bool &_bWasNull,
+ 						const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ 						void* _pValue,
+-						SQLINTEGER _rSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
++						SQLLEN _nSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+ {
+     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen at sun.com", "OTools::getValue" );
+-	SQLINTEGER pcbValue = SQL_NULL_DATA;
++	SQLLEN pcbValue = SQL_NULL_DATA;
+ 	OTools::ThrowException(_pConnection,
+ 							(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
+ 										(SQLUSMALLINT)columnIndex,
+ 										_nType,
+ 										_pValue,
+-										(SQLINTEGER)_rSize,
++										_nSize,
+ 										&pcbValue),
+ 							_aStatementHandle,SQL_HANDLE_STMT,_xInterface,sal_False);
+ 	_bWasNull = pcbValue == SQL_NULL_DATA;
+@@ -86,12 +86,12 @@
+ {
+     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen at sun.com", "OTools::bindParameter" );
+ 	SQLRETURN nRetcode;
+-	SWORD   fSqlType;
+-	SWORD   fCType;
+-	SDWORD  nMaxLen = 0;
++	SQLSMALLINT fSqlType;
++	SQLSMALLINT fCType;
++	SQLLEN  nMaxLen = 0;
+ 	//	void*&   pData   = pDataBuffer;
+-	SQLINTEGER* pLen    = (SQLINTEGER*)pLenBuffer;
+-	SQLUINTEGER nColumnSize=0;
++	SQLLEN* pLen    = (SQLLEN*)pLenBuffer;
++	SQLULEN nColumnSize=0;
+ 	SQLSMALLINT	nDecimalDigits=0;
+ 
+ 	OTools::getBindTypes(_bUseWChar,_bUseOldTimeDate,_nODBCtype,fCType,fSqlType);
+@@ -123,10 +123,10 @@
+ void OTools::bindData(	SQLSMALLINT _nOdbcType,
+ 						sal_Bool _bUseWChar,
+ 						sal_Int8 *&_pData,
+-						SQLINTEGER*& pLen,
++						SQLLEN*& pLen,
+ 						const void* _pValue,
+ 						rtl_TextEncoding _nTextEncoding,
+-						SQLUINTEGER& _nColumnSize)
++						SQLULEN& _nColumnSize)
+ {
+     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen at sun.com", "OTools::bindData" );
+ 	_nColumnSize = 0;
+@@ -222,7 +222,7 @@
+ 			{
+ 				sal_Int32 nLen = 0;
+                 nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
+-				*pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
++				*pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
+ 			}
+ 			break;
+ 		case SQL_LONGVARCHAR:
+@@ -235,21 +235,21 @@
+ 				::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding));
+ 				nLen = aString.getLength();
+ 			}
+-			*pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
++			*pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
+ 		}   break;
+ 		case SQL_DATE:
+ 			*(DATE_STRUCT*)_pData = *(DATE_STRUCT*)_pValue;
+-			*pLen = (SDWORD)sizeof(DATE_STRUCT);
++			*pLen = (SQLLEN)sizeof(DATE_STRUCT);
+ 			_nColumnSize = 10;
+ 			break;
+ 		case SQL_TIME:
+ 			*(TIME_STRUCT*)_pData = *(TIME_STRUCT*)_pValue;
+-			*pLen = (SDWORD)sizeof(TIME_STRUCT);
++			*pLen = (SQLLEN)sizeof(TIME_STRUCT);
+ 			_nColumnSize = 8;
+ 			break;
+ 		case SQL_TIMESTAMP:
+ 			*(TIMESTAMP_STRUCT*)_pData = *(TIMESTAMP_STRUCT*)_pValue;
+-			*pLen = (SDWORD)sizeof(TIMESTAMP_STRUCT);
++			*pLen = (SQLLEN)sizeof(TIMESTAMP_STRUCT);
+ 			_nColumnSize = 19;
+ 			break;
+ 	}
+@@ -262,7 +262,7 @@
+ 						SQLSMALLINT _nMaxLen,
+ 						const void* _pValue,
+ 						void* _pData,
+-						SQLINTEGER *pLen,
++						SQLLEN *pLen,
+ 						const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ 						rtl_TextEncoding _nTextEncoding,
+ 						sal_Bool _bUseOldTimeDate) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+@@ -271,7 +271,7 @@
+ 	SQLRETURN nRetcode;
+ 	SQLSMALLINT   fSqlType;
+ 	SQLSMALLINT   fCType;
+-	SQLSMALLINT   nMaxLen = _nMaxLen;
++	SQLLEN nMaxLen = _nMaxLen;
+ 
+ 	OTools::getBindTypes(	sal_False,
+ 							_bUseOldTimeDate,
+@@ -375,7 +375,7 @@
+ 					_pData = (void*)(columnIndex);
+ 					sal_Int32 nLen = 0;
+                     nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
+-					*pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
++					*pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
+ 				}
+ 					break;
+ 				case SQL_LONGVARCHAR:
+@@ -383,7 +383,7 @@
+ 					_pData = (void*)(columnIndex);
+ 					sal_Int32 nLen = 0;
+ 					nLen = ((::rtl::OUString*)_pValue)->getLength();
+-					*pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
++					*pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
+ 				}   break;
+ 				case SQL_DATE:
+ 					*pLen = sizeof(DATE_STRUCT);
+@@ -446,10 +446,10 @@
+     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen at sun.com", "OTools::ThrowException" );
+ 
+ 	SDB_ODBC_CHAR szSqlState[5];
+-	SDWORD pfNativeError;
++	SQLINTEGER pfNativeError;
+ 	SDB_ODBC_CHAR szErrorMessage[SQL_MAX_MESSAGE_LENGTH];
+ 	szErrorMessage[0] = '\0';
+-	SWORD pcbErrorMsg = 0;
++	SQLSMALLINT pcbErrorMsg = 0;
+ 
+ 	// Informationen zur letzten Operation:
+ 	// wenn hstmt != SQL_NULL_HSTMT ist (Benutzung von SetStatus in SdbCursor, SdbTable, ...),
+@@ -478,7 +478,7 @@
+ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
+ 										 SQLHANDLE _aStatementHandle,
+ 										 sal_Int32 columnIndex,
+-										 SWORD  _fSqlType,
++										 SQLSMALLINT _fSqlType,
+ 										 sal_Bool &_bWasNull,
+ 										 const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException)
+ {
+@@ -486,14 +486,14 @@
+ 	char aCharArray[2048];
+ 	// Erstmal versuchen, die Daten mit dem kleinen Puffer
+ 	// abzuholen:
+-	SQLINTEGER nMaxLen = sizeof aCharArray - 1;
++	SQLLEN nMaxLen = sizeof aCharArray - 1;
+ 	//	GETDATA(SQL_C_CHAR,aCharArray,nMaxLen);
+-	SQLINTEGER pcbValue = 0;
++	SQLLEN pcbValue = 0;
+ 	OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
+ 										(SQLUSMALLINT)columnIndex,
+ 										_fSqlType,
+ 										(SQLPOINTER)aCharArray,
+-										(SQLINTEGER)nMaxLen,
++										nMaxLen,
+ 										&pcbValue),
+ 							_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
+ 
+@@ -540,7 +540,7 @@
+ ::rtl::OUString OTools::getStringValue(OConnection* _pConnection,
+ 									   SQLHANDLE _aStatementHandle,
+ 									   sal_Int32 columnIndex,
+-									   SWORD  _fSqlType,
++									   SQLSMALLINT _fSqlType,
+ 									   sal_Bool &_bWasNull,
+ 									   const Reference< XInterface >& _xInterface,
+ 									   rtl_TextEncoding _nTextEncoding) throw(SQLException, RuntimeException)
+@@ -555,15 +555,15 @@
+ 		{
+ 			sal_Unicode waCharArray[2048];
+ 			// read the unicode data
+-			sal_Int32 nMaxLen = (sizeof(waCharArray) / sizeof(sal_Unicode)) - 1;
++			SQLLEN nMaxLen = (sizeof(waCharArray) / sizeof(sal_Unicode)) - 1;
+ 			//	GETDATA(SQL_C_WCHAR, waCharArray, nMaxLen + sizeof(sal_Unicode));
+ 
+-			SQLINTEGER pcbValue=0;
++			SQLLEN pcbValue=0;
+ 			OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
+ 												(SQLUSMALLINT)columnIndex,
+ 												SQL_C_WCHAR,
+ 												&waCharArray,
+-												(SQLINTEGER)nMaxLen*sizeof(sal_Unicode),
++												(SQLLEN)nMaxLen*sizeof(sal_Unicode),
+ 												&pcbValue),
+ 									_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
+ 			_bWasNull = pcbValue == SQL_NULL_DATA;
+@@ -571,7 +571,7 @@
+ 				return ::rtl::OUString();
+ 			// Bei Fehler bricht der GETDATA-Makro mit return ab,
+ 			// bei NULL mit break!
+-			SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
++			SQLLEN nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
+ 			waCharArray[nLen] = 0;
+ 			aData = ::rtl::OUString(waCharArray);
+ 
+@@ -595,7 +595,7 @@
+ 												(SQLUSMALLINT)columnIndex,
+ 												SQL_C_WCHAR,
+ 												&waCharArray,
+-												(SQLINTEGER)nLen+1,
++												(SQLLEN)nLen+1,
+ 												&pcbValue),
+ 									_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
+ 				nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
+@@ -610,21 +610,21 @@
+ 			char aCharArray[2048];
+ 			// Erstmal versuchen, die Daten mit dem kleinen Puffer
+ 			// abzuholen:
+-			SDWORD nMaxLen = sizeof aCharArray - 1;
++			SQLLEN nMaxLen = sizeof aCharArray - 1;
+ 			//	GETDATA(SQL_C_CHAR,aCharArray,nMaxLen);
+-			SQLINTEGER pcbValue = 0;
++			SQLLEN pcbValue = 0;
+ 			OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
+ 												(SQLUSMALLINT)columnIndex,
+ 												SQL_C_CHAR,
+ 												&aCharArray,
+-												(SQLINTEGER)nMaxLen,
++												nMaxLen,
+ 												&pcbValue),
+ 									_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
+ 			_bWasNull = pcbValue == SQL_NULL_DATA;
+ 			if(_bWasNull)
+ 				return ::rtl::OUString();
+ 
+-			SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
++			SQLLEN nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
+ 			aCharArray[nLen] = 0;
+ 			if ( ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) && aCharArray[nLen-1] == 0 && nLen > 0 )
+ 				--nLen;
+Index: connectivity/source/drivers/odbcbase/OStatement.cxx
+===================================================================
+--- connectivity/source/drivers/odbcbase/OStatement.cxx	(revision 274960)
++++ connectivity/source/drivers/odbcbase/OStatement.cxx	(working copy)
+@@ -250,13 +250,13 @@
+     m_xResultSet = Reference< XResultSet >();
+ }
+ //--------------------------------------------------------------------
+-sal_Int32 OStatement_Base::getRowCount () throw( SQLException)
++SQLLEN OStatement_Base::getRowCount () throw( SQLException)
+ {
+ 	::osl::MutexGuard aGuard( m_aMutex );
+ 	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ 
+ 
+-	sal_Int32	numRows = 0;
++	SQLLEN numRows = 0;
+ 
+ 	try {
+ 		THROW_SQL(N3SQLRowCount(m_aStatementHandle,&numRows));
+@@ -523,7 +523,9 @@
+ 		SQLRETURN nError = N3SQLMoreResults(m_aStatementHandle);
+ 		if(nError == SQL_SUCCESS)
+ 		{
+-			N3SQLRowCount(m_aStatementHandle,&pArray[j]);
++			SQLLEN nRowCount=0;
++			N3SQLRowCount(m_aStatementHandle,&nRowCount);
++			pArray[j] = nRowCount;
+ 		}
+ 	}
+ 	return aRet;
+Index: connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
+===================================================================
+--- connectivity/source/drivers/odbcbase/OPreparedStatement.cxx	(revision 274960)
++++ connectivity/source/drivers/odbcbase/OPreparedStatement.cxx	(working copy)
+@@ -446,11 +446,11 @@
+ 	checkParameterIndex(parameterIndex);
+ 
+ 	sal_Int8* lenBuf = getLengthBuf (parameterIndex);
+-	*(SDWORD*)lenBuf = SQL_NULL_DATA;
++	*(SQLLEN*)lenBuf = SQL_NULL_DATA;
+ 
+ 
+-	SQLINTEGER	prec = 0;
+-	SQLUINTEGER nColumnSize = 0;
++	SQLLEN prec = 0;
++	SQLULEN nColumnSize = 0;
+ 	if (sqlType == SQL_CHAR || sqlType == SQL_VARCHAR || sqlType == SQL_LONGVARCHAR)
+ 	{
+ 		prec = 1;
+@@ -476,7 +476,7 @@
+ 											nDecimalDigits,
+ 											NULL,
+ 											prec,
+-											(SDWORD*)lenBuf
++											(SQLLEN*)lenBuf
+ 											);
+ 	OTools::ThrowException(m_pConnection,nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+ }
+@@ -861,7 +861,7 @@
+ 
+     // Bind the parameter with SQL_LEN_DATA_AT_EXEC
+ 	SQLSMALLINT   Ctype = SQL_C_CHAR;
+-	SDWORD	atExec = SQL_LEN_DATA_AT_EXEC (length);
++	SQLLEN	atExec = SQL_LEN_DATA_AT_EXEC (length);
+ 	memcpy (dataBuf, &ParameterIndex, sizeof(ParameterIndex));
+ 	memcpy (lenBuf, &atExec, sizeof (atExec));
+ 
+@@ -872,14 +872,14 @@
+ 	OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
+ 	N3SQLBindParameter(m_aStatementHandle,
+ 						(SQLUSMALLINT)ParameterIndex,
+-						(SQLSMALLINT)SQL_PARAM_INPUT,
++						(SQLUSMALLINT)SQL_PARAM_INPUT,
+ 						Ctype,
+ 						(SQLSMALLINT)SQLtype,
+-						(SQLUINTEGER)length,
++						(SQLULEN)length,
+ 						0,
+ 						dataBuf,
+ 						sizeof(ParameterIndex),
+-						(SDWORD*)lenBuf);
++						(SQLLEN*)lenBuf);
+ 
+ 	// Save the input stream
+ 	boundParams[ParameterIndex - 1].setInputStream (x, length);
+Index: connectivity/source/drivers/odbcbase/OResultSet.cxx
+===================================================================
+--- connectivity/source/drivers/odbcbase/OResultSet.cxx	(revision 274960)
++++ connectivity/source/drivers/odbcbase/OResultSet.cxx	(working copy)
+@@ -843,8 +843,8 @@
+ 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ 
+ 
+-	SQLSMALLINT nMaxLen = 20;
+-	SQLINTEGER nRealLen = 0;
++	SQLLEN nMaxLen = 20;
++	SQLLEN nRealLen = 0;
+ 	Sequence<sal_Int8> aBookmark(nMaxLen);
+ 
+ 	SQLRETURN nRet = N3SQLBindCol(m_aStatementHandle,
+@@ -925,7 +925,7 @@
+     sal_Bool bPositionByBookmark = ( NULL != getOdbcFunction( ODBC3SQLBulkOperations ) );
+ 	if ( bPositionByBookmark )
+ 	{
+-		SQLINTEGER nRealLen = 0;
++		SQLLEN nRealLen = 0;
+ 		nRet = N3SQLBindCol(m_aStatementHandle,
+ 							0,
+ 							SQL_C_VARBOOKMARK,
+Index: connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
+===================================================================
+--- connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx	(revision 274960)
++++ connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx	(working copy)
+@@ -86,13 +86,13 @@
+ 	return  sValue;
+ }
+ // -------------------------------------------------------------------------
+-SWORD OResultSetMetaData::getNumColAttrib(OConnection* _pConnection
++SQLLEN OResultSetMetaData::getNumColAttrib(OConnection* _pConnection
+                                               ,SQLHANDLE _aStatementHandle
+                                               ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
+                                               ,sal_Int32 _column
+                                               ,sal_Int32 _ident) throw(SQLException, RuntimeException)
+ {
+-	SWORD nValue=0;
++	SQLLEN nValue=0;
+ 	OTools::ThrowException(_pConnection,(*(T3SQLColAttribute)_pConnection->getOdbcFunction(ODBC3SQLColAttribute))(_aStatementHandle,
+ 										 (SQLUSMALLINT)_column,
+ 										 (SQLUSMALLINT)_ident,
+@@ -117,13 +117,13 @@
+ 	return getNumColAttrib(column,SQL_DESC_DISPLAY_SIZE);
+ }
+ // -------------------------------------------------------------------------
+-SWORD OResultSetMetaData::getColumnODBCType(OConnection* _pConnection
++SQLSMALLINT OResultSetMetaData::getColumnODBCType(OConnection* _pConnection
+                                               ,SQLHANDLE _aStatementHandle
+                                               ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
+                                               ,sal_Int32 column)
+                                                throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+ {
+-    SWORD nType = 0;
++    SQLSMALLINT nType = 0;
+     try
+ 	{
+ 		nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE);
+Index: unixODBC/inc/sql.h
+===================================================================
+--- unixODBC/inc/sql.h	(revision 274960)
++++ unixODBC/inc/sql.h	(working copy)
+@@ -7,6 +7,7 @@
+ #ifndef __SQL_H
+ #define __SQL_H
+ 
++
+ /****************************
+  * default to 3.51 declare something else before here and you get a whole new ball of wax
+  ***************************/
+@@ -14,7 +15,9 @@
+ #define ODBCVER 0x0351
+ #endif
+ 
++#ifndef __SQLTYPES_H
+ #include "sqltypes.h"
++#endif
+ 
+ #ifdef __cplusplus
+ extern "C" {
+@@ -270,6 +273,7 @@
+ #define SQL_NULL_HSTMT      0
+ #if (ODBCVER >= 0x0300)
+ #define SQL_NULL_HDESC      0
++#define SQL_NULL_DESC       0
+ #endif
+ 
+ /* null handle used in place of parent handle when allocating HENV */
+@@ -562,254 +566,257 @@
+ #define SQL_NC_HIGH                         0
+ #define SQL_NC_LOW                          1
+ 
+-SQLRETURN   SQLAllocConnect(SQLHENV EnvironmentHandle,
+-           SQLHDBC *ConnectionHandle);
++    SQLRETURN  SQL_API SQLAllocConnect(SQLHENV EnvironmentHandle,
++                                       SQLHDBC *ConnectionHandle);
+ 
+-SQLRETURN   SQLAllocEnv(SQLHENV *EnvironmentHandle);
++    SQLRETURN  SQL_API SQLAllocEnv(SQLHENV *EnvironmentHandle);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLAllocHandle(SQLSMALLINT HandleType,
+-           SQLHANDLE InputHandle, SQLHANDLE *OutputHandle);
++    SQLRETURN  SQL_API SQLAllocHandle(SQLSMALLINT HandleType,
++                                      SQLHANDLE InputHandle, SQLHANDLE *OutputHandle);
+ #endif
+ 
+-SQLRETURN   SQLAllocStmt(SQLHDBC ConnectionHandle,
+-           SQLHSTMT *StatementHandle);
++    SQLRETURN  SQL_API SQLAllocStmt(SQLHDBC ConnectionHandle,
++                                    SQLHSTMT *StatementHandle);
+ 
+-SQLRETURN   SQLBindCol(SQLHSTMT StatementHandle,
+-		   SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
+-		   SQLPOINTER TargetValue, SQLINTEGER BufferLength,
+-	   	   SQLINTEGER *StrLen_or_Ind);
++    SQLRETURN  SQL_API SQLBindCol(SQLHSTMT StatementHandle,
++                                  SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
++                                  SQLPOINTER TargetValue, SQLLEN BufferLength,
++                                  SQLLEN *StrLen_or_Ind);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLBindParam(SQLHSTMT StatementHandle,
+-           SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
+-           SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
+-           SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
+-           SQLINTEGER *StrLen_or_Ind);
++    SQLRETURN  SQL_API SQLBindParam(SQLHSTMT StatementHandle,
++                                    SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
++                                    SQLSMALLINT ParameterType, SQLULEN LengthPrecision,
++                                    SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
++                                    SQLLEN *StrLen_or_Ind);
+ #endif
+ 
+-SQLRETURN   SQLCancel(SQLHSTMT StatementHandle);
++    SQLRETURN  SQL_API SQLCancel(SQLHSTMT StatementHandle);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLCloseCursor(SQLHSTMT StatementHandle);
++    SQLRETURN  SQL_API SQLCloseCursor(SQLHSTMT StatementHandle);
+ 
+-SQLRETURN   SQLColAttribute (SQLHSTMT StatementHandle,
+-           SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
+-           SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
+-           SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute);
++    SQLRETURN  SQL_API SQLColAttribute(SQLHSTMT StatementHandle,
++                                        SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
++                                        SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
++                                        SQLSMALLINT *StringLength, SQLLEN *NumericAttribute 
++										/* spec says (SQLPOINTER) not (SQLEN*) - PAH */ );
++										/* Ms now say SQLLEN* http://msdn.microsoft.com/library/en-us/odbc/htm/dasdkodbcoverview_64bit.asp - NG */
++										
+ #endif
+ 
+ 
+-SQLRETURN   SQLColumns(SQLHSTMT StatementHandle,
+-           SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
+-           SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
+-           SQLCHAR *TableName, SQLSMALLINT NameLength3,
+-           SQLCHAR *ColumnName, SQLSMALLINT NameLength4);
++    SQLRETURN  SQL_API SQLColumns(SQLHSTMT StatementHandle,
++                                  SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
++                                  SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
++                                  SQLCHAR *TableName, SQLSMALLINT NameLength3,
++                                  SQLCHAR *ColumnName, SQLSMALLINT NameLength4);
+ 
+ 
+-SQLRETURN   SQLConnect(SQLHDBC ConnectionHandle,
+-           SQLCHAR *ServerName, SQLSMALLINT NameLength1,
+-           SQLCHAR *UserName, SQLSMALLINT NameLength2,
+-           SQLCHAR *Authentication, SQLSMALLINT NameLength3);
++    SQLRETURN  SQL_API SQLConnect(SQLHDBC ConnectionHandle,
++                                  SQLCHAR *ServerName, SQLSMALLINT NameLength1,
++                                  SQLCHAR *UserName, SQLSMALLINT NameLength2,
++                                  SQLCHAR *Authentication, SQLSMALLINT NameLength3);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLCopyDesc(SQLHDESC SourceDescHandle,
+-           SQLHDESC TargetDescHandle);
++    SQLRETURN  SQL_API SQLCopyDesc(SQLHDESC SourceDescHandle,
++                                   SQLHDESC TargetDescHandle);
+ #endif
+ 
+-SQLRETURN   SQLDataSources(SQLHENV EnvironmentHandle,
+-           SQLUSMALLINT Direction, SQLCHAR *ServerName,
+-           SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
+-           SQLCHAR *Description, SQLSMALLINT BufferLength2,
+-           SQLSMALLINT *NameLength2);
++    SQLRETURN  SQL_API SQLDataSources(SQLHENV EnvironmentHandle,
++                                      SQLUSMALLINT Direction, SQLCHAR *ServerName,
++                                      SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
++                                      SQLCHAR *Description, SQLSMALLINT BufferLength2,
++                                      SQLSMALLINT *NameLength2);
+ 
+-SQLRETURN   SQLDescribeCol(SQLHSTMT StatementHandle,
+-           SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
+-           SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
+-           SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize,
+-           SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable);
++    SQLRETURN  SQL_API SQLDescribeCol(SQLHSTMT StatementHandle,
++                                      SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
++                                      SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
++                                      SQLSMALLINT *DataType, SQLULEN *ColumnSize,
++                                      SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable);
+ 
+-SQLRETURN   SQLDisconnect(SQLHDBC ConnectionHandle);
++    SQLRETURN  SQL_API SQLDisconnect(SQLHDBC ConnectionHandle);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle,
+-           SQLSMALLINT CompletionType);
++    SQLRETURN  SQL_API SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle,
++                                  SQLSMALLINT CompletionType);
+ #endif
+ 
+-SQLRETURN   SQLError(SQLHENV EnvironmentHandle,
+-           SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
+-           SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
+-           SQLCHAR *MessageText, SQLSMALLINT BufferLength,
+-           SQLSMALLINT *TextLength);
++    SQLRETURN  SQL_API SQLError(SQLHENV EnvironmentHandle,
++                                SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
++                                SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
++                                SQLCHAR *MessageText, SQLSMALLINT BufferLength,
++                                SQLSMALLINT *TextLength);
+ 
+-SQLRETURN   SQLExecDirect(SQLHSTMT StatementHandle,
+-           SQLCHAR *StatementText, SQLINTEGER TextLength);
++    SQLRETURN  SQL_API SQLExecDirect(SQLHSTMT StatementHandle,
++                                     SQLCHAR *StatementText, SQLINTEGER TextLength);
+ 
+-SQLRETURN   SQLExecute(SQLHSTMT StatementHandle);
++    SQLRETURN  SQL_API SQLExecute(SQLHSTMT StatementHandle);
+ 
+-SQLRETURN   SQLFetch(SQLHSTMT StatementHandle);
++    SQLRETURN  SQL_API SQLFetch(SQLHSTMT StatementHandle);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLFetchScroll(SQLHSTMT StatementHandle,
+-           SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset);
++    SQLRETURN  SQL_API SQLFetchScroll(SQLHSTMT StatementHandle,
++                                      SQLSMALLINT FetchOrientation, SQLLEN FetchOffset);
+ #endif
+ 
+-SQLRETURN   SQLFreeConnect(SQLHDBC ConnectionHandle);
++    SQLRETURN  SQL_API SQLFreeConnect(SQLHDBC ConnectionHandle);
+ 
+-SQLRETURN   SQLFreeEnv(SQLHENV EnvironmentHandle);
++    SQLRETURN  SQL_API SQLFreeEnv(SQLHENV EnvironmentHandle);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle);
++    SQLRETURN  SQL_API SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle);
+ #endif
+ 
+-SQLRETURN   SQLFreeStmt(SQLHSTMT StatementHandle,
+-           SQLUSMALLINT Option);
++    SQLRETURN  SQL_API SQLFreeStmt(SQLHSTMT StatementHandle,
++                                   SQLUSMALLINT Option);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLGetConnectAttr(SQLHDBC ConnectionHandle,
+-           SQLINTEGER Attribute, SQLPOINTER Value,
+-           SQLINTEGER BufferLength, SQLINTEGER *StringLength);
++    SQLRETURN  SQL_API SQLGetConnectAttr(SQLHDBC ConnectionHandle,
++                                         SQLINTEGER Attribute, SQLPOINTER Value,
++                                         SQLINTEGER BufferLength, SQLINTEGER *StringLength);
+ #endif
+ 
+-SQLRETURN   SQLGetConnectOption(SQLHDBC ConnectionHandle,
+-           SQLUSMALLINT Option, SQLPOINTER Value);
++    SQLRETURN  SQL_API SQLGetConnectOption(SQLHDBC ConnectionHandle,
++                                           SQLUSMALLINT Option, SQLPOINTER Value);
+ 
+-SQLRETURN   SQLGetCursorName(SQLHSTMT StatementHandle,
+-           SQLCHAR *CursorName, SQLSMALLINT BufferLength,
+-           SQLSMALLINT *NameLength);
++    SQLRETURN  SQL_API SQLGetCursorName(SQLHSTMT StatementHandle,
++                                        SQLCHAR *CursorName, SQLSMALLINT BufferLength,
++                                        SQLSMALLINT *NameLength);
+ 
+-SQLRETURN   SQLGetData(SQLHSTMT StatementHandle,
+-           SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
+-           SQLPOINTER TargetValue, SQLINTEGER BufferLength,
+-           SQLINTEGER *StrLen_or_Ind);
++    SQLRETURN  SQL_API SQLGetData(SQLHSTMT StatementHandle,
++                                  SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
++                                  SQLPOINTER TargetValue, SQLLEN BufferLength,
++                                  SQLLEN *StrLen_or_Ind);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLGetDescField(SQLHDESC DescriptorHandle,
+-           SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
+-           SQLPOINTER Value, SQLINTEGER BufferLength,
+-           SQLINTEGER *StringLength);
++    SQLRETURN   SQLGetDescField(SQLHDESC DescriptorHandle,
++                                SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
++                                SQLPOINTER Value, SQLINTEGER BufferLength,
++                                SQLINTEGER *StringLength);
+ 
+-SQLRETURN   SQLGetDescRec(SQLHDESC DescriptorHandle,
+-           SQLSMALLINT RecNumber, SQLCHAR *Name,
+-           SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
+-           SQLSMALLINT *Type, SQLSMALLINT *SubType,
+-           SQLINTEGER *Length, SQLSMALLINT *Precision,
+-           SQLSMALLINT *Scale, SQLSMALLINT *Nullable);
++    SQLRETURN  SQL_API SQLGetDescRec(SQLHDESC DescriptorHandle,
++                                     SQLSMALLINT RecNumber, SQLCHAR *Name,
++                                     SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
++                                     SQLSMALLINT *Type, SQLSMALLINT *SubType,
++                                     SQLLEN *Length, SQLSMALLINT *Precision,
++                                     SQLSMALLINT *Scale, SQLSMALLINT *Nullable);
+ 
+-SQLRETURN   SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
+-           SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
+-           SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
+-           SQLSMALLINT *StringLength);
++    SQLRETURN  SQL_API SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
++                                       SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
++                                       SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
++                                       SQLSMALLINT *StringLength);
+ 
+-SQLRETURN   SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle,
+-           SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
+-           SQLINTEGER *NativeError, SQLCHAR *MessageText,
+-           SQLSMALLINT BufferLength, SQLSMALLINT *TextLength);
++    SQLRETURN  SQL_API SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle,
++                                     SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
++                                     SQLINTEGER *NativeError, SQLCHAR *MessageText,
++                                     SQLSMALLINT BufferLength, SQLSMALLINT *TextLength);
+ 
+-SQLRETURN   SQLGetEnvAttr(SQLHENV EnvironmentHandle,
+-           SQLINTEGER Attribute, SQLPOINTER Value,
+-           SQLINTEGER BufferLength, SQLINTEGER *StringLength);
++    SQLRETURN  SQL_API SQLGetEnvAttr(SQLHENV EnvironmentHandle,
++                                     SQLINTEGER Attribute, SQLPOINTER Value,
++                                     SQLINTEGER BufferLength, SQLINTEGER *StringLength);
+ #endif  /* ODBCVER >= 0x0300 */
+ 
+-SQLRETURN   SQLGetFunctions(SQLHDBC ConnectionHandle,
+-           SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported);
++    SQLRETURN  SQL_API SQLGetFunctions(SQLHDBC ConnectionHandle,
++                                       SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported);
+ 
+-SQLRETURN   SQLGetInfo(SQLHDBC ConnectionHandle,
+-           SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
+-           SQLSMALLINT BufferLength, SQLSMALLINT *StringLength);
++    SQLRETURN  SQL_API SQLGetInfo(SQLHDBC ConnectionHandle,
++                                  SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
++                                  SQLSMALLINT BufferLength, SQLSMALLINT *StringLength);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLGetStmtAttr(SQLHSTMT StatementHandle,
+-           SQLINTEGER Attribute, SQLPOINTER Value,
+-           SQLINTEGER BufferLength, SQLINTEGER *StringLength);
++    SQLRETURN  SQL_API SQLGetStmtAttr(SQLHSTMT StatementHandle,
++                                      SQLINTEGER Attribute, SQLPOINTER Value,
++                                      SQLINTEGER BufferLength, SQLINTEGER *StringLength);
+ #endif  /* ODBCVER >= 0x0300 */
+ 
+-SQLRETURN   SQLGetStmtOption(SQLHSTMT StatementHandle,
+-           SQLUSMALLINT Option, SQLPOINTER Value);
++    SQLRETURN  SQL_API SQLGetStmtOption(SQLHSTMT StatementHandle,
++                                        SQLUSMALLINT Option, SQLPOINTER Value);
+ 
+-SQLRETURN   SQLGetTypeInfo(SQLHSTMT StatementHandle,
+-           SQLSMALLINT DataType);
++    SQLRETURN  SQL_API SQLGetTypeInfo(SQLHSTMT StatementHandle,
++                                      SQLSMALLINT DataType);
+ 
+-SQLRETURN   SQLNumResultCols(SQLHSTMT StatementHandle,
+-           SQLSMALLINT *ColumnCount);
++    SQLRETURN  SQL_API SQLNumResultCols(SQLHSTMT StatementHandle,
++                                        SQLSMALLINT *ColumnCount);
+ 
+-SQLRETURN   SQLParamData(SQLHSTMT StatementHandle,
+-           SQLPOINTER *Value);
++    SQLRETURN  SQL_API SQLParamData(SQLHSTMT StatementHandle,
++                                    SQLPOINTER *Value);
+ 
+-SQLRETURN   SQLPrepare(SQLHSTMT StatementHandle,
+-           SQLCHAR *StatementText, SQLINTEGER TextLength);
++    SQLRETURN  SQL_API SQLPrepare(SQLHSTMT StatementHandle,
++                                  SQLCHAR *StatementText, SQLINTEGER TextLength);
+ 
+-SQLRETURN   SQLPutData(SQLHSTMT StatementHandle,
+-           SQLPOINTER Data, SQLINTEGER StrLen_or_Ind);
++    SQLRETURN  SQL_API SQLPutData(SQLHSTMT StatementHandle,
++                                  SQLPOINTER Data, SQLLEN StrLen_or_Ind);
+ 
+-SQLRETURN   SQLRowCount(SQLHSTMT StatementHandle,
+-	   SQLINTEGER *RowCount);
++    SQLRETURN  SQL_API SQLRowCount(SQLHSTMT StatementHandle,
++                                   SQLLEN *RowCount);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLSetConnectAttr(SQLHDBC ConnectionHandle,
+-           SQLINTEGER Attribute, SQLPOINTER Value,
+-           SQLINTEGER StringLength);
++    SQLRETURN  SQL_API SQLSetConnectAttr(SQLHDBC ConnectionHandle,
++                                         SQLINTEGER Attribute, SQLPOINTER Value,
++                                         SQLINTEGER StringLength);
+ #endif /* ODBCVER >= 0x0300 */
+ 
+-SQLRETURN   SQLSetConnectOption(SQLHDBC ConnectionHandle,
+-           SQLUSMALLINT Option, SQLUINTEGER Value);
++    SQLRETURN  SQL_API SQLSetConnectOption(SQLHDBC ConnectionHandle,
++                                           SQLUSMALLINT Option, SQLULEN Value);
+ 
+-SQLRETURN   SQLSetCursorName(SQLHSTMT StatementHandle,
+-           SQLCHAR *CursorName, SQLSMALLINT NameLength);
++    SQLRETURN  SQL_API SQLSetCursorName(SQLHSTMT StatementHandle,
++                                        SQLCHAR *CursorName, SQLSMALLINT NameLength);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLSetDescField(SQLHDESC DescriptorHandle,
+-           SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
+-           SQLPOINTER Value, SQLINTEGER BufferLength);
++    SQLRETURN  SQL_API SQLSetDescField(SQLHDESC DescriptorHandle,
++                                       SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
++                                       SQLPOINTER Value, SQLINTEGER BufferLength);
+ 
+-SQLRETURN   SQLSetDescRec(SQLHDESC DescriptorHandle,
+-           SQLSMALLINT RecNumber, SQLSMALLINT Type,
+-           SQLSMALLINT SubType, SQLINTEGER Length,
+-           SQLSMALLINT Precision, SQLSMALLINT Scale,
+-           SQLPOINTER Data, SQLINTEGER *StringLength,
+-           SQLINTEGER *Indicator);
++    SQLRETURN  SQL_API SQLSetDescRec(SQLHDESC DescriptorHandle,
++                                     SQLSMALLINT RecNumber, SQLSMALLINT Type,
++                                     SQLSMALLINT SubType, SQLLEN Length,
++                                     SQLSMALLINT Precision, SQLSMALLINT Scale,
++                                     SQLPOINTER Data, SQLLEN *StringLength,
++                                     SQLLEN *Indicator);
+ 
+-SQLRETURN   SQLSetEnvAttr(SQLHENV EnvironmentHandle,
+-           SQLINTEGER Attribute, SQLPOINTER Value,
+-           SQLINTEGER StringLength);
++    SQLRETURN  SQL_API SQLSetEnvAttr(SQLHENV EnvironmentHandle,
++                                     SQLINTEGER Attribute, SQLPOINTER Value,
++                                     SQLINTEGER StringLength);
+ #endif /* ODBCVER >= 0x0300 */
+ 
+-SQLRETURN   SQLSetParam(SQLHSTMT StatementHandle,
+-           SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
+-           SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
+-           SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
+-           SQLINTEGER *StrLen_or_Ind);
++    SQLRETURN  SQL_API SQLSetParam(SQLHSTMT StatementHandle,
++                                   SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
++                                   SQLSMALLINT ParameterType, SQLULEN LengthPrecision,
++                                   SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
++                                   SQLLEN *StrLen_or_Ind);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN   SQLSetStmtAttr(SQLHSTMT StatementHandle,
+-           SQLINTEGER Attribute, SQLPOINTER Value,
+-           SQLINTEGER StringLength);
++    SQLRETURN  SQL_API SQLSetStmtAttr(SQLHSTMT StatementHandle,
++                                      SQLINTEGER Attribute, SQLPOINTER Value,
++                                      SQLINTEGER StringLength);
+ #endif
+ 
+-SQLRETURN   SQLSetStmtOption(SQLHSTMT StatementHandle,
+-           SQLUSMALLINT Option, SQLUINTEGER Value);
++    SQLRETURN  SQL_API SQLSetStmtOption(SQLHSTMT StatementHandle,
++                                        SQLUSMALLINT Option, SQLULEN Value);
+ 
+-SQLRETURN   SQLSpecialColumns(SQLHSTMT StatementHandle,
+-           SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
+-           SQLSMALLINT NameLength1, SQLCHAR *SchemaName,
+-           SQLSMALLINT NameLength2, SQLCHAR *TableName,
+-           SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
+-           SQLUSMALLINT Nullable);
++    SQLRETURN  SQL_API SQLSpecialColumns(SQLHSTMT StatementHandle,
++                                         SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
++                                         SQLSMALLINT NameLength1, SQLCHAR *SchemaName,
++                                         SQLSMALLINT NameLength2, SQLCHAR *TableName,
++                                         SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
++                                         SQLUSMALLINT Nullable);
+ 
+-SQLRETURN   SQLStatistics(SQLHSTMT StatementHandle,
+-           SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
+-           SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
+-           SQLCHAR *TableName, SQLSMALLINT NameLength3,
+-           SQLUSMALLINT Unique, SQLUSMALLINT Reserved);
++    SQLRETURN  SQL_API SQLStatistics(SQLHSTMT StatementHandle,
++                                     SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
++                                     SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
++                                     SQLCHAR *TableName, SQLSMALLINT NameLength3,
++                                     SQLUSMALLINT Unique, SQLUSMALLINT Reserved);
+ 
+-SQLRETURN   SQLTables(SQLHSTMT StatementHandle,
+-           SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
+-           SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
+-           SQLCHAR *TableName, SQLSMALLINT NameLength3,
+-           SQLCHAR *TableType, SQLSMALLINT NameLength4);
++    SQLRETURN   SQL_API SQLTables(SQLHSTMT StatementHandle,
++                                  SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
++                                  SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
++                                  SQLCHAR *TableName, SQLSMALLINT NameLength3,
++                                  SQLCHAR *TableType, SQLSMALLINT NameLength4);
+ 
+-SQLRETURN   SQLTransact(SQLHENV EnvironmentHandle,
+-           SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType);
++    SQLRETURN  SQL_API SQLTransact(SQLHENV EnvironmentHandle,
++                                   SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType);
+ 
+ #ifdef __cplusplus
+ }
+Index: unixODBC/inc/sqlext.h
+===================================================================
+--- unixODBC/inc/sqlext.h	(revision 274960)
++++ unixODBC/inc/sqlext.h	(working copy)
+@@ -39,7 +39,9 @@
+ 
+ /* END - unixODBC ONLY */
+ 
++#ifndef __SQL_H
+ #include "sql.h"
++#endif
+ 
+ #ifdef __cplusplus
+ extern "C" {                         /* Assume C declarations for C++ */
+@@ -47,8 +49,8 @@
+ 
+ /* generally useful constants */
+ #define SQL_SPEC_MAJOR     3     	/* Major version of specification  */
+-#define SQL_SPEC_MINOR	   51     	/* Minor version of specification  */
+-#define SQL_SPEC_STRING   "03.51"	/* String constant for version */
++#define SQL_SPEC_MINOR	   52     	/* Minor version of specification  */
++#define SQL_SPEC_STRING   "03.52"	/* String constant for version */
+ 
+ #define SQL_SQLSTATE_SIZE	5	/* size of SQLSTATE */
+ #define SQL_MAX_DSN_LENGTH	32	/* maximum data source name size */
+@@ -72,6 +74,11 @@
+ #define SQL_ATTR_ODBC_VERSION				200
+ #define SQL_ATTR_CONNECTION_POOLING			201
+ #define SQL_ATTR_CP_MATCH					202
++
++/* unixODBC additions */
++#define SQL_ATTR_UNIXODBC_SYSPATH           65001
++#define SQL_ATTR_UNIXODBC_VERSION           65002
++#define SQL_ATTR_UNIXODBC_ENVATTR           65003
+ #endif  /* ODBCVER >= 0x0300 */
+ 
+ #if (ODBCVER >= 0x0300)
+@@ -127,6 +134,8 @@
+ 
+ #define SQL_ATTR_CONNECTION_DEAD	1209	/* GetConnectAttr only */
+ 
++#define SQL_ATTR_DRIVER_THREADING	1028	/* Driver threading level */
++
+ #if (ODBCVER >= 0x0351)
+ /*	ODBC Driver Manager sets this connection attribute to a unicode driver
+ 	(which supports SQLConnectW) when the application is an ANSI application
+@@ -170,7 +179,7 @@
+ #define SQL_OPT_TRACE_OFF               0UL
+ #define SQL_OPT_TRACE_ON                1UL
+ #define SQL_OPT_TRACE_DEFAULT           SQL_OPT_TRACE_OFF
+-#define SQL_OPT_TRACE_FILE_DEFAULT      "\\SQL.LOG"
++#define SQL_OPT_TRACE_FILE_DEFAULT      "/tmp/SQL.LOG"
+ 
+ /* SQL_ODBC_CURSORS options */
+ #define SQL_CUR_USE_IF_NEEDED           0UL
+@@ -516,7 +525,12 @@
+ #define SQL_C_ULONG      (SQL_C_LONG+SQL_UNSIGNED_OFFSET)  /* UNSIGNED INTEGER*/
+ #define SQL_C_USHORT     (SQL_C_SHORT+SQL_UNSIGNED_OFFSET) /* UNSIGNED SMALLINT*/
+ #define SQL_C_UTINYINT   (SQL_TINYINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED TINYINT*/
++
++#if (ODBCVER >= 0x0300) && (SIZEOF_LONG_INT == 8) && !defined(BUILD_LEGACY_64_BIT_MODE)
++#define SQL_C_BOOKMARK   SQL_C_UBIGINT                     /* BOOKMARK        */
++#else
+ #define SQL_C_BOOKMARK   SQL_C_ULONG                       /* BOOKMARK        */
++#endif
+ 
+ #if (ODBCVER >= 0x0350)
+ #define SQL_C_GUID	SQL_GUID
+@@ -751,6 +765,7 @@
+ #define SQL_CONVERT_VARBINARY               69
+ #define SQL_CONVERT_VARCHAR                 70
+ #define SQL_CONVERT_LONGVARBINARY           71
++#define SQL_CONVERT_GUID           			173
+ #define SQL_ODBC_SQL_OPT_IEF                73		/* SQL_INTEGRITY */
+ #define SQL_CORRELATION_NAME                74
+ #define SQL_NON_NULLABLE_COLUMNS            75
+@@ -780,7 +795,9 @@
+ #define SQL_QUALIFIER_LOCATION              114
+ 
+ #if (ODBCVER >= 0x0201 && ODBCVER < 0x0300)
++#ifndef SQL_OJ_CAPABILITIES
+ #define SQL_OJ_CAPABILITIES         65003  /* Temp value until ODBC 3.0 */
++#endif
+ #endif  /* ODBCVER >= 0x0201 && ODBCVER < 0x0300 */
+ 
+ /*----------------------------------------------*/
+@@ -927,6 +944,7 @@
+ #define	SQL_CVT_WCHAR						0x00200000L
+ #define	SQL_CVT_WLONGVARCHAR				0x00400000L
+ #define	SQL_CVT_WVARCHAR					0x00800000L
++#define	SQL_CVT_GUID						0x01000000L
+ 
+ #endif  /* ODBCVER >= 0x0300 */
+ 
+@@ -1199,7 +1217,7 @@
+ #define SQL_FILE_NOT_SUPPORTED              0x0000
+ #define SQL_FILE_TABLE                      0x0001
+ #define SQL_FILE_QUALIFIER                  0x0002
+-#define SQL_FILE_CATALOG					SQL_FILE_QUALIFIER	// ODBC 3.0
++#define SQL_FILE_CATALOG					SQL_FILE_QUALIFIER	/* ODBC 3.0 */
+ 
+ 
+ /* SQL_GETDATA_EXTENSIONS values */
+@@ -1688,7 +1706,7 @@
+ #define SQL_DRIVER_PROMPT               2
+ #define SQL_DRIVER_COMPLETE_REQUIRED    3
+ 
+-SQLRETURN  SQLDriverConnect(
++SQLRETURN SQL_API SQLDriverConnect(
+     SQLHDBC            hdbc,
+     SQLHWND            hwnd,
+     SQLCHAR 		  *szConnStrIn,
+@@ -1762,8 +1780,7 @@
+ #define SQL_PT_FUNCTION                  2
+ 
+ /*      This define is too large for RC */
+-#define SQL_ODBC_KEYWORDS "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"
+-/*
++#define SQL_ODBC_KEYWORDS "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\
+ "ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\
+ "BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\
+ "CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\
+@@ -1794,9 +1811,8 @@
+ "UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\
+ "VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,WRITE,"\
+ "YEAR,ZONE"
+-*/
+ 
+-SQLRETURN  SQLBrowseConnect(
++SQLRETURN SQL_API SQLBrowseConnect(
+     SQLHDBC            hdbc,
+     SQLCHAR 		  *szConnStrIn,
+     SQLSMALLINT        cbConnStrIn,
+@@ -1805,21 +1821,21 @@
+     SQLSMALLINT       *pcbConnStrOut);
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN	SQLBulkOperations(
++SQLRETURN	SQL_API SQLBulkOperations(
+ 	SQLHSTMT			StatementHandle,
+ 	SQLSMALLINT			Operation);
+ #endif  /* ODBCVER >= 0x0300 */
+ 
+-SQLRETURN  SQLColAttributes(
++SQLRETURN SQL_API SQLColAttributes(
+     SQLHSTMT           hstmt,
+     SQLUSMALLINT       icol,
+     SQLUSMALLINT       fDescType,
+     SQLPOINTER         rgbDesc,
+     SQLSMALLINT        cbDescMax,
+     SQLSMALLINT 	  *pcbDesc,
+-    SQLINTEGER 		  *pfDesc);
++    SQLLEN 		      *pfDesc);
+ 
+-SQLRETURN  SQLColumnPrivileges(
++SQLRETURN SQL_API SQLColumnPrivileges(
+     SQLHSTMT           hstmt,
+     SQLCHAR 		  *szCatalogName,
+     SQLSMALLINT        cbCatalogName,
+@@ -1830,22 +1846,22 @@
+     SQLCHAR 		  *szColumnName,
+     SQLSMALLINT        cbColumnName);
+ 
+-SQLRETURN  SQLDescribeParam(
++SQLRETURN SQL_API SQLDescribeParam(
+     SQLHSTMT           hstmt,
+     SQLUSMALLINT       ipar,
+     SQLSMALLINT 	  *pfSqlType,
+-    SQLUINTEGER 	  *pcbParamDef,
++    SQLULEN 	      *pcbParamDef,
+     SQLSMALLINT 	  *pibScale,
+     SQLSMALLINT 	  *pfNullable);
+ 
+-SQLRETURN  SQLExtendedFetch(
++SQLRETURN SQL_API SQLExtendedFetch(
+     SQLHSTMT           hstmt,
+     SQLUSMALLINT       fFetchType,
+-    SQLINTEGER         irow,
+-    SQLUINTEGER 	  *pcrow,
+-    SQLUSMALLINT 	  *rgfRowStatus);
++    SQLLEN             irow,
++    SQLULEN 	  	   *pcrow,
++    SQLUSMALLINT 	   *rgfRowStatus);
+ 
+-SQLRETURN  SQLForeignKeys(
++SQLRETURN SQL_API SQLForeignKeys(
+     SQLHSTMT           hstmt,
+     SQLCHAR 		  *szPkCatalogName,
+     SQLSMALLINT        cbPkCatalogName,
+@@ -1860,10 +1876,10 @@
+     SQLCHAR 		  *szFkTableName,
+     SQLSMALLINT        cbFkTableName);
+ 
+-SQLRETURN  SQLMoreResults(
++SQLRETURN SQL_API SQLMoreResults(
+     SQLHSTMT           hstmt);
+ 
+-SQLRETURN  SQLNativeSql(
++SQLRETURN SQL_API SQLNativeSql(
+     SQLHDBC            hdbc,
+     SQLCHAR 		  *szSqlStrIn,
+     SQLINTEGER         cbSqlStrIn,
+@@ -1871,16 +1887,16 @@
+     SQLINTEGER         cbSqlStrMax,
+     SQLINTEGER 		  *pcbSqlStr);
+ 
+-SQLRETURN  SQLNumParams(
++SQLRETURN SQL_API SQLNumParams(
+     SQLHSTMT           hstmt,
+     SQLSMALLINT 	  *pcpar);
+ 
+-SQLRETURN  SQLParamOptions(
++SQLRETURN SQL_API SQLParamOptions(
+     SQLHSTMT           hstmt,
+-    SQLUINTEGER        crow,
+-    SQLUINTEGER 	  *pirow);
++    SQLULEN        	   crow,
++    SQLULEN 	  	   *pirow);
+ 
+-SQLRETURN  SQLPrimaryKeys(
++SQLRETURN SQL_API SQLPrimaryKeys(
+     SQLHSTMT           hstmt,
+     SQLCHAR 		  *szCatalogName,
+     SQLSMALLINT        cbCatalogName,
+@@ -1889,7 +1905,7 @@
+     SQLCHAR 		  *szTableName,
+     SQLSMALLINT        cbTableName);
+ 
+-SQLRETURN  SQLProcedureColumns(
++SQLRETURN SQL_API SQLProcedureColumns(
+     SQLHSTMT           hstmt,
+     SQLCHAR 		  *szCatalogName,
+     SQLSMALLINT        cbCatalogName,
+@@ -1900,7 +1916,7 @@
+     SQLCHAR 		  *szColumnName,
+     SQLSMALLINT        cbColumnName);
+ 
+-SQLRETURN  SQLProcedures(
++SQLRETURN SQL_API SQLProcedures(
+     SQLHSTMT           hstmt,
+     SQLCHAR 		  *szCatalogName,
+     SQLSMALLINT        cbCatalogName,
+@@ -1909,13 +1925,13 @@
+     SQLCHAR 		  *szProcName,
+     SQLSMALLINT        cbProcName);
+ 
+-SQLRETURN  SQLSetPos(
++SQLRETURN SQL_API SQLSetPos(
+     SQLHSTMT           hstmt,
+-    SQLUSMALLINT       irow,
++    SQLSETPOSIROW      irow,
+     SQLUSMALLINT       fOption,
+     SQLUSMALLINT       fLock);
+ 
+-SQLRETURN  SQLTablePrivileges(
++SQLRETURN SQL_API SQLTablePrivileges(
+     SQLHSTMT           hstmt,
+     SQLCHAR 		  *szCatalogName,
+     SQLSMALLINT        cbCatalogName,
+@@ -1924,7 +1940,7 @@
+     SQLCHAR 		  *szTableName,
+     SQLSMALLINT        cbTableName);
+ 
+-SQLRETURN  SQLDrivers(
++SQLRETURN SQL_API SQLDrivers(
+     SQLHENV            henv,
+     SQLUSMALLINT       fDirection,
+     SQLCHAR 		  *szDriverDesc,
+@@ -1934,17 +1950,17 @@
+     SQLSMALLINT        cbDrvrAttrMax,
+     SQLSMALLINT 	  *pcbDrvrAttr);
+ 
+-SQLRETURN  SQLBindParameter(
++SQLRETURN SQL_API SQLBindParameter(
+     SQLHSTMT           hstmt,
+     SQLUSMALLINT       ipar,
+     SQLSMALLINT        fParamType,
+     SQLSMALLINT        fCType,
+     SQLSMALLINT        fSqlType,
+-    SQLUINTEGER        cbColDef,
++    SQLULEN            cbColDef,
+     SQLSMALLINT        ibScale,
+     SQLPOINTER         rgbValue,
+-    SQLINTEGER         cbValueMax,
+-    SQLINTEGER 		  *pcbValue);
++    SQLLEN             cbValueMax,
++    SQLLEN 		      *pcbValue);
+ 
+ /*---------------------------------------------------------*/
+ /* SQLAllocHandleStd is implemented to make SQLAllocHandle */
+@@ -1972,7 +1988,7 @@
+ #endif /* ODBC_STD */
+ 
+ #if (ODBCVER >= 0x0300)
+-SQLRETURN  SQLAllocHandleStd(
++SQLRETURN SQL_API SQLAllocHandleStd(
+ 	SQLSMALLINT		fHandleType,
+ 	SQLHANDLE		hInput,
+ 	SQLHANDLE	   *phOutput);
+@@ -1999,21 +2015,57 @@
+ #define SQL_SCROLL_STATIC               (-3L) /*-SQL_CURSOR_STATIC */
+ 
+ /*      Deprecated functions from prior versions of ODBC */
+-SQLRETURN  SQLSetScrollOptions(    /*      Use SQLSetStmtOptions */
++SQLRETURN SQL_API SQLSetScrollOptions(    /*      Use SQLSetStmtOptions */
+     SQLHSTMT           hstmt,
+     SQLUSMALLINT       fConcurrency,
+-    SQLINTEGER         crowKeyset,
++    SQLLEN             crowKeyset,
+     SQLUSMALLINT       crowRowset);
+ 
+-/* Tracing section */
++/*!
++ * \defgroup    Tracing.
++ *
++ *              unixODBC implements a slight variation of the tracing mechanism used 
++ *              on MS platforms. The unixODBC method loses the ability to produce trace
++ *              output for invalid handles but gains the following;
++ *
++ *              - better concurrency 
++ *              - allows tracing to be turned on/off and configured at finer granularity
++ *              - hopefully; better performance
++ *
++ *              unixODBC provides a cross-platform helper library called 'trace' and an
++ *              example/default trace plugin called 'odbctrac'. Those writing an ODBC 
++ *              driver can use the 'trace' helper library (a static library). Those wanting
++ *              to create custom trace output can implement a different version of the
++ *              'odbctrac' plugin.
++ *
++ *              The text file driver (odbctxt) included with unixODBC is an example of a 
++ *              driver using the 'trace' helper library.
++ *
++ *              The 'trace' library and the example plugin 'odbctrac' are designed to be 
++ *              portable on all platforms where unixODBC is available and on MS platforms.
++ *              This will allow drivers using 'trace' and 'odbctrac' plugin to equilly 
++ *              portable. On MS platforms - this compliments traditional tracing (mostly
++ *              just used by the Driver Manager).
++ *
++ * \sa          trace
++ *              odbctxt
++ *              odbctrac
++ */
++/*@{*/
++#define	TRACE_VERSION 1000                                  /*!< Version of trace API                               */
++#ifdef UNICODE
++RETCODE TraceOpenLogFile(SQLPOINTER,LPWSTR,LPWSTR,DWORD); 	/*!< open a trace log file				                */
++#else
++RETCODE TraceOpenLogFile(SQLPOINTER,LPSTR,LPSTR,DWORD); 	/*!< open a trace log file				                */
++#endif
++RETCODE TraceCloseLogFile(SQLPOINTER);					    /*!< Request to close a trace log		                */
++SQLRETURN TraceReturn(SQLPOINTER,SQLRETURN);                /*!< Call to produce trace output upon function return. */
++#ifdef __cplusplus
++DWORD	 TraceVersion();							        /*!< Returns trace API version			                */
++#else
++DWORD	 TraceVersion(VOID);							    /*!< Returns trace API version			                */
++#endif
+ 
+-#define		TRACE_VERSION	1000		/* Version of trace API */
+-
+-RETCODE	 TraceOpenLogFile(LPWSTR,LPWSTR,DWORD); 	/* open a trace log file				*/
+-RETCODE	 TraceCloseLogFile();					/* Request to close a trace log			*/
+-VOID	 TraceReturn(RETCODE,RETCODE);			/* Processes trace after FN is called	*/
+-DWORD	 TraceVersion();							/* Returns trace API version			*/
+-
+ /* Functions for Visual Studio Analyzer*/
+ /* to turn on/off tracing or VS events, call TraceVSControl by setting or clearing the following bits  */
+ #define TRACE_ON			0x00000001L
+@@ -2028,7 +2080,11 @@
+ #define ODBC_VS_FLAG_STOP		0x00000008L	/* Stop firing visual studio analyzer events */
+ 
+ typedef struct tagODBC_VS_ARGS {
++#ifdef GUID_DEFINED
+ 	const GUID	*pguidEvent;	/* the GUID for event */
++#else
++	const void	*pguidEvent;	/* the GUID for event */
++#endif
+ 	DWORD	dwFlags;		/* flags for the call */
+ 	union {
+ 		WCHAR	*wszArg;	
+@@ -2042,10 +2098,25 @@
+ } ODBC_VS_ARGS, *PODBC_VS_ARGS;
+ 
+ VOID	FireVSDebugEvent(PODBC_VS_ARGS);
++/*@}*/
+ 
+-
+ #ifdef __cplusplus
+ }
+ #endif
+ 
++/*
++ * connection pooling retry times
++ */
++
++BOOL ODBCSetTryWaitValue ( DWORD dwValue );
++#ifdef __cplusplus
++DWORD ODBCGetTryWaitValue ( );
++#else
++DWORD ODBCGetTryWaitValue ( VOID );
+ #endif
++
++#ifndef __SQLUCODE_H
++#include "sqlucode.h"
++#endif
++
++#endif
+Index: unixODBC/inc/sqltypes.h
+===================================================================
+--- unixODBC/inc/sqltypes.h	(revision 274960)
++++ unixODBC/inc/sqltypes.h	(working copy)
+@@ -26,48 +26,111 @@
+ #define ODBCVER	0x0351
+ #endif
+ 
++/*
++ * if thi sis set, then use a 4 byte unicode definition, insteead of the 2 bye that MS use
++ */
++
++#ifdef SQL_WCHART_CONVERT  
++/* 
++ * Use this if you want to use the C/C++ portable definition of  a wide char, wchar_t
++ *  Microsoft hardcoded a definition of  unsigned short which may not be compatible with
++ *  your platform specific wide char definition.
++ */
++#include <wchar.h>
++#endif
++
++#include <sal/types.h>
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
+-#ifndef SIZEOF_LONG
+-# if defined(__alpha__) || defined(__x86_64__) || defined(__ia64__) || defined(__s390x__) || defined(__sparcv9) || defined(__LP64__)
+-# define SIZEOF_LONG        8
+-#else
+-# define SIZEOF_LONG        4
++#ifndef SIZEOF_LONG_INT
++# define SIZEOF_LONG_INT SAL_TYPES_SIZEOFLONG
+ #endif
++#ifndef ODBCINT64
++# define ODBCINT64 sal_Int64
+ #endif
++#ifndef UODBCINT64
++# define UODBCINT64 sal_uInt64
++#endif
+ 
++/*
++ * this is defined by configure, but will not be on a normal application build
++ * the install creates a unixodbc_conf.h file that contains the current build settings
++ */
++
++#ifndef SIZEOF_LONG_INT
++#include <unixodbc_conf.h>
++#endif
++
++#ifndef SIZEOF_LONG_INT
++#error "Needs to know how big a long int is to continue!!!"
++#endif
++
+ /****************************
+  * These make up for having no windows.h
+  ***************************/
++#ifndef ALLREADY_HAVE_WINDOWS_TYPE
++
+ #define FAR
+ #define CALLBACK
++#ifdef __OS2__
++#define SQL_API _System
++#else
+ #define SQL_API
++#endif
+ #define	BOOL				int
+ typedef void*				HWND;
+-#ifndef CHAR
+-typedef char*				GUID;
++typedef char				CHAR;
++#ifdef UNICODE
++
++/* 
++ * NOTE: The Microsoft unicode define is only for apps that want to use TCHARs and 
++ *  be able to compile for both unicode and non-unicode with the same source.
++ *  This is not recommanded for linux applications and is not supported
++ * 	by the standard linux string header files.
++ */
++#ifdef SQL_WCHART_CONVERT
++typedef wchar_t             TCHAR;
++#else
++typedef signed short        TCHAR;
+ #endif
+-#define GUID_DEFINED
+-typedef char				CHAR;
++
++#else
++typedef char				TCHAR;
++#endif
++
+ #ifndef DONT_TD_VOID
+ typedef void				VOID;
+ #endif
++
+ typedef unsigned short		WORD;
+-#if SIZEOF_LONG == 4
+-	typedef unsigned long		DWORD;
++#if (SIZEOF_LONG_INT == 4)
++typedef unsigned long		DWORD;
+ #else
+-	typedef unsigned int		DWORD;
++typedef unsigned int		DWORD;
+ #endif
+ typedef unsigned char		BYTE;
++
++#ifdef SQL_WCHART_CONVERT
++typedef wchar_t             WCHAR;
++#else
+ typedef unsigned short 		WCHAR;
+-typedef WCHAR* 		        LPWSTR;
++#endif
++
++typedef WCHAR* 	            LPWSTR;
+ typedef const char*         LPCSTR;
++typedef const WCHAR*        LPCWSTR;
++typedef TCHAR*              LPTSTR;
+ typedef char*               LPSTR;
+ typedef DWORD*           	LPDWORD;
+ 
++typedef void*               HINSTANCE;
+ 
++#endif
++
++
+ /****************************
+  * standard SQL* data types. use these as much as possible when using ODBC calls/vars
+  ***************************/
+@@ -80,11 +143,61 @@
+ typedef double          SQLFLOAT;
+ #endif
+ 
+-#if SIZEOF_LONG == 4
+-	typedef long	SQLINTEGER;
++/*
++ * can't use a long it fails on 64 platforms
++ */
++
++/*
++ * Hopefully by now it should be safe to assume most drivers know about SQLLEN now
++ * and the defaukt is now sizeof( SQLLEN ) = 8 on 64 bit platforms
++ * 
++ */
++
++#if (SIZEOF_LONG_INT == 8)
++#ifdef BUILD_LEGACY_64_BIT_MODE
++typedef int             SQLINTEGER;
++typedef unsigned int    SQLUINTEGER;
++#define SQLLEN          SQLINTEGER
++#define SQLULEN         SQLUINTEGER
++#define SQLSETPOSIROW   SQLUSMALLINT
++/* 
++ * These are not supprted on 64bit ODBC according to MS, removed, so use at your peril
++ *
++ typedef SQLULEN         SQLROWCOUNT;
++ typedef SQLULEN         SQLROWSETSIZE;
++ typedef SQLULEN         SQLTRANSID;
++ typedef SQLLEN          SQLROWOFFSET;
++*/
+ #else
+-	typedef int	SQLINTEGER;
++typedef int             SQLINTEGER;
++typedef unsigned int    SQLUINTEGER;
++typedef long            SQLLEN;
++typedef unsigned long   SQLULEN;
++typedef unsigned long   SQLSETPOSIROW;
++/* 
++ * These are not supprted on 64bit ODBC according to MS, removed, so use at your peril
++ *
++ typedef SQLULEN 		SQLTRANSID;
++ typedef SQLULEN 		SQLROWCOUNT;
++ typedef SQLUINTEGER 	SQLROWSETSIZE;
++ typedef SQLLEN 		SQLROWOFFSET;
++ */
++typedef SQLULEN         SQLROWCOUNT;
++typedef SQLULEN         SQLROWSETSIZE;
++typedef SQLULEN         SQLTRANSID;
++typedef SQLLEN          SQLROWOFFSET;
+ #endif
++#else
++typedef long            SQLINTEGER;
++typedef unsigned long   SQLUINTEGER;
++#define SQLLEN          SQLINTEGER
++#define SQLULEN         SQLUINTEGER
++#define SQLSETPOSIROW   SQLUSMALLINT
++typedef SQLULEN         SQLROWCOUNT;
++typedef SQLULEN         SQLROWSETSIZE;
++typedef SQLULEN         SQLTRANSID;
++typedef SQLLEN          SQLROWOFFSET;
++#endif
+ 
+ #if (ODBCVER >= 0x0300)
+ typedef unsigned char   SQLNUMERIC;
+@@ -107,39 +220,58 @@
+ 
+ typedef SQLSMALLINT     SQLRETURN;
+ 
+-/* typedef void * 			SQLHANDLE; */
+-
+-typedef SQLINTEGER		SQLHANDLE;
+ #if (ODBCVER >= 0x0300)
+-
++typedef void * 			        SQLHANDLE; 
+ typedef SQLHANDLE               SQLHENV;
+ typedef SQLHANDLE               SQLHDBC;
+ typedef SQLHANDLE               SQLHSTMT;
+ typedef SQLHANDLE               SQLHDESC;
++#else
++typedef void *                  SQLHENV;
++typedef void *                  SQLHDBC;
++typedef void *                  SQLHSTMT;
++/*
++ * some things like PHP won't build without this
++ */
++typedef void * 			        SQLHANDLE; 
++#endif
+ 
++/****************************
++ * These are cast into the actual struct that is being passed around. The
++ * DriverManager knows what its structs look like and the Driver knows about its
++ * structs... the app knows nothing about them... just void*
++ * These are deprecated in favour of SQLHENV, SQLHDBC, SQLHSTMT
++ ***************************/
++
++#if (ODBCVER >= 0x0300)
++typedef SQLHANDLE          		HENV;
++typedef SQLHANDLE          		HDBC;
++typedef SQLHANDLE          		HSTMT;
+ #else
+-typedef SQLINTEGER              SQLHENV;
+-typedef SQLINTEGER              SQLHDBC;
+-typedef SQLINTEGER              SQLHSTMT;
++typedef void *          	    HENV;
++typedef void *          	    HDBC;
++typedef void *          	    HSTMT;
+ #endif
+ 
+ 
+ /****************************
+  * more basic data types to augment what windows.h provides
+  ***************************/
++#ifndef ALLREADY_HAVE_WINDOWS_TYPE
++
+ typedef unsigned char           UCHAR;
+ typedef signed char             SCHAR;
+ typedef SCHAR                   SQLSCHAR;
+-#if SIZEOF_LONG == 4
+-	typedef long int		SDWORD;
+-	typedef unsigned long int	UDWORD;
++#if (SIZEOF_LONG_INT == 4)
++typedef long int                SDWORD;
++typedef unsigned long int       UDWORD;
+ #else
+-	typedef signed int	SDWORD;
+-	typedef unsigned int	UDWORD;
++typedef int                     SDWORD;
++typedef unsigned int            UDWORD;
+ #endif
+ typedef signed short int        SWORD;
+ typedef unsigned short int      UWORD;
+-typedef UDWORD                  SQLUINTEGER;
++typedef unsigned int            UINT;
+ typedef signed long             SLONG;
+ typedef signed short            SSHORT;
+ typedef unsigned long           ULONG;
+@@ -151,20 +283,7 @@
+ typedef signed short            RETCODE;
+ typedef void*                   SQLHWND;
+ 
+-/****************************
+- * These are cast into the actual struct that is being passed around. The
+- * DriverManager knows what its structs look like and the Driver knows about its
+- * structs... the app knows nothing about them... just void*
+- * These are deprecated in favour of SQLHENV, SQLHDBC, SQLHSTMT
+- ***************************/
+-/*
+-typedef void*              		HENV;
+-typedef void*              		HDBC;
+-typedef void*              		HSTMT;
+-*/
+-typedef SQLHANDLE          		HENV;
+-typedef SQLHANDLE          		HDBC;
+-typedef SQLHANDLE          		HSTMT;
++#endif
+ 
+ /****************************
+  * standard structs for working with date/times
+@@ -263,12 +382,41 @@
+ /****************************
+  *
+  ***************************/
+-#if (ODBCVER >= 0x0300)
+-#define ODBCINT64	long
++#ifndef ODBCINT64
++# if (ODBCVER >= 0x0300)
++# if (SIZEOF_LONG_INT == 8)
++#   define ODBCINT64	    long
++#   define UODBCINT64	unsigned long
++# else
++#  ifdef HAVE_LONG_LONG
++#   define ODBCINT64	    long long
++#   define UODBCINT64	unsigned long long
++#  else
++/*
++ * may fail in some cases, but what else can we do ?
++ */
++struct __bigint_struct
++{
++    int             hiword;
++    unsigned int    loword;
++};
++struct __bigint_struct_u
++{
++    unsigned int    hiword;
++    unsigned int    loword;
++};
++#   define ODBCINT64	    struct __bigint_struct
++#   define UODBCINT64	struct __bigint_struct_u
++#  endif
++# endif
++#endif
++#endif
++
+ #ifdef ODBCINT64
+ typedef ODBCINT64	SQLBIGINT;
+-typedef unsigned ODBCINT64	SQLUBIGINT;
+ #endif
++#ifdef UODBCINT64
++typedef UODBCINT64	SQLUBIGINT;
+ #endif
+ 
+ 
+@@ -288,6 +436,7 @@
+ 
+ #if (ODBCVER >= 0x0350)
+ #ifdef GUID_DEFINED
++#ifndef ALLREADY_HAVE_WINDOWS_TYPE
+ typedef GUID	SQLGUID;
+ #else
+ typedef struct  tagSQLGUID
+@@ -298,18 +447,21 @@
+     BYTE Data4[ 8 ];
+ } SQLGUID;
+ #endif
++#else
++typedef struct  tagSQLGUID
++{
++    DWORD Data1;
++    WORD Data2;
++    WORD Data3;
++    BYTE Data4[ 8 ];
++} SQLGUID;
+ #endif
++#endif
+ 
++typedef SQLULEN         BOOKMARK;
+ 
+-typedef unsigned long int       BOOKMARK;
++typedef  WCHAR         SQLWCHAR;
+ 
+-
+-#ifdef _WCHAR_T_DEFINED
+-typedef wchar_t SQLWCHAR;
+-#else
+-typedef unsigned short SQLWCHAR;
+-#endif
+-
+ #ifdef UNICODE
+ typedef SQLWCHAR        SQLTCHAR;
+ #else
+@@ -321,3 +473,6 @@
+ #endif
+ 
+ #endif
++
++
++
diff --git a/patches/dev300/new-SQLLEN.diff b/patches/dev300/new-SQLLEN.diff
index 12f74af..75d7900 100644
--- a/patches/dev300/new-SQLLEN.diff
+++ b/patches/dev300/new-SQLLEN.diff
@@ -456,15 +456,18 @@ Index: connectivity/source/drivers/odbcbase/OTools.cxx
  												&pcbValue),
  									_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
  			_bWasNull = pcbValue == SQL_NULL_DATA;
-@@ -571,7 +571,7 @@
- 				return ::rtl::OUString();
- 			// Bei Fehler bricht der GETDATA-Makro mit return ab,
- 			// bei NULL mit break!
--			SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
-+			SQLLEN nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
- 			waCharArray[nLen] = 0;
- 			aData = ::rtl::OUString(waCharArray);
- 
+@@ -571,9 +571,9 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
+                 return ::rtl::OUString();
+             // Bei Fehler bricht der GETDATA-Makro mit return ab,
+             // bei NULL mit break!
+-            SQLINTEGER nRealSize = 0;
++            SQLLEN nRealSize = 0;
+             if ( pcbValue > -1 )
+                 nRealSize = pcbValue / sizeof(sal_Unicode);
+-            SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? std::min(nRealSize, nMaxLen) : (nMaxLen-1);
++            SQLLEN nLen = pcbValue != SQL_NO_TOTAL ? std::min(nRealSize, nMaxLen) : (nMaxLen-1);
+             waCharArray[nLen] = 0;
+             aData.append(waCharArray,nLen);
 @@ -595,7 +595,7 @@
  												(SQLUSMALLINT)columnIndex,
  												SQL_C_WCHAR,


More information about the ooo-build-commit mailing list