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