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 62 : ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
47 62 : ,m_pConnection(_pCon)
48 : {
49 62 : }
50 :
51 62 : ODatabaseMetaData::~ODatabaseMetaData()
52 : {
53 62 : }
54 :
55 0 : Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
56 : {
57 0 : return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTypeInfo );
58 : }
59 :
60 56 : OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
61 : {
62 56 : 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","Should be overloaded!");
70 0 : return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns );
71 : }
72 :
73 :
74 : namespace
75 : {
76 140 : sal_Int16 isCaseSensitiveParentFolder( const OUString& _rFolderOrDoc, const OUString& _rDocName )
77 : {
78 140 : sal_Int16 nIsCS = 1;
79 : try
80 : {
81 : // first get the real content for the URL
82 140 : INetURLObject aContentURL( _rFolderOrDoc );
83 280 : ::ucbhelper::Content aContent1;
84 : {
85 140 : ::ucbhelper::Content aFolderOrDoc( _rFolderOrDoc, Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
86 140 : if ( aFolderOrDoc.isDocument() )
87 0 : aContent1 = aFolderOrDoc;
88 : else
89 : {
90 140 : aContentURL = INetURLObject( _rFolderOrDoc, INetURLObject::WAS_ENCODED );
91 140 : aContentURL.Append( _rDocName );
92 140 : aContent1 = ::ucbhelper::Content( aContentURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
93 140 : }
94 : }
95 :
96 : // get two extensions which differ by case only
97 280 : OUString sExtension1(aContentURL.getExtension());
98 280 : OUString sExtension2(sExtension1.toAsciiLowerCase());
99 140 : if (sExtension2 == sExtension1)
100 : {
101 : // the extension was already in lower case
102 140 : sExtension2 = sExtension2.toAsciiUpperCase();
103 : }
104 :
105 : // the complete URL for the second extension
106 280 : INetURLObject aURL2( aContentURL );
107 140 : if (!sExtension2.isEmpty())
108 140 : aURL2.SetExtension( sExtension2 );
109 140 : if ( aURL2.GetMainURL(INetURLObject::NO_DECODE) == aContentURL.GetMainURL(INetURLObject::NO_DECODE) )
110 0 : return -1;
111 :
112 : // the second context
113 140 : bool bCanAccess = false;
114 280 : ::ucbhelper::Content aContent2;
115 : try
116 : {
117 140 : aContent2 = ::ucbhelper::Content( aURL2.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
118 140 : bCanAccess = aContent2.isDocument();
119 : }
120 140 : catch( const Exception& )
121 : {
122 : }
123 :
124 140 : 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 140 : }
146 : }
147 0 : catch( const Exception& )
148 : {
149 : SAL_WARN( "connectivity.drivers", "isCaseSensitiveParentFolder: caught an unexpected exception!" );
150 : }
151 :
152 140 : return nIsCS;
153 : }
154 : }
155 :
156 :
157 140 : 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 140 : ::osl::MutexGuard aGuard( m_aMutex );
162 :
163 :
164 140 : ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTables );
165 140 : 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 140 : static const OUString aTable("TABLE");
171 :
172 140 : bool bTableFound = true;
173 140 : sal_Int32 nLength = types.getLength();
174 140 : if(nLength)
175 : {
176 88 : bTableFound = false;
177 :
178 88 : const OUString* pBegin = types.getConstArray();
179 88 : const OUString* pEnd = pBegin + nLength;
180 176 : for(;pBegin != pEnd;++pBegin)
181 : {
182 176 : if(*pBegin == aTable)
183 : {
184 88 : bTableFound = true;
185 88 : break;
186 : }
187 : }
188 : }
189 140 : if(!bTableFound)
190 0 : return xRef;
191 :
192 280 : Reference<XDynamicResultSet> xContent = m_pConnection->getDir();
193 : Reference < XSortedDynamicResultSetFactory > xSRSFac =
194 280 : SortedDynamicResultSetFactory::create( m_pConnection->getDriver()->getComponentContext() );
195 :
196 280 : Sequence< NumberedSortingInfo > aSortInfo( 1 );
197 140 : NumberedSortingInfo* pInfo = aSortInfo.getArray();
198 140 : pInfo[ 0 ].ColumnIndex = 1;
199 140 : pInfo[ 0 ].Ascending = sal_True;
200 :
201 280 : Reference < XAnyCompareFactory > xFactory;
202 280 : Reference< XDynamicResultSet > xDynamicResultSet;
203 140 : xDynamicResultSet = xSRSFac->createSortedDynamicResultSet( xContent, aSortInfo, xFactory );
204 280 : Reference<XResultSet> xResultSet = xDynamicResultSet->getStaticResultSet();
205 :
206 280 : Reference<XRow> xRow(xResultSet,UNO_QUERY);
207 :
208 280 : OUString aFilenameExtension = m_pConnection->getExtension();
209 280 : OUString sThisContentExtension;
210 280 : ODatabaseMetaDataResultSet::ORows aRows;
211 : // scan the directory for tables
212 280 : OUString aName;
213 280 : INetURLObject aURL;
214 140 : xResultSet->beforeFirst();
215 :
216 140 : bool bKnowCaseSensivity = false;
217 140 : bool bCaseSensitiveDir = true;
218 140 : bool bCheckEnabled = m_pConnection->isCheckEnabled();
219 :
220 704 : while(xResultSet->next())
221 : {
222 424 : aName = xRow->getString(1);
223 424 : aURL.SetSmartProtocol(INET_PROT_FILE);
224 424 : OUString sUrl = m_pConnection->getURL() + "/" + aName;
225 424 : aURL.SetSmartURL( sUrl );
226 424 : sThisContentExtension = aURL.getExtension();
227 :
228 848 : ODatabaseMetaDataResultSet::ORow aRow(3);
229 424 : aRow.reserve(6);
230 424 : bool bNewRow = false;
231 :
232 424 : if ( !bKnowCaseSensivity )
233 : {
234 140 : bKnowCaseSensivity = true;
235 140 : sal_Int16 nCase = isCaseSensitiveParentFolder( m_pConnection->getURL(), aURL.getName() );
236 140 : switch( nCase )
237 : {
238 : case 1:
239 140 : bCaseSensitiveDir = true;
240 140 : break;
241 : case -1:
242 0 : bKnowCaseSensivity = false;
243 : /** run through */
244 : case 0:
245 0 : bCaseSensitiveDir = false;
246 : }
247 140 : if ( bKnowCaseSensivity )
248 : {
249 140 : m_pConnection->setCaseSensitiveExtension( bCaseSensitiveDir, OConnection::GrantAccess() );
250 140 : if ( !bCaseSensitiveDir )
251 : {
252 0 : aFilenameExtension = aFilenameExtension.toAsciiLowerCase();
253 : }
254 : }
255 : }
256 :
257 424 : if (!aFilenameExtension.isEmpty())
258 : {
259 424 : if ( !bCaseSensitiveDir )
260 : {
261 0 : sThisContentExtension = sThisContentExtension.toAsciiLowerCase();
262 : }
263 :
264 424 : if ( sThisContentExtension == aFilenameExtension )
265 : {
266 196 : aName = aName.copy(0, (aName.getLength()-(aFilenameExtension.getLength()+1)));
267 196 : sal_Unicode nChar = aName.toChar();
268 196 : if ( match(tableNamePattern,aName,'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) )
269 : {
270 108 : aRow.push_back(new ORowSetValueDecorator(aName));
271 108 : 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 424 : if(bNewRow)
298 : {
299 108 : aRow.push_back(new ORowSetValueDecorator(aTable));
300 108 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
301 :
302 108 : aRows.push_back(aRow);
303 : }
304 424 : }
305 :
306 140 : pResult->setRows(aRows);
307 :
308 280 : 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 62 : sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
367 : {
368 62 : 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 4 : bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
476 : {
477 4 : return false;
478 : }
479 :
480 4 : bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
481 : {
482 4 : 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 56 : OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
501 : {
502 56 : static const OUString sQuote("\"");
503 56 : return sQuote;
504 : }
505 :
506 24 : OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException, std::exception)
507 : {
508 24 : return OUString();
509 : }
510 :
511 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
512 : {
513 0 : return sal_True;
514 : }
515 :
516 0 : bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
517 : {
518 0 : return true;
519 : }
520 :
521 0 : sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException, std::exception)
522 : {
523 0 : return sal_True;
524 : }
525 :
526 0 : sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException, std::exception)
527 : {
528 0 : return sal_True;
529 : }
530 :
531 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException, std::exception)
532 : {
533 0 : return sal_False;
534 : }
535 :
536 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException, std::exception)
537 : {
538 0 : return sal_False;
539 : }
540 :
541 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException, std::exception)
542 : {
543 0 : return sal_False;
544 : }
545 :
546 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException, std::exception)
547 : {
548 0 : return sal_False;
549 : }
550 :
551 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
552 : {
553 0 : return sal_False;
554 : }
555 :
556 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
557 : {
558 0 : return sal_False;
559 : }
560 :
561 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
562 : {
563 0 : return sal_False;
564 : }
565 :
566 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
567 : {
568 0 : return sal_False;
569 : }
570 :
571 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException, std::exception)
572 : {
573 0 : return sal_False;
574 : }
575 :
576 56 : bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
577 : {
578 56 : return false;
579 : }
580 :
581 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException, std::exception)
582 : {
583 0 : return sal_False;
584 : }
585 :
586 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException, std::exception)
587 : {
588 0 : return sal_False;
589 : }
590 :
591 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException, std::exception)
592 : {
593 0 : return sal_False;
594 : }
595 :
596 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
597 : {
598 0 : return sal_False;
599 : }
600 :
601 0 : bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
602 : {
603 0 : return false;
604 : }
605 :
606 0 : bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
607 : {
608 0 : return false;
609 : }
610 :
611 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
612 : {
613 0 : return sal_False;
614 : }
615 :
616 56 : bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
617 : {
618 56 : return false;
619 : }
620 :
621 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
622 : {
623 0 : return sal_False;
624 : }
625 :
626 62 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException, std::exception)
627 : {
628 62 : ::osl::MutexGuard aGuard( m_aMutex );
629 :
630 62 : ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes );
631 62 : Reference< XResultSet > xRef = pResult;
632 62 : static ODatabaseMetaDataResultSet::ORows aRows;
633 62 : if(aRows.empty())
634 : {
635 12 : ODatabaseMetaDataResultSet::ORow aRow;
636 12 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
637 12 : aRow.push_back(new ORowSetValueDecorator(OUString("TABLE")));
638 12 : aRows.push_back(aRow);
639 : }
640 62 : pResult->setRows(aRows);
641 62 : return xRef;
642 : }
643 :
644 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException, std::exception)
645 : {
646 0 : return 0;
647 : }
648 :
649 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException, std::exception)
650 : {
651 0 : return 0;
652 : }
653 :
654 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException, std::exception)
655 : {
656 0 : return 0;
657 : }
658 :
659 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException, std::exception)
660 : {
661 0 : return sal_False;
662 : }
663 :
664 0 : sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException, std::exception)
665 : {
666 0 : return sal_False;
667 : }
668 :
669 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException, std::exception)
670 : {
671 0 : return sal_False;
672 : }
673 :
674 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException, std::exception)
675 : {
676 0 : return sal_False;
677 : }
678 :
679 0 : sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException, std::exception)
680 : {
681 0 : return sal_True;
682 : }
683 :
684 0 : sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException, std::exception)
685 : {
686 0 : return sal_True;
687 : }
688 :
689 0 : sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException, std::exception)
690 : {
691 0 : return sal_True;
692 : }
693 :
694 0 : sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException, std::exception)
695 : {
696 0 : return sal_True;
697 : }
698 :
699 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException, std::exception)
700 : {
701 0 : return sal_False;
702 : }
703 :
704 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException, std::exception)
705 : {
706 0 : return sal_True;
707 : }
708 :
709 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException, std::exception)
710 : {
711 0 : return sal_True;
712 : }
713 :
714 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
715 : {
716 0 : return sal_True;
717 : }
718 :
719 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException, std::exception)
720 : {
721 0 : return sal_False;
722 : }
723 :
724 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
725 : {
726 0 : return sal_False;
727 : }
728 :
729 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException, std::exception)
730 : {
731 0 : return sal_False;
732 : }
733 :
734 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException, std::exception)
735 : {
736 0 : return sal_False;
737 : }
738 :
739 2 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
740 : {
741 2 : return sal_False;
742 : }
743 :
744 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException, std::exception)
745 : {
746 0 : return sal_False;
747 : }
748 :
749 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException, std::exception)
750 : {
751 0 : return sal_False;
752 : }
753 :
754 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException, std::exception)
755 : {
756 0 : return sal_False;
757 : }
758 :
759 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
760 : {
761 0 : return sal_True;
762 : }
763 :
764 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException, std::exception)
765 : {
766 0 : return sal_False;
767 : }
768 :
769 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException, std::exception)
770 : {
771 0 : return sal_False;
772 : }
773 :
774 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
775 : {
776 0 : return sal_True;
777 : }
778 :
779 4 : bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
780 : {
781 4 : return false;
782 : }
783 :
784 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException, std::exception)
785 : {
786 0 : return sal_False;
787 : }
788 :
789 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException, std::exception)
790 : {
791 0 : return sal_True;
792 : }
793 :
794 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException, std::exception)
795 : {
796 0 : return sal_False;
797 : }
798 :
799 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException, std::exception)
800 : {
801 0 : return sal_True;
802 : }
803 :
804 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
805 : {
806 0 : return sal_False;
807 : }
808 :
809 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
810 : {
811 0 : return sal_False;
812 : }
813 :
814 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
815 : {
816 0 : return sal_False;
817 : }
818 :
819 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
820 : {
821 0 : return sal_False;
822 : }
823 :
824 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException, std::exception)
825 : {
826 0 : return sal_False;
827 : }
828 :
829 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException, std::exception)
830 : {
831 0 : return sal_False;
832 : }
833 :
834 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException, std::exception)
835 : {
836 0 : return sal_False;
837 : }
838 :
839 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException, std::exception)
840 : {
841 0 : return sal_False;
842 : }
843 :
844 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException, std::exception)
845 : {
846 0 : return sal_False;
847 : }
848 :
849 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException, std::exception)
850 : {
851 0 : return sal_False;
852 : }
853 :
854 0 : OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception)
855 : {
856 0 : static const OUString aValue( "sdbc:file:" );
857 0 : return aValue;
858 : }
859 :
860 0 : OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException, std::exception)
861 : {
862 0 : return OUString();
863 : }
864 :
865 0 : OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException, std::exception)
866 : {
867 0 : return OUString();
868 : }
869 :
870 0 : OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException, std::exception)
871 : {
872 0 : return OUString::number(1);
873 : }
874 :
875 0 : OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException, std::exception)
876 : {
877 0 : return OUString::number(0);
878 : }
879 :
880 0 : OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException, std::exception)
881 : {
882 0 : return OUString();
883 : }
884 :
885 0 : OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException, std::exception)
886 : {
887 0 : return OUString();
888 : }
889 :
890 0 : OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException, std::exception)
891 : {
892 0 : return OUString();
893 : }
894 :
895 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException, std::exception)
896 : {
897 0 : return 0;
898 : }
899 :
900 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException, std::exception)
901 : {
902 0 : return 0;
903 : }
904 :
905 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException, std::exception)
906 : {
907 0 : return 0;
908 : }
909 :
910 0 : OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException, std::exception)
911 : {
912 0 : return OUString();
913 : }
914 :
915 0 : OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException, std::exception)
916 : {
917 0 : return OUString();
918 : }
919 :
920 0 : OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException, std::exception)
921 : {
922 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");
923 : }
924 :
925 0 : OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException, std::exception)
926 : {
927 0 : return OUString("DAYOFWEEK,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,CURDATE,CURTIME,NOW");
928 : }
929 :
930 0 : OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException, std::exception)
931 : {
932 0 : return OUString();
933 : }
934 :
935 0 : OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException, std::exception)
936 : {
937 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");
938 : }
939 :
940 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
941 : {
942 0 : return sal_False;
943 : }
944 :
945 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
946 : {
947 0 : return sal_False;
948 : }
949 :
950 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
951 : {
952 0 : return sal_True;
953 : }
954 :
955 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
956 : {
957 0 : return sal_False;
958 : }
959 :
960 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
961 : {
962 0 : return sal_False;
963 : }
964 :
965 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException, std::exception)
966 : {
967 0 : return 0;
968 : }
969 :
970 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
971 : {
972 0 : return 0;
973 : }
974 :
975 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException, std::exception)
976 : {
977 0 : return 0;
978 : }
979 :
980 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException, std::exception)
981 : {
982 0 : return 0;
983 : }
984 :
985 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
986 : {
987 0 : switch(setType)
988 : {
989 : case ResultSetType::FORWARD_ONLY:
990 0 : return sal_True;
991 : case ResultSetType::SCROLL_INSENSITIVE:
992 : case ResultSetType::SCROLL_SENSITIVE:
993 0 : break;
994 : }
995 0 : return sal_False;
996 : }
997 :
998 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException, std::exception)
999 : {
1000 0 : switch(setType)
1001 : {
1002 : case ResultSetType::FORWARD_ONLY:
1003 0 : return sal_True;
1004 : case ResultSetType::SCROLL_INSENSITIVE:
1005 : case ResultSetType::SCROLL_SENSITIVE:
1006 0 : break;
1007 : }
1008 0 : return sal_False;
1009 : }
1010 :
1011 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1012 : {
1013 0 : return sal_True;
1014 : }
1015 :
1016 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1017 : {
1018 0 : return sal_True;
1019 : }
1020 :
1021 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1022 : {
1023 0 : return sal_True;
1024 : }
1025 :
1026 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1027 : {
1028 0 : return sal_True;
1029 : }
1030 :
1031 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1032 : {
1033 0 : return sal_True;
1034 : }
1035 :
1036 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1037 : {
1038 0 : return sal_True;
1039 : }
1040 :
1041 0 : sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1042 : {
1043 0 : return sal_False;
1044 : }
1045 :
1046 0 : sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1047 : {
1048 0 : return sal_False;
1049 : }
1050 :
1051 0 : sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1052 : {
1053 0 : return sal_False;
1054 : }
1055 :
1056 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException, std::exception)
1057 : {
1058 0 : return sal_False;
1059 : }
1060 :
1061 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)
1062 : {
1063 0 : return NULL;
1064 : }
1065 :
1066 :
1067 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|