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