20#include <config_fuzzers.h>
24#include <com/sun/star/sdbc/ResultSetType.hpp>
25#include <com/sun/star/ucb/UniversalContentBroker.hpp>
26#include <com/sun/star/ucb/SortedDynamicResultSetFactory.hpp>
66 const Any& ,
const OUString& ,
const OUString& ,
69 SAL_WARN(
"connectivity.drivers",
"ODatabaseMetaData::getColumns() should be overridden!");
77 sal_Int16 isCaseSensitiveParentFolder(
const OUString& _rFolderOrDoc, std::u16string_view _rDocName )
87 if ( aFolderOrDoc.isDocument() )
88 aContent1 = aFolderOrDoc;
92 aContentURL.Append( _rDocName );
98 OUString sExtension1(aContentURL.getExtension());
99 OUString sExtension2(sExtension1.toAsciiLowerCase());
100 if (sExtension2 == sExtension1)
103 sExtension2 = sExtension2.toAsciiUpperCase();
108 if (!sExtension2.isEmpty())
109 aURL2.SetExtension( sExtension2 );
114 bool bCanAccess =
false;
121 catch(
const Exception& )
131 OSL_ENSURE( xContent1.is() && xContent2.is(),
"isCaseSensitiveParentFolder: invalid content interfaces!" );
132 if ( xContent1.is() && xContent2.is() )
136 OSL_ENSURE( xID1.is() && xID2.is(),
"isCaseSensitiveParentFolder: invalid ID interfaces!" );
137 if ( xID1.is() && xID2.is()
138 && ( UniversalContentBroker::create(
140 compareContentIds( xID1, xID2 ) == 0 ) )
148 catch(
const Exception& )
160 const Any& ,
const OUString& ,
163 ::osl::MutexGuard aGuard(
m_aMutex );
170 static constexpr OUStringLiteral aTable =
u"TABLE";
172 bool bTableFound =
true;
173 sal_Int32
nLength = types.getLength();
178 const OUString* pBegin = types.getConstArray();
179 const OUString* pEnd = pBegin +
nLength;
180 for(;pBegin != pEnd;++pBegin)
182 if(*pBegin == aTable)
197 NumberedSortingInfo* pInfo = aSortInfo.getArray();
198 pInfo[ 0 ].ColumnIndex = 1;
199 pInfo[ 0 ].Ascending =
true;
208 OUString sThisContentExtension;
213 xResultSet->beforeFirst();
215 bool bKnowCaseSensitivity =
false;
216 bool bCaseSensitiveDir =
true;
219 while(xResultSet->next())
221 aName = xRow->getString(1);
222 aURL.SetSmartProtocol(INetProtocol::File);
224 aURL.SetSmartURL( sUrl );
225 sThisContentExtension =
aURL.getExtension();
229 bool bNewRow =
false;
231 if ( !bKnowCaseSensitivity )
233 bKnowCaseSensitivity =
true;
242 bCaseSensitiveDir =
true;
245 bKnowCaseSensitivity =
false;
248 bCaseSensitiveDir =
false;
250 if ( bKnowCaseSensitivity )
253 if ( !bCaseSensitiveDir )
255 aFilenameExtension = aFilenameExtension.toAsciiLowerCase();
260 if (!aFilenameExtension.isEmpty())
262 if ( !bCaseSensitiveDir )
264 sThisContentExtension = sThisContentExtension.toAsciiLowerCase();
267 if ( sThisContentExtension == aFilenameExtension )
269 aName =
aName.copy(0, (
aName.getLength()-(aFilenameExtension.getLength()+1)));
271 if (
match(tableNamePattern,aName,
'\0') && ( !bCheckEnabled || (nChar < '0' || nChar >
'9')) )
282 if (
aURL.getExtension().isEmpty())
285 if(
match(tableNamePattern,
aURL.getBase(),
'\0') && ( !bCheckEnabled || nChar < '0' || nChar >
'9' ) )
292 if ( !xResultSet->next() )
296 aName = xRow->getString(1);
297 aURL.SetSmartURL(aName);
305 aRows.push_back(aRow);
309 pResult->setRows(std::move(aRows));
375 const Any& ,
const OUString& ,
const OUString& tableNamePattern )
377 ::osl::MutexGuard aGuard(
m_aMutex );
387 const OUString* pBegin = aNames.getConstArray();
388 const OUString* pEnd = pBegin + aNames.getLength();
389 for(;pBegin != pEnd;++pBegin)
391 if(
match(tableNamePattern,*pBegin,
'\0'))
398 aRows.push_back(aRow);
401 xNames->getByName(*pBegin), css::uno::UNO_QUERY);
404 auto pTable =
dynamic_cast<OFileTable*
>(xTable.get());
405 if(pTable && !pTable->isReadOnly())
408 aRows.push_back(aRow);
412 aRows.push_back(aRow);
415 aRows.push_back(aRow);
417 aRows.push_back(aRow);
419 aRows.push_back(aRow);
421 aRows.push_back(aRow);
423 aRows.push_back(aRow);
430 pResult->setRows(std::move(aRows));
628 pResult->setRows(std::move(aRows));
859 return OUString::number(1);
864 return OUString::number(0);
909 return "UCASE,LCASE,ASCII,LENGTH,OCTET_LENGTH,CHAR_LENGTH,CHARACTER_LENGTH,CHAR,CONCAT,LOCATE,SUBSTRING,LTRIM,RTRIM,SPACE,REPLACE,REPEAT,INSERT,LEFT,RIGHT";
914 return "DAYOFWEEK,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,CURDATE,CURTIME,NOW";
924 return "ABS,SIGN,MOD,FLOOR,CEILING,ROUND,EXP,LN,LOG,LOG10,POWER,SQRT,PI,COS,SIN,TAN,ACOS,ASIN,ATAN,ATAN2,DEGREES,RADIANS";
976 case ResultSetType::FORWARD_ONLY:
978 case ResultSetType::SCROLL_INSENSITIVE:
979 case ResultSetType::SCROLL_SENSITIVE:
989 case ResultSetType::FORWARD_ONLY:
991 case ResultSetType::SCROLL_INSENSITIVE:
992 case ResultSetType::SCROLL_SENSITIVE:
ORowSetValueDecorator decorates an ORowSetValue so the value is "refcounted".
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog()
bool isCheckEnabled() const
void setCaseSensitiveExtension(bool _bIsCS, GrantAccess)
css::uno::Reference< css::ucb::XDynamicResultSet > getDir() const
const OUString & getExtension() const
OFileDriver * getDriver() const
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
mutable::osl::Mutex m_aMutex
css::uno::Reference< css::ucb::XContent > get() const
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XSingleServiceFactory > xFactory
#define SAL_WARN(area, stream)
Reference< XComponentContext > getProcessComponentContext()
bool match(const sal_Unicode *pWild, const sal_Unicode *pStr, const sal_Unicode cEscape)