Use emplace_back instead of push_back (connectivity)
Change-Id: Ie90901832dafbaab56d3ac22bdb1cf91e3564fd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161181 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
@@ -358,7 +358,7 @@ Reference< XBlob> Connection::createBlob(ISC_QUAD const * pBlobId)
|
||||
&m_aTransactionHandle,
|
||||
*pBlobId);
|
||||
|
||||
m_aStatements.push_back(WeakReferenceHelper(xReturn));
|
||||
m_aStatements.emplace_back(xReturn);
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ Reference< XClob> Connection::createClob(ISC_QUAD const * pBlobId)
|
||||
&m_aTransactionHandle,
|
||||
*pBlobId);
|
||||
|
||||
m_aStatements.push_back(WeakReferenceHelper(xReturn));
|
||||
m_aStatements.emplace_back(xReturn);
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ Reference< XStatement > SAL_CALL Connection::createStatement( )
|
||||
// create a statement
|
||||
// the statement can only be executed once
|
||||
Reference< XStatement > xReturn = new OStatement(this);
|
||||
m_aStatements.push_back(WeakReferenceHelper(xReturn));
|
||||
m_aStatements.emplace_back(xReturn);
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ Reference< XPreparedStatement > SAL_CALL Connection::prepareStatement(
|
||||
buildTypeInfo();
|
||||
|
||||
Reference< XPreparedStatement > xReturn = new OPreparedStatement(this, _sSql);
|
||||
m_aStatements.push_back(WeakReferenceHelper(xReturn));
|
||||
m_aStatements.emplace_back(xReturn);
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ Reference< XConnection > SAL_CALL FirebirdDriver::connect(
|
||||
rtl::Reference<Connection> pCon = new Connection();
|
||||
pCon->construct(url, info);
|
||||
|
||||
m_xConnections.push_back(WeakReferenceHelper(*pCon));
|
||||
m_xConnections.emplace_back(*pCon);
|
||||
|
||||
return pCon;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const S
|
||||
|
||||
rtl::Reference<OFlatConnection> pCon = new OFlatConnection(this);
|
||||
pCon->construct(url,info);
|
||||
m_xConnections.push_back(WeakReferenceHelper(*pCon));
|
||||
m_xConnections.emplace_back(*pCon);
|
||||
|
||||
return pCon;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ bool loadClass(
|
||||
// JVM that are not easily undone). If the pushed ClassMapEntry is
|
||||
// not used after all (return false, etc.) it will be pruned on next
|
||||
// call because its classLoader/classObject are null:
|
||||
classMapData.map.push_back( ClassMapEntry( classPath, name ) );
|
||||
classMapData.map.emplace_back(classPath, name);
|
||||
i = std::prev(classMapData.map.end());
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( )
|
||||
SDBThreadAttach t;
|
||||
rtl::Reference<java_sql_Statement> pStatement = new java_sql_Statement( t.pEnv, *this );
|
||||
Reference< XStatement > xStmt = pStatement;
|
||||
m_aStatements.push_back( WeakReferenceHelper( xStmt ) );
|
||||
m_aStatements.emplace_back(xStmt);
|
||||
|
||||
m_aLogger.log( LogLevel::FINE, STR_LOG_CREATED_STATEMENT_ID, pStatement->getStatementObjectID() );
|
||||
return xStmt;
|
||||
@@ -453,7 +453,7 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement(
|
||||
|
||||
rtl::Reference<java_sql_PreparedStatement> pStatement = new java_sql_PreparedStatement( t.pEnv, *this, sql );
|
||||
Reference< XPreparedStatement > xReturn( pStatement );
|
||||
m_aStatements.push_back(WeakReferenceHelper(xReturn));
|
||||
m_aStatements.emplace_back(xReturn);
|
||||
|
||||
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_STATEMENT_ID, pStatement->getStatementObjectID() );
|
||||
return xReturn;
|
||||
@@ -469,7 +469,7 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const
|
||||
|
||||
rtl::Reference<java_sql_CallableStatement> pStatement = new java_sql_CallableStatement( t.pEnv, *this, sql );
|
||||
Reference< XPreparedStatement > xStmt( pStatement );
|
||||
m_aStatements.push_back(WeakReferenceHelper(xStmt));
|
||||
m_aStatements.emplace_back(xStmt);
|
||||
|
||||
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_CALL_ID, pStatement->getStatementObjectID() );
|
||||
return xStmt;
|
||||
|
||||
@@ -158,31 +158,25 @@ Sequence<PropertyValue> lcl_convertProperties(T_DRIVERTYPE _eType,
|
||||
|
||||
if (_eType == T_DRIVERTYPE::Odbc)
|
||||
{
|
||||
aProps.push_back(PropertyValue("Silent", 0, Any(true), PropertyState_DIRECT_VALUE));
|
||||
aProps.push_back(
|
||||
PropertyValue("PreventGetVersionColumns", 0, Any(true), PropertyState_DIRECT_VALUE));
|
||||
aProps.emplace_back("Silent", 0, Any(true), PropertyState_DIRECT_VALUE);
|
||||
aProps.emplace_back("PreventGetVersionColumns", 0, Any(true), PropertyState_DIRECT_VALUE);
|
||||
}
|
||||
else if (_eType == T_DRIVERTYPE::Jdbc)
|
||||
{
|
||||
if (!jdc)
|
||||
{
|
||||
aProps.push_back(PropertyValue("JavaDriverClass", 0,
|
||||
Any(OUString("com.mysql.jdbc.Driver")),
|
||||
PropertyState_DIRECT_VALUE));
|
||||
aProps.emplace_back("JavaDriverClass", 0, Any(OUString("com.mysql.jdbc.Driver")),
|
||||
PropertyState_DIRECT_VALUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aProps.push_back(
|
||||
PropertyValue("PublicConnectionURL", 0, Any(_sUrl), PropertyState_DIRECT_VALUE));
|
||||
aProps.emplace_back("PublicConnectionURL", 0, Any(_sUrl), PropertyState_DIRECT_VALUE);
|
||||
}
|
||||
aProps.push_back(
|
||||
PropertyValue("IsAutoRetrievingEnabled", 0, Any(true), PropertyState_DIRECT_VALUE));
|
||||
aProps.push_back(PropertyValue("AutoRetrievingStatement", 0,
|
||||
Any(OUString("SELECT LAST_INSERT_ID()")),
|
||||
PropertyState_DIRECT_VALUE));
|
||||
aProps.push_back(
|
||||
PropertyValue("ParameterNameSubstitution", 0, Any(true), PropertyState_DIRECT_VALUE));
|
||||
aProps.emplace_back("IsAutoRetrievingEnabled", 0, Any(true), PropertyState_DIRECT_VALUE);
|
||||
aProps.emplace_back("AutoRetrievingStatement", 0, Any(OUString("SELECT LAST_INSERT_ID()")),
|
||||
PropertyState_DIRECT_VALUE);
|
||||
aProps.emplace_back("ParameterNameSubstitution", 0, Any(true), PropertyState_DIRECT_VALUE);
|
||||
return Sequence<PropertyValue>(aProps.data(), aProps.size());
|
||||
}
|
||||
}
|
||||
@@ -266,9 +260,9 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
|
||||
auto pMetaConnection = comphelper::getFromUnoTunnel<OMetaConnection>(xConnection);
|
||||
if (pMetaConnection)
|
||||
pMetaConnection->setURL(url);
|
||||
m_aConnections.push_back(
|
||||
TWeakPair(WeakReferenceHelper(xConnection),
|
||||
TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection)));
|
||||
m_aConnections.emplace_back(
|
||||
WeakReferenceHelper(xConnection),
|
||||
TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,18 +294,17 @@ ODriverDelegator::getPropertyInfo(const OUString& url, const Sequence<PropertyVa
|
||||
const T_DRIVERTYPE eType = lcl_getDriverType(url);
|
||||
if (eType == T_DRIVERTYPE::Jdbc)
|
||||
{
|
||||
aDriverInfo.push_back(DriverPropertyInfo("JavaDriverClass", "The JDBC driver class name.",
|
||||
true, getJavaDriverClass(info),
|
||||
Sequence<OUString>()));
|
||||
aDriverInfo.emplace_back("JavaDriverClass", "The JDBC driver class name.", true,
|
||||
getJavaDriverClass(info), Sequence<OUString>());
|
||||
}
|
||||
else if (eType == T_DRIVERTYPE::Native)
|
||||
{
|
||||
aDriverInfo.push_back(DriverPropertyInfo(
|
||||
"LocalSocket", "The file path of a socket to connect to a local MySQL server.", false,
|
||||
OUString(), Sequence<OUString>()));
|
||||
aDriverInfo.push_back(DriverPropertyInfo(
|
||||
"NamedPipe", "The name of a pipe to connect to a local MySQL server.", false,
|
||||
OUString(), Sequence<OUString>()));
|
||||
aDriverInfo.emplace_back("LocalSocket",
|
||||
"The file path of a socket to connect to a local MySQL server.",
|
||||
false, OUString(), Sequence<OUString>());
|
||||
aDriverInfo.emplace_back("NamedPipe",
|
||||
"The name of a pipe to connect to a local MySQL server.", false,
|
||||
OUString(), Sequence<OUString>());
|
||||
}
|
||||
|
||||
return Sequence<DriverPropertyInfo>(aDriverInfo.data(), aDriverInfo.size());
|
||||
|
||||
@@ -416,7 +416,7 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
|
||||
{
|
||||
if( '"' == c )
|
||||
{
|
||||
vec.push_back( OString( &sql.getStr()[start], i-start+1 ) );
|
||||
vec.emplace_back( &sql.getStr()[start], i-start+1 );
|
||||
start = i + 1;
|
||||
doubleQuote = false;
|
||||
}
|
||||
@@ -431,7 +431,7 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
|
||||
}
|
||||
else if( '\'' == c )
|
||||
{
|
||||
vec.push_back( OString( &sql.getStr()[start], i - start +1 ) );
|
||||
vec.emplace_back( &sql.getStr()[start], i - start +1 );
|
||||
start = i + 1; // leave single quotes !
|
||||
singleQuote = false;
|
||||
}
|
||||
@@ -440,20 +440,20 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
|
||||
{
|
||||
if( '"' == c )
|
||||
{
|
||||
vec.push_back( OString( &sql.getStr()[start], i - start ) );
|
||||
vec.emplace_back( &sql.getStr()[start], i - start );
|
||||
doubleQuote = true;
|
||||
start = i;
|
||||
}
|
||||
else if( '\'' == c )
|
||||
{
|
||||
vec.push_back( OString( &sql.getStr()[start], i - start ) );
|
||||
vec.emplace_back( &sql.getStr()[start], i - start );
|
||||
singleQuote = true;
|
||||
start = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( start < i )
|
||||
vec.push_back( OString( &sql.getStr()[start] , i - start ) );
|
||||
vec.emplace_back( &sql.getStr()[start] , i - start );
|
||||
|
||||
// for( i = 0 ; i < vec.size() ; i ++ )
|
||||
// printf( "%s!" , vec[i].getStr() );
|
||||
@@ -476,7 +476,7 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
|
||||
{
|
||||
if( '"' == c )
|
||||
{
|
||||
vec.push_back( OString( &sql.getStr()[start], i-start ) );
|
||||
vec.emplace_back( &sql.getStr()[start], i-start );
|
||||
start = i + 1;
|
||||
doubleQuote = false;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
|
||||
{
|
||||
if( '\'' == c )
|
||||
{
|
||||
vec.push_back( OString( &sql.getStr()[start], i - start +1 ) );
|
||||
vec.emplace_back( &sql.getStr()[start], i - start +1 );
|
||||
start = i + 1; // leave single quotes !
|
||||
singleQuote = false;
|
||||
}
|
||||
@@ -508,15 +508,15 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
|
||||
start ++; // skip additional whitespace
|
||||
else
|
||||
{
|
||||
vec.push_back( OString( &sql.getStr()[start], i - start ) );
|
||||
vec.emplace_back( &sql.getStr()[start], i - start );
|
||||
start = i +1;
|
||||
}
|
||||
}
|
||||
else if( ',' == c || isOperator( c ) || '(' == c || ')' == c )
|
||||
{
|
||||
if( i - start )
|
||||
vec.push_back( OString( &sql.getStr()[start], i - start ) );
|
||||
vec.push_back( OString( &sql.getStr()[i], 1 ) );
|
||||
vec.emplace_back( &sql.getStr()[start], i - start );
|
||||
vec.emplace_back( &sql.getStr()[i], 1 );
|
||||
start = i + 1;
|
||||
}
|
||||
else if( '.' == c )
|
||||
@@ -529,15 +529,15 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
|
||||
else
|
||||
{
|
||||
if( i - start )
|
||||
vec.push_back( OString( &sql.getStr()[start], i - start ) );
|
||||
vec.push_back( "."_ostr );
|
||||
vec.emplace_back( &sql.getStr()[start], i - start );
|
||||
vec.emplace_back( "." );
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( start < i )
|
||||
vec.push_back( OString( &sql.getStr()[start] , i - start ) );
|
||||
vec.emplace_back( &sql.getStr()[start] , i - start );
|
||||
|
||||
// for( i = 0 ; i < vec.size() ; i ++ )
|
||||
// printf( "%s!" , vec[i].getStr() );
|
||||
@@ -644,7 +644,7 @@ std::vector< Any > parseArray( std::u16string_view str )
|
||||
if( brackets == 0 )
|
||||
{
|
||||
if( !current.isEmpty() || doubleQuotedValue )
|
||||
elements.push_back( Any( current.makeStringAndClear() ) );
|
||||
elements.emplace_back( current.makeStringAndClear() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -673,7 +673,7 @@ std::vector< Any > parseArray( std::u16string_view str )
|
||||
else if( ',' == c && brackets == 1)
|
||||
{
|
||||
doubleQuotedValue = false;
|
||||
elements.push_back( Any( current.makeStringAndClear() ) );
|
||||
elements.emplace_back( current.makeStringAndClear() );
|
||||
}
|
||||
else if( isWhitespace( c ) )
|
||||
{
|
||||
|
||||
@@ -317,7 +317,7 @@ void Columns::refresh()
|
||||
// name ) );
|
||||
|
||||
{
|
||||
m_values.push_back( Any( prop ) );
|
||||
m_values.emplace_back(prop);
|
||||
map[ name ] = columnIndex;
|
||||
++columnIndex;
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ void Container::append(
|
||||
}
|
||||
|
||||
int index = m_values.size();
|
||||
m_values.push_back( Any( descriptor ) );
|
||||
m_values.emplace_back(descriptor);
|
||||
m_name2index[name] = index;
|
||||
|
||||
fire( InsertedBroadcaster( *this, name, Any( descriptor ) ) );
|
||||
|
||||
@@ -164,7 +164,7 @@ void Indexes::refresh()
|
||||
st.PRIVATE_COLUMN_INDEXES, Any( columnNames ));
|
||||
|
||||
{
|
||||
m_values.push_back( Any( prop ) );
|
||||
m_values.emplace_back(prop);
|
||||
map[ currentIndexName ] = index;
|
||||
++index;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void KeyColumns::refresh()
|
||||
}
|
||||
|
||||
{
|
||||
m_values.push_back( Any( prop ) );
|
||||
m_values.emplace_back(prop);
|
||||
map[ name ] = columnIndex;
|
||||
++columnIndex;
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ uno::Reference<sdbc::XStatement> SAL_CALL OWriterConnection::createStatement()
|
||||
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
|
||||
|
||||
uno::Reference<sdbc::XStatement> xReturn = new component::OComponentStatement(this);
|
||||
m_aStatements.push_back(uno::WeakReferenceHelper(xReturn));
|
||||
m_aStatements.emplace_back(xReturn);
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ uno::Reference<sdbc::XPreparedStatement>
|
||||
rtl::Reference<component::OComponentPreparedStatement> pStmt
|
||||
= new component::OComponentPreparedStatement(this);
|
||||
pStmt->construct(sql);
|
||||
m_aStatements.push_back(uno::WeakReferenceHelper(*pStmt));
|
||||
m_aStatements.emplace_back(*pStmt);
|
||||
return pStmt;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ uno::Reference<sdbc::XConnection>
|
||||
|
||||
rtl::Reference<OWriterConnection> pCon = new OWriterConnection(this);
|
||||
pCon->construct(url, info);
|
||||
m_xConnections.push_back(uno::WeakReferenceHelper(*pCon));
|
||||
m_xConnections.emplace_back(*pCon);
|
||||
|
||||
return pCon;
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLP
|
||||
{
|
||||
const OSQLParseNode * pCol = pColumnCommalist->getChild(i);
|
||||
// add twice because the column must exists in both tables
|
||||
m_pImpl->m_aJoinConditions.push_back( TNodePair(pCol,pCol) );
|
||||
m_pImpl->m_aJoinConditions.emplace_back(pCol,pCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user