1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9b5730f6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9b5730f6SAndrew Rist  * distributed with this work for additional information
6*9b5730f6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9b5730f6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist  * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9b5730f6SAndrew Rist  *
11*9b5730f6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9b5730f6SAndrew Rist  *
13*9b5730f6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist  * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9b5730f6SAndrew Rist  * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist  * under the License.
19*9b5730f6SAndrew Rist  *
20*9b5730f6SAndrew Rist  *************************************************************/
21*9b5730f6SAndrew Rist 
22*9b5730f6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
26cdf0e10cSrcweir #include "ORealDriver.hxx"
27cdf0e10cSrcweir #include "odbc/ODriver.hxx"
28cdf0e10cSrcweir #include "odbc/OTools.hxx"
29cdf0e10cSrcweir #include "odbc/OFunctions.hxx"
30cdf0e10cSrcweir #include "diagnose_ex.h"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace connectivity
33cdf0e10cSrcweir {
34cdf0e10cSrcweir 	sal_Bool LoadFunctions(oslModule pODBCso);
35cdf0e10cSrcweir 	sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath);
36cdf0e10cSrcweir 	// extern declaration of the function pointer
37cdf0e10cSrcweir 	extern T3SQLAllocHandle pODBC3SQLAllocHandle;
38cdf0e10cSrcweir 	extern T3SQLConnect pODBC3SQLConnect;
39cdf0e10cSrcweir 	extern T3SQLDriverConnect pODBC3SQLDriverConnect;
40cdf0e10cSrcweir 	extern T3SQLBrowseConnect pODBC3SQLBrowseConnect;
41cdf0e10cSrcweir 	extern T3SQLDataSources pODBC3SQLDataSources;
42cdf0e10cSrcweir 	extern T3SQLDrivers pODBC3SQLDrivers;
43cdf0e10cSrcweir 	extern T3SQLGetInfo pODBC3SQLGetInfo;
44cdf0e10cSrcweir 	extern T3SQLGetFunctions pODBC3SQLGetFunctions;
45cdf0e10cSrcweir 	extern T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
46cdf0e10cSrcweir 	extern T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
47cdf0e10cSrcweir 	extern T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
48cdf0e10cSrcweir 	extern T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
49cdf0e10cSrcweir 	extern T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
50cdf0e10cSrcweir 	extern T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
51cdf0e10cSrcweir 	extern T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
52cdf0e10cSrcweir 	//extern T3SQLSetDescField pODBC3SQLSetDescField;
53cdf0e10cSrcweir 	//extern T3SQLGetDescField pODBC3SQLGetDescField;
54cdf0e10cSrcweir 	//extern T3SQLGetDescRec pODBC3SQLGetDescRec;
55cdf0e10cSrcweir 	//extern T3SQLSetDescRec pODBC3SQLSetDescRec;
56cdf0e10cSrcweir 	extern T3SQLPrepare pODBC3SQLPrepare;
57cdf0e10cSrcweir 	extern T3SQLBindParameter pODBC3SQLBindParameter;
58cdf0e10cSrcweir 	//extern T3SQLGetCursorName pODBC3SQLGetCursorName;
59cdf0e10cSrcweir 	extern T3SQLSetCursorName pODBC3SQLSetCursorName;
60cdf0e10cSrcweir 	extern T3SQLExecute pODBC3SQLExecute;
61cdf0e10cSrcweir 	extern T3SQLExecDirect pODBC3SQLExecDirect;
62cdf0e10cSrcweir 	//extern T3SQLNativeSql pODBC3SQLNativeSql;
63cdf0e10cSrcweir 	extern T3SQLDescribeParam pODBC3SQLDescribeParam;
64cdf0e10cSrcweir 	extern T3SQLNumParams pODBC3SQLNumParams;
65cdf0e10cSrcweir 	extern T3SQLParamData pODBC3SQLParamData;
66cdf0e10cSrcweir 	extern T3SQLPutData pODBC3SQLPutData;
67cdf0e10cSrcweir 	extern T3SQLRowCount pODBC3SQLRowCount;
68cdf0e10cSrcweir 	extern T3SQLNumResultCols pODBC3SQLNumResultCols;
69cdf0e10cSrcweir 	extern T3SQLDescribeCol pODBC3SQLDescribeCol;
70cdf0e10cSrcweir 	extern T3SQLColAttribute pODBC3SQLColAttribute;
71cdf0e10cSrcweir 	extern T3SQLBindCol pODBC3SQLBindCol;
72cdf0e10cSrcweir 	extern T3SQLFetch pODBC3SQLFetch;
73cdf0e10cSrcweir 	extern T3SQLFetchScroll pODBC3SQLFetchScroll;
74cdf0e10cSrcweir 	extern T3SQLGetData pODBC3SQLGetData;
75cdf0e10cSrcweir 	extern T3SQLSetPos pODBC3SQLSetPos;
76cdf0e10cSrcweir 	extern T3SQLBulkOperations pODBC3SQLBulkOperations;
77cdf0e10cSrcweir 	extern T3SQLMoreResults pODBC3SQLMoreResults;
78cdf0e10cSrcweir 	//extern T3SQLGetDiagField pODBC3SQLGetDiagField;
79cdf0e10cSrcweir 	extern T3SQLGetDiagRec pODBC3SQLGetDiagRec;
80cdf0e10cSrcweir 	extern T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
81cdf0e10cSrcweir 	extern T3SQLColumns pODBC3SQLColumns;
82cdf0e10cSrcweir 	extern T3SQLForeignKeys pODBC3SQLForeignKeys;
83cdf0e10cSrcweir 	extern T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
84cdf0e10cSrcweir 	extern T3SQLProcedureColumns pODBC3SQLProcedureColumns;
85cdf0e10cSrcweir 	extern T3SQLProcedures pODBC3SQLProcedures;
86cdf0e10cSrcweir 	extern T3SQLSpecialColumns pODBC3SQLSpecialColumns;
87cdf0e10cSrcweir 	extern T3SQLStatistics pODBC3SQLStatistics;
88cdf0e10cSrcweir 	extern T3SQLTablePrivileges pODBC3SQLTablePrivileges;
89cdf0e10cSrcweir 	extern T3SQLTables pODBC3SQLTables;
90cdf0e10cSrcweir 	extern T3SQLFreeStmt pODBC3SQLFreeStmt;
91cdf0e10cSrcweir 	extern T3SQLCloseCursor pODBC3SQLCloseCursor;
92cdf0e10cSrcweir 	extern T3SQLCancel pODBC3SQLCancel;
93cdf0e10cSrcweir 	extern T3SQLEndTran pODBC3SQLEndTran;
94cdf0e10cSrcweir 	extern T3SQLDisconnect pODBC3SQLDisconnect;
95cdf0e10cSrcweir 	extern T3SQLFreeHandle pODBC3SQLFreeHandle;
96cdf0e10cSrcweir 	extern T3SQLGetCursorName pODBC3SQLGetCursorName;
97cdf0e10cSrcweir 	extern T3SQLNativeSql pODBC3SQLNativeSql;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	namespace odbc
101cdf0e10cSrcweir 	{
102cdf0e10cSrcweir 		class ORealObdcDriver : public ODBCDriver
103cdf0e10cSrcweir 		{
104cdf0e10cSrcweir 		protected:
105cdf0e10cSrcweir 			virtual oslGenericFunction  getOdbcFunction(sal_Int32 _nIndex)  const;
106cdf0e10cSrcweir 			virtual SQLHANDLE	EnvironmentHandle(::rtl::OUString &_rPath);
107cdf0e10cSrcweir 		public:
ORealObdcDriver(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & _rxFactory)108cdf0e10cSrcweir 			ORealObdcDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : ODBCDriver(_rxFactory) {}
109cdf0e10cSrcweir 		};
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 		//------------------------------------------------------------------
getOdbcFunction(sal_Int32 _nIndex) const112cdf0e10cSrcweir oslGenericFunction ORealObdcDriver::getOdbcFunction(sal_Int32 _nIndex) const
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	oslGenericFunction pFunction = NULL;
115cdf0e10cSrcweir 	switch(_nIndex)
116cdf0e10cSrcweir 	{
117cdf0e10cSrcweir 		case ODBC3SQLAllocHandle:
118cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLAllocHandle;
119cdf0e10cSrcweir 			break;
120cdf0e10cSrcweir 		case ODBC3SQLConnect:
121cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLConnect;
122cdf0e10cSrcweir 			break;
123cdf0e10cSrcweir 		case ODBC3SQLDriverConnect:
124cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLDriverConnect;
125cdf0e10cSrcweir 			break;
126cdf0e10cSrcweir 		case ODBC3SQLBrowseConnect:
127cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLBrowseConnect;
128cdf0e10cSrcweir 			break;
129cdf0e10cSrcweir 		case ODBC3SQLDataSources:
130cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLDataSources;
131cdf0e10cSrcweir 			break;
132cdf0e10cSrcweir 		case ODBC3SQLDrivers:
133cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLDrivers;
134cdf0e10cSrcweir 			break;
135cdf0e10cSrcweir 		case ODBC3SQLGetInfo:
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetInfo;
138cdf0e10cSrcweir 			break;
139cdf0e10cSrcweir 		case ODBC3SQLGetFunctions:
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetFunctions;
142cdf0e10cSrcweir 			break;
143cdf0e10cSrcweir 		case ODBC3SQLGetTypeInfo:
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetTypeInfo;
146cdf0e10cSrcweir 			break;
147cdf0e10cSrcweir 		case ODBC3SQLSetConnectAttr:
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLSetConnectAttr;
150cdf0e10cSrcweir 			break;
151cdf0e10cSrcweir 		case ODBC3SQLGetConnectAttr:
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetConnectAttr;
154cdf0e10cSrcweir 			break;
155cdf0e10cSrcweir 		case ODBC3SQLSetEnvAttr:
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLSetEnvAttr;
158cdf0e10cSrcweir 			break;
159cdf0e10cSrcweir 		case ODBC3SQLGetEnvAttr:
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetEnvAttr;
162cdf0e10cSrcweir 			break;
163cdf0e10cSrcweir 		case ODBC3SQLSetStmtAttr:
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLSetStmtAttr;
166cdf0e10cSrcweir 			break;
167cdf0e10cSrcweir 		case ODBC3SQLGetStmtAttr:
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetStmtAttr;
170cdf0e10cSrcweir 			break;
171cdf0e10cSrcweir 		case ODBC3SQLPrepare:
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLPrepare;
174cdf0e10cSrcweir 			break;
175cdf0e10cSrcweir 		case ODBC3SQLBindParameter:
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLBindParameter;
178cdf0e10cSrcweir 			break;
179cdf0e10cSrcweir 		case ODBC3SQLSetCursorName:
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLSetCursorName;
182cdf0e10cSrcweir 			break;
183cdf0e10cSrcweir 		case ODBC3SQLExecute:
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLExecute;
186cdf0e10cSrcweir 			break;
187cdf0e10cSrcweir 		case ODBC3SQLExecDirect:
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLExecDirect;
190cdf0e10cSrcweir 			break;
191cdf0e10cSrcweir 		case ODBC3SQLDescribeParam:
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLDescribeParam;
194cdf0e10cSrcweir 			break;
195cdf0e10cSrcweir 		case ODBC3SQLNumParams:
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLNumParams;
198cdf0e10cSrcweir 			break;
199cdf0e10cSrcweir 		case ODBC3SQLParamData:
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLParamData;
202cdf0e10cSrcweir 			break;
203cdf0e10cSrcweir 		case ODBC3SQLPutData:
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLPutData;
206cdf0e10cSrcweir 			break;
207cdf0e10cSrcweir 		case ODBC3SQLRowCount:
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLRowCount;
210cdf0e10cSrcweir 			break;
211cdf0e10cSrcweir 		case ODBC3SQLNumResultCols:
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLNumResultCols;
214cdf0e10cSrcweir 			break;
215cdf0e10cSrcweir 		case ODBC3SQLDescribeCol:
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLDescribeCol;
218cdf0e10cSrcweir 			break;
219cdf0e10cSrcweir 		case ODBC3SQLColAttribute:
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLColAttribute;
222cdf0e10cSrcweir 			break;
223cdf0e10cSrcweir 		case ODBC3SQLBindCol:
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLBindCol;
226cdf0e10cSrcweir 			break;
227cdf0e10cSrcweir 		case ODBC3SQLFetch:
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLFetch;
230cdf0e10cSrcweir 			break;
231cdf0e10cSrcweir 		case ODBC3SQLFetchScroll:
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLFetchScroll;
234cdf0e10cSrcweir 			break;
235cdf0e10cSrcweir 		case ODBC3SQLGetData:
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetData;
238cdf0e10cSrcweir 			break;
239cdf0e10cSrcweir 		case ODBC3SQLSetPos:
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLSetPos;
242cdf0e10cSrcweir 			break;
243cdf0e10cSrcweir 		case ODBC3SQLBulkOperations:
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLBulkOperations;
246cdf0e10cSrcweir 			break;
247cdf0e10cSrcweir 		case ODBC3SQLMoreResults:
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLMoreResults;
250cdf0e10cSrcweir 			break;
251cdf0e10cSrcweir 		case ODBC3SQLGetDiagRec:
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetDiagRec;
254cdf0e10cSrcweir 			break;
255cdf0e10cSrcweir 		case ODBC3SQLColumnPrivileges:
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLColumnPrivileges;
258cdf0e10cSrcweir 			break;
259cdf0e10cSrcweir 		case ODBC3SQLColumns:
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLColumns;
262cdf0e10cSrcweir 			break;
263cdf0e10cSrcweir 		case ODBC3SQLForeignKeys:
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLForeignKeys;
266cdf0e10cSrcweir 			break;
267cdf0e10cSrcweir 		case ODBC3SQLPrimaryKeys:
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLPrimaryKeys;
270cdf0e10cSrcweir 			break;
271cdf0e10cSrcweir 		case ODBC3SQLProcedureColumns:
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLProcedureColumns;
274cdf0e10cSrcweir 			break;
275cdf0e10cSrcweir 		case ODBC3SQLProcedures:
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLProcedures;
278cdf0e10cSrcweir 			break;
279cdf0e10cSrcweir 		case ODBC3SQLSpecialColumns:
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLSpecialColumns;
282cdf0e10cSrcweir 			break;
283cdf0e10cSrcweir 		case ODBC3SQLStatistics:
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLStatistics;
286cdf0e10cSrcweir 			break;
287cdf0e10cSrcweir 		case ODBC3SQLTablePrivileges:
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLTablePrivileges;
290cdf0e10cSrcweir 			break;
291cdf0e10cSrcweir 		case ODBC3SQLTables:
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLTables;
294cdf0e10cSrcweir 			break;
295cdf0e10cSrcweir 		case ODBC3SQLFreeStmt:
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLFreeStmt;
298cdf0e10cSrcweir 			break;
299cdf0e10cSrcweir 		case ODBC3SQLCloseCursor:
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLCloseCursor;
302cdf0e10cSrcweir 			break;
303cdf0e10cSrcweir 		case ODBC3SQLCancel:
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLCancel;
306cdf0e10cSrcweir 			break;
307cdf0e10cSrcweir 		case ODBC3SQLEndTran:
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLEndTran;
310cdf0e10cSrcweir 			break;
311cdf0e10cSrcweir 		case ODBC3SQLDisconnect:
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLDisconnect;
314cdf0e10cSrcweir 			break;
315cdf0e10cSrcweir 		case ODBC3SQLFreeHandle:
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLFreeHandle;
318cdf0e10cSrcweir 			break;
319cdf0e10cSrcweir 		case ODBC3SQLGetCursorName:
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLGetCursorName;
322cdf0e10cSrcweir 			break;
323cdf0e10cSrcweir 		case ODBC3SQLNativeSql:
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 			pFunction = (oslGenericFunction)pODBC3SQLNativeSql;
326cdf0e10cSrcweir 			break;
327cdf0e10cSrcweir 		default:
328cdf0e10cSrcweir 			OSL_ENSURE(0,"Function unknown!");
329cdf0e10cSrcweir 	}
330cdf0e10cSrcweir 	return pFunction;
331cdf0e10cSrcweir }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir //------------------------------------------------------------------
ODBCDriver_CreateInstance(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & _rxFactory)334cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >  SAL_CALL ODBCDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
335cdf0e10cSrcweir {
336cdf0e10cSrcweir 	return *(new ORealObdcDriver(_rxFactory));
337cdf0e10cSrcweir }
338cdf0e10cSrcweir // -----------------------------------------------------------------------------
339cdf0e10cSrcweir // ODBC Environment (gemeinsam fuer alle Connections):
EnvironmentHandle(::rtl::OUString & _rPath)340cdf0e10cSrcweir SQLHANDLE ORealObdcDriver::EnvironmentHandle(::rtl::OUString &_rPath)
341cdf0e10cSrcweir {
342cdf0e10cSrcweir 	// Ist (fuer diese Instanz) bereits ein Environment erzeugt worden?
343cdf0e10cSrcweir 	if (!m_pDriverHandle)
344cdf0e10cSrcweir 	{
345cdf0e10cSrcweir 		SQLHANDLE h = SQL_NULL_HANDLE;
346cdf0e10cSrcweir 		// Environment allozieren
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 		// ODBC-DLL jetzt laden:
349cdf0e10cSrcweir 		if (!LoadLibrary_ODBC3(_rPath) || N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS)
350cdf0e10cSrcweir 			return SQL_NULL_HANDLE;
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 		// In globaler Struktur merken ...
353cdf0e10cSrcweir 		m_pDriverHandle = h;
354cdf0e10cSrcweir 		SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER);
355cdf0e10cSrcweir         OSL_UNUSED( nError );
356cdf0e10cSrcweir 		//N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER);
357cdf0e10cSrcweir 	}
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	return m_pDriverHandle;
360cdf0e10cSrcweir }
361cdf0e10cSrcweir // -----------------------------------------------------------------------------
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 	}
364cdf0e10cSrcweir }
365cdf0e10cSrcweir 
366