connectivity: Use appropriate OUString functions on string constants

Change-Id: I9ca72364cd57fd2da0c6f5f704a3fe494c0a1df5
This commit is contained in:
Stephan Bergmann 2014-12-18 13:21:30 +01:00
parent acb7ca4283
commit ecf24f3032
14 changed files with 29 additions and 26 deletions

View File

@ -114,7 +114,7 @@ void DriversConfigImpl::Load(const uno::Reference< uno::XComponentContext >& _rx
lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver); lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver);
if ( !aInstalledDriver.sDriverFactory.isEmpty() && if ( !aInstalledDriver.sDriverFactory.isEmpty() &&
( aMiscOptions.IsExperimentalMode() || ( aMiscOptions.IsExperimentalMode() ||
!aInstalledDriver.sDriverFactory.equals("com.sun.star.comp.sdbc.firebird.Driver") )) aInstalledDriver.sDriverFactory != "com.sun.star.comp.sdbc.firebird.Driver" ))
m_aDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver)); m_aDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver));
} }
} // if ( m_aInstalled.isValid() ) } // if ( m_aInstalled.isValid() )

View File

@ -85,7 +85,7 @@ void OCalcConnection::construct(const OUString& url,const Sequence< PropertyValu
} }
m_aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE); m_aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE);
m_sPassword = ""; m_sPassword.clear();
const char* pPwd = "password"; const char* pPwd = "password";
const PropertyValue *pIter = info.getConstArray(); const PropertyValue *pIter = info.getConstArray();

View File

@ -240,7 +240,7 @@ OUString SAL_CALL OCalcDatabaseMetaData::getURL( ) throw(SQLException, RuntimeE
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
return OUString("sdbc:calc:") + m_pConnection->getURL(); return "sdbc:calc:" + m_pConnection->getURL();
} }

View File

@ -485,7 +485,7 @@ void OCalcTable::fillColumns()
break; break;
default: default:
SAL_WARN( "connectivity.drivers","missing type name"); SAL_WARN( "connectivity.drivers","missing type name");
aTypeName = ""; aTypeName.clear();
} }
// check if the column name already exists // check if the column name already exists

View File

@ -331,7 +331,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
OUString SAL_CALL ODbaseDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception) OUString SAL_CALL ODbaseDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception)
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
return OUString("sdbc:dbase:") + m_pConnection->getURL(); return "sdbc:dbase:" + m_pConnection->getURL();
} }
sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException, std::exception) sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException, std::exception)

View File

@ -2517,7 +2517,7 @@ OUString ODbaseTable::createTempFile()
aIdent += "/"; aIdent += "/";
OUString sTempName(aIdent); OUString sTempName(aIdent);
OUString sExt(OUString(".") + m_pConnection->getExtension()); OUString sExt("." + m_pConnection->getExtension());
OUString sName(m_Name); OUString sName(m_Name);
TempFile aTempFile(sName, true, &sExt, &sTempName); TempFile aTempFile(sName, true, &sExt, &sTempName);
if(!aTempFile.IsValid()) if(!aTempFile.IsValid())

View File

@ -134,7 +134,7 @@ void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyV
bool bIsNewDatabase = false; bool bIsNewDatabase = false;
OUString aStorageURL; OUString aStorageURL;
if (url.equals("sdbc:embedded:firebird")) if (url == "sdbc:embedded:firebird")
{ {
m_bIsEmbedded = true; m_bIsEmbedded = true;

View File

@ -186,7 +186,7 @@ sal_Bool SAL_CALL FirebirdDriver::acceptsURL( const OUString& url )
SvtMiscOptions aMiscOptions; SvtMiscOptions aMiscOptions;
return aMiscOptions.IsExperimentalMode() && return aMiscOptions.IsExperimentalMode() &&
(url.equals("sdbc:embedded:firebird") || url.startsWith("sdbc:firebird:")); (url == "sdbc:embedded:firebird" || url.startsWith("sdbc:firebird:"));
} }
Sequence< DriverPropertyInfo > SAL_CALL FirebirdDriver::getPropertyInfo( Sequence< DriverPropertyInfo > SAL_CALL FirebirdDriver::getPropertyInfo(

View File

@ -240,7 +240,7 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns(
OUString SAL_CALL OFlatDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception) OUString SAL_CALL OFlatDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception)
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
return OUString("sdbc:flat:") + m_pConnection->getURL(); return "sdbc:flat:" + m_pConnection->getURL();
} }

View File

@ -411,7 +411,7 @@ namespace connectivity
"connectivity.hsqldb", "jfw_getEnabled: error code " << +e); "connectivity.hsqldb", "jfw_getEnabled: error code " << +e);
break; break;
} }
return bEnabled && url.equals("sdbc:embedded:hsqldb"); return bEnabled && url == "sdbc:embedded:hsqldb";
} }

View File

@ -271,7 +271,7 @@ sal_Bool SAL_CALL MacabDriver::acceptsURL( const OUString& url )
return sal_False; return sal_False;
// here we have to look whether we support this URL format // here we have to look whether we support this URL format
return url.equals("sdbc:address:macab"); return url == "sdbc:address:macab";
} }
Sequence< DriverPropertyInfo > SAL_CALL MacabDriver::getPropertyInfo( const OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException) Sequence< DriverPropertyInfo > SAL_CALL MacabDriver::getPropertyInfo( const OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException)

View File

@ -739,7 +739,7 @@ void OResultSet::parseParameter( const OSQLParseNode* pNode, OUString& rMatchStr
OSQLParseNode *pMark = pNode->getChild(0); OSQLParseNode *pMark = pNode->getChild(0);
// Initialize to empty string // Initialize to empty string
rMatchString = ""; rMatchString.clear();
OUString aParameterName; OUString aParameterName;
if (SQL_ISPUNCTUATION(pMark,"?")) { if (SQL_ISPUNCTUATION(pMark,"?")) {
@ -944,7 +944,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT
// String containing only a '%' and nothing else // String containing only a '%' and nothing else
op = MQueryOp::Exists; op = MQueryOp::Exists;
// Will be ignored for Exists case, but clear anyway. // Will be ignored for Exists case, but clear anyway.
matchString = ""; matchString.clear();
} }
else if ( matchString.indexOf ( WILDCARD ) == -1 && else if ( matchString.indexOf ( WILDCARD ) == -1 &&
matchString.indexOf ( MATCHCHAR ) == -1 ) matchString.indexOf ( MATCHCHAR ) == -1 )
@ -1370,7 +1370,7 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow,
if (xTableColumn.is()) if (xTableColumn.is())
xTableColumn->getPropertyValue(sName) >>= sTableColumnName; xTableColumn->getPropertyValue(sName) >>= sTableColumnName;
else else
sTableColumnName = ""; sTableColumnName.clear();
// look if we have such a select column // look if we have such a select column
// TODO: would like to have a O(log n) search here ... // TODO: would like to have a O(log n) search here ...

View File

@ -252,7 +252,7 @@ namespace
{ {
_out_rString = _rxRow->getString( _nColumnIndex ); _out_rString = _rxRow->getString( _nColumnIndex );
if ( _rxRow->wasNull() ) if ( _rxRow->wasNull() )
_out_rString = ""; _out_rString.clear();
} }
@ -274,7 +274,7 @@ namespace
if ( _rxDBMeta.is() ) if ( _rxDBMeta.is() )
{ {
sComposedName = ""; sComposedName.clear();
Reference< XResultSet> xRes = _rxDBMeta->getTables( Reference< XResultSet> xRes = _rxDBMeta->getTables(
!_rCatalog.isEmpty() ? makeAny( _rCatalog ) : Any(), !_rSchema.isEmpty() ? _rSchema : s_sWildcard, _rTableName, sTableTypes ); !_rCatalog.isEmpty() ? makeAny( _rCatalog ) : Any(), !_rSchema.isEmpty() ? _rSchema : s_sWildcard, _rTableName, sTableTypes );
@ -502,7 +502,7 @@ void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLP
OSL_PRECOND( SQL_ISRULE( pTableRef, cross_union ) || SQL_ISRULE( pTableRef, qualified_join ) , OSL_PRECOND( SQL_ISRULE( pTableRef, cross_union ) || SQL_ISRULE( pTableRef, qualified_join ) ,
"OSQLParseTreeIterator::getQualified_join: illegal node!" ); "OSQLParseTreeIterator::getQualified_join: illegal node!" );
aTableRange = ""; aTableRange.clear();
const OSQLParseNode* pNode = getTableNode(_rTables,pTableRef->getChild(0),aTableRange); const OSQLParseNode* pNode = getTableNode(_rTables,pTableRef->getChild(0),aTableRange);
if ( isTableNode( pNode ) ) if ( isTableNode( pNode ) )
@ -620,7 +620,7 @@ void OSQLParseTreeIterator::getSelect_statement(OSQLTables& _rTables,const OSQLP
OUString aTableRange; OUString aTableRange;
for (sal_uInt32 i = 0; i < pTableRefCommalist->count(); i++) for (sal_uInt32 i = 0; i < pTableRefCommalist->count(); i++)
{ // Process FROM clause { // Process FROM clause
aTableRange = ""; aTableRange.clear();
const OSQLParseNode* pTableListElement = pTableRefCommalist->getChild(i); const OSQLParseNode* pTableListElement = pTableRefCommalist->getChild(i);
if ( isTableNode( pTableListElement ) ) if ( isTableNode( pTableListElement ) )
@ -711,7 +711,9 @@ namespace
OUString& _out_rColumnName, OUString& _out_rTableRange, OUString& _out_rColumnName, OUString& _out_rTableRange,
const OSQLColumns* _pSelectColumns, OUString& _out_rColumnAliasIfPresent ) const OSQLColumns* _pSelectColumns, OUString& _out_rColumnAliasIfPresent )
{ {
_out_rColumnName = _out_rTableRange = _out_rColumnAliasIfPresent = ""; _out_rColumnName.clear();
_out_rTableRange.clear();
_out_rColumnAliasIfPresent.clear();
if ( SQL_ISRULE( _pColumnRef, column_ref ) ) if ( SQL_ISRULE( _pColumnRef, column_ref ) )
{ {
if( _pColumnRef->count() > 1 ) if( _pColumnRef->count() > 1 )
@ -1081,8 +1083,8 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo
pColumnRef = pColumnRef->getChild(0); pColumnRef = pColumnRef->getChild(0);
} }
OSL_ENSURE(pColumnRef != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(pColumnRef != NULL,"OSQLParseTreeIterator: error in parse tree!");
aTableRange = ""; aTableRange.clear();
sColumnName = ""; sColumnName.clear();
if ( SQL_ISRULE(pColumnRef,column_ref) ) if ( SQL_ISRULE(pColumnRef,column_ref) )
{ {
// Column name (and TableRange): // Column name (and TableRange):

View File

@ -361,7 +361,7 @@ bool OSQLParseNode::parseNodeToExecutableStatement( OUString& _out_rString, cons
aParseParam.pParser = &_rParser; aParseParam.pParser = &_rParser;
_out_rString = ""; _out_rString.clear();
OUStringBuffer sBuffer; OUStringBuffer sBuffer;
bool bSuccess = false; bool bSuccess = false;
try try
@ -777,7 +777,8 @@ bool OSQLParseNode::getTableComponents(const OSQLParseNode* _pTableNode,
const OSQLParseNode* pTableNode = _pTableNode; const OSQLParseNode* pTableNode = _pTableNode;
// clear the parameter given // clear the parameter given
_rCatalog = Any(); _rCatalog = Any();
_rSchema = _rTable = ""; _rSchema.clear();
_rTable.clear();
// see rule catalog_name: in sqlbison.y // see rule catalog_name: in sqlbison.y
if (SQL_ISRULE(pTableNode,catalog_name)) if (SQL_ISRULE(pTableNode,catalog_name))
{ {
@ -1269,12 +1270,12 @@ OSQLParseNode* OSQLParser::predicateTree(OUString& rErrorMessage, const OUString
SQLyylval.pParseNode = NULL; SQLyylval.pParseNode = NULL;
// SQLyypvt = NULL; // SQLyypvt = NULL;
m_pParseTree = NULL; m_pParseTree = NULL;
m_sErrorMessage = ""; m_sErrorMessage.clear();
// Start the parser // Start the parser
if (SQLyyparse() != 0) if (SQLyyparse() != 0)
{ {
m_sFieldName = ""; m_sFieldName.clear();
m_xField.clear(); m_xField.clear();
m_xFormatter.clear(); m_xFormatter.clear();
m_nFormatKey = 0; m_nFormatKey = 0;
@ -1295,7 +1296,7 @@ OSQLParseNode* OSQLParser::predicateTree(OUString& rErrorMessage, const OUString
{ {
(*s_pGarbageCollector)->clear(); (*s_pGarbageCollector)->clear();
m_sFieldName = ""; m_sFieldName.clear();
m_xField.clear(); m_xField.clear();
m_xFormatter.clear(); m_xFormatter.clear();
m_nFormatKey = 0; m_nFormatKey = 0;