use more concrete UNO in connectivity
Change-Id: I3842706a0b28c3bf78c8f359ca2d2226ed5f1b07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182769 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
0ce35e70da
commit
02a5df653f
@ -65,33 +65,33 @@ css::uno::Reference< css::beans::XPropertySet > OIndexColumns::createObject(cons
|
||||
xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getColumns(
|
||||
Catalog, aSchema, aTable, _rName);
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
if ( xResult.is() )
|
||||
{
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
while( xResult->next() )
|
||||
{
|
||||
if ( xRow->getString(4) == _rName )
|
||||
{
|
||||
sal_Int32 nDataType = xRow->getInt(5);
|
||||
OUString aTypeName(xRow->getString(6));
|
||||
sal_Int32 nSize = xRow->getInt(7);
|
||||
sal_Int32 nDec = xRow->getInt(9);
|
||||
sal_Int32 nNull = xRow->getInt(11);
|
||||
OUString aColumnDef(xRow->getString(13));
|
||||
if ( !xResult.is() )
|
||||
return nullptr;
|
||||
|
||||
xRet = new OIndexColumn(bAsc,
|
||||
_rName,
|
||||
aTypeName,
|
||||
aColumnDef,
|
||||
nNull,
|
||||
nSize,
|
||||
nDec,
|
||||
nDataType,
|
||||
true,
|
||||
aCatalog, aSchema, aTable);
|
||||
break;
|
||||
}
|
||||
rtl::Reference< OIndexColumn > xRet;
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
while( xResult->next() )
|
||||
{
|
||||
if ( xRow->getString(4) == _rName )
|
||||
{
|
||||
sal_Int32 nDataType = xRow->getInt(5);
|
||||
OUString aTypeName(xRow->getString(6));
|
||||
sal_Int32 nSize = xRow->getInt(7);
|
||||
sal_Int32 nDec = xRow->getInt(9);
|
||||
sal_Int32 nNull = xRow->getInt(11);
|
||||
OUString aColumnDef(xRow->getString(13));
|
||||
|
||||
xRet = new OIndexColumn(bAsc,
|
||||
_rName,
|
||||
aTypeName,
|
||||
aColumnDef,
|
||||
nNull,
|
||||
nSize,
|
||||
nDec,
|
||||
nDataType,
|
||||
true,
|
||||
aCatalog, aSchema, aTable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ css::uno::Reference< css::beans::XPropertySet > OIndexesHelper::createObject(con
|
||||
if ( !xConnection.is() )
|
||||
return nullptr;
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
rtl::Reference< OIndexHelper > xRet;
|
||||
OUString aName,aQualifier;
|
||||
sal_Int32 nLen = _rName.indexOf('.');
|
||||
if ( nLen != -1 )
|
||||
|
@ -70,48 +70,46 @@ css::uno::Reference< css::beans::XPropertySet > OKeyColumnsHelper::createObject(
|
||||
}
|
||||
}
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
|
||||
// now describe the column _rName and set his related column
|
||||
xResult = m_pKey->getTable()->getMetaData()->getColumns(Catalog, aSchema, aTable, _rName);
|
||||
|
||||
if ( xResult.is() )
|
||||
{
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
if ( xResult->next() )
|
||||
{
|
||||
if ( xRow->getString(4) == _rName )
|
||||
{
|
||||
sal_Int32 nDataType = xRow->getInt(5);
|
||||
OUString aTypeName(xRow->getString(6));
|
||||
sal_Int32 nSize = xRow->getInt(7);
|
||||
sal_Int32 nDec = xRow->getInt(9);
|
||||
sal_Int32 nNull = xRow->getInt(11);
|
||||
OUString sColumnDef;
|
||||
try
|
||||
{
|
||||
sColumnDef = xRow->getString(13);
|
||||
}
|
||||
catch(const SQLException&)
|
||||
{
|
||||
// sometimes we get an error when asking for this param
|
||||
}
|
||||
if ( !xResult.is() )
|
||||
return nullptr;
|
||||
|
||||
xRet = new OKeyColumn(aRefColumnName,
|
||||
_rName,
|
||||
aTypeName,
|
||||
sColumnDef,
|
||||
nNull,
|
||||
nSize,
|
||||
nDec,
|
||||
nDataType,
|
||||
isCaseSensitive(),
|
||||
aCatalog,
|
||||
aSchema,
|
||||
aTable);
|
||||
}
|
||||
}
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
if ( !xResult->next() )
|
||||
return nullptr;
|
||||
|
||||
if ( xRow->getString(4) != _rName )
|
||||
return nullptr;
|
||||
|
||||
sal_Int32 nDataType = xRow->getInt(5);
|
||||
OUString aTypeName(xRow->getString(6));
|
||||
sal_Int32 nSize = xRow->getInt(7);
|
||||
sal_Int32 nDec = xRow->getInt(9);
|
||||
sal_Int32 nNull = xRow->getInt(11);
|
||||
OUString sColumnDef;
|
||||
try
|
||||
{
|
||||
sColumnDef = xRow->getString(13);
|
||||
}
|
||||
catch(const SQLException&)
|
||||
{
|
||||
// sometimes we get an error when asking for this param
|
||||
}
|
||||
|
||||
rtl::Reference<OKeyColumn> xRet = new OKeyColumn(aRefColumnName,
|
||||
_rName,
|
||||
aTypeName,
|
||||
sColumnDef,
|
||||
nNull,
|
||||
nSize,
|
||||
nDec,
|
||||
nDataType,
|
||||
isCaseSensitive(),
|
||||
aCatalog,
|
||||
aSchema,
|
||||
aTable);
|
||||
|
||||
return xRet;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ OKeysHelper::OKeysHelper( OTableHelper* _pTable,
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > OKeysHelper::createObject(const OUString& _rName)
|
||||
{
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
rtl::Reference< OTableKeyHelper > xRet;
|
||||
|
||||
if(!_rName.isEmpty())
|
||||
{
|
||||
|
@ -408,100 +408,100 @@ namespace
|
||||
bool _bIsCurrency,
|
||||
sal_Int32 _nDataType)
|
||||
{
|
||||
Reference<XPropertySet> xProp;
|
||||
Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
|
||||
Reference< XResultSet > xResult = xMetaData->getColumns(_aCatalog, _aSchema, _aTable, _rQueryName);
|
||||
OUString sCatalog;
|
||||
_aCatalog >>= sCatalog;
|
||||
|
||||
if ( xResult.is() )
|
||||
if ( !xResult.is() )
|
||||
return nullptr;
|
||||
|
||||
rtl::Reference<connectivity::sdbcx::OColumn> xProp;
|
||||
UStringMixEqual aMixCompare(_bCase);
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
while( xResult->next() )
|
||||
{
|
||||
UStringMixEqual aMixCompare(_bCase);
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
while( xResult->next() )
|
||||
if ( aMixCompare(xRow->getString(4),_rName) )
|
||||
{
|
||||
if ( aMixCompare(xRow->getString(4),_rName) )
|
||||
sal_Int32 nField5 = xRow->getInt(5);
|
||||
OUString aField6 = xRow->getString(6);
|
||||
sal_Int32 nField7 = xRow->getInt(7)
|
||||
, nField9 = xRow->getInt(9)
|
||||
, nField11= xRow->getInt(11);
|
||||
OUString sField12 = xRow->getString(12),
|
||||
sField13 = xRow->getString(13);
|
||||
::comphelper::disposeComponent(xRow);
|
||||
|
||||
bool bAutoIncrement = _bIsAutoIncrement
|
||||
,bIsCurrency = _bIsCurrency;
|
||||
if ( _bQueryForInfo )
|
||||
{
|
||||
sal_Int32 nField5 = xRow->getInt(5);
|
||||
OUString aField6 = xRow->getString(6);
|
||||
sal_Int32 nField7 = xRow->getInt(7)
|
||||
, nField9 = xRow->getInt(9)
|
||||
, nField11= xRow->getInt(11);
|
||||
OUString sField12 = xRow->getString(12),
|
||||
sField13 = xRow->getString(13);
|
||||
::comphelper::disposeComponent(xRow);
|
||||
const OUString sQuote = xMetaData->getIdentifierQuoteString();
|
||||
OUString sQuotedName = ::dbtools::quoteName(sQuote,_rName);
|
||||
OUString sComposedName = composeTableNameForSelect(_xConnection, getString( _aCatalog ), _aSchema, _aTable );
|
||||
|
||||
bool bAutoIncrement = _bIsAutoIncrement
|
||||
,bIsCurrency = _bIsCurrency;
|
||||
if ( _bQueryForInfo )
|
||||
ColumnInformationMap aInfo((UStringMixLess(_bCase)));
|
||||
collectColumnInformation(_xConnection,sComposedName,sQuotedName,aInfo);
|
||||
ColumnInformationMap::const_iterator aIter = aInfo.begin();
|
||||
if ( aIter != aInfo.end() )
|
||||
{
|
||||
const OUString sQuote = xMetaData->getIdentifierQuoteString();
|
||||
OUString sQuotedName = ::dbtools::quoteName(sQuote,_rName);
|
||||
OUString sComposedName = composeTableNameForSelect(_xConnection, getString( _aCatalog ), _aSchema, _aTable );
|
||||
|
||||
ColumnInformationMap aInfo((UStringMixLess(_bCase)));
|
||||
collectColumnInformation(_xConnection,sComposedName,sQuotedName,aInfo);
|
||||
ColumnInformationMap::const_iterator aIter = aInfo.begin();
|
||||
if ( aIter != aInfo.end() )
|
||||
{
|
||||
bAutoIncrement = aIter->second.first.first;
|
||||
bIsCurrency = aIter->second.first.second;
|
||||
if ( DataType::OTHER == nField5 )
|
||||
nField5 = aIter->second.second;
|
||||
}
|
||||
bAutoIncrement = aIter->second.first.first;
|
||||
bIsCurrency = aIter->second.first.second;
|
||||
if ( DataType::OTHER == nField5 )
|
||||
nField5 = aIter->second.second;
|
||||
}
|
||||
else if ( DataType::OTHER == nField5 )
|
||||
nField5 = _nDataType;
|
||||
}
|
||||
else if ( DataType::OTHER == nField5 )
|
||||
nField5 = _nDataType;
|
||||
|
||||
if ( nField11 != ColumnValue::NO_NULLS )
|
||||
if ( nField11 != ColumnValue::NO_NULLS )
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
if ( _xPrimaryKeyColumns.is() )
|
||||
{
|
||||
if ( _xPrimaryKeyColumns.is() )
|
||||
{
|
||||
if ( _xPrimaryKeyColumns->hasByName(_rName) )
|
||||
nField11 = ColumnValue::NO_NULLS;
|
||||
if ( _xPrimaryKeyColumns->hasByName(_rName) )
|
||||
nField11 = ColumnValue::NO_NULLS;
|
||||
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
Reference< XResultSet > xPKeys = xMetaData->getPrimaryKeys( _aCatalog, _aSchema, _aTable );
|
||||
Reference< XRow > xPKeyRow( xPKeys, UNO_QUERY_THROW );
|
||||
while( xPKeys->next() ) // there can be only one primary key
|
||||
{
|
||||
Reference< XResultSet > xPKeys = xMetaData->getPrimaryKeys( _aCatalog, _aSchema, _aTable );
|
||||
Reference< XRow > xPKeyRow( xPKeys, UNO_QUERY_THROW );
|
||||
while( xPKeys->next() ) // there can be only one primary key
|
||||
OUString sKeyColumn = xPKeyRow->getString(4);
|
||||
if ( aMixCompare(_rName,sKeyColumn) )
|
||||
{
|
||||
OUString sKeyColumn = xPKeyRow->getString(4);
|
||||
if ( aMixCompare(_rName,sKeyColumn) )
|
||||
{
|
||||
nField11 = ColumnValue::NO_NULLS;
|
||||
break;
|
||||
}
|
||||
nField11 = ColumnValue::NO_NULLS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(SQLException&)
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION( "connectivity.commontools", "lcl_createSDBCXColumn" );
|
||||
}
|
||||
}
|
||||
|
||||
xProp = new connectivity::sdbcx::OColumn(_rName,
|
||||
aField6,
|
||||
sField13,
|
||||
sField12,
|
||||
nField11,
|
||||
nField7,
|
||||
nField9,
|
||||
nField5,
|
||||
bAutoIncrement,
|
||||
false,
|
||||
bIsCurrency,
|
||||
_bCase,
|
||||
sCatalog,
|
||||
_aSchema,
|
||||
_aTable);
|
||||
|
||||
break;
|
||||
catch(SQLException&)
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION( "connectivity.commontools", "lcl_createSDBCXColumn" );
|
||||
}
|
||||
}
|
||||
|
||||
xProp = new connectivity::sdbcx::OColumn(_rName,
|
||||
aField6,
|
||||
sField13,
|
||||
sField12,
|
||||
nField11,
|
||||
nField7,
|
||||
nField9,
|
||||
nField5,
|
||||
bAutoIncrement,
|
||||
false,
|
||||
bIsCurrency,
|
||||
_bCase,
|
||||
sCatalog,
|
||||
_aSchema,
|
||||
_aTable);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,23 +45,8 @@ css::uno::Reference< css::beans::XPropertySet > ODbaseIndexes::createObject(cons
|
||||
::dbtools::throwGenericSQLException( sError, *m_pTable );
|
||||
}
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
std::unique_ptr<SvStream> pFileStream = ::connectivity::file::OFileTable::createStream_simpleError(sFile, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE);
|
||||
if(pFileStream)
|
||||
{
|
||||
pFileStream->SetEndian(SvStreamEndian::LITTLE);
|
||||
pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
|
||||
ODbaseIndex::NDXHeader aHeader;
|
||||
|
||||
pFileStream->Seek(0);
|
||||
ReadHeader(*pFileStream, aHeader);
|
||||
pFileStream.reset();
|
||||
|
||||
rtl::Reference<ODbaseIndex> pIndex = new ODbaseIndex(m_pTable,aHeader,_rName);
|
||||
xRet = pIndex;
|
||||
pIndex->openIndexFile();
|
||||
}
|
||||
else
|
||||
if(!pFileStream)
|
||||
{
|
||||
const OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
|
||||
STR_COULD_NOT_LOAD_FILE,
|
||||
@ -69,7 +54,18 @@ css::uno::Reference< css::beans::XPropertySet > ODbaseIndexes::createObject(cons
|
||||
) );
|
||||
::dbtools::throwGenericSQLException( sError, *m_pTable );
|
||||
}
|
||||
return xRet;
|
||||
|
||||
pFileStream->SetEndian(SvStreamEndian::LITTLE);
|
||||
pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
|
||||
ODbaseIndex::NDXHeader aHeader;
|
||||
|
||||
pFileStream->Seek(0);
|
||||
ReadHeader(*pFileStream, aHeader);
|
||||
pFileStream.reset();
|
||||
|
||||
rtl::Reference<ODbaseIndex> pIndex = new ODbaseIndex(m_pTable,aHeader,_rName);
|
||||
pIndex->openIndexFile();
|
||||
return pIndex;
|
||||
}
|
||||
|
||||
void ODbaseIndexes::impl_refresh( )
|
||||
|
@ -42,33 +42,32 @@ css::uno::Reference< css::beans::XPropertySet > OEvoabColumns::createObject(cons
|
||||
sTableName,
|
||||
_rName);
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
if (xResult.is())
|
||||
{
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
if (!xResult.is())
|
||||
return nullptr;
|
||||
|
||||
while (xResult->next())
|
||||
rtl::Reference< OColumn > xRet;
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
while (xResult->next())
|
||||
{
|
||||
if (xRow->getString(4) == _rName)
|
||||
{
|
||||
if (xRow->getString(4) == _rName)
|
||||
{
|
||||
xRet = new OColumn(
|
||||
_rName,
|
||||
xRow->getString(6),
|
||||
xRow->getString(13),
|
||||
xRow->getString(12),
|
||||
xRow->getInt(11),
|
||||
xRow->getInt(7),
|
||||
xRow->getInt(9),
|
||||
xRow->getInt(5),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
sCatalogName,
|
||||
sSchemaName,
|
||||
sTableName);
|
||||
break;
|
||||
}
|
||||
xRet = new OColumn(
|
||||
_rName,
|
||||
xRow->getString(6),
|
||||
xRow->getString(13),
|
||||
xRow->getString(12),
|
||||
xRow->getInt(11),
|
||||
xRow->getInt(7),
|
||||
xRow->getInt(9),
|
||||
xRow->getInt(5),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
sCatalogName,
|
||||
sSchemaName,
|
||||
sTableName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,21 +37,21 @@ css::uno::Reference< css::beans::XPropertySet > OEvoabTables::createObject(const
|
||||
|
||||
Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),u"%"_ustr,aName,aTypes);
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
if(xResult.is())
|
||||
rtl::Reference< OEvoabTable > xRet;
|
||||
if(!xResult.is())
|
||||
return nullptr;
|
||||
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
if(xResult->next()) // there can be only one table with this name
|
||||
{
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
if(xResult->next()) // there can be only one table with this name
|
||||
{
|
||||
xRet = new OEvoabTable(
|
||||
this,
|
||||
static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
|
||||
aName,
|
||||
xRow->getString(4),
|
||||
xRow->getString(5),
|
||||
u""_ustr,
|
||||
u""_ustr);
|
||||
}
|
||||
xRet = new OEvoabTable(
|
||||
this,
|
||||
static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
|
||||
aName,
|
||||
xRow->getString(4),
|
||||
xRow->getString(5),
|
||||
u""_ustr,
|
||||
u""_ustr);
|
||||
}
|
||||
|
||||
::comphelper::disposeComponent(xResult);
|
||||
|
@ -36,31 +36,31 @@ css::uno::Reference< css::beans::XPropertySet > OColumns::createObject(const OUS
|
||||
Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(),
|
||||
sSchemaName, sTableName, _rName);
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
if(xResult.is())
|
||||
if(!xResult.is())
|
||||
return nullptr;
|
||||
|
||||
rtl::Reference< sdbcx::OColumn > xRet;
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
while(xResult->next())
|
||||
{
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
while(xResult->next())
|
||||
if(xRow->getString(4) == _rName)
|
||||
{
|
||||
if(xRow->getString(4) == _rName)
|
||||
{
|
||||
xRet = new sdbcx::OColumn(_rName,
|
||||
xRow->getString(6),
|
||||
xRow->getString(13),
|
||||
xRow->getString(12),
|
||||
xRow->getInt(11),
|
||||
xRow->getInt(7),
|
||||
xRow->getInt(9),
|
||||
xRow->getInt(5),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
m_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),
|
||||
sCatalogName,
|
||||
sSchemaName,
|
||||
sTableName);
|
||||
break;
|
||||
}
|
||||
xRet = new sdbcx::OColumn(_rName,
|
||||
xRow->getString(6),
|
||||
xRow->getString(13),
|
||||
xRow->getString(12),
|
||||
xRow->getInt(11),
|
||||
xRow->getInt(7),
|
||||
xRow->getInt(9),
|
||||
xRow->getInt(5),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
m_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),
|
||||
sCatalogName,
|
||||
sSchemaName,
|
||||
sTableName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -709,11 +709,11 @@ Reference< XDatabaseMetaData > SAL_CALL Connection::getMetaData( )
|
||||
|
||||
// here we have to create the class with biggest interface
|
||||
// The answer is 42 :-)
|
||||
Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
|
||||
rtl::Reference< ODatabaseMetaData > xMetaData = m_xMetaData.get();
|
||||
if(!xMetaData.is())
|
||||
{
|
||||
xMetaData = new ODatabaseMetaData(this); // need the connection because it can return it
|
||||
m_xMetaData = xMetaData;
|
||||
m_xMetaData = xMetaData.get();
|
||||
}
|
||||
|
||||
return xMetaData;
|
||||
@ -879,7 +879,7 @@ void Connection::disposing()
|
||||
|
||||
disposeStatements();
|
||||
|
||||
m_xMetaData = css::uno::WeakReference< css::sdbc::XDatabaseMetaData>();
|
||||
m_xMetaData.clear();
|
||||
|
||||
ISC_STATUS_ARRAY status; /* status vector */
|
||||
if (m_aTransactionHandle)
|
||||
@ -949,18 +949,13 @@ uno::Reference< XTablesSupplier > Connection::createCatalog()
|
||||
MutexGuard aGuard(m_aMutex);
|
||||
|
||||
// m_xCatalog is a weak reference. Reuse it if it still exists.
|
||||
Reference< XTablesSupplier > xCatalog = m_xCatalog;
|
||||
if (xCatalog.is())
|
||||
{
|
||||
return xCatalog;
|
||||
}
|
||||
else
|
||||
rtl::Reference< Catalog > xCatalog = m_xCatalog.get();
|
||||
if (!xCatalog.is())
|
||||
{
|
||||
xCatalog = new Catalog(this);
|
||||
m_xCatalog = xCatalog;
|
||||
return m_xCatalog;
|
||||
m_xCatalog = xCatalog.get();
|
||||
}
|
||||
|
||||
return xCatalog;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <memory>
|
||||
#include <OTypeInfo.hxx>
|
||||
#include <unotools/tempfile.hxx>
|
||||
#include <unotools/weakref.hxx>
|
||||
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/document/DocumentEvent.hpp>
|
||||
@ -54,6 +55,7 @@ namespace connectivity::firebird
|
||||
class OStatementCommonBase;
|
||||
class FirebirdDriver;
|
||||
class ODatabaseMetaData;
|
||||
class Catalog;
|
||||
|
||||
|
||||
typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
|
||||
@ -136,9 +138,9 @@ namespace connectivity::firebird
|
||||
isc_db_handle m_aDBHandle;
|
||||
isc_tr_handle m_aTransactionHandle;
|
||||
|
||||
css::uno::WeakReference< css::sdbcx::XTablesSupplier>
|
||||
unotools::WeakReference< Catalog >
|
||||
m_xCatalog;
|
||||
css::uno::WeakReference< css::sdbc::XDatabaseMetaData >
|
||||
unotools::WeakReference< ODatabaseMetaData >
|
||||
m_xMetaData;
|
||||
/** Statements owned by this connection. */
|
||||
OWeakRefArray m_aStatements;
|
||||
|
@ -51,28 +51,28 @@ css::uno::Reference< css::beans::XPropertySet > OTables::createObject(const OUSt
|
||||
aCatalog <<= sCatalog;
|
||||
Reference< XResultSet > xResult = m_xMetaData->getTables(aCatalog,sSchema,sTable,sTableTypes);
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySet > xRet;
|
||||
if ( xResult.is() )
|
||||
{
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
if ( xResult->next() ) // there can be only one table with this name
|
||||
{
|
||||
sal_Int32 nPrivileges = ::dbtools::getTablePrivileges( m_xMetaData, sCatalog, sSchema, sTable );
|
||||
if ( m_xMetaData->isReadOnly() )
|
||||
nPrivileges &= ~( Privilege::INSERT | Privilege::UPDATE | Privilege::DELETE | Privilege::CREATE | Privilege::ALTER | Privilege::DROP );
|
||||
if ( !xResult.is() )
|
||||
return nullptr;
|
||||
|
||||
// obtain privileges
|
||||
xRet = new OHSQLTable( this
|
||||
,static_cast<OHCatalog&>(m_rParent).getConnection()
|
||||
,sTable
|
||||
,xRow->getString(4)
|
||||
,xRow->getString(5)
|
||||
,sSchema
|
||||
,sCatalog
|
||||
,nPrivileges);
|
||||
}
|
||||
::comphelper::disposeComponent(xResult);
|
||||
rtl::Reference< OHSQLTable > xRet;
|
||||
Reference< XRow > xRow(xResult,UNO_QUERY);
|
||||
if ( xResult->next() ) // there can be only one table with this name
|
||||
{
|
||||
sal_Int32 nPrivileges = ::dbtools::getTablePrivileges( m_xMetaData, sCatalog, sSchema, sTable );
|
||||
if ( m_xMetaData->isReadOnly() )
|
||||
nPrivileges &= ~( Privilege::INSERT | Privilege::UPDATE | Privilege::DELETE | Privilege::CREATE | Privilege::ALTER | Privilege::DROP );
|
||||
|
||||
// obtain privileges
|
||||
xRet = new OHSQLTable( this
|
||||
,static_cast<OHCatalog&>(m_rParent).getConnection()
|
||||
,sTable
|
||||
,xRow->getString(4)
|
||||
,xRow->getString(5)
|
||||
,sSchema
|
||||
,sCatalog
|
||||
,nPrivileges);
|
||||
}
|
||||
::comphelper::disposeComponent(xResult);
|
||||
|
||||
return xRet;
|
||||
}
|
||||
|
@ -68,12 +68,11 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const OUString& url,
|
||||
{
|
||||
m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_CONNECTING_URL, url );
|
||||
|
||||
Reference< XConnection > xOut;
|
||||
rtl::Reference< java_sql_Connection > xOut;
|
||||
if ( acceptsURL(url ) )
|
||||
{
|
||||
rtl::Reference<java_sql_Connection> pConnection = new java_sql_Connection( *this );
|
||||
xOut = pConnection;
|
||||
if ( !pConnection->construct(url,info) )
|
||||
xOut = new java_sql_Connection( *this );
|
||||
if ( !xOut->construct(url,info) )
|
||||
xOut.clear(); // an error occurred and the java driver didn't throw an exception
|
||||
else
|
||||
m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_SUCCESS );
|
||||
|
@ -54,7 +54,7 @@ css::uno::Reference<css::beans::XPropertySet> OTables::createObject(const OUStri
|
||||
aCatalog <<= sCatalog;
|
||||
Reference<XResultSet> xResult = m_xMetaData->getTables(aCatalog, sSchema, sTable, sTableTypes);
|
||||
|
||||
css::uno::Reference<css::beans::XPropertySet> xRet;
|
||||
rtl::Reference<OMySQLTable> xRet;
|
||||
if (xResult.is())
|
||||
{
|
||||
Reference<XRow> xRow(xResult, UNO_QUERY);
|
||||
|
@ -231,7 +231,7 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( )
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
|
||||
|
||||
Reference< XResultSet > rs;
|
||||
rtl::Reference< OResultSet > rs;
|
||||
|
||||
prepareStatement();
|
||||
|
||||
|
@ -1587,7 +1587,7 @@ void OSQLParseTreeIterator::setSelectColumnName(const OUString & rColumnName,con
|
||||
// without table specified
|
||||
if ( !bFkt )
|
||||
{
|
||||
Reference< XPropertySet> xNewColumn;
|
||||
rtl::Reference< OParseColumn> xNewColumn;
|
||||
|
||||
for (auto const& table : *m_pImpl->m_pTables)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user