summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-18 10:51:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-18 20:35:49 +0200
commit2d0bdcc586af71dae665646b37177fa104c50906 (patch)
treea4c0fafefd366b2840365a3e0ee83ed0ad314bbd /connectivity
parent02f7d20f14dffcb3832264eeab5bb97acc4977f3 (diff)
loplugin:flatten connectivity
Change-Id: Ic1d9eb84b64ebde99e15704a10b27f21447df4d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92469 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/DriversConfig.cxx72
-rw-r--r--connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx170
-rw-r--r--connectivity/source/commontools/FValue.cxx206
-rw-r--r--connectivity/source/commontools/TColumnsHelper.cxx28
-rw-r--r--connectivity/source/commontools/TIndexes.cxx44
-rw-r--r--connectivity/source/commontools/TKeys.cxx62
-rw-r--r--connectivity/source/commontools/TTableHelper.cxx86
-rw-r--r--connectivity/source/commontools/conncleanup.cxx77
-rw-r--r--connectivity/source/commontools/dbtools.cxx130
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx300
-rw-r--r--connectivity/source/drivers/dbase/DIndex.cxx40
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx96
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx32
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx72
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx66
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx58
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx30
-rw-r--r--connectivity/source/drivers/firebird/Blob.cxx22
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx75
-rw-r--r--connectivity/source/drivers/firebird/Keys.cxx22
-rw-r--r--connectivity/source/drivers/firebird/Table.cxx36
-rw-r--r--connectivity/source/drivers/firebird/Tables.cxx20
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx20
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx62
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageAccess.cxx76
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageMap.cxx30
-rw-r--r--connectivity/source/drivers/hsqldb/HTables.cxx56
-rw-r--r--connectivity/source/drivers/hsqldb/HUser.cxx134
-rw-r--r--connectivity/source/drivers/hsqldb/StorageFileAccess.cxx68
-rw-r--r--connectivity/source/drivers/jdbc/CallableStatement.cxx56
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx26
-rw-r--r--connectivity/source/drivers/jdbc/JStatement.cxx51
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx65
-rw-r--r--connectivity/source/drivers/mork/MPreparedStatement.cxx18
-rw-r--r--connectivity/source/drivers/mork/MStatement.cxx30
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YTables.cxx73
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YUser.cxx186
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YViews.cxx22
-rw-r--r--connectivity/source/drivers/odbc/OResultSet.cxx68
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx99
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx142
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcontainer.cxx36
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtables.cxx124
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx98
-rw-r--r--connectivity/source/parse/sqlnode.cxx334
45 files changed, 1809 insertions, 1809 deletions
diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx
index e165763d5e5e..9d2ab8a475d7 100644
--- a/connectivity/source/commontools/DriversConfig.cxx
+++ b/connectivity/source/commontools/DriversConfig.cxx
@@ -41,48 +41,48 @@ namespace
void lcl_fillValues(const ::utl::OConfigurationNode& _aURLPatternNode,const OUString& _sNode,::comphelper::NamedValueCollection& _rValues)
{
const ::utl::OConfigurationNode aPropertiesNode = _aURLPatternNode.openNode(_sNode);
- if ( aPropertiesNode.isValid() )
+ if ( !aPropertiesNode.isValid() )
+ return;
+
+ uno::Sequence< OUString > aStringSeq;
+ const uno::Sequence< OUString > aProperties = aPropertiesNode.getNodeNames();
+ const OUString* pPropertiesIter = aProperties.getConstArray();
+ const OUString* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
+ for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
{
- uno::Sequence< OUString > aStringSeq;
- const uno::Sequence< OUString > aProperties = aPropertiesNode.getNodeNames();
- const OUString* pPropertiesIter = aProperties.getConstArray();
- const OUString* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
- for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter + "/Value");
+ if ( aValue >>= aStringSeq )
{
- uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter + "/Value");
- if ( aValue >>= aStringSeq )
- {
- lcl_convert(aStringSeq,aValue);
- }
- _rValues.put(*pPropertiesIter,aValue);
- } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter,++pNamedIter)
- } // if ( aPropertiesNode.isValid() )
+ lcl_convert(aStringSeq,aValue);
+ }
+ _rValues.put(*pPropertiesIter,aValue);
+ } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter,++pNamedIter)
}
void lcl_readURLPatternNode(const ::utl::OConfigurationTreeRoot& _aInstalled,const OUString& _sEntry,TInstalledDriver& _rInstalledDriver)
{
const ::utl::OConfigurationNode aURLPatternNode = _aInstalled.openNode(_sEntry);
- if ( aURLPatternNode.isValid() )
- {
- OUString sParentURLPattern;
- aURLPatternNode.getNodeValue("ParentURLPattern") >>= sParentURLPattern;
- if ( !sParentURLPattern.isEmpty() )
- lcl_readURLPatternNode(_aInstalled,sParentURLPattern,_rInstalledDriver);
-
- OUString sDriverFactory;
- aURLPatternNode.getNodeValue("Driver") >>= sDriverFactory;
- if ( !sDriverFactory.isEmpty() )
- _rInstalledDriver.sDriverFactory = sDriverFactory;
-
- OUString sDriverTypeDisplayName;
- aURLPatternNode.getNodeValue("DriverTypeDisplayName") >>= sDriverTypeDisplayName;
- OSL_ENSURE(!sDriverTypeDisplayName.isEmpty(),"No valid DriverTypeDisplayName property!");
- if ( !sDriverTypeDisplayName.isEmpty() )
- _rInstalledDriver.sDriverTypeDisplayName = sDriverTypeDisplayName;
-
- lcl_fillValues(aURLPatternNode,"Properties",_rInstalledDriver.aProperties);
- lcl_fillValues(aURLPatternNode,"Features",_rInstalledDriver.aFeatures);
- lcl_fillValues(aURLPatternNode,"MetaData",_rInstalledDriver.aMetaData);
- }
+ if ( !aURLPatternNode.isValid() )
+ return;
+
+ OUString sParentURLPattern;
+ aURLPatternNode.getNodeValue("ParentURLPattern") >>= sParentURLPattern;
+ if ( !sParentURLPattern.isEmpty() )
+ lcl_readURLPatternNode(_aInstalled,sParentURLPattern,_rInstalledDriver);
+
+ OUString sDriverFactory;
+ aURLPatternNode.getNodeValue("Driver") >>= sDriverFactory;
+ if ( !sDriverFactory.isEmpty() )
+ _rInstalledDriver.sDriverFactory = sDriverFactory;
+
+ OUString sDriverTypeDisplayName;
+ aURLPatternNode.getNodeValue("DriverTypeDisplayName") >>= sDriverTypeDisplayName;
+ OSL_ENSURE(!sDriverTypeDisplayName.isEmpty(),"No valid DriverTypeDisplayName property!");
+ if ( !sDriverTypeDisplayName.isEmpty() )
+ _rInstalledDriver.sDriverTypeDisplayName = sDriverTypeDisplayName;
+
+ lcl_fillValues(aURLPatternNode,"Properties",_rInstalledDriver.aProperties);
+ lcl_fillValues(aURLPatternNode,"Features",_rInstalledDriver.aFeatures);
+ lcl_fillValues(aURLPatternNode,"MetaData",_rInstalledDriver.aMetaData);
}
}
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
index d30bd85b4fab..7d3d34891783 100644
--- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
@@ -737,98 +737,98 @@ ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getQuoteValue()
void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aArguments )
{
- if ( _aArguments.getLength() == 2 )
+ if ( _aArguments.getLength() != 2 )
+ return;
+
+ sal_Int32 nResultSetType = 0;
+ if ( !(_aArguments[0] >>= nResultSetType))
+ return;
+
+ setType(static_cast<MetaDataResultSetType>(nResultSetType));
+ Sequence< Sequence<Any> > aRows;
+ if ( !(_aArguments[1] >>= aRows) )
+ return;
+
+ ORows aRowsToSet;
+ const Sequence<Any>* pRowsIter = aRows.getConstArray();
+ const Sequence<Any>* pRowsEnd = pRowsIter + aRows.getLength();
+ for (; pRowsIter != pRowsEnd;++pRowsIter)
{
- sal_Int32 nResultSetType = 0;
- if ( _aArguments[0] >>= nResultSetType)
+ ORow aRowToSet;
+ const Any* pRowIter = pRowsIter->getConstArray();
+ const Any* pRowEnd = pRowIter + pRowsIter->getLength();
+ for (; pRowIter != pRowEnd;++pRowIter)
{
- setType(static_cast<MetaDataResultSetType>(nResultSetType));
- Sequence< Sequence<Any> > aRows;
- if ( _aArguments[1] >>= aRows )
+ ORowSetValueDecoratorRef aValue;
+ switch( pRowIter->getValueTypeClass() )
{
- ORows aRowsToSet;
- const Sequence<Any>* pRowsIter = aRows.getConstArray();
- const Sequence<Any>* pRowsEnd = pRowsIter + aRows.getLength();
- for (; pRowsIter != pRowsEnd;++pRowsIter)
- {
- ORow aRowToSet;
- const Any* pRowIter = pRowsIter->getConstArray();
- const Any* pRowEnd = pRowIter + pRowsIter->getLength();
- for (; pRowIter != pRowEnd;++pRowIter)
+ case TypeClass_BOOLEAN:
{
- ORowSetValueDecoratorRef aValue;
- switch( pRowIter->getValueTypeClass() )
- {
- case TypeClass_BOOLEAN:
- {
- bool bValue = false;
- *pRowIter >>= bValue;
- aValue = new ORowSetValueDecorator(ORowSetValue(bValue));
- }
- break;
- case TypeClass_BYTE:
- {
- sal_Int8 nValue(0);
- *pRowIter >>= nValue;
- aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
- }
- break;
- case TypeClass_SHORT:
- case TypeClass_UNSIGNED_SHORT:
- {
- sal_Int16 nValue(0);
- *pRowIter >>= nValue;
- aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
- }
- break;
- case TypeClass_LONG:
- case TypeClass_UNSIGNED_LONG:
- {
- sal_Int32 nValue(0);
- *pRowIter >>= nValue;
- aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
- }
- break;
- case TypeClass_HYPER:
- case TypeClass_UNSIGNED_HYPER:
- {
- sal_Int64 nValue(0);
- *pRowIter >>= nValue;
- aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
- }
- break;
- case TypeClass_FLOAT:
- {
- float nValue(0.0);
- *pRowIter >>= nValue;
- aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
- }
- break;
- case TypeClass_DOUBLE:
- {
- double nValue(0.0);
- *pRowIter >>= nValue;
- aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
- }
- break;
- case TypeClass_STRING:
- {
- OUString sValue;
- *pRowIter >>= sValue;
- aValue = new ORowSetValueDecorator(ORowSetValue(sValue));
- }
- break;
- default:
- break;
- }
- aRowToSet.push_back(aValue);
+ bool bValue = false;
+ *pRowIter >>= bValue;
+ aValue = new ORowSetValueDecorator(ORowSetValue(bValue));
}
- aRowsToSet.push_back(aRowToSet);
- } // for (; pRowsIter != pRowsEnd;++pRowsIter
- setRows(aRowsToSet);
+ break;
+ case TypeClass_BYTE:
+ {
+ sal_Int8 nValue(0);
+ *pRowIter >>= nValue;
+ aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
+ }
+ break;
+ case TypeClass_SHORT:
+ case TypeClass_UNSIGNED_SHORT:
+ {
+ sal_Int16 nValue(0);
+ *pRowIter >>= nValue;
+ aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
+ }
+ break;
+ case TypeClass_LONG:
+ case TypeClass_UNSIGNED_LONG:
+ {
+ sal_Int32 nValue(0);
+ *pRowIter >>= nValue;
+ aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
+ }
+ break;
+ case TypeClass_HYPER:
+ case TypeClass_UNSIGNED_HYPER:
+ {
+ sal_Int64 nValue(0);
+ *pRowIter >>= nValue;
+ aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
+ }
+ break;
+ case TypeClass_FLOAT:
+ {
+ float nValue(0.0);
+ *pRowIter >>= nValue;
+ aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
+ }
+ break;
+ case TypeClass_DOUBLE:
+ {
+ double nValue(0.0);
+ *pRowIter >>= nValue;
+ aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
+ }
+ break;
+ case TypeClass_STRING:
+ {
+ OUString sValue;
+ *pRowIter >>= sValue;
+ aValue = new ORowSetValueDecorator(ORowSetValue(sValue));
+ }
+ break;
+ default:
+ break;
}
+ aRowToSet.push_back(aValue);
}
- }
+ aRowsToSet.push_back(aRowToSet);
+ } // for (; pRowsIter != pRowsEnd;++pRowsIter
+ setRows(aRowsToSet);
}
// XServiceInfo
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 828419b3efff..2f1cabbd4520 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -260,64 +260,64 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType)
void ORowSetValue::free() noexcept
{
- if(!m_bNull)
+ if(m_bNull)
+ return;
+
+ switch(m_eTypeKind)
{
- switch(m_eTypeKind)
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::LONGVARCHAR:
- OSL_ENSURE(m_aValue.m_pString,"String pointer is null!");
- rtl_uString_release(m_aValue.m_pString);
- m_aValue.m_pString = nullptr;
- break;
- case DataType::DATE:
- delete static_cast<css::util::Date*>(m_aValue.m_pValue);
- m_aValue.m_pValue = nullptr;
- break;
- case DataType::TIME:
- delete static_cast<css::util::Time*>(m_aValue.m_pValue);
- m_aValue.m_pValue = nullptr;
- break;
- case DataType::TIMESTAMP:
- delete static_cast<css::util::DateTime*>(m_aValue.m_pValue);
- m_aValue.m_pValue = nullptr;
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- delete static_cast<Sequence<sal_Int8>*>(m_aValue.m_pValue);
- m_aValue.m_pValue = nullptr;
- break;
- case DataType::BLOB:
- case DataType::CLOB:
- case DataType::OBJECT:
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ case DataType::LONGVARCHAR:
+ OSL_ENSURE(m_aValue.m_pString,"String pointer is null!");
+ rtl_uString_release(m_aValue.m_pString);
+ m_aValue.m_pString = nullptr;
+ break;
+ case DataType::DATE:
+ delete static_cast<css::util::Date*>(m_aValue.m_pValue);
+ m_aValue.m_pValue = nullptr;
+ break;
+ case DataType::TIME:
+ delete static_cast<css::util::Time*>(m_aValue.m_pValue);
+ m_aValue.m_pValue = nullptr;
+ break;
+ case DataType::TIMESTAMP:
+ delete static_cast<css::util::DateTime*>(m_aValue.m_pValue);
+ m_aValue.m_pValue = nullptr;
+ break;
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::LONGVARBINARY:
+ delete static_cast<Sequence<sal_Int8>*>(m_aValue.m_pValue);
+ m_aValue.m_pValue = nullptr;
+ break;
+ case DataType::BLOB:
+ case DataType::CLOB:
+ case DataType::OBJECT:
+ delete static_cast<Any*>(m_aValue.m_pValue);
+ m_aValue.m_pValue = nullptr;
+ break;
+ case DataType::BIT:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::BIGINT:
+ case DataType::BOOLEAN:
+ case DataType::FLOAT:
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ break;
+ default:
+ if ( m_aValue.m_pValue )
+ {
delete static_cast<Any*>(m_aValue.m_pValue);
m_aValue.m_pValue = nullptr;
- break;
- case DataType::BIT:
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::INTEGER:
- case DataType::BIGINT:
- case DataType::BOOLEAN:
- case DataType::FLOAT:
- case DataType::DOUBLE:
- case DataType::REAL:
- break;
- default:
- if ( m_aValue.m_pValue )
- {
- delete static_cast<Any*>(m_aValue.m_pValue);
- m_aValue.m_pValue = nullptr;
- }
- break;
+ }
+ break;
- }
- m_bNull = true;
}
+ m_bNull = true;
}
ORowSetValue& ORowSetValue::operator=(const ORowSetValue& _rRH)
@@ -2046,62 +2046,62 @@ css::util::DateTime ORowSetValue::getDateTime() const
void ORowSetValue::setSigned(bool _bMod)
{
- if ( m_bSigned != _bMod )
+ if ( m_bSigned == _bMod )
+ return;
+
+ m_bSigned = _bMod;
+ if ( m_bNull )
+ return;
+
+ sal_Int32 nType = m_eTypeKind;
+ switch(m_eTypeKind)
{
- m_bSigned = _bMod;
- if ( !m_bNull )
+ case DataType::TINYINT:
+ if ( m_bSigned )
+ (*this) = getInt8();
+ else
+ {
+ m_bSigned = !m_bSigned;
+ (*this) = getInt16();
+ m_bSigned = !m_bSigned;
+ }
+ break;
+ case DataType::SMALLINT:
+ if ( m_bSigned )
+ (*this) = getInt16();
+ else
+ {
+ m_bSigned = !m_bSigned;
+ (*this) = getInt32();
+ m_bSigned = !m_bSigned;
+ }
+ break;
+ case DataType::INTEGER:
+ if ( m_bSigned )
+ (*this) = getInt32();
+ else
+ {
+ m_bSigned = !m_bSigned;
+ (*this) = getLong();
+ m_bSigned = !m_bSigned;
+ }
+ break;
+ case DataType::BIGINT:
{
- sal_Int32 nType = m_eTypeKind;
- switch(m_eTypeKind)
+ if ( m_bSigned )
{
- case DataType::TINYINT:
- if ( m_bSigned )
- (*this) = getInt8();
- else
- {
- m_bSigned = !m_bSigned;
- (*this) = getInt16();
- m_bSigned = !m_bSigned;
- }
- break;
- case DataType::SMALLINT:
- if ( m_bSigned )
- (*this) = getInt16();
- else
- {
- m_bSigned = !m_bSigned;
- (*this) = getInt32();
- m_bSigned = !m_bSigned;
- }
- break;
- case DataType::INTEGER:
- if ( m_bSigned )
- (*this) = getInt32();
- else
- {
- m_bSigned = !m_bSigned;
- (*this) = getLong();
- m_bSigned = !m_bSigned;
- }
- break;
- case DataType::BIGINT:
- {
- if ( m_bSigned )
- {
- auto nTmp = static_cast<sal_Int64>(m_aValue.m_uInt64);
- m_aValue.m_nInt64 = nTmp;
- }
- else
- {
- auto nTmp = static_cast<sal_uInt64>(m_aValue.m_nInt64);
- m_aValue.m_uInt64 = nTmp;
- }
- break;
- }
+ auto nTmp = static_cast<sal_Int64>(m_aValue.m_uInt64);
+ m_aValue.m_nInt64 = nTmp;
}
- m_eTypeKind = nType;
+ else
+ {
+ auto nTmp = static_cast<sal_uInt64>(m_aValue.m_nInt64);
+ m_aValue.m_uInt64 = nTmp;
+ }
+ break;
}
}
+ m_eTypeKind = nType;
}
diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx
index 36061dc2fe3d..a97faeeb8b4e 100644
--- a/connectivity/source/commontools/TColumnsHelper.cxx
+++ b/connectivity/source/commontools/TColumnsHelper.cxx
@@ -186,21 +186,21 @@ sdbcx::ObjectType OColumnsHelper::appendObject( const OUString& _rForName, const
void OColumnsHelper::dropObject(sal_Int32 /*_nPos*/, const OUString& _sElementName)
{
OSL_ENSURE(m_pTable,"OColumnsHelper::dropByName: Table is null!");
- if ( m_pTable && !m_pTable->isNew() )
+ if ( !(m_pTable && !m_pTable->isNew()) )
+ return;
+
+ Reference<XDatabaseMetaData> xMetaData = m_pTable->getConnection()->getMetaData();
+ OUString aQuote = xMetaData->getIdentifierQuoteString( );
+ OUString aSql = "ALTER TABLE " +
+ ::dbtools::composeTableName( xMetaData, m_pTable, ::dbtools::EComposeRule::InTableDefinitions, true ) +
+ " DROP " +
+ ::dbtools::quoteName( aQuote,_sElementName);
+
+ Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
+ if ( xStmt.is() )
{
- Reference<XDatabaseMetaData> xMetaData = m_pTable->getConnection()->getMetaData();
- OUString aQuote = xMetaData->getIdentifierQuoteString( );
- OUString aSql = "ALTER TABLE " +
- ::dbtools::composeTableName( xMetaData, m_pTable, ::dbtools::EComposeRule::InTableDefinitions, true ) +
- " DROP " +
- ::dbtools::quoteName( aQuote,_sElementName);
-
- Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
}
}
diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx
index aeb9253b0885..f5cff00ec835 100644
--- a/connectivity/source/commontools/TIndexes.cxx
+++ b/connectivity/source/commontools/TIndexes.cxx
@@ -213,33 +213,33 @@ sdbcx::ObjectType OIndexesHelper::appendObject( const OUString& _rForName, const
void OIndexesHelper::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
{
Reference< XConnection> xConnection = m_pTable->getConnection();
- if( xConnection.is() && !m_pTable->isNew())
+ if( !(xConnection.is() && !m_pTable->isNew()))
+ return;
+
+ if ( m_pTable->getIndexService().is() )
{
- if ( m_pTable->getIndexService().is() )
- {
- m_pTable->getIndexService()->dropIndex(m_pTable,_sElementName);
- }
- else
- {
- OUString aName,aSchema;
- sal_Int32 nLen = _sElementName.indexOf('.');
- if(nLen != -1)
- aSchema = _sElementName.copy(0,nLen);
- aName = _sElementName.copy(nLen+1);
+ m_pTable->getIndexService()->dropIndex(m_pTable,_sElementName);
+ }
+ else
+ {
+ OUString aName,aSchema;
+ sal_Int32 nLen = _sElementName.indexOf('.');
+ if(nLen != -1)
+ aSchema = _sElementName.copy(0,nLen);
+ aName = _sElementName.copy(nLen+1);
- OUString aSql( "DROP INDEX " );
+ OUString aSql( "DROP INDEX " );
- OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::EComposeRule::InIndexDefinitions, true );
- OUString sIndexName = dbtools::composeTableName( m_pTable->getMetaData(), OUString(), aSchema, aName, true, ::dbtools::EComposeRule::InIndexDefinitions );
+ OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::EComposeRule::InIndexDefinitions, true );
+ OUString sIndexName = dbtools::composeTableName( m_pTable->getMetaData(), OUString(), aSchema, aName, true, ::dbtools::EComposeRule::InIndexDefinitions );
- aSql += sIndexName + " ON " + aComposedName;
+ aSql += sIndexName + " ON " + aComposedName;
- Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
+ Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
+ if ( xStmt.is() )
+ {
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
}
}
}
diff --git a/connectivity/source/commontools/TKeys.cxx b/connectivity/source/commontools/TKeys.cxx
index 57b49b6e8416..742a1832049a 100644
--- a/connectivity/source/commontools/TKeys.cxx
+++ b/connectivity/source/commontools/TKeys.cxx
@@ -264,43 +264,43 @@ OUString OKeysHelper::getDropForeignKey() const
void OKeysHelper::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
{
Reference< XConnection> xConnection = m_pTable->getConnection();
- if ( xConnection.is() && !m_pTable->isNew() )
+ if ( !(xConnection.is() && !m_pTable->isNew()) )
+ return;
+
+ Reference<XPropertySet> xKey(getObject(_nPos),UNO_QUERY);
+ if ( m_pTable->getKeyService().is() )
+ {
+ m_pTable->getKeyService()->dropKey(m_pTable,xKey);
+ }
+ else
{
- Reference<XPropertySet> xKey(getObject(_nPos),UNO_QUERY);
- if ( m_pTable->getKeyService().is() )
+ OUStringBuffer aSql;
+ aSql.append("ALTER TABLE ");
+
+ aSql.append( composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::EComposeRule::InTableDefinitions, true ));
+
+ sal_Int32 nKeyType = KeyType::PRIMARY;
+ if ( xKey.is() )
{
- m_pTable->getKeyService()->dropKey(m_pTable,xKey);
+ ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
+ xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= nKeyType;
+ }
+ if ( KeyType::PRIMARY == nKeyType )
+ {
+ aSql.append(" DROP PRIMARY KEY");
}
else
{
- OUStringBuffer aSql;
- aSql.append("ALTER TABLE ");
-
- aSql.append( composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::EComposeRule::InTableDefinitions, true ));
-
- sal_Int32 nKeyType = KeyType::PRIMARY;
- if ( xKey.is() )
- {
- ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
- xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= nKeyType;
- }
- if ( KeyType::PRIMARY == nKeyType )
- {
- aSql.append(" DROP PRIMARY KEY");
- }
- else
- {
- aSql.append(getDropForeignKey());
- const OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString();
- aSql.append( ::dbtools::quoteName( aQuote,_sElementName) );
- }
+ aSql.append(getDropForeignKey());
+ const OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString();
+ aSql.append( ::dbtools::quoteName( aQuote,_sElementName) );
+ }
- Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql.makeStringAndClear());
- ::comphelper::disposeComponent(xStmt);
- }
+ Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
+ if ( xStmt.is() )
+ {
+ xStmt->execute(aSql.makeStringAndClear());
+ ::comphelper::disposeComponent(xStmt);
}
}
}
diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx
index 246becfa6ae0..e22740144316 100644
--- a/connectivity/source/commontools/TTableHelper.cxx
+++ b/connectivity/source/commontools/TTableHelper.cxx
@@ -348,54 +348,54 @@ void OTableHelper::refreshForeignKeys(::std::vector< OUString>& _rNames)
Reference< XResultSet > xResult = getMetaData()->getImportedKeys(aCatalog,m_SchemaName,m_Name);
Reference< XRow > xRow(xResult,UNO_QUERY);
- if ( xRow.is() )
+ if ( !xRow.is() )
+ return;
+
+ std::shared_ptr<sdbcx::KeyProperties> pKeyProps;
+ OUString aName,sCatalog,aSchema,sOldFKName;
+ while( xResult->next() )
{
- std::shared_ptr<sdbcx::KeyProperties> pKeyProps;
- OUString aName,sCatalog,aSchema,sOldFKName;
- while( xResult->next() )
+ // this must be outside the "if" because we have to call in a right order
+ sCatalog = xRow->getString(1);
+ if ( xRow->wasNull() )
+ sCatalog.clear();
+ aSchema = xRow->getString(2);
+ aName = xRow->getString(3);
+
+ const OUString sForeignKeyColumn = xRow->getString(8);
+ const sal_Int32 nUpdateRule = xRow->getInt(10);
+ const sal_Int32 nDeleteRule = xRow->getInt(11);
+ const OUString sFkName = xRow->getString(12);
+
+ if ( !sFkName.isEmpty() && !xRow->wasNull() )
{
- // this must be outside the "if" because we have to call in a right order
- sCatalog = xRow->getString(1);
- if ( xRow->wasNull() )
- sCatalog.clear();
- aSchema = xRow->getString(2);
- aName = xRow->getString(3);
-
- const OUString sForeignKeyColumn = xRow->getString(8);
- const sal_Int32 nUpdateRule = xRow->getInt(10);
- const sal_Int32 nDeleteRule = xRow->getInt(11);
- const OUString sFkName = xRow->getString(12);
-
- if ( !sFkName.isEmpty() && !xRow->wasNull() )
+ if ( sOldFKName != sFkName )
{
- if ( sOldFKName != sFkName )
+ if ( pKeyProps.get() )
+ m_pImpl->m_aKeys.emplace(sOldFKName,pKeyProps);
+
+ const OUString sReferencedName = ::dbtools::composeTableName(getMetaData(),sCatalog,aSchema,aName,false,::dbtools::EComposeRule::InDataManipulation);
+ pKeyProps = std::make_shared<sdbcx::KeyProperties>(sReferencedName,KeyType::FOREIGN,nUpdateRule,nDeleteRule);
+ pKeyProps->m_aKeyColumnNames.push_back(sForeignKeyColumn);
+ _rNames.push_back(sFkName);
+ if ( m_pTables->hasByName(sReferencedName) )
{
- if ( pKeyProps.get() )
- m_pImpl->m_aKeys.emplace(sOldFKName,pKeyProps);
-
- const OUString sReferencedName = ::dbtools::composeTableName(getMetaData(),sCatalog,aSchema,aName,false,::dbtools::EComposeRule::InDataManipulation);
- pKeyProps = std::make_shared<sdbcx::KeyProperties>(sReferencedName,KeyType::FOREIGN,nUpdateRule,nDeleteRule);
- pKeyProps->m_aKeyColumnNames.push_back(sForeignKeyColumn);
- _rNames.push_back(sFkName);
- if ( m_pTables->hasByName(sReferencedName) )
- {
- if ( !m_pImpl->m_xTablePropertyListener.is() )
- m_pImpl->m_xTablePropertyListener = new OTableContainerListener(this);
- m_pTables->addContainerListener(m_pImpl->m_xTablePropertyListener.get());
- m_pImpl->m_xTablePropertyListener->add(sReferencedName);
- } // if ( m_pTables->hasByName(sReferencedName) )
- sOldFKName = sFkName;
- } // if ( sOldFKName != sFkName )
- else if ( pKeyProps.get() )
- {
- pKeyProps->m_aKeyColumnNames.push_back(sForeignKeyColumn);
- }
+ if ( !m_pImpl->m_xTablePropertyListener.is() )
+ m_pImpl->m_xTablePropertyListener = new OTableContainerListener(this);
+ m_pTables->addContainerListener(m_pImpl->m_xTablePropertyListener.get());
+ m_pImpl->m_xTablePropertyListener->add(sReferencedName);
+ } // if ( m_pTables->hasByName(sReferencedName) )
+ sOldFKName = sFkName;
+ } // if ( sOldFKName != sFkName )
+ else if ( pKeyProps.get() )
+ {
+ pKeyProps->m_aKeyColumnNames.push_back(sForeignKeyColumn);
}
- } // while( xResult->next() )
- if ( pKeyProps.get() )
- m_pImpl->m_aKeys.emplace(sOldFKName,pKeyProps);
- ::comphelper::disposeComponent(xResult);
- }
+ }
+ } // while( xResult->next() )
+ if ( pKeyProps.get() )
+ m_pImpl->m_aKeys.emplace(sOldFKName,pKeyProps);
+ ::comphelper::disposeComponent(xResult);
}
void OTableHelper::refreshKeys()
diff --git a/connectivity/source/commontools/conncleanup.cxx b/connectivity/source/commontools/conncleanup.cxx
index 922551c470af..d0198df5f494 100644
--- a/connectivity/source/commontools/conncleanup.cxx
+++ b/connectivity/source/commontools/conncleanup.cxx
@@ -129,51 +129,52 @@ namespace dbtools
void SAL_CALL OAutoConnectionDisposer::propertyChange( const PropertyChangeEvent& _rEvent )
{
- if ( _rEvent.PropertyName == ACTIVE_CONNECTION_PROPERTY_NAME )
- { // somebody set a new ActiveConnection
+ if ( _rEvent.PropertyName != ACTIVE_CONNECTION_PROPERTY_NAME )
+ return;
+
+// somebody set a new ActiveConnection
- Reference< XConnection > xNewConnection;
- _rEvent.NewValue >>= xNewConnection;
+ Reference< XConnection > xNewConnection;
+ _rEvent.NewValue >>= xNewConnection;
- if ( isRowSetListening() )
+ if ( isRowSetListening() )
+ {
+ // we're listening at the row set, this means that the row set does not have our
+ // m_xOriginalConnection as active connection anymore
+ // So there are two possibilities
+ // a. somebody sets a new connection which is not our original one
+ // b. somebody sets a new connection, which is exactly the original one
+ // a. we're not interested in a, but in b: In this case, we simply need to move to the state
+ // we had originally: listen for property changes, do not listen for row set changes, and
+ // do not dispose the connection until the row set does not need it anymore
+ if ( xNewConnection.get() == m_xOriginalConnection.get() )
{
- // we're listening at the row set, this means that the row set does not have our
- // m_xOriginalConnection as active connection anymore
- // So there are two possibilities
- // a. somebody sets a new connection which is not our original one
- // b. somebody sets a new connection, which is exactly the original one
- // a. we're not interested in a, but in b: In this case, we simply need to move to the state
- // we had originally: listen for property changes, do not listen for row set changes, and
- // do not dispose the connection until the row set does not need it anymore
- if ( xNewConnection.get() == m_xOriginalConnection.get() )
- {
- stopRowSetListening();
- }
+ stopRowSetListening();
}
- else
+ }
+ else
+ {
+ // start listening at the row set. We're allowed to dispose the old connection as soon
+ // as the RowSet changed
+
+ // Unfortunately, the our database form implementations sometimes fire the change of their
+ // ActiveConnection twice. This is an error in forms/source/component/DatabaseForm.cxx, but
+ // changing this would require incompatible changes we can't do for a while.
+ // So for the moment, we have to live with it here.
+ //
+ // The only scenario where this doubled notification causes problems is when the connection
+ // of the form is reset to the one we're responsible for (m_xOriginalConnection), so we
+ // check this here.
+ //
+ // Yes, this is a HACK :(
+ if ( xNewConnection.get() != m_xOriginalConnection.get() )
{
- // start listening at the row set. We're allowed to dispose the old connection as soon
- // as the RowSet changed
-
- // Unfortunately, the our database form implementations sometimes fire the change of their
- // ActiveConnection twice. This is an error in forms/source/component/DatabaseForm.cxx, but
- // changing this would require incompatible changes we can't do for a while.
- // So for the moment, we have to live with it here.
- //
- // The only scenario where this doubled notification causes problems is when the connection
- // of the form is reset to the one we're responsible for (m_xOriginalConnection), so we
- // check this here.
- //
- // Yes, this is a HACK :(
- if ( xNewConnection.get() != m_xOriginalConnection.get() )
- {
#if OSL_DEBUG_LEVEL > 0
- Reference< XConnection > xOldConnection;
- _rEvent.OldValue >>= xOldConnection;
- OSL_ENSURE( xOldConnection.get() == m_xOriginalConnection.get(), "OAutoConnectionDisposer::propertyChange: unexpected (original) property value!" );
+ Reference< XConnection > xOldConnection;
+ _rEvent.OldValue >>= xOldConnection;
+ OSL_ENSURE( xOldConnection.get() == m_xOriginalConnection.get(), "OAutoConnectionDisposer::propertyChange: unexpected (original) property value!" );
#endif
- startRowSetListening();
- }
+ startRowSetListening();
}
}
}
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index c0b88f1c7ba1..36161735ebb2 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -1696,76 +1696,76 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
Reference<XIndexAccess> xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>();
sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0;
std::vector<bool, std::allocator<bool> > aNewParameterSet( _aParametersSet );
- if ( nParamCount && std::count(aNewParameterSet.begin(),aNewParameterSet.end(),true) != nParamCount )
- {
- static const OUString PROPERTY_NAME(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME));
- aNewParameterSet.resize(nParamCount ,false);
- typedef std::map< OUString, std::vector<sal_Int32> > TParameterPositions;
- TParameterPositions aParameterNames;
- for(sal_Int32 i = 0; i < nParamCount; ++i)
- {
- Reference<XPropertySet> xParam(xParamsAsIndicies->getByIndex(i),UNO_QUERY);
- OUString sName;
- xParam->getPropertyValue(PROPERTY_NAME) >>= sName;
+ if ( !(nParamCount && std::count(aNewParameterSet.begin(),aNewParameterSet.end(),true) != nParamCount) )
+ return;
- TParameterPositions::const_iterator aFind = aParameterNames.find(sName);
- if ( aFind != aParameterNames.end() )
- aNewParameterSet[i] = true;
- aParameterNames[sName].push_back(i+1);
- }
- // build an interaction request
- // two continuations (Ok and Cancel)
- OInteractionAbort* pAbort = new OInteractionAbort;
- OParameterContinuation* pParams = new OParameterContinuation;
- // the request
- ParametersRequest aRequest;
- Reference<XIndexAccess> xWrappedParameters = new OParameterWrapper(aNewParameterSet,xParamsAsIndicies);
- aRequest.Parameters = xWrappedParameters;
- aRequest.Connection = _xConnection;
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xRequest(pRequest);
- // some knittings
- pRequest->addContinuation(pAbort);
- pRequest->addContinuation(pParams);
-
- // execute the request
- _rxHandler->handle(xRequest);
-
- if (!pParams->wasSelected())
- {
- // canceled by the user (i.e. (s)he canceled the dialog)
- RowSetVetoException e;
- e.ErrorCode = ParameterInteractionCancelled;
- throw e;
- }
+ static const OUString PROPERTY_NAME(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME));
+ aNewParameterSet.resize(nParamCount ,false);
+ typedef std::map< OUString, std::vector<sal_Int32> > TParameterPositions;
+ TParameterPositions aParameterNames;
+ for(sal_Int32 i = 0; i < nParamCount; ++i)
+ {
+ Reference<XPropertySet> xParam(xParamsAsIndicies->getByIndex(i),UNO_QUERY);
+ OUString sName;
+ xParam->getPropertyValue(PROPERTY_NAME) >>= sName;
+
+ TParameterPositions::const_iterator aFind = aParameterNames.find(sName);
+ if ( aFind != aParameterNames.end() )
+ aNewParameterSet[i] = true;
+ aParameterNames[sName].push_back(i+1);
+ }
+ // build an interaction request
+ // two continuations (Ok and Cancel)
+ OInteractionAbort* pAbort = new OInteractionAbort;
+ OParameterContinuation* pParams = new OParameterContinuation;
+ // the request
+ ParametersRequest aRequest;
+ Reference<XIndexAccess> xWrappedParameters = new OParameterWrapper(aNewParameterSet,xParamsAsIndicies);
+ aRequest.Parameters = xWrappedParameters;
+ aRequest.Connection = _xConnection;
+ OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
+ Reference< XInteractionRequest > xRequest(pRequest);
+ // some knittings
+ pRequest->addContinuation(pAbort);
+ pRequest->addContinuation(pParams);
+
+ // execute the request
+ _rxHandler->handle(xRequest);
+
+ if (!pParams->wasSelected())
+ {
+ // canceled by the user (i.e. (s)he canceled the dialog)
+ RowSetVetoException e;
+ e.ErrorCode = ParameterInteractionCancelled;
+ throw e;
+ }
- // now transfer the values from the continuation object to the parameter columns
- Sequence< PropertyValue > aFinalValues = pParams->getValues();
- const PropertyValue* pFinalValues = aFinalValues.getConstArray();
- for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues)
+ // now transfer the values from the continuation object to the parameter columns
+ Sequence< PropertyValue > aFinalValues = pParams->getValues();
+ const PropertyValue* pFinalValues = aFinalValues.getConstArray();
+ for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues)
+ {
+ Reference< XPropertySet > xParamColumn(xWrappedParameters->getByIndex(i),UNO_QUERY);
+ if (xParamColumn.is())
{
- Reference< XPropertySet > xParamColumn(xWrappedParameters->getByIndex(i),UNO_QUERY);
- if (xParamColumn.is())
+ OUString sName;
+ xParamColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
+ OSL_ENSURE(sName == pFinalValues->Name, "::dbaui::askForParameters: inconsistent parameter names!");
+
+ // determine the field type and ...
+ sal_Int32 nParamType = 0;
+ xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nParamType;
+ // ... the scale of the parameter column
+ sal_Int32 nScale = 0;
+ if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE), xParamColumn))
+ xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
+ // (the index of the parameters is one-based)
+ TParameterPositions::const_iterator aFind = aParameterNames.find(pFinalValues->Name);
+ for(const auto& rItem : aFind->second)
{
- OUString sName;
- xParamColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
- OSL_ENSURE(sName == pFinalValues->Name, "::dbaui::askForParameters: inconsistent parameter names!");
-
- // determine the field type and ...
- sal_Int32 nParamType = 0;
- xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nParamType;
- // ... the scale of the parameter column
- sal_Int32 nScale = 0;
- if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE), xParamColumn))
- xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
- // (the index of the parameters is one-based)
- TParameterPositions::const_iterator aFind = aParameterNames.find(pFinalValues->Name);
- for(const auto& rItem : aFind->second)
+ if ( _aParametersSet.empty() || !_aParametersSet[rItem-1] )
{
- if ( _aParametersSet.empty() || !_aParametersSet[rItem-1] )
- {
- _xParameters->setObjectWithInfo(rItem, pFinalValues->Value, nParamType, nScale);
- }
+ _xParameters->setObjectWithInfo(rItem, pFinalValues->Value, nParamType, nScale);
}
}
}
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 1d905aa73ea8..045ea54190ac 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -65,21 +65,21 @@ static void lcl_UpdateArea( const Reference<XCellRange>& xUsedRange, sal_Int32&
// update rEndCol, rEndRow if any non-empty cell in xUsedRange is right/below
const Reference<XCellRangesQuery> xUsedQuery( xUsedRange, UNO_QUERY );
- if ( xUsedQuery.is() )
- {
- const sal_Int16 nContentFlags =
- CellFlags::STRING | CellFlags::VALUE | CellFlags::DATETIME | CellFlags::FORMULA | CellFlags::ANNOTATION;
+ if ( !xUsedQuery.is() )
+ return;
- const Reference<XSheetCellRanges> xUsedRanges = xUsedQuery->queryContentCells( nContentFlags );
- const Sequence<CellRangeAddress> aAddresses = xUsedRanges->getRangeAddresses();
+ const sal_Int16 nContentFlags =
+ CellFlags::STRING | CellFlags::VALUE | CellFlags::DATETIME | CellFlags::FORMULA | CellFlags::ANNOTATION;
- const sal_Int32 nCount = aAddresses.getLength();
- const CellRangeAddress* pData = aAddresses.getConstArray();
- for ( sal_Int32 i=0; i<nCount; i++ )
- {
- rEndCol = std::max(pData[i].EndColumn, rEndCol);
- rEndRow = std::max(pData[i].EndRow, rEndRow);
- }
+ const Reference<XSheetCellRanges> xUsedRanges = xUsedQuery->queryContentCells( nContentFlags );
+ const Sequence<CellRangeAddress> aAddresses = xUsedRanges->getRangeAddresses();
+
+ const sal_Int32 nCount = aAddresses.getLength();
+ const CellRangeAddress* pData = aAddresses.getConstArray();
+ for ( sal_Int32 i=0; i<nCount; i++ )
+ {
+ rEndCol = std::max(pData[i].EndColumn, rEndCol);
+ rEndRow = std::max(pData[i].EndRow, rEndRow);
}
}
@@ -237,64 +237,64 @@ static void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const Refe
Reference<XCell> xDataCell = lcl_GetUsedCell( xSheet, nDocColumn, nDataRow );
Reference<XPropertySet> xProp( xDataCell, UNO_QUERY );
- if ( xProp.is() )
+ if ( !xProp.is() )
+ return;
+
+ rCurrency = false; // set to true for currency below
+
+ const CellContentType eCellType = lcl_GetContentOrResultType( xDataCell );
+ // #i35178# use "text" type if there is any text cell in the column
+ if ( eCellType == CellContentType_TEXT || lcl_HasTextInColumn( xSheet, nDocColumn, nDataRow ) )
+ rDataType = DataType::VARCHAR;
+ else if ( eCellType == CellContentType_VALUE )
{
- rCurrency = false; // set to true for currency below
+ // get number format to distinguish between different types
- const CellContentType eCellType = lcl_GetContentOrResultType( xDataCell );
- // #i35178# use "text" type if there is any text cell in the column
- if ( eCellType == CellContentType_TEXT || lcl_HasTextInColumn( xSheet, nDocColumn, nDataRow ) )
- rDataType = DataType::VARCHAR;
- else if ( eCellType == CellContentType_VALUE )
+ sal_Int16 nNumType = NumberFormat::NUMBER;
+ try
{
- // get number format to distinguish between different types
+ sal_Int32 nKey = 0;
- sal_Int16 nNumType = NumberFormat::NUMBER;
- try
+ if ( xProp->getPropertyValue( "NumberFormat" ) >>= nKey )
{
- sal_Int32 nKey = 0;
-
- if ( xProp->getPropertyValue( "NumberFormat" ) >>= nKey )
+ const Reference<XPropertySet> xFormat = xFormats->getByKey( nKey );
+ if ( xFormat.is() )
{
- const Reference<XPropertySet> xFormat = xFormats->getByKey( nKey );
- if ( xFormat.is() )
- {
- xFormat->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE) ) >>= nNumType;
- }
+ xFormat->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE) ) >>= nNumType;
}
}
- catch ( Exception& )
- {
- }
-
- if ( nNumType & NumberFormat::TEXT )
- rDataType = DataType::VARCHAR;
- else if ( nNumType & NumberFormat::NUMBER )
- rDataType = DataType::DECIMAL;
- else if ( nNumType & NumberFormat::CURRENCY )
- {
- rCurrency = true;
- rDataType = DataType::DECIMAL;
- }
- else if ( ( nNumType & NumberFormat::DATETIME ) == NumberFormat::DATETIME )
- {
- // NumberFormat::DATETIME is DATE | TIME
- rDataType = DataType::TIMESTAMP;
- }
- else if ( nNumType & NumberFormat::DATE )
- rDataType = DataType::DATE;
- else if ( nNumType & NumberFormat::TIME )
- rDataType = DataType::TIME;
- else if ( nNumType & NumberFormat::LOGICAL )
- rDataType = DataType::BIT;
- else
- rDataType = DataType::DECIMAL;
}
- else
+ catch ( Exception& )
{
- // whole column empty
+ }
+
+ if ( nNumType & NumberFormat::TEXT )
rDataType = DataType::VARCHAR;
+ else if ( nNumType & NumberFormat::NUMBER )
+ rDataType = DataType::DECIMAL;
+ else if ( nNumType & NumberFormat::CURRENCY )
+ {
+ rCurrency = true;
+ rDataType = DataType::DECIMAL;
}
+ else if ( ( nNumType & NumberFormat::DATETIME ) == NumberFormat::DATETIME )
+ {
+ // NumberFormat::DATETIME is DATE | TIME
+ rDataType = DataType::TIMESTAMP;
+ }
+ else if ( nNumType & NumberFormat::DATE )
+ rDataType = DataType::DATE;
+ else if ( nNumType & NumberFormat::TIME )
+ rDataType = DataType::TIME;
+ else if ( nNumType & NumberFormat::LOGICAL )
+ rDataType = DataType::BIT;
+ else
+ rDataType = DataType::DECIMAL;
+ }
+ else
+ {
+ // whole column empty
+ rDataType = DataType::VARCHAR;
}
}
@@ -310,104 +310,104 @@ static void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& x
++nDocRow;
const Reference<XCell> xCell = xSheet->getCellByPosition( nDocColumn, nDocRow );
- if ( xCell.is() )
+ if ( !xCell.is() )
+ return;
+
+ CellContentType eCellType = lcl_GetContentOrResultType( xCell );
+ switch (nType)
{
- CellContentType eCellType = lcl_GetContentOrResultType( xCell );
- switch (nType)
- {
- case DataType::VARCHAR:
- if ( eCellType == CellContentType_EMPTY )
- rValue.setNull();
- else
- {
- // #i25840# still let Calc convert numbers to text
- const Reference<XText> xText( xCell, UNO_QUERY );
- if ( xText.is() )
- rValue = xText->getString();
- }
- break;
- case DataType::DECIMAL:
- if ( eCellType == CellContentType_VALUE )
- rValue = xCell->getValue(); // double
- else
- rValue.setNull();
- break;
- case DataType::BIT:
- if ( eCellType == CellContentType_VALUE )
- rValue = xCell->getValue() != 0.0;
- else
- rValue.setNull();
- break;
- case DataType::DATE:
- if ( eCellType == CellContentType_VALUE )
- {
- ::Date aDate( rNullDate );
- aDate.AddDays(::rtl::math::approxFloor( xCell->getValue() ));
- rValue = aDate.GetUNODate();
- }
- else
- rValue.setNull();
- break;
- case DataType::TIME:
- if ( eCellType == CellContentType_VALUE )
+ case DataType::VARCHAR:
+ if ( eCellType == CellContentType_EMPTY )
+ rValue.setNull();
+ else
+ {
+ // #i25840# still let Calc convert numbers to text
+ const Reference<XText> xText( xCell, UNO_QUERY );
+ if ( xText.is() )
+ rValue = xText->getString();
+ }
+ break;
+ case DataType::DECIMAL:
+ if ( eCellType == CellContentType_VALUE )
+ rValue = xCell->getValue(); // double
+ else
+ rValue.setNull();
+ break;
+ case DataType::BIT:
+ if ( eCellType == CellContentType_VALUE )
+ rValue = xCell->getValue() != 0.0;
+ else
+ rValue.setNull();
+ break;
+ case DataType::DATE:
+ if ( eCellType == CellContentType_VALUE )
+ {
+ ::Date aDate( rNullDate );
+ aDate.AddDays(::rtl::math::approxFloor( xCell->getValue() ));
+ rValue = aDate.GetUNODate();
+ }
+ else
+ rValue.setNull();
+ break;
+ case DataType::TIME:
+ if ( eCellType == CellContentType_VALUE )
+ {
+ double fCellVal = xCell->getValue();
+ double fTime = fCellVal - rtl::math::approxFloor( fCellVal );
+ sal_Int64 nIntTime = static_cast<sal_Int64>(rtl::math::round( fTime * static_cast<double>(::tools::Time::nanoSecPerDay) ));
+ if ( nIntTime == ::tools::Time::nanoSecPerDay)
+ nIntTime = 0; // 23:59:59.9999999995 and above is 00:00:00.00
+ css::util::Time aTime;
+ aTime.NanoSeconds = static_cast<sal_uInt32>( nIntTime % ::tools::Time::nanoSecPerSec );
+ nIntTime /= ::tools::Time::nanoSecPerSec;
+ aTime.Seconds = static_cast<sal_uInt16>( nIntTime % 60 );
+ nIntTime /= 60;
+ aTime.Minutes = static_cast<sal_uInt16>( nIntTime % 60 );
+ nIntTime /= 60;
+ OSL_ENSURE( nIntTime < 24, "error in time calculation" );
+ aTime.Hours = static_cast<sal_uInt16>(nIntTime);
+ rValue = aTime;
+ }
+ else
+ rValue.setNull();
+ break;
+ case DataType::TIMESTAMP:
+ if ( eCellType == CellContentType_VALUE )
+ {
+ double fCellVal = xCell->getValue();
+ double fDays = ::rtl::math::approxFloor( fCellVal );
+ double fTime = fCellVal - fDays;
+ long nIntDays = static_cast<long>(fDays);
+ sal_Int64 nIntTime = ::rtl::math::round( fTime * static_cast<double>(::tools::Time::nanoSecPerDay) );
+ if ( nIntTime == ::tools::Time::nanoSecPerDay )
{
- double fCellVal = xCell->getValue();
- double fTime = fCellVal - rtl::math::approxFloor( fCellVal );
- sal_Int64 nIntTime = static_cast<sal_Int64>(rtl::math::round( fTime * static_cast<double>(::tools::Time::nanoSecPerDay) ));
- if ( nIntTime == ::tools::Time::nanoSecPerDay)
- nIntTime = 0; // 23:59:59.9999999995 and above is 00:00:00.00
- css::util::Time aTime;
- aTime.NanoSeconds = static_cast<sal_uInt32>( nIntTime % ::tools::Time::nanoSecPerSec );
- nIntTime /= ::tools::Time::nanoSecPerSec;
- aTime.Seconds = static_cast<sal_uInt16>( nIntTime % 60 );
- nIntTime /= 60;
- aTime.Minutes = static_cast<sal_uInt16>( nIntTime % 60 );
- nIntTime /= 60;
- OSL_ENSURE( nIntTime < 24, "error in time calculation" );
- aTime.Hours = static_cast<sal_uInt16>(nIntTime);
- rValue = aTime;
+ nIntTime = 0; // 23:59:59.9999999995 and above is 00:00:00.00
+ ++nIntDays; // (next day)
}
- else
- rValue.setNull();
- break;
- case DataType::TIMESTAMP:
- if ( eCellType == CellContentType_VALUE )
- {
- double fCellVal = xCell->getValue();
- double fDays = ::rtl::math::approxFloor( fCellVal );
- double fTime = fCellVal - fDays;
- long nIntDays = static_cast<long>(fDays);
- sal_Int64 nIntTime = ::rtl::math::round( fTime * static_cast<double>(::tools::Time::nanoSecPerDay) );
- if ( nIntTime == ::tools::Time::nanoSecPerDay )
- {
- nIntTime = 0; // 23:59:59.9999999995 and above is 00:00:00.00
- ++nIntDays; // (next day)
- }
- css::util::DateTime aDateTime;
+ css::util::DateTime aDateTime;
- aDateTime.NanoSeconds = static_cast<sal_uInt16>( nIntTime % ::tools::Time::nanoSecPerSec );
- nIntTime /= ::tools::Time::nanoSecPerSec;
- aDateTime.Seconds = static_cast<sal_uInt16>( nIntTime % 60 );
- nIntTime /= 60;
- aDateTime.Minutes = static_cast<sal_uInt16>( nIntTime % 60 );
- nIntTime /= 60;
- OSL_ENSURE( nIntTime < 24, "error in time calculation" );
- aDateTime.Hours = static_cast<sal_uInt16>(nIntTime);
+ aDateTime.NanoSeconds = static_cast<sal_uInt16>( nIntTime % ::tools::Time::nanoSecPerSec );
+ nIntTime /= ::tools::Time::nanoSecPerSec;
+ aDateTime.Seconds = static_cast<sal_uInt16>( nIntTime % 60 );
+ nIntTime /= 60;
+ aDateTime.Minutes = static_cast<sal_uInt16>( nIntTime % 60 );
+ nIntTime /= 60;
+ OSL_ENSURE( nIntTime < 24, "error in time calculation" );
+ aDateTime.Hours = static_cast<sal_uInt16>(nIntTime);
- ::Date aDate( rNullDate );
- aDate.AddDays( nIntDays );
- aDateTime.Day = aDate.GetDay();
- aDateTime.Month = aDate.GetMonth();
- aDateTime.Year = aDate.GetYear();
+ ::Date aDate( rNullDate );
+ aDate.AddDays( nIntDays );
+ aDateTime.Day = aDate.GetDay();
+ aDateTime.Month = aDate.GetMonth();
+ aDateTime.Year = aDate.GetYear();
- rValue = aDateTime;
- }
- else
- rValue.setNull();
- break;
- } // switch (nType)
- }
+ rValue = aDateTime;
+ }
+ else
+ rValue.setNull();
+ break;
+ } // switch (nType)
// rValue.setTypeKind(nType);
}
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index fdb782174412..d168de39eb77 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -130,30 +130,30 @@ ONDXPagePtr const & ODbaseIndex::getRoot()
void ODbaseIndex::openIndexFile()
{
- if(!m_pFileStream)
+ if(m_pFileStream)
+ return;
+
+ OUString sFile = getCompletePath();
+ if(UCBContentHelper::Exists(sFile))
{
- OUString sFile = getCompletePath();
- if(UCBContentHelper::Exists(sFile))
- {
- m_pFileStream = OFileTable::createStream_simpleError(sFile, StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE);
- if (!m_pFileStream)
- m_pFileStream = OFileTable::createStream_simpleError(sFile, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYNONE);
- if(m_pFileStream)
- {
- m_pFileStream->SetEndian(SvStreamEndian::LITTLE);
- m_pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
- (*m_pFileStream) >> *this;
- }
- }
- if(!m_pFileStream)
+ m_pFileStream = OFileTable::createStream_simpleError(sFile, StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE);
+ if (!m_pFileStream)
+ m_pFileStream = OFileTable::createStream_simpleError(sFile, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYNONE);
+ if(m_pFileStream)
{
- const OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COULD_NOT_LOAD_FILE,
- "$filename$", sFile
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
+ m_pFileStream->SetEndian(SvStreamEndian::LITTLE);
+ m_pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
+ (*m_pFileStream) >> *this;
}
}
+ if(!m_pFileStream)
+ {
+ const OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
+ STR_COULD_NOT_LOAD_FILE,
+ "$filename$", sFile
+ ) );
+ ::dbtools::throwGenericSQLException( sError, *this );
+ }
}
std::unique_ptr<OIndexIterator> ODbaseIndex::createIterator()
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index bf2036b2ca19..ff01f3b6ba37 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -482,63 +482,63 @@ void ODbaseTable::construct()
m_pFileStream = createStream_simpleError( sFileName, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYNONE);
}
- if(m_pFileStream)
- {
- readHeader();
- if (HasMemoFields())
- {
- // Create Memo-Filename (.DBT):
- // nyi: Ugly for Unix and Mac!
+ if(!m_pFileStream)
+ return;
- if ( m_aHeader.type == FoxProMemo || m_aHeader.type == VisualFoxPro || m_aHeader.type == VisualFoxProAuto) // foxpro uses another extension
- aURL.SetExtension("fpt");
- else
- aURL.SetExtension("dbt");
+ readHeader();
+ if (HasMemoFields())
+ {
+ // Create Memo-Filename (.DBT):
+ // nyi: Ugly for Unix and Mac!
- // If the memo file isn't found, the data will be displayed anyhow.
- // However, updates can't be done
- // but the operation is executed
- m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE);
- if ( !m_pMemoStream )
- {
- m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYNONE);
- }
- if (m_pMemoStream)
- ReadMemoHeader();
- }
- fillColumns();
+ if ( m_aHeader.type == FoxProMemo || m_aHeader.type == VisualFoxPro || m_aHeader.type == VisualFoxProAuto) // foxpro uses another extension
+ aURL.SetExtension("fpt");
+ else
+ aURL.SetExtension("dbt");
- std::size_t nFileSize = lcl_getFileSize(*m_pFileStream);
- m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
- // seems to be empty or someone wrote bullshit into the dbase file
- // try and recover if m_aHeader.db_slng is sane
- if (m_aHeader.nbRecords == 0 && m_aHeader.recordLength)
+ // If the memo file isn't found, the data will be displayed anyhow.
+ // However, updates can't be done
+ // but the operation is executed
+ m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE);
+ if ( !m_pMemoStream )
{
- std::size_t nRecords = (nFileSize-m_aHeader.headerLength)/m_aHeader.recordLength;
- if (nRecords > 0)
- m_aHeader.nbRecords = nRecords;
+ m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYNONE);
}
+ if (m_pMemoStream)
+ ReadMemoHeader();
+ }
+ fillColumns();
- // Buffersize dependent on the file size
- m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 :
- nFileSize > 100000 ? 16384 :
- nFileSize > 10000 ? 4096 : 1024);
+ std::size_t nFileSize = lcl_getFileSize(*m_pFileStream);
+ m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
+ // seems to be empty or someone wrote bullshit into the dbase file
+ // try and recover if m_aHeader.db_slng is sane
+ if (m_aHeader.nbRecords == 0 && m_aHeader.recordLength)
+ {
+ std::size_t nRecords = (nFileSize-m_aHeader.headerLength)/m_aHeader.recordLength;
+ if (nRecords > 0)
+ m_aHeader.nbRecords = nRecords;
+ }
- if (m_pMemoStream)
- {
- // set the buffer exactly to the length of a record
- nFileSize = m_pMemoStream->TellEnd();
- m_pMemoStream->Seek(STREAM_SEEK_TO_BEGIN);
-
- // Buffersize dependent on the file size
- m_pMemoStream->SetBufferSize(nFileSize > 1000000 ? 32768 :
- nFileSize > 100000 ? 16384 :
- nFileSize > 10000 ? 4096 :
- m_aMemoHeader.db_size);
- }
+ // Buffersize dependent on the file size
+ m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 :
+ nFileSize > 100000 ? 16384 :
+ nFileSize > 10000 ? 4096 : 1024);
+
+ if (m_pMemoStream)
+ {
+ // set the buffer exactly to the length of a record
+ nFileSize = m_pMemoStream->TellEnd();
+ m_pMemoStream->Seek(STREAM_SEEK_TO_BEGIN);
- AllocBuffer();
+ // Buffersize dependent on the file size
+ m_pMemoStream->SetBufferSize(nFileSize > 1000000 ? 32768 :
+ nFileSize > 100000 ? 16384 :
+ nFileSize > 10000 ? 4096 :
+ m_aMemoHeader.db_size);
}
+
+ AllocBuffer();
}
void ODbaseTable::ReadMemoHeader()
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index ae105b8be512..1ac10800f0a9 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -997,24 +997,24 @@ void ONDXPage::SearchAndReplace(const ONDXKey& rSearch,
ONDXKey const & rReplace)
{
OSL_ENSURE(rSearch != rReplace,"Invalid here:rSearch == rReplace");
- if (rSearch != rReplace)
- {
- sal_uInt16 nPos = NODE_NOTFOUND;
- ONDXPage* pPage = this;
+ if (rSearch == rReplace)
+ return;
- while (pPage)
- {
- nPos = pPage->Search(rSearch);
- if (nPos != NODE_NOTFOUND)
- break;
- pPage = pPage->aParent;
- }
+ sal_uInt16 nPos = NODE_NOTFOUND;
+ ONDXPage* pPage = this;
- if (pPage)
- {
- (*pPage)[nPos].GetKey() = rReplace;
- pPage->SetModified(true);
- }
+ while (pPage)
+ {
+ nPos = pPage->Search(rSearch);
+ if (nPos != NODE_NOTFOUND)
+ break;
+ pPage = pPage->aParent;
+ }
+
+ if (pPage)
+ {
+ (*pPage)[nPos].GetKey() = rReplace;
+ pPage->SetModified(true);
}
}
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index a5efdd2a0e6a..9eb6f1d34862 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -90,53 +90,53 @@ namespace connectivity::evoab
static void
initFields()
{
- if( !pFields )
+ if( pFields )
+ return;
+
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( pFields )
+ return;
+
+ guint nProps;
+ ColumnProperty **pToBeFields;
+ GParamSpec **pProps;
+ nFields = 0;
+ pProps = g_object_class_list_properties
+ ( static_cast<GObjectClass *>(g_type_class_ref( E_TYPE_CONTACT )),
+ &nProps );
+ pToBeFields = g_new0(ColumnProperty *, (nProps + OTHER_ZIP)/* new column(s)*/ );
+ for ( guint i = 0; i < nProps; i++ )
{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pFields )
+ switch (pProps[i]->value_type)
{
- guint nProps;
- ColumnProperty **pToBeFields;
- GParamSpec **pProps;
- nFields = 0;
- pProps = g_object_class_list_properties
- ( static_cast<GObjectClass *>(g_type_class_ref( E_TYPE_CONTACT )),
- &nProps );
- pToBeFields = g_new0(ColumnProperty *, (nProps + OTHER_ZIP)/* new column(s)*/ );
- for ( guint i = 0; i < nProps; i++ )
+ case G_TYPE_STRING:
+ case G_TYPE_BOOLEAN:
{
- switch (pProps[i]->value_type)
+ bool bAdd = true;
+ const char *pName = g_param_spec_get_name( pProps[i] );
+ for (unsigned int j = 0; j < G_N_ELEMENTS( pBlackList ); j++ )
{
- case G_TYPE_STRING:
- case G_TYPE_BOOLEAN:
+ if( !strcmp( pBlackList[j], pName ) )
{
- bool bAdd = true;
- const char *pName = g_param_spec_get_name( pProps[i] );
- for (unsigned int j = 0; j < G_N_ELEMENTS( pBlackList ); j++ )
- {
- if( !strcmp( pBlackList[j], pName ) )
- {
- bAdd = false;
- break;
- }
- }
- if( bAdd )
- {
- pToBeFields[nFields]= g_new0(ColumnProperty,1);
- pToBeFields[nFields]->bIsSplittedValue=false;
- pToBeFields[ nFields++ ]->pField = g_param_spec_ref( pProps[i] );
- }
+ bAdd = false;
break;
}
- default:
- break;
}
+ if( bAdd )
+ {
+ pToBeFields[nFields]= g_new0(ColumnProperty,1);
+ pToBeFields[nFields]->bIsSplittedValue=false;
+ pToBeFields[ nFields++ ]->pField = g_param_spec_ref( pProps[i] );
+ }
+ break;
}
-
- splitColumn(pToBeFields);
- pFields = pToBeFields;
+ default:
+ break;
}
}
+
+ splitColumn(pToBeFields);
+ pFields = pToBeFields;
}
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
index 6d74583935ca..fc5b81923cb4 100644
--- a/connectivity/source/drivers/file/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/file/FPreparedStatement.cxx
@@ -482,17 +482,17 @@ void OPreparedStatement::describeParameter()
{
std::vector< OSQLParseNode*> aParseNodes;
scanParameter(m_pParseTree,aParseNodes);
- if ( !aParseNodes.empty() )
+ if ( aParseNodes.empty() )
+ return;
+
+ // m_xParamColumns = new OSQLColumns();
+ const OSQLTables& rTabs = m_aSQLIterator.getTables();
+ if( !rTabs.empty() )
{
- // m_xParamColumns = new OSQLColumns();
- const OSQLTables& rTabs = m_aSQLIterator.getTables();
- if( !rTabs.empty() )
+ OSQLTable xTable = rTabs.begin()->second;
+ for (auto const& parseNode : aParseNodes)
{
- OSQLTable xTable = rTabs.begin()->second;
- for (auto const& parseNode : aParseNodes)
- {
- describeColumn(parseNode,parseNode->getParent()->getChild(0),xTable);
- }
+ describeColumn(parseNode,parseNode->getParent()->getChild(0),xTable);
}
}
}
@@ -501,36 +501,36 @@ void OPreparedStatement::initializeResultSet(OResultSet* pRS)
OStatement_Base::initializeResultSet(pRS);
// Substitute parameter (AssignValues and criteria):
- if (!m_xParamColumns->empty())
- {
- // begin with AssignValues
- sal_uInt16 nParaCount=0; // gives the current number of previously set Parameters
+ if (m_xParamColumns->empty())
+ return;
- // search for parameters to be substituted:
- size_t nCount = m_aAssignValues.is() ? m_aAssignValues->size() : 1; // 1 is important for the Criteria
- for (size_t j = 1; j < nCount; j++)
- {
- sal_uInt32 nParameter = (*m_aAssignValues).getParameterIndex(j);
- if (nParameter == SQL_NO_PARAMETER)
- continue; // this AssignValue is no Parameter
+ // begin with AssignValues
+ sal_uInt16 nParaCount=0; // gives the current number of previously set Parameters
- ++nParaCount; // now the Parameter is valid
- }
+ // search for parameters to be substituted:
+ size_t nCount = m_aAssignValues.is() ? m_aAssignValues->size() : 1; // 1 is important for the Criteria
+ for (size_t j = 1; j < nCount; j++)
+ {
+ sal_uInt32 nParameter = (*m_aAssignValues).getParameterIndex(j);
+ if (nParameter == SQL_NO_PARAMETER)
+ continue; // this AssignValue is no Parameter
- if (m_aParameterRow.is() && (m_xParamColumns->size()+1) != m_aParameterRow->size() )
+ ++nParaCount; // now the Parameter is valid
+ }
+
+ if (m_aParameterRow.is() && (m_xParamColumns->size()+1) != m_aParameterRow->size() )
+ {
+ sal_Int32 i = m_aParameterRow->size();
+ sal_Int32 nParamColumns = m_xParamColumns->size()+1;
+ m_aParameterRow->resize(nParamColumns);
+ for ( ;i < nParamColumns; ++i )
{
- sal_Int32 i = m_aParameterRow->size();
- sal_Int32 nParamColumns = m_xParamColumns->size()+1;
- m_aParameterRow->resize(nParamColumns);
- for ( ;i < nParamColumns; ++i )
- {
- if ( !(*m_aParameterRow)[i].is() )
- (*m_aParameterRow)[i] = new ORowSetValueDecorator;
- }
+ if ( !(*m_aParameterRow)[i].is() )
+ (*m_aParameterRow)[i] = new ORowSetValueDecorator;
}
- if (m_aParameterRow.is() && nParaCount < m_aParameterRow->size() )
- m_pSQLAnalyzer->bindParameterRow(m_aParameterRow);
}
+ if (m_aParameterRow.is() && nParaCount < m_aParameterRow->size() )
+ m_pSQLAnalyzer->bindParameterRow(m_aParameterRow);
}
void OPreparedStatement::parseParamterElem(const OUString& _sColumnName, OSQLParseNode* pRow_Value_Constructor_Elem)
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 3b8f69d6ab6e..d7f3d6bd2090 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -1472,40 +1472,40 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow,
}
}
// in this case we got more select columns as columns exist in the table
- if ( _bSetColumnMapping && aSelectIters.size() != _rColMapping.size() )
- {
- Reference<XNameAccess> xNameAccess(_xNames,UNO_QUERY);
- Sequence< OUString > aSelectColumns = xNameAccess->getElementNames();
+ if ( !(_bSetColumnMapping && aSelectIters.size() != _rColMapping.size()) )
+ return;
- for ( OSQLColumns::iterator aIter = _rxColumns->begin();
- aIter != _rxColumns->end();
- ++aIter
- )
+ Reference<XNameAccess> xNameAccess(_xNames,UNO_QUERY);
+ Sequence< OUString > aSelectColumns = xNameAccess->getElementNames();
+
+ for ( OSQLColumns::iterator aIter = _rxColumns->begin();
+ aIter != _rxColumns->end();
+ ++aIter
+ )
+ {
+ if ( aSelectIters.end() == aSelectIters.find(aIter) )
{
- if ( aSelectIters.end() == aSelectIters.find(aIter) )
- {
- if ( (*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName) )
- (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
- else
- (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
+ if ( (*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName) )
+ (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
+ else
+ (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
- if ( xNameAccess->hasByName( sSelectColumnRealName ) )
+ if ( xNameAccess->hasByName( sSelectColumnRealName ) )
+ {
+ aSelectIters.emplace(aIter,true);
+ sal_Int32 nSelectColumnPos = aIter - _rxColumns->begin() + 1;
+ const OUString* pBegin = aSelectColumns.getConstArray();
+ const OUString* pEnd = pBegin + aSelectColumns.getLength();
+ for(sal_Int32 i=0;pBegin != pEnd;++pBegin,++i)
{
- aSelectIters.emplace(aIter,true);
- sal_Int32 nSelectColumnPos = aIter - _rxColumns->begin() + 1;
- const OUString* pBegin = aSelectColumns.getConstArray();
- const OUString* pEnd = pBegin + aSelectColumns.getLength();
- for(sal_Int32 i=0;pBegin != pEnd;++pBegin,++i)
+ if ( aCase(*pBegin, sSelectColumnRealName) )
{
- if ( aCase(*pBegin, sSelectColumnRealName) )
- {
- // the getXXX methods are 1-based ...
- sal_Int32 nTableColumnPos = i + 1;
- // get first table column is the bookmark column ...
- _rColMapping[nSelectColumnPos] = nTableColumnPos;
- (*_rSelectRow)[nSelectColumnPos] = (*_rRow)[nTableColumnPos];
- break;
- }
+ // the getXXX methods are 1-based ...
+ sal_Int32 nTableColumnPos = i + 1;
+ // get first table column is the bookmark column ...
+ _rColMapping[nSelectColumnPos] = nTableColumnPos;
+ (*_rSelectRow)[nSelectColumnPos] = (*_rRow)[nTableColumnPos];
+ break;
}
}
}
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
index 28eef44ff71e..08c4f7fdd844 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -310,25 +310,25 @@ void OStatement_Base::anylizeSQL()
m_pSQLAnalyzer->start(m_pParseTree);
const OSQLParseNode* pOrderbyClause = m_aSQLIterator.getOrderTree();
- if(pOrderbyClause)
+ if(!pOrderbyClause)
+ return;
+
+ OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
+ OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Error in Parse Tree");
+
+ for (size_t m = 0; m < pOrderingSpecCommalist->count(); m++)
{
- OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Error in Parse Tree");
+ OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
+ OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Error in Parse Tree");
+ OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Error in Parse Tree");
- for (size_t m = 0; m < pOrderingSpecCommalist->count(); m++)
+ OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
+ if(!SQL_ISRULE(pColumnRef,column_ref))
{
- OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Error in Parse Tree");
- OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Error in Parse Tree");
-
- OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
- if(!SQL_ISRULE(pColumnRef,column_ref))
- {
- throw SQLException();
- }
- OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
- setOrderbyColumn(pColumnRef,pAscendingDescending);
+ throw SQLException();
}
+ OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
+ setOrderbyColumn(pColumnRef,pAscendingDescending);
}
}
diff --git a/connectivity/source/drivers/firebird/Blob.cxx b/connectivity/source/drivers/firebird/Blob.cxx
index 3468a50ce3f4..8ed9fc4a8ac7 100644
--- a/connectivity/source/drivers/firebird/Blob.cxx
+++ b/connectivity/source/drivers/firebird/Blob.cxx
@@ -153,21 +153,21 @@ void Blob::closeBlob()
{
MutexGuard aGuard(m_aMutex);
- if (m_bBlobOpened)
- {
- ISC_STATUS aErr;
- aErr = isc_close_blob(m_statusVector,
- &m_blobHandle);
- if (aErr)
- evaluateStatusVector(m_statusVector, "isc_close_blob", *this);
+ if (!m_bBlobOpened)
+ return;
- m_bBlobOpened = false;
+ ISC_STATUS aErr;
+ aErr = isc_close_blob(m_statusVector,
+ &m_blobHandle);
+ if (aErr)
+ evaluateStatusVector(m_statusVector, "isc_close_blob", *this);
+
+ m_bBlobOpened = false;
#if SAL_TYPES_SIZEOFPOINTER == 8
- m_blobHandle = 0;
+ m_blobHandle = 0;
#else
- m_blobHandle = nullptr;
+ m_blobHandle = nullptr;
#endif
- }
}
void SAL_CALL Blob::disposing()
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 58aad4e1939e..b5a3c4ce748a 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -791,49 +791,48 @@ void SAL_CALL Connection::documentEventOccured( const DocumentEvent& Event )
if (!m_bIsEmbedded)
return;
- if (Event.EventName == "OnSave" || Event.EventName == "OnSaveAs")
- {
- commit(); // Commit and close transaction
- if ( m_bIsEmbedded && m_xEmbeddedStorage.is() )
- {
- SAL_INFO("connectivity.firebird", "Writing .fbk from running db");
- try
- {
- runBackupService(isc_action_svc_backup);
- }
- catch (const SQLException& e)
- {
- auto a = cppu::getCaughtException();
- throw WrappedTargetRuntimeException(e.Message, e.Context, a);
- }
+ if (!(Event.EventName == "OnSave" || Event.EventName == "OnSaveAs"))
+ return;
+ commit(); // Commit and close transaction
+ if ( !(m_bIsEmbedded && m_xEmbeddedStorage.is()) )
+ return;
+
+ SAL_INFO("connectivity.firebird", "Writing .fbk from running db");
+ try
+ {
+ runBackupService(isc_action_svc_backup);
+ }
+ catch (const SQLException& e)
+ {
+ auto a = cppu::getCaughtException();
+ throw WrappedTargetRuntimeException(e.Message, e.Context, a);
+ }
- Reference< XStream > xDBStream(m_xEmbeddedStorage->openStreamElement(our_sFBKLocation,
- ElementModes::WRITE));
- // TODO: verify the backup actually exists -- the backup service
- // can fail without giving any sane error messages / telling us
- // that it failed.
- using namespace ::comphelper;
- Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
- Reference< XInputStream > xInputStream;
- if (xContext.is())
- {
- xInputStream =
- OStorageHelper::GetInputStreamFromURL(m_sFBKPath, xContext);
- if (xInputStream.is())
- OStorageHelper::CopyInputToOutput( xInputStream,
- xDBStream->getOutputStream());
+ Reference< XStream > xDBStream(m_xEmbeddedStorage->openStreamElement(our_sFBKLocation,
+ ElementModes::WRITE));
- // remove old fdb file if exists
- uno::Reference< ucb::XSimpleFileAccess > xFileAccess =
- ucb::SimpleFileAccess::create(xContext);
- if (xFileAccess->exists(m_sFirebirdURL))
- xFileAccess->kill(m_sFirebirdURL);
- }
- }
+ // TODO: verify the backup actually exists -- the backup service
+ // can fail without giving any sane error messages / telling us
+ // that it failed.
+ using namespace ::comphelper;
+ Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
+ Reference< XInputStream > xInputStream;
+ if (!xContext.is())
+ return;
- }
+ xInputStream =
+ OStorageHelper::GetInputStreamFromURL(m_sFBKPath, xContext);
+ if (xInputStream.is())
+ OStorageHelper::CopyInputToOutput( xInputStream,
+ xDBStream->getOutputStream());
+
+ // remove old fdb file if exists
+ uno::Reference< ucb::XSimpleFileAccess > xFileAccess =
+ ucb::SimpleFileAccess::create(xContext);
+ if (xFileAccess->exists(m_sFirebirdURL))
+ xFileAccess->kill(m_sFirebirdURL);
}
// XEventListener
void SAL_CALL Connection::disposing(const EventObject& /*rSource*/)
diff --git a/connectivity/source/drivers/firebird/Keys.cxx b/connectivity/source/drivers/firebird/Keys.cxx
index 90f3966efad7..dd4cca47fb20 100644
--- a/connectivity/source/drivers/firebird/Keys.cxx
+++ b/connectivity/source/drivers/firebird/Keys.cxx
@@ -34,20 +34,20 @@ Keys::Keys(Table* pTable, Mutex& rMutex, const ::std::vector< OUString>& rNames)
//----- XDrop ----------------------------------------------------------------
void Keys::dropObject(sal_Int32 nPosition, const OUString& sName)
{
- if (!m_pTable->isNew())
- {
- uno::Reference<XPropertySet> xKey(getObject(nPosition), UNO_QUERY);
+ if (m_pTable->isNew())
+ return;
+
+ uno::Reference<XPropertySet> xKey(getObject(nPosition), UNO_QUERY);
- if (xKey.is())
- {
- const OUString sQuote = m_pTable->getConnection()->getMetaData()
- ->getIdentifierQuoteString();
+ if (xKey.is())
+ {
+ const OUString sQuote = m_pTable->getConnection()->getMetaData()
+ ->getIdentifierQuoteString();
- OUString sSql("ALTER TABLE " + quoteName(sQuote, m_pTable->getName())
- + " DROP CONSTRAINT " + quoteName(sQuote, sName));
+ OUString sSql("ALTER TABLE " + quoteName(sQuote, m_pTable->getName())
+ + " DROP CONSTRAINT " + quoteName(sQuote, sName));
- m_pTable->getConnection()->createStatement()->execute(sSql);
- }
+ m_pTable->getConnection()->createStatement()->execute(sSql);
}
}
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index 0220a8458264..e0eba9d7e264 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -70,24 +70,24 @@ Table::Table(Tables* pTables,
void Table::construct()
{
OTableHelper::construct();
- if (!isNew())
- {
- // TODO: get privileges when in non-embedded mode.
- m_nPrivileges = Privilege::DROP |
- Privilege::REFERENCE |
- Privilege::ALTER |
- Privilege::CREATE |
- Privilege::READ |
- Privilege::DELETE |
- Privilege::UPDATE |
- Privilege::INSERT |
- Privilege::SELECT;
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRIVILEGES),
- PROPERTY_ID_PRIVILEGES,
- PropertyAttribute::READONLY,
- &m_nPrivileges,
- cppu::UnoType<decltype(m_nPrivileges)>::get());
- }
+ if (isNew())
+ return;
+
+ // TODO: get privileges when in non-embedded mode.
+ m_nPrivileges = Privilege::DROP |
+ Privilege::REFERENCE |
+ Privilege::ALTER |
+ Privilege::CREATE |
+ Privilege::READ |
+ Privilege::DELETE |
+ Privilege::UPDATE |
+ Privilege::INSERT |
+ Privilege::SELECT;
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRIVILEGES),
+ PROPERTY_ID_PRIVILEGES,
+ PropertyAttribute::READONLY,
+ &m_nPrivileges,
+ cppu::UnoType<decltype(m_nPrivileges)>::get());
}
//----- OTableHelper ---------------------------------------------------------
OCollection* Table::createColumns(const ::std::vector< OUString>& rNames)
diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx
index 7be79b5a2d4a..34907418abf8 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -207,19 +207,19 @@ void Tables::dropObject(sal_Int32 nPosition, const OUString& sName)
{
uno::Reference< XPropertySet > xTable(getObject(nPosition));
- if (!ODescriptor::isNew(xTable))
- {
- OUStringBuffer sSql("DROP ");
+ if (ODescriptor::isNew(xTable))
+ return;
- OUString sType;
- xTable->getPropertyValue("Type") >>= sType;
- sSql.append(sType);
+ OUStringBuffer sSql("DROP ");
- const OUString sQuoteString = m_xMetaData->getIdentifierQuoteString();
- sSql.append(::dbtools::quoteName(sQuoteString,sName));
+ OUString sType;
+ xTable->getPropertyValue("Type") >>= sType;
+ sSql.append(sType);
- m_xMetaData->getConnection()->createStatement()->execute(sSql.makeStringAndClear());
- }
+ const OUString sQuoteString = m_xMetaData->getIdentifierQuoteString();
+ sSql.append(::dbtools::quoteName(sQuoteString,sName));
+
+ m_xMetaData->getConnection()->createStatement()->execute(sSql.makeStringAndClear());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 670fe46dffb0..43bc75225b1d 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -430,19 +430,19 @@ void OFlatTable::construct()
if(!m_pFileStream)
m_pFileStream = createStream_simpleError( aFileName, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYNONE);
- if(m_pFileStream)
- {
- sal_uInt64 const nSize = m_pFileStream->remainingSize();
+ if(!m_pFileStream)
+ return;
- // Buffersize is dependent on the file-size
- m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 :
- nSize > 100000 ? 16384 :
- nSize > 10000 ? 4096 : 1024);
+ sal_uInt64 const nSize = m_pFileStream->remainingSize();
- fillColumns(aAppLocale);
+ // Buffersize is dependent on the file-size
+ m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 :
+ nSize > 100000 ? 16384 :
+ nSize > 10000 ? 4096 : 1024);
- refreshColumns();
- }
+ fillColumns(aAppLocale);
+
+ refreshColumns();
}
OUString OFlatTable::getEntry() const
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 7e006ecb61a2..05b9478a9f12 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -611,41 +611,41 @@ namespace connectivity
Reference< XStorage> xStorage(aEvent.Source,UNO_QUERY);
OUString sKey = StorageContainer::getRegisteredKey(xStorage);
- if ( !sKey.isEmpty() )
- {
- TWeakPairVector::const_iterator i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
- [&sKey] (const TWeakPairVector::value_type& conn) {
- return conn.second.first == sKey;
- });
+ if ( sKey.isEmpty() )
+ return;
+
+ TWeakPairVector::const_iterator i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
+ [&sKey] (const TWeakPairVector::value_type& conn) {
+ return conn.second.first == sKey;
+ });
+
+ OSL_ENSURE( i != m_aConnections.end(), "ODriverDelegator::preCommit: they're committing a storage which I do not know!" );
+ if ( i == m_aConnections.end() )
+ return;
- OSL_ENSURE( i != m_aConnections.end(), "ODriverDelegator::preCommit: they're committing a storage which I do not know!" );
- if ( i != m_aConnections.end() )
+ try
+ {
+ Reference<XConnection> xConnection(i->first,UNO_QUERY);
+ if ( xConnection.is() )
{
- try
- {
- Reference<XConnection> xConnection(i->first,UNO_QUERY);
- if ( xConnection.is() )
- {
- Reference< XStatement> xStmt = xConnection->createStatement();
- OSL_ENSURE( xStmt.is(), "ODriverDelegator::preCommit: no statement!" );
- if ( xStmt.is() )
- xStmt->execute( "SET WRITE_DELAY 0" );
-
- bool bPreviousAutoCommit = xConnection->getAutoCommit();
- xConnection->setAutoCommit( false );
- xConnection->commit();
- xConnection->setAutoCommit( bPreviousAutoCommit );
-
- if ( xStmt.is() )
- xStmt->execute( "SET WRITE_DELAY 60" );
- }
- }
- catch(Exception&)
- {
- TOOLS_WARN_EXCEPTION( "connectivity.hsqldb", "ODriverDelegator::preCommit" );
- }
+ Reference< XStatement> xStmt = xConnection->createStatement();
+ OSL_ENSURE( xStmt.is(), "ODriverDelegator::preCommit: no statement!" );
+ if ( xStmt.is() )
+ xStmt->execute( "SET WRITE_DELAY 0" );
+
+ bool bPreviousAutoCommit = xConnection->getAutoCommit();
+ xConnection->setAutoCommit( false );
+ xConnection->commit();
+ xConnection->setAutoCommit( bPreviousAutoCommit );
+
+ if ( xStmt.is() )
+ xStmt->execute( "SET WRITE_DELAY 60" );
}
}
+ catch(Exception&)
+ {
+ TOOLS_WARN_EXCEPTION( "connectivity.hsqldb", "ODriverDelegator::preCommit" );
+ }
}
void SAL_CALL ODriverDelegator::commited( const css::lang::EventObject& /*aEvent*/ )
diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
index f5d4110a36f0..5ea16e7e1c60 100644
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
@@ -343,53 +343,53 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nativ
Reference< XSeekable> xSeek = pHelper.get() ? pHelper->getSeek() : Reference< XSeekable>();
OSL_ENSURE(xSeek.is(),"No Seekable stream!");
- if ( xSeek.is() )
+ if ( !xSeek.is() )
+ return;
+
+#ifdef HSQLDB_DBG
+ DataLogFile aDataLog( env, name, "data" );
+#endif
+
+ ::sal_Int64 nLen = xSeek->getLength();
+ if ( nLen < position)
{
+ static const ::sal_Int64 BUFFER_SIZE = 9192;
#ifdef HSQLDB_DBG
- DataLogFile aDataLog( env, name, "data" );
+ aDataLog.seek( nLen );
#endif
+ xSeek->seek(nLen);
+ Reference< XOutputStream> xOut = pHelper->getOutputStream();
+ OSL_ENSURE(xOut.is(),"No output stream!");
- ::sal_Int64 nLen = xSeek->getLength();
- if ( nLen < position)
+ ::sal_Int64 diff = position - nLen;
+ sal_Int32 n;
+ while( diff != 0 )
{
- static const ::sal_Int64 BUFFER_SIZE = 9192;
- #ifdef HSQLDB_DBG
- aDataLog.seek( nLen );
- #endif
- xSeek->seek(nLen);
- Reference< XOutputStream> xOut = pHelper->getOutputStream();
- OSL_ENSURE(xOut.is(),"No output stream!");
-
- ::sal_Int64 diff = position - nLen;
- sal_Int32 n;
- while( diff != 0 )
+ if ( BUFFER_SIZE < diff )
{
- if ( BUFFER_SIZE < diff )
- {
- n = static_cast<sal_Int32>(BUFFER_SIZE);
- diff = diff - BUFFER_SIZE;
- }
- else
- {
- n = static_cast<sal_Int32>(diff);
- diff = 0;
- }
- Sequence< ::sal_Int8 > aData(n);
- memset(aData.getArray(),0,n);
- xOut->writeBytes(aData);
- #ifdef HSQLDB_DBG
- aDataLog.write( aData.getConstArray(), n );
- #endif
+ n = static_cast<sal_Int32>(BUFFER_SIZE);
+ diff = diff - BUFFER_SIZE;
}
+ else
+ {
+ n = static_cast<sal_Int32>(diff);
+ diff = 0;
+ }
+ Sequence< ::sal_Int8 > aData(n);
+ memset(aData.getArray(),0,n);
+ xOut->writeBytes(aData);
+ #ifdef HSQLDB_DBG
+ aDataLog.write( aData.getConstArray(), n );
+ #endif
}
- xSeek->seek(position);
- OSL_ENSURE(xSeek->getPosition() == position,"Wrong position after seeking the stream");
-
- #ifdef HSQLDB_DBG
- aDataLog.seek( position );
- OSL_ENSURE( xSeek->getPosition() == aDataLog.tell(), "Wrong position after seeking the stream" );
- #endif
}
+ xSeek->seek(position);
+ OSL_ENSURE(xSeek->getPosition() == position,"Wrong position after seeking the stream");
+
+#ifdef HSQLDB_DBG
+ aDataLog.seek( position );
+ OSL_ENSURE( xSeek->getPosition() == aDataLog.tell(), "Wrong position after seeking the stream" );
+#endif
}
diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
index 598ef060bc4c..d10ee29a69f6 100644
--- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
@@ -233,25 +233,25 @@ namespace connectivity::hsqldb
{
TStorages& rMap = lcl_getStorageMap();
TStorages::iterator aFind = rMap.find(_sKey);
- if ( aFind != rMap.end() )
+ if ( aFind == rMap.end() )
+ return;
+
+ try
{
- try
+ if ( _xListener.is() )
{
- if ( _xListener.is() )
- {
- Reference<XTransactionBroadcaster> xBroad(aFind->second.mapStorage(),UNO_QUERY);
- if ( xBroad.is() )
- xBroad->removeTransactionListener(_xListener);
- Reference<XTransactedObject> xTrans(aFind->second.mapStorage(),UNO_QUERY);
- if ( xTrans.is() )
- xTrans->commit();
- }
+ Reference<XTransactionBroadcaster> xBroad(aFind->second.mapStorage(),UNO_QUERY);
+ if ( xBroad.is() )
+ xBroad->removeTransactionListener(_xListener);
+ Reference<XTransactedObject> xTrans(aFind->second.mapStorage(),UNO_QUERY);
+ if ( xTrans.is() )
+ xTrans->commit();
}
- catch(const Exception&)
- {
- }
- rMap.erase(aFind);
}
+ catch(const Exception&)
+ {
+ }
+ rMap.erase(aFind);
}
TStreamMap::mapped_type StorageContainer::registerStream(JNIEnv * env,jstring name, jstring key,sal_Int32 _nMode)
diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx
index b98d57c774ab..787af894b992 100644
--- a/connectivity/source/drivers/hsqldb/HTables.cxx
+++ b/connectivity/source/drivers/hsqldb/HTables.cxx
@@ -110,39 +110,39 @@ void OTables::dropObject(sal_Int32 _nPos,const OUString& _sElementName)
{
Reference< XInterface > xObject( getObject( _nPos ) );
bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- Reference< XConnection > xConnection = static_cast<OHCatalog&>(m_rParent).getConnection();
+ if (bIsNew)
+ return;
+ Reference< XConnection > xConnection = static_cast<OHCatalog&>(m_rParent).getConnection();
- OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
- OUString aSql( "DROP " );
+ OUString sCatalog,sSchema,sTable;
+ ::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
- Reference<XPropertySet> xProp(xObject,UNO_QUERY);
- bool bIsView;
- if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == "VIEW"))) // here we have a view
- aSql += "VIEW ";
- else
- aSql += "TABLE ";
+ OUString aSql( "DROP " );
- OUString sComposedName(
- ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InDataManipulation ) );
- aSql += sComposedName;
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
- // if no exception was thrown we must delete it from the views
- if ( bIsView )
- {
- HViews* pViews = static_cast<HViews*>(static_cast<OHCatalog&>(m_rParent).getPrivateViews());
- if ( pViews && pViews->hasByName(_sElementName) )
- pViews->dropByNameImpl(_sElementName);
- }
+ Reference<XPropertySet> xProp(xObject,UNO_QUERY);
+ bool bIsView;
+ if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == "VIEW"))) // here we have a view
+ aSql += "VIEW ";
+ else
+ aSql += "TABLE ";
+
+ OUString sComposedName(
+ ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InDataManipulation ) );
+ aSql += sComposedName;
+ Reference< XStatement > xStmt = xConnection->createStatement( );
+ if ( xStmt.is() )
+ {
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
+ }
+ // if no exception was thrown we must delete it from the views
+ if ( bIsView )
+ {
+ HViews* pViews = static_cast<HViews*>(static_cast<OHCatalog&>(m_rParent).getPrivateViews());
+ if ( pViews && pViews->hasByName(_sElementName) )
+ pViews->dropByNameImpl(_sElementName);
}
}
diff --git a/connectivity/source/drivers/hsqldb/HUser.cxx b/connectivity/source/drivers/hsqldb/HUser.cxx
index 0c413d117b0b..2ed0c06262ff 100644
--- a/connectivity/source/drivers/hsqldb/HUser.cxx
+++ b/connectivity/source/drivers/hsqldb/HUser.cxx
@@ -118,79 +118,79 @@ void OHSQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_In
break;
}
- if ( xRes.is() )
- {
- static const char sYes [] = "YES";
+ if ( !xRes.is() )
+ return;
- nRightsWithGrant = nRights = 0;
+ static const char sYes [] = "YES";
- Reference<XRow> xCurrentRow(xRes,UNO_QUERY);
- while( xCurrentRow.is() && xRes->next() )
- {
- OUString sGrantee = xCurrentRow->getString(5);
- OUString sPrivilege = xCurrentRow->getString(6);
- OUString sGrantable = xCurrentRow->getString(7);
+ nRightsWithGrant = nRights = 0;
- if (!m_Name.equalsIgnoreAsciiCase(sGrantee))
- continue;
+ Reference<XRow> xCurrentRow(xRes,UNO_QUERY);
+ while( xCurrentRow.is() && xRes->next() )
+ {
+ OUString sGrantee = xCurrentRow->getString(5);
+ OUString sPrivilege = xCurrentRow->getString(6);
+ OUString sGrantable = xCurrentRow->getString(7);
- if (sPrivilege.equalsIgnoreAsciiCase("SELECT"))
- {
- nRights |= Privilege::SELECT;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::SELECT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("INSERT"))
- {
- nRights |= Privilege::INSERT;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::INSERT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE"))
- {
- nRights |= Privilege::UPDATE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::UPDATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("DELETE"))
- {
- nRights |= Privilege::DELETE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::DELETE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("READ"))
- {
- nRights |= Privilege::READ;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::READ;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("CREATE"))
- {
- nRights |= Privilege::CREATE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::CREATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("ALTER"))
- {
- nRights |= Privilege::ALTER;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::ALTER;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCE"))
- {
- nRights |= Privilege::REFERENCE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::REFERENCE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("DROP"))
- {
- nRights |= Privilege::DROP;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::DROP;
- }
+ if (!m_Name.equalsIgnoreAsciiCase(sGrantee))
+ continue;
+
+ if (sPrivilege.equalsIgnoreAsciiCase("SELECT"))
+ {
+ nRights |= Privilege::SELECT;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::SELECT;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("INSERT"))
+ {
+ nRights |= Privilege::INSERT;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::INSERT;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE"))
+ {
+ nRights |= Privilege::UPDATE;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::UPDATE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("DELETE"))
+ {
+ nRights |= Privilege::DELETE;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::DELETE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("READ"))
+ {
+ nRights |= Privilege::READ;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::READ;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("CREATE"))
+ {
+ nRights |= Privilege::CREATE;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::CREATE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("ALTER"))
+ {
+ nRights |= Privilege::ALTER;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::ALTER;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCE"))
+ {
+ nRights |= Privilege::REFERENCE;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::REFERENCE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("DROP"))
+ {
+ nRights |= Privilege::DROP;
+ if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
+ nRightsWithGrant |= Privilege::DROP;
}
- ::comphelper::disposeComponent(xRes);
}
+ ::comphelper::disposeComponent(xRes);
}
sal_Int32 SAL_CALL OHSQLUser::getGrantablePrivileges( const OUString& objName, sal_Int32 objType )
diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
index b8b698f50254..3e8461a95f8f 100644
--- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
@@ -101,22 +101,22 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
#endif
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
auto storage = aStoragePair.mapStorage();
- if ( storage.is() )
+ if ( !storage.is() )
+ return;
+
+ try
{
- try
- {
- storage->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.url));
- }
- catch(const NoSuchElementException&)
- {
- if (env->ExceptionCheck())
- env->ExceptionClear();
- }
- catch(const Exception& e)
- {
- TOOLS_WARN_EXCEPTION("connectivity.hsqldb", "");
- StorageContainer::throwJavaException(e,env);
- }
+ storage->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.url));
+ }
+ catch(const NoSuchElementException&)
+ {
+ if (env->ExceptionCheck())
+ env->ExceptionClear();
+ }
+ catch(const Exception& e)
+ {
+ TOOLS_WARN_EXCEPTION("connectivity.hsqldb", "");
+ StorageContainer::throwJavaException(e,env);
}
}
@@ -138,29 +138,29 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
#endif
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
auto storage = aStoragePair.mapStorage();
- if ( storage.is() )
+ if ( !storage.is() )
+ return;
+
+ try
{
- try
- {
- storage->renameElement(
- StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,oldname),aStoragePair.url),
- StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.url)
- );
+ storage->renameElement(
+ StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,oldname),aStoragePair.url),
+ StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.url)
+ );
#ifdef HSQLDB_DBG
- {
- OUString sNewName = StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.first.second);
- OSL_ENSURE(aStoragePair.first.first->isStreamElement(sNewName),"Stream could not be renamed");
- }
-#endif
- }
- catch(const NoSuchElementException&)
- {
- }
- catch(const Exception& e)
{
- OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement");
- StorageContainer::throwJavaException(e,env);
+ OUString sNewName = StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.first.second);
+ OSL_ENSURE(aStoragePair.first.first->isStreamElement(sNewName),"Stream could not be renamed");
}
+#endif
+ }
+ catch(const NoSuchElementException&)
+ {
+ }
+ catch(const Exception& e)
+ {
+ OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement");
+ StorageContainer::throwJavaException(e,env);
}
}
diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx
index 720b9c9a8ff1..0994c827e29a 100644
--- a/connectivity/source/drivers/jdbc/CallableStatement.cxx
+++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx
@@ -317,37 +317,37 @@ void java_sql_CallableStatement::createStatement(JNIEnv* /*_pEnv*/)
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
- if( t.pEnv && !object ){
- // initialize temporary variable
- static const char * const cMethodName = "prepareCall";
- // execute Java-Call
- jobject out = nullptr;
- // convert Parameter
- jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,m_sSqlStatement));
-
- static jmethodID mID = [&]()
- {
- static const char * const cSignature = "(Ljava/lang/String;II)Ljava/sql/CallableStatement;";
- return t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
- }();
- if( mID ){
- out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID, str.get() ,m_nResultSetType,m_nResultSetConcurrency);
+ if( !(t.pEnv && !object) )
+ return;
+
+ // initialize temporary variable
+ static const char * const cMethodName = "prepareCall";
+ // execute Java-Call
+ jobject out = nullptr;
+ // convert Parameter
+ jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,m_sSqlStatement));
+
+ static jmethodID mID = [&]()
+ {
+ static const char * const cSignature = "(Ljava/lang/String;II)Ljava/sql/CallableStatement;";
+ return t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
+ }();
+ if( mID ){
+ out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID, str.get() ,m_nResultSetType,m_nResultSetConcurrency);
+ } //mID
+ else
+ {
+ static const char * const cSignature2 = "(Ljava/lang/String;)Ljava/sql/CallableStatement;";
+ static jmethodID mID2 = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
+ if( mID2 ){
+ out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, str.get() );
} //mID
- else
- {
- static const char * const cSignature2 = "(Ljava/lang/String;)Ljava/sql/CallableStatement;";
- static jmethodID mID2 = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
- if( mID2 ){
- out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, str.get() );
- } //mID
- }
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
+ }
+ ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- if ( out )
- object = t.pEnv->NewGlobalRef( out );
- } //t.pEnv
+ if ( out )
+ object = t.pEnv->NewGlobalRef( out );
}
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index 6def8948abee..1d33f2941316 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -261,21 +261,21 @@ java_sql_Connection::java_sql_Connection( const java_sql_Driver& _rDriver )
java_sql_Connection::~java_sql_Connection()
{
::rtl::Reference< jvmaccess::VirtualMachine > xTest = java_lang_Object::getVM();
- if ( xTest.is() )
- {
- SDBThreadAttach t;
- clearObject(*t.pEnv);
+ if ( !xTest.is() )
+ return;
- {
- if ( m_pDriverobject )
- t.pEnv->DeleteGlobalRef( m_pDriverobject );
- m_pDriverobject = nullptr;
- if ( m_Driver_theClass )
- t.pEnv->DeleteGlobalRef( m_Driver_theClass );
- m_Driver_theClass = nullptr;
- }
- SDBThreadAttach::releaseRef();
+ SDBThreadAttach t;
+ clearObject(*t.pEnv);
+
+ {
+ if ( m_pDriverobject )
+ t.pEnv->DeleteGlobalRef( m_pDriverobject );
+ m_pDriverobject = nullptr;
+ if ( m_Driver_theClass )
+ t.pEnv->DeleteGlobalRef( m_Driver_theClass );
+ m_Driver_theClass = nullptr;
}
+ SDBThreadAttach::releaseRef();
}
void java_sql_Connection::disposing()
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx
index 32ffe22a4897..9bfe11838b7f 100644
--- a/connectivity/source/drivers/jdbc/JStatement.cxx
+++ b/connectivity/source/drivers/jdbc/JStatement.cxx
@@ -761,33 +761,34 @@ void java_sql_Statement::createStatement(JNIEnv* _pEnv)
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- if( _pEnv && !object ){
- // initialize temporary variable
- static const char * const cMethodName = "createStatement";
- // Java-Call
- jobject out = nullptr;
- static jmethodID mID(nullptr);
- if ( !mID )
- {
- static const char * const cSignature = "(II)Ljava/sql/Statement;";
- mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
- }
- if( mID ){
- out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID,m_nResultSetType,m_nResultSetConcurrency );
+ if( !(_pEnv && !object) )
+ return;
+
+ // initialize temporary variable
+ static const char * const cMethodName = "createStatement";
+ // Java-Call
+ jobject out = nullptr;
+ static jmethodID mID(nullptr);
+ if ( !mID )
+ {
+ static const char * const cSignature = "(II)Ljava/sql/Statement;";
+ mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
+ }
+ if( mID ){
+ out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID,m_nResultSetType,m_nResultSetConcurrency );
+ } //mID
+ else
+ {
+ static const char * const cSignature2 = "()Ljava/sql/Statement;";
+ static jmethodID mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
+ if( mID2 ){
+ out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2);
} //mID
- else
- {
- static const char * const cSignature2 = "()Ljava/sql/Statement;";
- static jmethodID mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
- if( mID2 ){
- out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2);
- } //mID
- }
- ThrowLoggedSQLException( m_aLogger, _pEnv, *this );
+ }
+ ThrowLoggedSQLException( m_aLogger, _pEnv, *this );
- if ( out )
- object = _pEnv->NewGlobalRef( out );
- } //_pEnv
+ if ( out )
+ object = _pEnv->NewGlobalRef( out );
}
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index a01df751c4a0..34c28f084677 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -655,41 +655,42 @@ void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv)
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- if( !object && _pEnv ){
- // initialize temporary variable
- static const char * const cMethodName = "prepareStatement";
+ if( !(!object && _pEnv) )
+ return;
- jvalue args[1];
- // convert Parameter
- args[0].l = convertwchar_tToJavaString(_pEnv,m_sSqlStatement);
- // Java-Call
- jobject out = nullptr;
- static jmethodID mID(nullptr);
- if ( !mID )
- {
- static const char * const cSignature = "(Ljava/lang/String;II)Ljava/sql/PreparedStatement;";
- mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
- }
- if( mID )
- {
- out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID, args[0].l ,m_nResultSetType,m_nResultSetConcurrency);
- }
- else
+ // initialize temporary variable
+ static const char * const cMethodName = "prepareStatement";
+
+ jvalue args[1];
+ // convert Parameter
+ args[0].l = convertwchar_tToJavaString(_pEnv,m_sSqlStatement);
+ // Java-Call
+ jobject out = nullptr;
+ static jmethodID mID(nullptr);
+ if ( !mID )
+ {
+ static const char * const cSignature = "(Ljava/lang/String;II)Ljava/sql/PreparedStatement;";
+ mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
+ }
+ if( mID )
+ {
+ out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID, args[0].l ,m_nResultSetType,m_nResultSetConcurrency);
+ }
+ else
+ {
+ static jmethodID mID2 = nullptr;
+ if ( !mID2 )
{
- static jmethodID mID2 = nullptr;
- if ( !mID2 )
- {
- static const char * const cSignature2 = "(Ljava/lang/String;)Ljava/sql/PreparedStatement;";
- mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );
- }
- if ( mID2 )
- out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, args[0].l );
+ static const char * const cSignature2 = "(Ljava/lang/String;)Ljava/sql/PreparedStatement;";
+ mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );
}
- _pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l));
- ThrowLoggedSQLException( m_aLogger, _pEnv, *this );
- if ( out )
- object = _pEnv->NewGlobalRef( out );
- } //t.pEnv
+ if ( mID2 )
+ out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, args[0].l );
+ }
+ _pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l));
+ ThrowLoggedSQLException( m_aLogger, _pEnv, *this );
+ if ( out )
+ object = _pEnv->NewGlobalRef( out );
}
diff --git a/connectivity/source/drivers/mork/MPreparedStatement.cxx b/connectivity/source/drivers/mork/MPreparedStatement.cxx
index d61a0ec96a51..f2cd8fdc752e 100644
--- a/connectivity/source/drivers/mork/MPreparedStatement.cxx
+++ b/connectivity/source/drivers/mork/MPreparedStatement.cxx
@@ -431,17 +431,17 @@ void OPreparedStatement::describeParameter()
{
std::vector< OSQLParseNode*> aParseNodes;
scanParameter(m_pParseTree.get(), aParseNodes);
- if(!aParseNodes.empty())
+ if(aParseNodes.empty())
+ return;
+
+ m_xParamColumns = new OSQLColumns();
+ const OSQLTables& rTabs = m_pSQLIterator->getTables();
+ if(!rTabs.empty())
{
- m_xParamColumns = new OSQLColumns();
- const OSQLTables& rTabs = m_pSQLIterator->getTables();
- if(!rTabs.empty())
+ OSQLTable xTable = rTabs.begin()->second;
+ for (auto const& parseNode : aParseNodes)
{
- OSQLTable xTable = rTabs.begin()->second;
- for (auto const& parseNode : aParseNodes)
- {
- describeColumn(parseNode,parseNode->getParent()->getChild(0),xTable);
- }
+ describeColumn(parseNode,parseNode->getParent()->getChild(0),xTable);
}
}
}
diff --git a/connectivity/source/drivers/mork/MStatement.cxx b/connectivity/source/drivers/mork/MStatement.cxx
index fc97ab20b15d..bd153afa6438 100644
--- a/connectivity/source/drivers/mork/MStatement.cxx
+++ b/connectivity/source/drivers/mork/MStatement.cxx
@@ -420,25 +420,25 @@ void OCommonStatement::createColumnMapping()
void OCommonStatement::analyseSQL()
{
const OSQLParseNode* pOrderbyClause = m_pSQLIterator->getOrderTree();
- if(pOrderbyClause)
+ if(!pOrderbyClause)
+ return;
+
+ OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
+ OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Error in Parse Tree");
+
+ for (size_t m = 0; m < pOrderingSpecCommalist->count(); m++)
{
- OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Error in Parse Tree");
+ OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
+ OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Error in Parse Tree");
+ OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Error in Parse Tree");
- for (size_t m = 0; m < pOrderingSpecCommalist->count(); m++)
+ OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
+ if(!SQL_ISRULE(pColumnRef,column_ref))
{
- OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Error in Parse Tree");
- OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Error in Parse Tree");
-
- OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
- if(!SQL_ISRULE(pColumnRef,column_ref))
- {
- throw SQLException();
- }
- OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
- setOrderbyColumn(pColumnRef,pAscendingDescending);
+ throw SQLException();
}
+ OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
+ setOrderbyColumn(pColumnRef,pAscendingDescending);
}
}
diff --git a/connectivity/source/drivers/mysql_jdbc/YTables.cxx b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
index 83b60fff5f15..e21e05fb2914 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTables.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
@@ -104,44 +104,43 @@ void OTables::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
{
Reference<XInterface> xObject(getObject(_nPos));
bool bIsNew = connectivity::sdbcx::ODescriptor::isNew(xObject);
- if (!bIsNew)
+ if (bIsNew)
+ return;
+
+ Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
+
+ OUString sCatalog, sSchema, sTable;
+ ::dbtools::qualifiedNameComponents(m_xMetaData, _sElementName, sCatalog, sSchema, sTable,
+ ::dbtools::EComposeRule::InDataManipulation);
+
+ OUString aSql("DROP ");
+
+ Reference<XPropertySet> xProp(xObject, UNO_QUERY);
+ bool bIsView = xProp.is()
+ && ::comphelper::getString(xProp->getPropertyValue(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
+ == "VIEW";
+ if (bIsView) // here we have a view
+ aSql += "VIEW ";
+ else
+ aSql += "TABLE ";
+
+ OUString sComposedName(::dbtools::composeTableName(
+ m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InDataManipulation));
+ aSql += sComposedName;
+ Reference<XStatement> xStmt = xConnection->createStatement();
+ if (xStmt.is())
{
- Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
-
- OUString sCatalog, sSchema, sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData, _sElementName, sCatalog, sSchema, sTable,
- ::dbtools::EComposeRule::InDataManipulation);
-
- OUString aSql("DROP ");
-
- Reference<XPropertySet> xProp(xObject, UNO_QUERY);
- bool bIsView = xProp.is()
- && ::comphelper::getString(xProp->getPropertyValue(
- OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
- == "VIEW";
- if (bIsView) // here we have a view
- aSql += "VIEW ";
- else
- aSql += "TABLE ";
-
- OUString sComposedName(
- ::dbtools::composeTableName(m_xMetaData, sCatalog, sSchema, sTable, true,
- ::dbtools::EComposeRule::InDataManipulation));
- aSql += sComposedName;
- Reference<XStatement> xStmt = xConnection->createStatement();
- if (xStmt.is())
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
- // if no exception was thrown we must delete it from the views
- if (bIsView)
- {
- OViews* pViews
- = static_cast<OViews*>(static_cast<OMySQLCatalog&>(m_rParent).getPrivateViews());
- if (pViews && pViews->hasByName(_sElementName))
- pViews->dropByNameImpl(_sElementName);
- }
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
+ }
+ // if no exception was thrown we must delete it from the views
+ if (bIsView)
+ {
+ OViews* pViews
+ = static_cast<OViews*>(static_cast<OMySQLCatalog&>(m_rParent).getPrivateViews());
+ if (pViews && pViews->hasByName(_sElementName))
+ pViews->dropByNameImpl(_sElementName);
}
}
diff --git a/connectivity/source/drivers/mysql_jdbc/YUser.cxx b/connectivity/source/drivers/mysql_jdbc/YUser.cxx
index c5031f3c0205..b683fe2b2757 100644
--- a/connectivity/source/drivers/mysql_jdbc/YUser.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YUser.cxx
@@ -121,79 +121,79 @@ void OMySQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_I
break;
}
- if (xRes.is())
+ if (!xRes.is())
+ return;
+
+ static const char sYes[] = "YES";
+
+ nRightsWithGrant = nRights = 0;
+
+ Reference<XRow> xCurrentRow(xRes, UNO_QUERY);
+ while (xCurrentRow.is() && xRes->next())
{
- static const char sYes[] = "YES";
+ OUString sGrantee = xCurrentRow->getString(5);
+ OUString sPrivilege = xCurrentRow->getString(6);
+ OUString sGrantable = xCurrentRow->getString(7);
- nRightsWithGrant = nRights = 0;
+ if (!m_Name.equalsIgnoreAsciiCase(sGrantee))
+ continue;
- Reference<XRow> xCurrentRow(xRes, UNO_QUERY);
- while (xCurrentRow.is() && xRes->next())
+ if (sPrivilege.equalsIgnoreAsciiCase("SELECT"))
+ {
+ nRights |= Privilege::SELECT;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::SELECT;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("INSERT"))
+ {
+ nRights |= Privilege::INSERT;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::INSERT;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE"))
+ {
+ nRights |= Privilege::UPDATE;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::UPDATE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("DELETE"))
+ {
+ nRights |= Privilege::DELETE;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::DELETE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("READ"))
+ {
+ nRights |= Privilege::READ;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::READ;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("CREATE"))
+ {
+ nRights |= Privilege::CREATE;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::CREATE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("ALTER"))
+ {
+ nRights |= Privilege::ALTER;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::ALTER;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCES"))
{
- OUString sGrantee = xCurrentRow->getString(5);
- OUString sPrivilege = xCurrentRow->getString(6);
- OUString sGrantable = xCurrentRow->getString(7);
-
- if (!m_Name.equalsIgnoreAsciiCase(sGrantee))
- continue;
-
- if (sPrivilege.equalsIgnoreAsciiCase("SELECT"))
- {
- nRights |= Privilege::SELECT;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::SELECT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("INSERT"))
- {
- nRights |= Privilege::INSERT;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::INSERT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE"))
- {
- nRights |= Privilege::UPDATE;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::UPDATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("DELETE"))
- {
- nRights |= Privilege::DELETE;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::DELETE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("READ"))
- {
- nRights |= Privilege::READ;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::READ;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("CREATE"))
- {
- nRights |= Privilege::CREATE;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::CREATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("ALTER"))
- {
- nRights |= Privilege::ALTER;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::ALTER;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCES"))
- {
- nRights |= Privilege::REFERENCE;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::REFERENCE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("DROP"))
- {
- nRights |= Privilege::DROP;
- if (sGrantable.equalsIgnoreAsciiCase(sYes))
- nRightsWithGrant |= Privilege::DROP;
- }
+ nRights |= Privilege::REFERENCE;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::REFERENCE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("DROP"))
+ {
+ nRights |= Privilege::DROP;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::DROP;
}
- ::comphelper::disposeComponent(xRes);
}
+ ::comphelper::disposeComponent(xRes);
}
sal_Int32 SAL_CALL OMySQLUser::getGrantablePrivileges(const OUString& objName, sal_Int32 objType)
@@ -219,19 +219,19 @@ void SAL_CALL OMySQLUser::grantPrivileges(const OUString& objName, sal_Int32 obj
::osl::MutexGuard aGuard(m_aMutex);
OUString sPrivs = getPrivilegeString(objPrivileges);
- if (!sPrivs.isEmpty())
- {
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- OUString sGrant = "GRANT " + sPrivs + " ON "
- + ::dbtools::quoteTableName(xMeta, objName,
- ::dbtools::EComposeRule::InDataManipulation)
- + " TO " + m_Name;
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if (xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
+ if (sPrivs.isEmpty())
+ return;
+
+ Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+ OUString sGrant
+ = "GRANT " + sPrivs + " ON "
+ + ::dbtools::quoteTableName(xMeta, objName, ::dbtools::EComposeRule::InDataManipulation)
+ + " TO " + m_Name;
+
+ Reference<XStatement> xStmt = m_xConnection->createStatement();
+ if (xStmt.is())
+ xStmt->execute(sGrant);
+ ::comphelper::disposeComponent(xStmt);
}
void SAL_CALL OMySQLUser::revokePrivileges(const OUString& objName, sal_Int32 objType,
@@ -247,19 +247,19 @@ void SAL_CALL OMySQLUser::revokePrivileges(const OUString& objName, sal_Int32 ob
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
OUString sPrivs = getPrivilegeString(objPrivileges);
- if (!sPrivs.isEmpty())
- {
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- OUString sGrant = "REVOKE " + sPrivs + " ON "
- + ::dbtools::quoteTableName(xMeta, objName,
- ::dbtools::EComposeRule::InDataManipulation)
- + " FROM " + m_Name;
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if (xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
+ if (sPrivs.isEmpty())
+ return;
+
+ Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+ OUString sGrant
+ = "REVOKE " + sPrivs + " ON "
+ + ::dbtools::quoteTableName(xMeta, objName, ::dbtools::EComposeRule::InDataManipulation)
+ + " FROM " + m_Name;
+
+ Reference<XStatement> xStmt = m_xConnection->createStatement();
+ if (xStmt.is())
+ xStmt->execute(sGrant);
+ ::comphelper::disposeComponent(xStmt);
}
// XUser
diff --git a/connectivity/source/drivers/mysql_jdbc/YViews.cxx b/connectivity/source/drivers/mysql_jdbc/YViews.cxx
index 4393ba0a566b..4bdeca9596b3 100644
--- a/connectivity/source/drivers/mysql_jdbc/YViews.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YViews.cxx
@@ -80,19 +80,19 @@ void OViews::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
Reference<XInterface> xObject(getObject(_nPos));
bool bIsNew = connectivity::sdbcx::ODescriptor::isNew(xObject);
- if (!bIsNew)
- {
- OUString aSql("DROP VIEW");
+ if (bIsNew)
+ return;
- Reference<XPropertySet> xProp(xObject, UNO_QUERY);
- aSql += ::dbtools::composeTableName(m_xMetaData, xProp,
- ::dbtools::EComposeRule::InTableDefinitions, true);
+ OUString aSql("DROP VIEW");
- Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- Reference<XStatement> xStmt = xConnection->createStatement();
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
+ Reference<XPropertySet> xProp(xObject, UNO_QUERY);
+ aSql += ::dbtools::composeTableName(m_xMetaData, xProp,
+ ::dbtools::EComposeRule::InTableDefinitions, true);
+
+ Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
+ Reference<XStatement> xStmt = xConnection->createStatement();
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
}
void OViews::dropByNameImpl(const OUString& elementName)
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index e17032152433..61e5caecfa77 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -1745,48 +1745,48 @@ bool OResultSet::moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32
void OResultSet::fillNeededData(SQLRETURN _nRet)
{
SQLRETURN nRet = _nRet;
- if( nRet == SQL_NEED_DATA)
+ if( nRet != SQL_NEED_DATA)
+ return;
+
+ void* pColumnIndex = nullptr;
+ nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
+
+ do
{
- void* pColumnIndex = nullptr;
- nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
+ if (nRet != SQL_SUCCESS && nRet != SQL_SUCCESS_WITH_INFO && nRet != SQL_NEED_DATA)
+ break;
- do
+ sal_IntPtr nColumnIndex ( reinterpret_cast<sal_IntPtr>(pColumnIndex));
+ Sequence< sal_Int8 > aSeq;
+ switch(m_aRow[nColumnIndex].getTypeKind())
{
- if (nRet != SQL_SUCCESS && nRet != SQL_SUCCESS_WITH_INFO && nRet != SQL_NEED_DATA)
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ aSeq = m_aRow[nColumnIndex];
+ N3SQLPutData (m_aStatementHandle, aSeq.getArray(), aSeq.getLength());
break;
-
- sal_IntPtr nColumnIndex ( reinterpret_cast<sal_IntPtr>(pColumnIndex));
- Sequence< sal_Int8 > aSeq;
- switch(m_aRow[nColumnIndex].getTypeKind())
+ case SQL_WLONGVARCHAR:
{
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- aSeq = m_aRow[nColumnIndex];
- N3SQLPutData (m_aStatementHandle, aSeq.getArray(), aSeq.getLength());
- break;
- case SQL_WLONGVARCHAR:
- {
- OUString const & sRet = m_aRow[nColumnIndex].getString();
- N3SQLPutData (m_aStatementHandle, static_cast<SQLPOINTER>(const_cast<sal_Unicode *>(sRet.getStr())), sizeof(sal_Unicode)*sRet.getLength());
- break;
- }
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- {
- OUString sRet = m_aRow[nColumnIndex].getString();
- OString aString(OUStringToOString(sRet,m_nTextEncoding));
- N3SQLPutData (m_aStatementHandle, static_cast<SQLPOINTER>(const_cast<char *>(aString.getStr())), aString.getLength());
- break;
- }
- default:
- SAL_WARN( "connectivity.odbc", "Not supported at the moment!");
+ OUString const & sRet = m_aRow[nColumnIndex].getString();
+ N3SQLPutData (m_aStatementHandle, static_cast<SQLPOINTER>(const_cast<sal_Unicode *>(sRet.getStr())), sizeof(sal_Unicode)*sRet.getLength());
+ break;
}
- nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
+ case DataType::LONGVARCHAR:
+ case DataType::CLOB:
+ {
+ OUString sRet = m_aRow[nColumnIndex].getString();
+ OString aString(OUStringToOString(sRet,m_nTextEncoding));
+ N3SQLPutData (m_aStatementHandle, static_cast<SQLPOINTER>(const_cast<char *>(aString.getStr())), aString.getLength());
+ break;
+ }
+ default:
+ SAL_WARN( "connectivity.odbc", "Not supported at the moment!");
}
- while (nRet == SQL_NEED_DATA);
+ nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
}
+ while (nRet == SQL_NEED_DATA);
}
SWORD OResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex)
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index 63255f562dc3..0452324a16cb 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -153,69 +153,68 @@ ResultSetMetaData::ResultSetMetaData(
void ResultSetMetaData::checkForTypes()
{
- if( ! m_checkedForTypes )
+ if( m_checkedForTypes )
+ return;
+
+ Reference< XStatement > stmt =
+ extractConnectionFromStatement( m_origin->getStatement() )->createStatement();
+ DisposeGuard guard( stmt );
+ OUStringBuffer buf(128);
+ buf.append( "SELECT oid, typname, typtype FROM pg_type WHERE ");
+ for( int i = 0 ; i < m_colCount ; i ++ )
{
- Reference< XStatement > stmt =
- extractConnectionFromStatement( m_origin->getStatement() )->createStatement();
- DisposeGuard guard( stmt );
- OUStringBuffer buf(128);
- buf.append( "SELECT oid, typname, typtype FROM pg_type WHERE ");
- for( int i = 0 ; i < m_colCount ; i ++ )
- {
- if( i > 0 )
- buf.append( " OR " );
- int oid = m_colDesc[i].typeOid;
- buf.append( "oid=" );
- buf.append( static_cast<sal_Int32>(oid) );
- }
- Reference< XResultSet > rs = stmt->executeQuery( buf.makeStringAndClear() );
- Reference< XRow > xRow( rs, UNO_QUERY );
- while( rs->next() )
- {
- Oid oid = xRow->getInt( 1 );
- OUString typeName = xRow->getString( 2 );
- OUString typType = xRow->getString( 3 );
+ if( i > 0 )
+ buf.append( " OR " );
+ int oid = m_colDesc[i].typeOid;
+ buf.append( "oid=" );
+ buf.append( static_cast<sal_Int32>(oid) );
+ }
+ Reference< XResultSet > rs = stmt->executeQuery( buf.makeStringAndClear() );
+ Reference< XRow > xRow( rs, UNO_QUERY );
+ while( rs->next() )
+ {
+ Oid oid = xRow->getInt( 1 );
+ OUString typeName = xRow->getString( 2 );
+ OUString typType = xRow->getString( 3 );
- sal_Int32 type = typeNameToDataType( typeName, typType );
+ sal_Int32 type = typeNameToDataType( typeName, typType );
- for( sal_Int32 j = 0; j < m_colCount ; j ++ )
+ for( sal_Int32 j = 0; j < m_colCount ; j ++ )
+ {
+ if( m_colDesc[j].typeOid == oid )
{
- if( m_colDesc[j].typeOid == oid )
- {
- m_colDesc[j].typeName = typeName;
- m_colDesc[j].type = type;
- }
+ m_colDesc[j].typeName = typeName;
+ m_colDesc[j].type = type;
}
}
- m_checkedForTypes = true;
}
+ m_checkedForTypes = true;
}
void ResultSetMetaData::checkTable()
{
- if( ! m_checkedForTable )
- {
- m_checkedForTable = true;
- if( m_tableName.getLength() )
- {
+ if( m_checkedForTable )
+ return;
- Reference< css::container::XNameAccess > tables = (*m_ppSettings)->tables;
- if( ! tables.is() )
- {
+ m_checkedForTable = true;
+ if( !m_tableName.getLength() )
+ return;
- Reference< XTablesSupplier > supplier(
- extractConnectionFromStatement( m_origin->getStatement() ), UNO_QUERY);
- if( supplier.is() )
- tables = supplier->getTables();
- }
- if( tables.is() )
- {
- const OUString name (getTableName ( 1 ));
- const OUString schema (getSchemaName( 1 ));
- const OUString composedName( schema.isEmpty() ? name : (schema + "." + name) );
- tables->getByName( composedName ) >>= m_table;
- }
- }
+ Reference< css::container::XNameAccess > tables = (*m_ppSettings)->tables;
+ if( ! tables.is() )
+ {
+
+ Reference< XTablesSupplier > supplier(
+ extractConnectionFromStatement( m_origin->getStatement() ), UNO_QUERY);
+ if( supplier.is() )
+ tables = supplier->getTables();
+ }
+ if( tables.is() )
+ {
+ const OUString name (getTableName ( 1 ));
+ const OUString schema (getSchemaName( 1 ));
+ const OUString composedName( schema.isEmpty() ? name : (schema + "." + name) );
+ tables->getByName( composedName ) >>= m_table;
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 37f6cb575c22..bece8a806f29 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -1036,45 +1036,45 @@ void bufferKey2TableConstraint(
}
buf.append( ") " );
- if( foreign )
+ if( !foreign )
+ return;
+
+ buf.append( "REFERENCES " );
+ OUString schema;
+ OUString tableName;
+ splitConcatenatedIdentifier( referencedTable, &schema, &tableName );
+ bufferQuoteQualifiedIdentifier(buf , schema, tableName, settings );
+ if(columns.is() )
{
- buf.append( "REFERENCES " );
- OUString schema;
- OUString tableName;
- splitConcatenatedIdentifier( referencedTable, &schema, &tableName );
- bufferQuoteQualifiedIdentifier(buf , schema, tableName, settings );
- if(columns.is() )
+ Reference< XEnumerationAccess > colEnumAccess( columns->getColumns(), UNO_QUERY);
+ if( colEnumAccess.is() )
{
- Reference< XEnumerationAccess > colEnumAccess( columns->getColumns(), UNO_QUERY);
- if( colEnumAccess.is() )
+ buf.append( " (" );
+ Reference< XEnumeration > colEnum(colEnumAccess->createEnumeration());
+ bool first = true;
+ while(colEnum.is() && colEnum->hasMoreElements() )
{
- buf.append( " (" );
- Reference< XEnumeration > colEnum(colEnumAccess->createEnumeration());
- bool first = true;
- while(colEnum.is() && colEnum->hasMoreElements() )
+ if( first )
{
- if( first )
- {
- first = false;
- }
- else
- {
- buf.append( ", " );
- }
- Reference< XPropertySet > keyColumn( colEnum->nextElement(), UNO_QUERY_THROW );
- bufferQuoteIdentifier(
- buf, extractStringProperty( keyColumn, st.RELATED_COLUMN ), settings );
+ first = false;
}
- buf.append( ") " );
+ else
+ {
+ buf.append( ", " );
+ }
+ Reference< XPropertySet > keyColumn( colEnum->nextElement(), UNO_QUERY_THROW );
+ bufferQuoteIdentifier(
+ buf, extractStringProperty( keyColumn, st.RELATED_COLUMN ), settings );
}
+ buf.append( ") " );
}
-
- buf.append( "ON DELETE " );
- keyType2String( buf, deleteRule );
- buf.append( " ON UPDATE " );
- keyType2String( buf, updateRule );
}
+ buf.append( "ON DELETE " );
+ keyType2String( buf, deleteRule );
+ buf.append( " ON UPDATE " );
+ keyType2String( buf, updateRule );
+
}
void extractNameValuePairsFromInsert( String2StringMap & map, const OString & lastQuery )
@@ -1084,57 +1084,57 @@ void extractNameValuePairsFromInsert( String2StringMap & map, const OString & la
int nSize = vec.size();
// printf( "1 %d\n", nSize );
- if( nSize > 6 &&
+ if( !(nSize > 6 &&
vec[0].equalsIgnoreAsciiCase( "insert" ) &&
- vec[1].equalsIgnoreAsciiCase( "into" ) )
- {
- int n = 2;
+ vec[1].equalsIgnoreAsciiCase( "into" )) )
+ return;
+
+ int n = 2;
// printf( "1a\n" );
- // skip table name
- if( vec[n+1].equalsIgnoreAsciiCase( "." ) )
+ // skip table name
+ if( vec[n+1].equalsIgnoreAsciiCase( "." ) )
+ {
+ n +=2;
+ }
+
+ n ++;
+ if( !vec[n].equalsIgnoreAsciiCase( "(" ) )
+ return;
+
+ std::vector< OString> names;
+// printf( "2\n" );
+ // extract names
+ n++;
+ while( nSize > n && ! vec[n].equalsIgnoreAsciiCase( ")" ) )
+ {
+ names.push_back( vec[n] );
+ if( nSize > n+1 && vec[n+1].equalsIgnoreAsciiCase( "," ) )
{
- n +=2;
+ n ++;
}
+ n++;
+ }
+ n++;
- n ++;
- if( vec[n].equalsIgnoreAsciiCase( "(" ) )
- {
- std::vector< OString> names;
-// printf( "2\n" );
- // extract names
- n++;
- while( nSize > n && ! vec[n].equalsIgnoreAsciiCase( ")" ) )
- {
- names.push_back( vec[n] );
- if( nSize > n+1 && vec[n+1].equalsIgnoreAsciiCase( "," ) )
- {
- n ++;
- }
- n++;
- }
- n++;
+ // now read the values
+ if( !(nSize > n +1 && vec[n].equalsIgnoreAsciiCase("VALUES") &&
+ vec[n+1].equalsIgnoreAsciiCase( "(" )) )
+ return;
- // now read the values
- if( nSize > n +1 && vec[n].equalsIgnoreAsciiCase("VALUES") &&
- vec[n+1].equalsIgnoreAsciiCase( "(" ) )
- {
- n +=2;
+ n +=2;
// printf( "3\n" );
- for (auto& name : names)
- {
- if (n >= nSize)
- break;
+ for (auto& name : names)
+ {
+ if (n >= nSize)
+ break;
- map[name] = vec[n];
- if( nSize > n+1 && vec[n+1].equalsIgnoreAsciiCase(",") )
- {
- n ++;
- }
- n++;
- }
- }
+ map[name] = vec[n];
+ if( nSize > n+1 && vec[n+1].equalsIgnoreAsciiCase(",") )
+ {
+ n ++;
}
+ n++;
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
index b7c1537eed04..06323615f4b7 100644
--- a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
@@ -378,26 +378,26 @@ void Container::removeContainerListener(
void Container::fire( const EventBroadcastHelper &helper )
{
cppu::OInterfaceContainerHelper *container = rBHelper.getContainer( helper.getType() );
- if( container )
+ if( !container )
+ return;
+
+ cppu::OInterfaceIteratorHelper iterator( * container );
+ while( iterator.hasMoreElements() )
{
- cppu::OInterfaceIteratorHelper iterator( * container );
- while( iterator.hasMoreElements() )
+ try
+ {
+ helper.fire( static_cast<XEventListener *>(iterator.next()) );
+ }
+ catch ( css::uno::RuntimeException & )
+ {
+ OSL_ENSURE( false, "exception caught" );
+ // loose coupling, a runtime exception shall not break anything
+ // TODO: log away as warning !
+ }
+ catch( css::uno::Exception & )
{
- try
- {
- helper.fire( static_cast<XEventListener *>(iterator.next()) );
- }
- catch ( css::uno::RuntimeException & )
- {
- OSL_ENSURE( false, "exception caught" );
- // loose coupling, a runtime exception shall not break anything
- // TODO: log away as warning !
- }
- catch( css::uno::Exception & )
- {
- OSL_ENSURE( false, "exception from listener flying through" );
- throw;
- }
+ OSL_ENSURE( false, "exception from listener flying through" );
+ throw;
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index 1d9b9fd3b13c..83758208b203 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -151,83 +151,83 @@ void Tables::refresh()
static void appendColumnList(
OUStringBuffer &buf, const Reference< XColumnsSupplier > & columnSupplier, ConnectionSettings *settings )
{
- if( columnSupplier.is() )
- {
- Reference< XEnumerationAccess > columns( columnSupplier->getColumns(),UNO_QUERY );
- if( columns.is() )
- {
- Reference< XEnumeration > xEnum( columns->createEnumeration() );
- bool first = true;
- Statics & st = getStatics();
+ if( !columnSupplier.is() )
+ return;
- while( xEnum.is() && xEnum->hasMoreElements() )
- {
- if( first )
- {
- first = false;
- }
- else
- {
- buf.append( ", " );
- }
- Reference< XPropertySet > column( xEnum->nextElement(), UNO_QUERY );
- OUString name = extractStringProperty( column, st.NAME );
- OUString defaultValue = extractStringProperty( column, st.DEFAULT_VALUE );
- bool isNullable = extractBoolProperty( column, st.IS_NULLABLE );
- bool isAutoIncrement = extractBoolProperty( column, st.IS_AUTO_INCREMENT );
+ Reference< XEnumerationAccess > columns( columnSupplier->getColumns(),UNO_QUERY );
+ if( !columns.is() )
+ return;
- bufferQuoteIdentifier( buf, name, settings );
+ Reference< XEnumeration > xEnum( columns->createEnumeration() );
+ bool first = true;
+ Statics & st = getStatics();
- OUString type = sqltype2string( column );
- if( isAutoIncrement )
- {
- sal_Int32 dataType = 0;
- column->getPropertyValue( st.TYPE ) >>= dataType;
- if( css::sdbc::DataType::INTEGER == dataType )
- {
- buf.append( " serial ");
- isNullable = false;
- }
- else if( css::sdbc::DataType::BIGINT == dataType )
- {
- buf.append( " serial8 " );
- isNullable = false;
- }
- else
- buf.append( type );
- }
- else
- {
- buf.append( type );
- }
- if( !defaultValue.isEmpty() )
- {
- bufferQuoteConstant( buf, defaultValue, settings );
- }
+ while( xEnum.is() && xEnum->hasMoreElements() )
+ {
+ if( first )
+ {
+ first = false;
+ }
+ else
+ {
+ buf.append( ", " );
+ }
+ Reference< XPropertySet > column( xEnum->nextElement(), UNO_QUERY );
+ OUString name = extractStringProperty( column, st.NAME );
+ OUString defaultValue = extractStringProperty( column, st.DEFAULT_VALUE );
+ bool isNullable = extractBoolProperty( column, st.IS_NULLABLE );
+ bool isAutoIncrement = extractBoolProperty( column, st.IS_AUTO_INCREMENT );
- if( ! isNullable )
- buf.append( " NOT NULL " );
+ bufferQuoteIdentifier( buf, name, settings );
+ OUString type = sqltype2string( column );
+ if( isAutoIncrement )
+ {
+ sal_Int32 dataType = 0;
+ column->getPropertyValue( st.TYPE ) >>= dataType;
+ if( css::sdbc::DataType::INTEGER == dataType )
+ {
+ buf.append( " serial ");
+ isNullable = false;
+ }
+ else if( css::sdbc::DataType::BIGINT == dataType )
+ {
+ buf.append( " serial8 " );
+ isNullable = false;
}
+ else
+ buf.append( type );
}
+ else
+ {
+ buf.append( type );
+ }
+ if( !defaultValue.isEmpty() )
+ {
+ bufferQuoteConstant( buf, defaultValue, settings );
+ }
+
+ if( ! isNullable )
+ buf.append( " NOT NULL " );
+
}
}
static void appendKeyList(
OUStringBuffer & buf, const Reference< XKeysSupplier > &keySupplier, ConnectionSettings *settings )
{
- if( keySupplier.is() )
+ if( !keySupplier.is() )
+ return;
+
+ Reference< XEnumerationAccess > keys( keySupplier->getKeys(), UNO_QUERY );
+ if(keys.is() )
{
- Reference< XEnumerationAccess > keys( keySupplier->getKeys(), UNO_QUERY );
- if(keys.is() )
+ Reference< XEnumeration > xEnum = keys->createEnumeration();
+ while( xEnum.is() && xEnum->hasMoreElements() )
{
- Reference< XEnumeration > xEnum = keys->createEnumeration();
- while( xEnum.is() && xEnum->hasMoreElements() )
- {
- buf.append( ", " );
- Reference< XPropertySet > key( xEnum->nextElement(), UNO_QUERY );
- bufferKey2TableConstraint( buf, key, settings );
- }
+ buf.append( ", " );
+ Reference< XPropertySet > key( xEnum->nextElement(), UNO_QUERY );
+ bufferKey2TableConstraint( buf, key, settings );
}
}
}
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index f624f72ff3f8..275cbb51f221 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -262,63 +262,63 @@ void OSDBCDriverManager::bootstrapDrivers()
xEnumDrivers = xEnumAccess->createContentEnumeration(SERVICE_SDBC_DRIVER);
OSL_ENSURE( xEnumDrivers.is(), "OSDBCDriverManager::bootstrapDrivers: no enumeration for the drivers available!" );
- if (xEnumDrivers.is())
+ if (!xEnumDrivers.is())
+ return;
+
+ Reference< XSingleComponentFactory > xFactory;
+ Reference< XServiceInfo > xSI;
+ while (xEnumDrivers->hasMoreElements())
{
- Reference< XSingleComponentFactory > xFactory;
- Reference< XServiceInfo > xSI;
- while (xEnumDrivers->hasMoreElements())
- {
- xFactory.set(xEnumDrivers->nextElement(), css::uno::UNO_QUERY);
- OSL_ENSURE( xFactory.is(), "OSDBCDriverManager::bootstrapDrivers: no factory extracted" );
+ xFactory.set(xEnumDrivers->nextElement(), css::uno::UNO_QUERY);
+ OSL_ENSURE( xFactory.is(), "OSDBCDriverManager::bootstrapDrivers: no factory extracted" );
- if ( xFactory.is() )
+ if ( xFactory.is() )
+ {
+ // we got a factory for the driver
+ DriverAccess aDriverDescriptor;
+ bool bValidDescriptor = false;
+
+ // can it tell us something about the implementation name?
+ xSI.set(xFactory, css::uno::UNO_QUERY);
+ if ( xSI.is() )
+ { // yes -> no need to load the driver immediately (load it later when needed)
+ aDriverDescriptor.sImplementationName = xSI->getImplementationName();
+ aDriverDescriptor.xComponentFactory = xFactory;
+ bValidDescriptor = true;
+
+ m_aEventLogger.log( LogLevel::CONFIG,
+ "found SDBC driver $1$, no need to load it",
+ aDriverDescriptor.sImplementationName
+ );
+ }
+ else
{
- // we got a factory for the driver
- DriverAccess aDriverDescriptor;
- bool bValidDescriptor = false;
-
- // can it tell us something about the implementation name?
- xSI.set(xFactory, css::uno::UNO_QUERY);
- if ( xSI.is() )
- { // yes -> no need to load the driver immediately (load it later when needed)
- aDriverDescriptor.sImplementationName = xSI->getImplementationName();
- aDriverDescriptor.xComponentFactory = xFactory;
- bValidDescriptor = true;
-
- m_aEventLogger.log( LogLevel::CONFIG,
- "found SDBC driver $1$, no need to load it",
- aDriverDescriptor.sImplementationName
- );
- }
- else
- {
- // no -> create the driver
- Reference< XDriver > xDriver( xFactory->createInstanceWithContext( m_xContext ), UNO_QUERY );
- OSL_ENSURE( xDriver.is(), "OSDBCDriverManager::bootstrapDrivers: a driver which is no driver?!" );
+ // no -> create the driver
+ Reference< XDriver > xDriver( xFactory->createInstanceWithContext( m_xContext ), UNO_QUERY );
+ OSL_ENSURE( xDriver.is(), "OSDBCDriverManager::bootstrapDrivers: a driver which is no driver?!" );
- if ( xDriver.is() )
+ if ( xDriver.is() )
+ {
+ aDriverDescriptor.xDriver = xDriver;
+ // and obtain it's implementation name
+ xSI.set(xDriver, css::uno::UNO_QUERY);
+ OSL_ENSURE( xSI.is(), "OSDBCDriverManager::bootstrapDrivers: a driver without service info?" );
+ if ( xSI.is() )
{
- aDriverDescriptor.xDriver = xDriver;
- // and obtain it's implementation name
- xSI.set(xDriver, css::uno::UNO_QUERY);
- OSL_ENSURE( xSI.is(), "OSDBCDriverManager::bootstrapDrivers: a driver without service info?" );
- if ( xSI.is() )
- {
- aDriverDescriptor.sImplementationName = xSI->getImplementationName();
- bValidDescriptor = true;
-
- m_aEventLogger.log( LogLevel::CONFIG,
- "found SDBC driver $1$, needed to load it",
- aDriverDescriptor.sImplementationName
- );
- }
+ aDriverDescriptor.sImplementationName = xSI->getImplementationName();
+ bValidDescriptor = true;
+
+ m_aEventLogger.log( LogLevel::CONFIG,
+ "found SDBC driver $1$, needed to load it",
+ aDriverDescriptor.sImplementationName
+ );
}
}
+ }
- if ( bValidDescriptor )
- {
- m_aDriversBS.push_back( aDriverDescriptor );
- }
+ if ( bValidDescriptor )
+ {
+ m_aDriversBS.push_back( aDriverDescriptor );
}
}
}
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 0ea8acdafef8..d31bcd2a9ada 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -302,27 +302,27 @@ void OSQLParseNode::parseNodeToStr(OUString& rString,
{
OSL_ENSURE( _rxConnection.is(), "OSQLParseNode::parseNodeToStr: invalid connection!" );
- if ( _rxConnection.is() )
+ if ( !_rxConnection.is() )
+ return;
+
+ OUStringBuffer sBuffer = rString;
+ try
{
- OUStringBuffer sBuffer = rString;
- try
- {
- OSQLParseNode::impl_parseNodeToString_throw( sBuffer,
- SQLParseNodeParameter(
- _rxConnection, xFormatter, _xField, _sPredicateTableAlias, rIntl, pContext,
- _bIntl, _bQuote, _sDecSep, _bPredicate, false
- ) );
- }
- catch( const SQLException& )
- {
- SAL_WARN( "connectivity.parse", "OSQLParseNode::parseNodeToStr: this should not throw!" );
- // our callers don't expect this method to throw anything. The only known situation
- // where impl_parseNodeToString_throw can throw is when there is a cyclic reference
- // in the sub queries, but this cannot be the case here, as we do not parse to
- // SDBC level.
- }
- rString = sBuffer.makeStringAndClear();
+ OSQLParseNode::impl_parseNodeToString_throw( sBuffer,
+ SQLParseNodeParameter(
+ _rxConnection, xFormatter, _xField, _sPredicateTableAlias, rIntl, pContext,
+ _bIntl, _bQuote, _sDecSep, _bPredicate, false
+ ) );
}
+ catch( const SQLException& )
+ {
+ SAL_WARN( "connectivity.parse", "OSQLParseNode::parseNodeToStr: this should not throw!" );
+ // our callers don't expect this method to throw anything. The only known situation
+ // where impl_parseNodeToString_throw can throw is when there is a cyclic reference
+ // in the sub queries, but this cannot be the case here, as we do not parse to
+ // SDBC level.
+ }
+ rString = sBuffer.makeStringAndClear();
}
bool OSQLParseNode::parseNodeToExecutableStatement( OUString& _out_rString, const Reference< XConnection >& _rxConnection,
@@ -520,61 +520,52 @@ void OSQLParseNode::impl_parseNodeToString_throw(OUStringBuffer& rString, const
break;
} // switch ( getKnownRuleID() )
- if ( !bHandled )
+ if ( bHandled )
+ return;
+
+ for (auto i = m_aChildren.begin(); i != m_aChildren.end();)
{
- for (auto i = m_aChildren.begin(); i != m_aChildren.end();)
+ const OSQLParseNode* pSubTree = i->get();
+ if ( !pSubTree )
{
- const OSQLParseNode* pSubTree = i->get();
- if ( !pSubTree )
- {
- ++i;
- continue;
- }
+ ++i;
+ continue;
+ }
- SQLParseNodeParameter aNewParam(rParam);
+ SQLParseNodeParameter aNewParam(rParam);
+
+ // don't replace the field for subqueries
+ if (rParam.xField.is() && SQL_ISRULE(pSubTree,subquery))
+ aNewParam.xField = nullptr;
- // don't replace the field for subqueries
- if (rParam.xField.is() && SQL_ISRULE(pSubTree,subquery))
- aNewParam.xField = nullptr;
-
- // When we are building a criterion inside a query view,
- // simplify criterion display by removing:
- // "currentFieldName"
- // "currentFieldName" =
- // but only in simple expressions.
- // This means anything that is made of:
- // (see the rules conditionalised by inPredicateCheck() in sqlbison.y).
- // - parentheses
- // - logical operators (and, or, not)
- // - comparison operators (IS, =, >, <, BETWEEN, LIKE, ...)
- // but *not* e.g. in function arguments
- if (bSimple && rParam.bPredicate && rParam.xField.is() && SQL_ISRULE(pSubTree,column_ref))
+ // When we are building a criterion inside a query view,
+ // simplify criterion display by removing:
+ // "currentFieldName"
+ // "currentFieldName" =
+ // but only in simple expressions.
+ // This means anything that is made of:
+ // (see the rules conditionalised by inPredicateCheck() in sqlbison.y).
+ // - parentheses
+ // - logical operators (and, or, not)
+ // - comparison operators (IS, =, >, <, BETWEEN, LIKE, ...)
+ // but *not* e.g. in function arguments
+ if (bSimple && rParam.bPredicate && rParam.xField.is() && SQL_ISRULE(pSubTree,column_ref))
+ {
+ if (columnMatchP(pSubTree, rParam))
{
- if (columnMatchP(pSubTree, rParam))
+ // skip field
+ ++i;
+ // if the following node is the comparison operator'=',
+ // we filter it as well
+ if (SQL_ISRULE(this, comparison_predicate))
{
- // skip field
- ++i;
- // if the following node is the comparison operator'=',
- // we filter it as well
- if (SQL_ISRULE(this, comparison_predicate))
+ if(i != m_aChildren.end())
{
- if(i != m_aChildren.end())
- {
- pSubTree = i->get();
- if (pSubTree && pSubTree->getNodeType() == SQLNodeType::Equal)
- ++i;
- }
+ pSubTree = i->get();
+ if (pSubTree && pSubTree->getNodeType() == SQLNodeType::Equal)
+ ++i;
}
}
- else
- {
- pSubTree->impl_parseNodeToString_throw( rString, aNewParam, bSimple );
- ++i;
-
- // In the comma lists, put commas in-between all subtrees
- if ((m_eNodeType == SQLNodeType::CommaListRule) && (i != m_aChildren.end()))
- rString.append(",");
- }
}
else
{
@@ -583,43 +574,52 @@ void OSQLParseNode::impl_parseNodeToString_throw(OUStringBuffer& rString, const
// In the comma lists, put commas in-between all subtrees
if ((m_eNodeType == SQLNodeType::CommaListRule) && (i != m_aChildren.end()))
- {
- if (SQL_ISRULE(this,value_exp_commalist) && rParam.bPredicate)
- rString.append(";");
- else
- rString.append(",");
- }
+ rString.append(",");
}
- // The right hand-side of these operators is not simple
- switch ( getKnownRuleID() )
+ }
+ else
+ {
+ pSubTree->impl_parseNodeToString_throw( rString, aNewParam, bSimple );
+ ++i;
+
+ // In the comma lists, put commas in-between all subtrees
+ if ((m_eNodeType == SQLNodeType::CommaListRule) && (i != m_aChildren.end()))
{
- case general_set_fct:
- case set_fct_spec:
- case position_exp:
- case extract_exp:
- case length_exp:
- case char_value_fct:
- case odbc_call_spec:
- case subquery:
- case comparison_predicate:
- case between_predicate:
- case like_predicate:
- case test_for_null:
- case in_predicate:
- case existence_test:
- case unique_test:
- case all_or_any_predicate:
- case join_condition:
- case comparison_predicate_part_2:
- case parenthesized_boolean_value_expression:
- case other_like_predicate_part_2:
- case between_predicate_part_2:
- bSimple=false;
- break;
- default:
- break;
+ if (SQL_ISRULE(this,value_exp_commalist) && rParam.bPredicate)
+ rString.append(";");
+ else
+ rString.append(",");
}
}
+ // The right hand-side of these operators is not simple
+ switch ( getKnownRuleID() )
+ {
+ case general_set_fct:
+ case set_fct_spec:
+ case position_exp:
+ case extract_exp:
+ case length_exp:
+ case char_value_fct:
+ case odbc_call_spec:
+ case subquery:
+ case comparison_predicate:
+ case between_predicate:
+ case like_predicate:
+ case test_for_null:
+ case in_predicate:
+ case existence_test:
+ case unique_test:
+ case all_or_any_predicate:
+ case join_condition:
+ case comparison_predicate_part_2:
+ case parenthesized_boolean_value_expression:
+ case other_like_predicate_part_2:
+ case between_predicate_part_2:
+ bSimple=false;
+ break;
+ default:
+ break;
+ }
}
}
@@ -2033,19 +2033,19 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition, bool
void OSQLParseNode::eraseBraces(OSQLParseNode*& pSearchCondition)
{
- if (pSearchCondition && (SQL_ISRULE(pSearchCondition,boolean_primary) || (pSearchCondition->count() == 3 && SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") &&
- SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")"))))
+ if (!(pSearchCondition && (SQL_ISRULE(pSearchCondition,boolean_primary) || (pSearchCondition->count() == 3 && SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") &&
+ SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")")))))
+ return;
+
+ OSQLParseNode* pRight = pSearchCondition->getChild(1);
+ absorptions(pRight);
+ // if child is not an or and tree then delete () around child
+ if(!(SQL_ISRULE(pSearchCondition->getChild(1),boolean_term) || SQL_ISRULE(pSearchCondition->getChild(1),search_condition)) ||
+ SQL_ISRULE(pSearchCondition->getChild(1),boolean_term) || // and can always stand without ()
+ (SQL_ISRULE(pSearchCondition->getChild(1),search_condition) && SQL_ISRULE(pSearchCondition->getParent(),search_condition)))
{
- OSQLParseNode* pRight = pSearchCondition->getChild(1);
- absorptions(pRight);
- // if child is not an or and tree then delete () around child
- if(!(SQL_ISRULE(pSearchCondition->getChild(1),boolean_term) || SQL_ISRULE(pSearchCondition->getChild(1),search_condition)) ||
- SQL_ISRULE(pSearchCondition->getChild(1),boolean_term) || // and can always stand without ()
- (SQL_ISRULE(pSearchCondition->getChild(1),search_condition) && SQL_ISRULE(pSearchCondition->getParent(),search_condition)))
- {
- OSQLParseNode* pNode = pSearchCondition->removeAt(1);
- replaceAndReset(pSearchCondition,pNode);
- }
+ OSQLParseNode* pNode = pSearchCondition->removeAt(1);
+ replaceAndReset(pSearchCondition,pNode);
}
}
@@ -2183,76 +2183,76 @@ void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition)
}
// or with two and trees where one element of the and trees are equal
- if(SQL_ISRULE(pSearchCondition,search_condition) && SQL_ISRULE(pSearchCondition->getChild(0),boolean_term) && SQL_ISRULE(pSearchCondition->getChild(2),boolean_term))
+ if(!(SQL_ISRULE(pSearchCondition,search_condition) && SQL_ISRULE(pSearchCondition->getChild(0),boolean_term) && SQL_ISRULE(pSearchCondition->getChild(2),boolean_term)))
+ return;
+
+ if(*pSearchCondition->getChild(0)->getChild(0) == *pSearchCondition->getChild(2)->getChild(0))
{
- if(*pSearchCondition->getChild(0)->getChild(0) == *pSearchCondition->getChild(2)->getChild(0))
- {
- OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(2);
- OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(2);
- OSQLParseNode* pNode = MakeORNode(pLeft,pRight);
+ OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(2);
+ OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(2);
+ OSQLParseNode* pNode = MakeORNode(pLeft,pRight);
- OSQLParseNode* pNewRule = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
- pNewRule->append(new OSQLParseNode("(",SQLNodeType::Punctuation));
- pNewRule->append(pNode);
- pNewRule->append(new OSQLParseNode(")",SQLNodeType::Punctuation));
+ OSQLParseNode* pNewRule = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
+ pNewRule->append(new OSQLParseNode("(",SQLNodeType::Punctuation));
+ pNewRule->append(pNode);
+ pNewRule->append(new OSQLParseNode(")",SQLNodeType::Punctuation));
- OSQLParseNode::eraseBraces(pLeft);
- OSQLParseNode::eraseBraces(pRight);
+ OSQLParseNode::eraseBraces(pLeft);
+ OSQLParseNode::eraseBraces(pRight);
- pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(sal_uInt32(0)),pNewRule);
- replaceAndReset(pSearchCondition,pNode);
- }
- else if(*pSearchCondition->getChild(0)->getChild(2) == *pSearchCondition->getChild(2)->getChild(0))
- {
- OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(sal_uInt32(0));
- OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(2);
- OSQLParseNode* pNode = MakeORNode(pLeft,pRight);
+ pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(sal_uInt32(0)),pNewRule);
+ replaceAndReset(pSearchCondition,pNode);
+ }
+ else if(*pSearchCondition->getChild(0)->getChild(2) == *pSearchCondition->getChild(2)->getChild(0))
+ {
+ OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(sal_uInt32(0));
+ OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(2);
+ OSQLParseNode* pNode = MakeORNode(pLeft,pRight);
- OSQLParseNode* pNewRule = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
- pNewRule->append(new OSQLParseNode("(",SQLNodeType::Punctuation));
- pNewRule->append(pNode);
- pNewRule->append(new OSQLParseNode(")",SQLNodeType::Punctuation));
+ OSQLParseNode* pNewRule = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
+ pNewRule->append(new OSQLParseNode("(",SQLNodeType::Punctuation));
+ pNewRule->append(pNode);
+ pNewRule->append(new OSQLParseNode(")",SQLNodeType::Punctuation));
- OSQLParseNode::eraseBraces(pLeft);
- OSQLParseNode::eraseBraces(pRight);
+ OSQLParseNode::eraseBraces(pLeft);
+ OSQLParseNode::eraseBraces(pRight);
- pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(1),pNewRule);
- replaceAndReset(pSearchCondition,pNode);
- }
- else if(*pSearchCondition->getChild(0)->getChild(0) == *pSearchCondition->getChild(2)->getChild(2))
- {
- OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(2);
- OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(sal_uInt32(0));
- OSQLParseNode* pNode = MakeORNode(pLeft,pRight);
+ pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(1),pNewRule);
+ replaceAndReset(pSearchCondition,pNode);
+ }
+ else if(*pSearchCondition->getChild(0)->getChild(0) == *pSearchCondition->getChild(2)->getChild(2))
+ {
+ OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(2);
+ OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(sal_uInt32(0));
+ OSQLParseNode* pNode = MakeORNode(pLeft,pRight);
- OSQLParseNode* pNewRule = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
- pNewRule->append(new OSQLParseNode("(",SQLNodeType::Punctuation));
- pNewRule->append(pNode);
- pNewRule->append(new OSQLParseNode(")",SQLNodeType::Punctuation));
+ OSQLParseNode* pNewRule = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
+ pNewRule->append(new OSQLParseNode("(",SQLNodeType::Punctuation));
+ pNewRule->append(pNode);
+ pNewRule->append(new OSQLParseNode(")",SQLNodeType::Punctuation));
- OSQLParseNode::eraseBraces(pLeft);
- OSQLParseNode::eraseBraces(pRight);
+ OSQLParseNode::eraseBraces(pLeft);
+ OSQLParseNode::eraseBraces(pRight);
- pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(sal_uInt32(0)),pNewRule);
- replaceAndReset(pSearchCondition,pNode);
- }
- else if(*pSearchCondition->getChild(0)->getChild(2) == *pSearchCondition->getChild(2)->getChild(2))
- {
- OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(sal_uInt32(0));
- OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(sal_uInt32(0));
- OSQLParseNode* pNode = MakeORNode(pLeft,pRight);
+ pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(sal_uInt32(0)),pNewRule);
+ replaceAndReset(pSearchCondition,pNode);
+ }
+ else if(*pSearchCondition->getChild(0)->getChild(2) == *pSearchCondition->getChild(2)->getChild(2))
+ {
+ OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(sal_uInt32(0));
+ OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(sal_uInt32(0));
+ OSQLParseNode* pNode = MakeORNode(pLeft,pRight);
- OSQLParseNode* pNewRule = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
- pNewRule->append(new OSQLParseNode("(",SQLNodeType::Punctuation));
- pNewRule->append(pNode);
- pNewRule->append(new OSQLParseNode(")",SQLNodeType::Punctuation));
+ OSQLParseNode* pNewRule = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
+ pNewRule->append(new OSQLParseNode("(",SQLNodeType::Punctuation));
+ pNewRule->append(pNode);
+ pNewRule->append(new OSQLParseNode(")",SQLNodeType::Punctuation));
- OSQLParseNode::eraseBraces(pLeft);
- OSQLParseNode::eraseBraces(pRight);
+ OSQLParseNode::eraseBraces(pLeft);
+ OSQLParseNode::eraseBraces(pRight);
- pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(1),pNewRule);
- replaceAndReset(pSearchCondition,pNode);
- }
+ pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(1),pNewRule);
+ replaceAndReset(pSearchCondition,pNode);
}
}
#if OSL_DEBUG_LEVEL > 1