Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "file/FDatabaseMetaData.hxx"
21 : #include "FDatabaseMetaDataResultSet.hxx"
22 : #include <com/sun/star/sdbc/DataType.hpp>
23 : #include <com/sun/star/sdbc/ResultSetType.hpp>
24 : #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
25 : #include <com/sun/star/ucb/SearchRecursion.hpp>
26 : #include <com/sun/star/ucb/SearchCommandArgument.hpp>
27 : #include <com/sun/star/ucb/UniversalContentBroker.hpp>
28 : #include <com/sun/star/ucb/SortedDynamicResultSetFactory.hpp>
29 : #include <com/sun/star/lang/XUnoTunnel.hpp>
30 : #include <tools/urlobj.hxx>
31 : #include "file/FDriver.hxx"
32 : #include "file/FTable.hxx"
33 : #include <comphelper/processfactory.hxx>
34 : #include <ucbhelper/content.hxx>
35 :
36 : using namespace com::sun::star::ucb;
37 : using namespace connectivity::file;
38 : using namespace connectivity;
39 : using namespace com::sun::star::uno;
40 : using namespace com::sun::star::lang;
41 : using namespace com::sun::star::beans;
42 : using namespace com::sun::star::sdbc;
43 : using namespace com::sun::star::sdbcx;
44 : using namespace com::sun::star::container;
45 :
46 38 : ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
47 38 : ,m_pConnection(_pCon)
48 : {
49 38 : }
50 :
51 37 : ODatabaseMetaData::~ODatabaseMetaData()
52 : {
53 37 : }
54 :
55 0 : Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
56 : {
57 0 : return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTypeInfo );
58 : }
59 :
60 34 : OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
61 : {
62 34 : return OUString();
63 : }
64 :
65 0 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
66 : const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*tableNamePattern*/,
67 : const OUString& /*columnNamePattern*/ ) throw(SQLException, RuntimeException, std::exception)
68 : {
69 : SAL_WARN("connectivity.drivers", "ODatabaseMetaData::getColumns() should be overridden!");
70 0 : return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns );
71 : }
72 :
73 :
74 : namespace
75 : {
76 70 : sal_Int16 isCaseSensitiveParentFolder( const OUString& _rFolderOrDoc, const OUString& _rDocName )
77 : {
78 70 : sal_Int16 nIsCS = 1;
79 : try
80 : {
81 : // first get the real content for the URL
82 70 : INetURLObject aContentURL( _rFolderOrDoc );
83 140 : ::ucbhelper::Content aContent1;
84 : {
85 70 : ::ucbhelper::Content aFolderOrDoc( _rFolderOrDoc, Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
86 70 : if ( aFolderOrDoc.isDocument() )
87 0 : aContent1 = aFolderOrDoc;
88 : else
89 : {
90 70 : aContentURL = INetURLObject( _rFolderOrDoc, INetURLObject::WAS_ENCODED );
91 70 : aContentURL.Append( _rDocName );
92 70 : aContent1 = ::ucbhelper::Content( aContentURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
93 70 : }
94 : }
95 :
96 : // get two extensions which differ by case only
97 140 : OUString sExtension1(aContentURL.getExtension());
98 140 : OUString sExtension2(sExtension1.toAsciiLowerCase());
99 70 : if (sExtension2 == sExtension1)
100 : {
101 : // the extension was already in lower case
102 70 : sExtension2 = sExtension2.toAsciiUpperCase();
103 : }
104 :
105 : // the complete URL for the second extension
106 140 : INetURLObject aURL2( aContentURL );
107 70 : if (!sExtension2.isEmpty())
108 70 : aURL2.SetExtension( sExtension2 );
109 70 : if ( aURL2.GetMainURL(INetURLObject::NO_DECODE) == aContentURL.GetMainURL(INetURLObject::NO_DECODE) )
110 0 : return -1;
111 :
112 : // the second context
113 70 : bool bCanAccess = false;
114 140 : ::ucbhelper::Content aContent2;
115 : try
116 : {
117 70 : aContent2 = ::ucbhelper::Content( aURL2.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
118 70 : bCanAccess = aContent2.isDocument();
119 : }
120 70 : catch( const Exception& )
121 : {
122 : }
123 :
124 70 : if ( bCanAccess )
125 : {
126 : // here we have two contents whose URLs differ by case only.
127 : // Now let's check if both really refer to the same object ....
128 0 : Reference< XContent > xContent1 = aContent1.get();
129 0 : Reference< XContent > xContent2 = aContent2.get();
130 : OSL_ENSURE( xContent1.is() && xContent2.is(), "isCaseSensitiveParentFolder: invalid content interfaces!" );
131 0 : if ( xContent1.is() && xContent2.is() )
132 : {
133 0 : Reference< XContentIdentifier > xID1 = xContent1->getIdentifier();
134 0 : Reference< XContentIdentifier > xID2 = xContent2->getIdentifier();
135 : OSL_ENSURE( xID1.is() && xID2.is(), "isCaseSensitiveParentFolder: invalid ID interfaces!" );
136 0 : if ( xID1.is() && xID2.is()
137 0 : && ( UniversalContentBroker::create(
138 0 : comphelper::getProcessComponentContext() )->
139 0 : compareContentIds( xID1, xID2 ) == 0 ) )
140 : {
141 : // finally, we know that the folder is not case-sensitive ....
142 0 : nIsCS = 0;
143 0 : }
144 0 : }
145 70 : }
146 : }
147 0 : catch( const Exception& )
148 : {
149 : SAL_WARN( "connectivity.drivers", "isCaseSensitiveParentFolder: caught an unexpected exception!" );
150 : }
151 :
152 70 : return nIsCS;
153 : }
154 : }
155 :
156 :
157 70 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
158 : const Any& /*catalog*/, const OUString& /*schemaPattern*/,
159 : const OUString& tableNamePattern, const Sequence< OUString >& types ) throw(SQLException, RuntimeException, std::exception)
160 : {
161 70 : ::osl::MutexGuard aGuard( m_aMutex );
162 :
163 :
164 70 : ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTables );
165 70 : Reference< XResultSet > xRef = pResult;
166 :
167 : // check if any type is given
168 : // when no types are given then we have to return all tables e.g. TABLE
169 :
170 : static const char aTable[] = "TABLE";
171 :
172 70 : bool bTableFound = true;
173 70 : sal_Int32 nLength = types.getLength();
174 70 : if(nLength)
175 : {
176 44 : bTableFound = false;
177 :
178 44 : const OUString* pBegin = types.getConstArray();
179 44 : const OUString* pEnd = pBegin + nLength;
180 88 : for(;pBegin != pEnd;++pBegin)
181 : {
182 88 : if(*pBegin == aTable)
183 : {
184 44 : bTableFound = true;
185 44 : break;
186 : }
187 : }
188 : }
189 70 : if(!bTableFound)
190 0 : return xRef;
191 :
192 140 : Reference<XDynamicResultSet> xContent = m_pConnection->getDir();
193 : Reference < XSortedDynamicResultSetFactory > xSRSFac =
194 140 : SortedDynamicResultSetFactory::create( m_pConnection->getDriver()->getComponentContext() );
195 :
196 140 : Sequence< NumberedSortingInfo > aSortInfo( 1 );
197 70 : NumberedSortingInfo* pInfo = aSortInfo.getArray();
198 70 : pInfo[ 0 ].ColumnIndex = 1;
199 70 : pInfo[ 0 ].Ascending = sal_True;
200 :
201 140 : Reference < XAnyCompareFactory > xFactory;
202 140 : Reference< XDynamicResultSet > xDynamicResultSet;
203 70 : xDynamicResultSet = xSRSFac->createSortedDynamicResultSet( xContent, aSortInfo, xFactory );
204 140 : Reference<XResultSet> xResultSet = xDynamicResultSet->getStaticResultSet();
205 :
206 140 : Reference<XRow> xRow(xResultSet,UNO_QUERY);
207 :
208 140 : OUString aFilenameExtension = m_pConnection->getExtension();
209 140 : OUString sThisContentExtension;
210 140 : ODatabaseMetaDataResultSet::ORows aRows;
211 : // scan the directory for tables
212 140 : OUString aName;
213 140 : INetURLObject aURL;
214 70 : xResultSet->beforeFirst();
215 :
216 70 : bool bKnowCaseSensivity = false;
217 70 : bool bCaseSensitiveDir = true;
218 70 : bool bCheckEnabled = m_pConnection->isCheckEnabled();
219 :
220 352 : while(xResultSet->next())
221 : {
222 212 : aName = xRow->getString(1);
223 212 : aURL.SetSmartProtocol(INetProtocol::File);
224 212 : OUString sUrl = m_pConnection->getURL() + "/" + aName;
225 212 : aURL.SetSmartURL( sUrl );
226 212 : sThisContentExtension = aURL.getExtension();
227 :
228 424 : ODatabaseMetaDataResultSet::ORow aRow(3);
229 212 : aRow.reserve(6);
230 212 : bool bNewRow = false;
231 :
232 212 : if ( !bKnowCaseSensivity )
233 : {
234 70 : bKnowCaseSensivity = true;
235 70 : sal_Int16 nCase = isCaseSensitiveParentFolder( m_pConnection->getURL(), aURL.getName() );
236 70 : switch( nCase )
237 : {
238 : case 1:
239 70 : bCaseSensitiveDir = true;
240 70 : break;
241 : case -1:
242 0 : bKnowCaseSensivity = false;
243 : /** run through */
244 : case 0:
245 0 : bCaseSensitiveDir = false;
246 : }
247 70 : if ( bKnowCaseSensivity )
248 : {
249 70 : m_pConnection->setCaseSensitiveExtension( bCaseSensitiveDir, OConnection::GrantAccess() );
250 70 : if ( !bCaseSensitiveDir )
251 : {
252 0 : aFilenameExtension = aFilenameExtension.toAsciiLowerCase();
253 : }
254 : }
255 : }
256 :
257 212 : if (!aFilenameExtension.isEmpty())
258 : {
259 212 : if ( !bCaseSensitiveDir )
260 : {
261 0 : sThisContentExtension = sThisContentExtension.toAsciiLowerCase();
262 : }
263 :
264 212 : if ( sThisContentExtension == aFilenameExtension )
265 : {
266 98 : aName = aName.copy(0, (aName.getLength()-(aFilenameExtension.getLength()+1)));
267 98 : sal_Unicode nChar = aName.toChar();
268 98 : if ( match(tableNamePattern,aName,'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) )
269 : {
270 54 : aRow.push_back(new ORowSetValueDecorator(aName));
271 54 : bNewRow = true;
272 : }
273 : }
274 : }
275 : else // no extension, filter myself
276 : {
277 0 : bool bErg = false;
278 0 : do
279 : {
280 0 : if (aURL.getExtension().isEmpty())
281 : {
282 0 : sal_Unicode nChar = aURL.getBase()[0];
283 0 : if(match(tableNamePattern,aURL.getBase(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) )
284 : {
285 0 : aRow.push_back(new ORowSetValueDecorator(OUString(aURL.getBase())));
286 0 : bNewRow = true;
287 : }
288 0 : break;
289 : }
290 0 : else if ( ( bErg = xResultSet->next() ) )
291 : {
292 0 : aName = xRow->getString(1);
293 0 : aURL.SetSmartURL(aName);
294 : }
295 : } while (bErg);
296 : }
297 212 : if(bNewRow)
298 : {
299 54 : aRow.push_back(new ORowSetValueDecorator(OUString(aTable)));
300 54 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
301 :
302 54 : aRows.push_back(aRow);
303 : }
304 212 : }
305 :
306 70 : pResult->setRows(aRows);
307 :
308 140 : return xRef;
309 : }
310 :
311 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException, std::exception)
312 : {
313 0 : return 0;
314 : }
315 :
316 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException, std::exception)
317 : {
318 0 : return 0;
319 : }
320 :
321 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException, std::exception)
322 : {
323 0 : return 0;
324 : }
325 :
326 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException, std::exception)
327 : {
328 0 : return SAL_MAX_INT32;
329 : }
330 :
331 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException, std::exception)
332 : {
333 0 : return 0;
334 : }
335 :
336 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException, std::exception)
337 : {
338 0 : return 0;
339 : }
340 :
341 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException, std::exception)
342 : {
343 0 : return 0;
344 : }
345 :
346 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException, std::exception)
347 : {
348 0 : return 0;
349 : }
350 :
351 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException, std::exception)
352 : {
353 0 : return 0;
354 : }
355 :
356 0 : sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
357 : {
358 0 : return 0;
359 : }
360 :
361 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException, std::exception)
362 : {
363 0 : return 0;
364 : }
365 :
366 38 : sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
367 : {
368 38 : return 1;
369 : }
370 :
371 0 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
372 : const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& tableNamePattern ) throw(SQLException, RuntimeException, std::exception)
373 : {
374 0 : ::osl::MutexGuard aGuard( m_aMutex );
375 :
376 0 : ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
377 0 : Reference< XResultSet > xRef = pResult;
378 0 : ODatabaseMetaDataResultSet::ORows aRows;
379 :
380 :
381 0 : Reference< XTablesSupplier > xTabSup = m_pConnection->createCatalog();
382 0 : if( xTabSup.is())
383 : {
384 0 : Reference< XNameAccess> xNames = xTabSup->getTables();
385 0 : Sequence< OUString > aNames = xNames->getElementNames();
386 0 : const OUString* pBegin = aNames.getConstArray();
387 0 : const OUString* pEnd = pBegin + aNames.getLength();
388 0 : for(;pBegin != pEnd;++pBegin)
389 : {
390 0 : if(match(tableNamePattern,*pBegin,'\0'))
391 : {
392 0 : static ODatabaseMetaDataResultSet::ORow aRow(8);
393 :
394 0 : aRow[2] = new ORowSetValueDecorator(*pBegin);
395 0 : aRow[6] = ODatabaseMetaDataResultSet::getSelectValue();
396 0 : aRow[7] = new ORowSetValueDecorator(OUString("NO"));
397 0 : aRows.push_back(aRow);
398 :
399 : Reference< XPropertySet> xTable(
400 0 : xNames->getByName(*pBegin), css::uno::UNO_QUERY);
401 0 : if(xTable.is())
402 : {
403 0 : Reference<XUnoTunnel> xTunnel(xTable,UNO_QUERY);
404 0 : if(xTunnel.is())
405 : {
406 0 : OFileTable* pTable = reinterpret_cast< OFileTable* >( xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()) );
407 0 : if(pTable)
408 : {
409 0 : if(!pTable->isReadOnly())
410 : {
411 0 : aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
412 0 : aRows.push_back(aRow);
413 0 : if(!m_pConnection->showDeleted())
414 : {
415 0 : aRow[6] = ODatabaseMetaDataResultSet::getDeleteValue();
416 0 : aRows.push_back(aRow);
417 : }
418 0 : aRow[6] = ODatabaseMetaDataResultSet::getUpdateValue();
419 0 : aRows.push_back(aRow);
420 0 : aRow[6] = ODatabaseMetaDataResultSet::getCreateValue();
421 0 : aRows.push_back(aRow);
422 0 : aRow[6] = ODatabaseMetaDataResultSet::getReadValue();
423 0 : aRows.push_back(aRow);
424 0 : aRow[6] = ODatabaseMetaDataResultSet::getAlterValue();
425 0 : aRows.push_back(aRow);
426 0 : aRow[6] = ODatabaseMetaDataResultSet::getDropValue();
427 0 : aRows.push_back(aRow);
428 : }
429 : }
430 0 : }
431 0 : }
432 : }
433 0 : }
434 : }
435 :
436 0 : pResult->setRows(aRows);
437 0 : return xRef;
438 : }
439 :
440 0 : sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException, std::exception)
441 : {
442 0 : return sal_True;
443 : }
444 :
445 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
446 : {
447 0 : return sal_False;
448 : }
449 :
450 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
451 : {
452 0 : return sal_False;
453 : }
454 :
455 0 : bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
456 : {
457 0 : return false;
458 : }
459 :
460 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
461 : {
462 0 : return sal_False;
463 : }
464 :
465 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
466 : {
467 0 : return sal_False;
468 : }
469 :
470 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
471 : {
472 0 : return sal_False;
473 : }
474 :
475 8 : bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
476 : {
477 8 : return false;
478 : }
479 :
480 8 : bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
481 : {
482 8 : return false;
483 : }
484 :
485 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException, std::exception)
486 : {
487 0 : return 0;
488 : }
489 :
490 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException, std::exception)
491 : {
492 0 : return sal_False;
493 : }
494 :
495 0 : OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException, std::exception)
496 : {
497 0 : return OUString();
498 : }
499 :
500 34 : OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
501 : {
502 34 : return OUString("\"");
503 : }
504 :
505 12 : OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException, std::exception)
506 : {
507 12 : return OUString();
508 : }
509 :
510 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
511 : {
512 0 : return sal_True;
513 : }
514 :
515 0 : bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
516 : {
517 0 : return true;
518 : }
519 :
520 0 : sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException, std::exception)
521 : {
522 0 : return sal_True;
523 : }
524 :
525 0 : sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException, std::exception)
526 : {
527 0 : return sal_True;
528 : }
529 :
530 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException, std::exception)
531 : {
532 0 : return sal_False;
533 : }
534 :
535 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException, std::exception)
536 : {
537 0 : return sal_False;
538 : }
539 :
540 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException, std::exception)
541 : {
542 0 : return sal_False;
543 : }
544 :
545 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException, std::exception)
546 : {
547 0 : return sal_False;
548 : }
549 :
550 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
551 : {
552 0 : return sal_False;
553 : }
554 :
555 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
556 : {
557 0 : return sal_False;
558 : }
559 :
560 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
561 : {
562 0 : return sal_False;
563 : }
564 :
565 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
566 : {
567 0 : return sal_False;
568 : }
569 :
570 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException, std::exception)
571 : {
572 0 : return sal_False;
573 : }
574 :
575 34 : bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
576 : {
577 34 : return false;
578 : }
579 :
580 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException, std::exception)
581 : {
582 0 : return sal_False;
583 : }
584 :
585 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException, std::exception)
586 : {
587 0 : return sal_False;
588 : }
589 :
590 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException, std::exception)
591 : {
592 0 : return sal_False;
593 : }
594 :
595 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
596 : {
597 0 : return sal_False;
598 : }
599 :
600 0 : bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
601 : {
602 0 : return false;
603 : }
604 :
605 0 : bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
606 : {
607 0 : return false;
608 : }
609 :
610 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
611 : {
612 0 : return sal_False;
613 : }
614 :
615 34 : bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
616 : {
617 34 : return false;
618 : }
619 :
620 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
621 : {
622 0 : return sal_False;
623 : }
624 :
625 38 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException, std::exception)
626 : {
627 38 : ::osl::MutexGuard aGuard( m_aMutex );
628 :
629 38 : ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes );
630 38 : Reference< XResultSet > xRef = pResult;
631 38 : static ODatabaseMetaDataResultSet::ORows aRows;
632 38 : if(aRows.empty())
633 : {
634 11 : ODatabaseMetaDataResultSet::ORow aRow;
635 11 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
636 11 : aRow.push_back(new ORowSetValueDecorator(OUString("TABLE")));
637 11 : aRows.push_back(aRow);
638 : }
639 38 : pResult->setRows(aRows);
640 38 : return xRef;
641 : }
642 :
643 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException, std::exception)
644 : {
645 0 : return 0;
646 : }
647 :
648 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException, std::exception)
649 : {
650 0 : return 0;
651 : }
652 :
653 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException, std::exception)
654 : {
655 0 : return 0;
656 : }
657 :
658 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException, std::exception)
659 : {
660 0 : return sal_False;
661 : }
662 :
663 0 : sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException, std::exception)
664 : {
665 0 : return sal_False;
666 : }
667 :
668 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException, std::exception)
669 : {
670 0 : return sal_False;
671 : }
672 :
673 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException, std::exception)
674 : {
675 0 : return sal_False;
676 : }
677 :
678 0 : sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException, std::exception)
679 : {
680 0 : return sal_True;
681 : }
682 :
683 0 : sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException, std::exception)
684 : {
685 0 : return sal_True;
686 : }
687 :
688 0 : sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException, std::exception)
689 : {
690 0 : return sal_True;
691 : }
692 :
693 0 : sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException, std::exception)
694 : {
695 0 : return sal_True;
696 : }
697 :
698 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException, std::exception)
699 : {
700 0 : return sal_False;
701 : }
702 :
703 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException, std::exception)
704 : {
705 0 : return sal_True;
706 : }
707 :
708 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException, std::exception)
709 : {
710 0 : return sal_True;
711 : }
712 :
713 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
714 : {
715 0 : return sal_True;
716 : }
717 :
718 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException, std::exception)
719 : {
720 0 : return sal_False;
721 : }
722 :
723 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
724 : {
725 0 : return sal_False;
726 : }
727 :
728 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException, std::exception)
729 : {
730 0 : return sal_False;
731 : }
732 :
733 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException, std::exception)
734 : {
735 0 : return sal_False;
736 : }
737 :
738 1 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
739 : {
740 1 : return sal_False;
741 : }
742 :
743 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException, std::exception)
744 : {
745 0 : return sal_False;
746 : }
747 :
748 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException, std::exception)
749 : {
750 0 : return sal_False;
751 : }
752 :
753 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException, std::exception)
754 : {
755 0 : return sal_False;
756 : }
757 :
758 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
759 : {
760 0 : return sal_True;
761 : }
762 :
763 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException, std::exception)
764 : {
765 0 : return sal_False;
766 : }
767 :
768 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException, std::exception)
769 : {
770 0 : return sal_False;
771 : }
772 :
773 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
774 : {
775 0 : return sal_True;
776 : }
777 :
778 9 : bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
779 : {
780 9 : return false;
781 : }
782 :
783 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException, std::exception)
784 : {
785 0 : return sal_False;
786 : }
787 :
788 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException, std::exception)
789 : {
790 0 : return sal_True;
791 : }
792 :
793 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException, std::exception)
794 : {
795 0 : return sal_False;
796 : }
797 :
798 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException, std::exception)
799 : {
800 0 : return sal_True;
801 : }
802 :
803 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
804 : {
805 0 : return sal_False;
806 : }
807 :
808 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
809 : {
810 0 : return sal_False;
811 : }
812 :
813 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
814 : {
815 0 : return sal_False;
816 : }
817 :
818 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
819 : {
820 0 : return sal_False;
821 : }
822 :
823 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException, std::exception)
824 : {
825 0 : return sal_False;
826 : }
827 :
828 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException, std::exception)
829 : {
830 0 : return sal_False;
831 : }
832 :
833 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException, std::exception)
834 : {
835 0 : return sal_False;
836 : }
837 :
838 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException, std::exception)
839 : {
840 0 : return sal_False;
841 : }
842 :
843 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException, std::exception)
844 : {
845 0 : return sal_False;
846 : }
847 :
848 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException, std::exception)
849 : {
850 0 : return sal_False;
851 : }
852 :
853 0 : OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception)
854 : {
855 0 : return OUString( "sdbc:file:" );
856 : }
857 :
858 0 : OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException, std::exception)
859 : {
860 0 : return OUString();
861 : }
862 :
863 0 : OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException, std::exception)
864 : {
865 0 : return OUString();
866 : }
867 :
868 0 : OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException, std::exception)
869 : {
870 0 : return OUString::number(1);
871 : }
872 :
873 0 : OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException, std::exception)
874 : {
875 0 : return OUString::number(0);
876 : }
877 :
878 0 : OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException, std::exception)
879 : {
880 0 : return OUString();
881 : }
882 :
883 0 : OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException, std::exception)
884 : {
885 0 : return OUString();
886 : }
887 :
888 0 : OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException, std::exception)
889 : {
890 0 : return OUString();
891 : }
892 :
893 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException, std::exception)
894 : {
895 0 : return 0;
896 : }
897 :
898 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException, std::exception)
899 : {
900 0 : return 0;
901 : }
902 :
903 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException, std::exception)
904 : {
905 0 : return 0;
906 : }
907 :
908 0 : OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException, std::exception)
909 : {
910 0 : return OUString();
911 : }
912 :
913 0 : OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException, std::exception)
914 : {
915 0 : return OUString();
916 : }
917 :
918 0 : OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException, std::exception)
919 : {
920 0 : return OUString("UCASE,LCASE,ASCII,LENGTH,OCTET_LENGTH,CHAR_LENGTH,CHARACTER_LENGTH,CHAR,CONCAT,LOCATE,SUBSTRING,LTRIM,RTRIM,SPACE,REPLACE,REPEAT,INSERT,LEFT,RIGHT");
921 : }
922 :
923 0 : OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException, std::exception)
924 : {
925 0 : return OUString("DAYOFWEEK,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,CURDATE,CURTIME,NOW");
926 : }
927 :
928 0 : OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException, std::exception)
929 : {
930 0 : return OUString();
931 : }
932 :
933 0 : OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException, std::exception)
934 : {
935 0 : return OUString("ABS,SIGN,MOD,FLOOR,CEILING,ROUND,EXP,LN,LOG,LOG10,POWER,SQRT,PI,COS,SIN,TAN,ACOS,ASIN,ATAN,ATAN2,DEGREES,RADIANS");
936 : }
937 :
938 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
939 : {
940 0 : return sal_False;
941 : }
942 :
943 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
944 : {
945 0 : return sal_False;
946 : }
947 :
948 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
949 : {
950 0 : return sal_True;
951 : }
952 :
953 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
954 : {
955 0 : return sal_False;
956 : }
957 :
958 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
959 : {
960 0 : return sal_False;
961 : }
962 :
963 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException, std::exception)
964 : {
965 0 : return 0;
966 : }
967 :
968 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
969 : {
970 0 : return 0;
971 : }
972 :
973 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException, std::exception)
974 : {
975 0 : return 0;
976 : }
977 :
978 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException, std::exception)
979 : {
980 0 : return 0;
981 : }
982 :
983 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
984 : {
985 0 : switch(setType)
986 : {
987 : case ResultSetType::FORWARD_ONLY:
988 0 : return sal_True;
989 : case ResultSetType::SCROLL_INSENSITIVE:
990 : case ResultSetType::SCROLL_SENSITIVE:
991 0 : break;
992 : }
993 0 : return sal_False;
994 : }
995 :
996 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException, std::exception)
997 : {
998 0 : switch(setType)
999 : {
1000 : case ResultSetType::FORWARD_ONLY:
1001 0 : return sal_True;
1002 : case ResultSetType::SCROLL_INSENSITIVE:
1003 : case ResultSetType::SCROLL_SENSITIVE:
1004 0 : break;
1005 : }
1006 0 : return sal_False;
1007 : }
1008 :
1009 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1010 : {
1011 0 : return sal_True;
1012 : }
1013 :
1014 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1015 : {
1016 0 : return sal_True;
1017 : }
1018 :
1019 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1020 : {
1021 0 : return sal_True;
1022 : }
1023 :
1024 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1025 : {
1026 0 : return sal_True;
1027 : }
1028 :
1029 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1030 : {
1031 0 : return sal_True;
1032 : }
1033 :
1034 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1035 : {
1036 0 : return sal_True;
1037 : }
1038 :
1039 0 : sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1040 : {
1041 0 : return sal_False;
1042 : }
1043 :
1044 0 : sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1045 : {
1046 0 : return sal_False;
1047 : }
1048 :
1049 0 : sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1050 : {
1051 0 : return sal_False;
1052 : }
1053 :
1054 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException, std::exception)
1055 : {
1056 0 : return sal_False;
1057 : }
1058 :
1059 0 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException, std::exception)
1060 : {
1061 0 : return NULL;
1062 : }
1063 :
1064 :
1065 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|