summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-09-15 15:54:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-09-16 08:30:26 +0000
commita2b77b43685884fb4e9be04152a49294fa50db36 (patch)
tree00d599e81a653dc5c663f9dd179970b3e6aa11f2 /connectivity
parent389939b02bde4ea72268960310bbd1f2984200bf (diff)
loplugin:singlevalfields in basic..idl
Also fix obvious bug in the initialisation of the connectivity::odbc::OConnection::m_bClosed field. Probably closes some kind of connection leak there. Change-Id: I04579cf91bcd6d6c51c697d83971da4142743a82 Reviewed-on: https://gerrit.libreoffice.org/28932 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx3
-rw-r--r--connectivity/source/drivers/mork/MQueryHelper.cxx9
-rw-r--r--connectivity/source/drivers/mork/MQueryHelper.hxx3
-rw-r--r--connectivity/source/drivers/mork/MResultSet.cxx9
-rw-r--r--connectivity/source/drivers/mork/MResultSet.hxx3
-rw-r--r--connectivity/source/drivers/mork/MorkParser.cxx5
-rw-r--r--connectivity/source/drivers/mork/MorkParser.hxx2
-rw-r--r--connectivity/source/drivers/odbc/OConnection.cxx2
-rw-r--r--connectivity/source/drivers/odbc/OResultSet.cxx3
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx12
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.hxx3
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultset.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx38
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.cxx5
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeys.cxx6
-rw-r--r--connectivity/source/inc/dbase/DTable.hxx1
-rw-r--r--connectivity/source/inc/odbc/OResultSet.hxx1
24 files changed, 57 insertions, 88 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index d5d210181394..858de8e37678 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -457,7 +457,6 @@ void ODbaseTable::fillColumns()
ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables, ODbaseConnection* _pConnection)
: ODbaseTable_BASE(_pTables,_pConnection)
, m_pMemoStream(nullptr)
- , m_bWriteableMemo(false)
{
// initialize the header
memset(&m_aHeader, 0, sizeof(m_aHeader));
@@ -477,7 +476,6 @@ ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables, ODbaseConnection* _pConne
SchemaName,
CatalogName)
, m_pMemoStream(nullptr)
- , m_bWriteableMemo(false)
{
memset(&m_aHeader, 0, sizeof(m_aHeader));
m_eEncoding = getConnection()->getTextEncoding();
@@ -530,7 +528,6 @@ void ODbaseTable::construct()
m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE), StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE);
if ( !m_pMemoStream )
{
- m_bWriteableMemo = false;
m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE), StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYNONE);
}
if (m_pMemoStream)
diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx
index a183dd3670a8..e6e27410ae97 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.cxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.cxx
@@ -70,10 +70,7 @@ void MQueryHelperResultEntry::setValue( const OString &key, const OUString & rVa
}
MQueryHelper::MQueryHelper(const OColumnAlias& _ca)
- :m_nIndex( 0 )
- ,m_bHasMore( true )
- ,m_bAtEnd( false )
- ,m_rColumnAlias( _ca )
+ :m_rColumnAlias( _ca )
,m_aError()
{
m_aResults.clear();
@@ -99,7 +96,6 @@ void MQueryHelper::append(MQueryHelperResultEntry* resEnt)
{
if ( resEnt != nullptr ) {
m_aResults.push_back( resEnt );
- m_bAtEnd = false;
}
}
@@ -115,9 +111,6 @@ void MQueryHelper::clear_results()
void MQueryHelper::reset()
{
- m_nIndex = 0;
- m_bHasMore = true;
- m_bAtEnd = false;
clear_results();
m_aError.reset();
}
diff --git a/connectivity/source/drivers/mork/MQueryHelper.hxx b/connectivity/source/drivers/mork/MQueryHelper.hxx
index 907c8fdd42dc..2fffac10fcd3 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.hxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.hxx
@@ -166,9 +166,6 @@ namespace connectivity
mutable ::osl::Mutex m_aMutex;
resultsArray m_aResults;
- sal_uInt32 m_nIndex;
- bool m_bHasMore;
- bool m_bAtEnd;
void append(MQueryHelperResultEntry* resEnt );
void clear_results();
OColumnAlias m_rColumnAlias;
diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx
index de5d0c9113cd..f00ab70d5c27 100644
--- a/connectivity/source/drivers/mork/MResultSet.cxx
+++ b/connectivity/source/drivers/mork/MResultSet.cxx
@@ -74,12 +74,10 @@ OResultSet::OResultSet(OCommonStatement* pStmt, const std::shared_ptr< connectiv
,m_xStatement(*pStmt)
,m_xMetaData(nullptr)
,m_nRowPos(0)
- ,m_nOldRowPos(0)
,m_bWasNull(false)
,m_nFetchSize(0)
,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
,m_nFetchDirection(FetchDirection::FORWARD)
- ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
,m_pSQLIterator( _pSQLIterator )
,m_pParseTree( _pSQLIterator->getParseTree() )
,m_aQueryHelper(pStmt->getOwnConnection()->getColumnAlias())
@@ -88,7 +86,6 @@ OResultSet::OResultSet(OCommonStatement* pStmt, const std::shared_ptr< connectiv
,m_nParamIndex(0)
,m_bIsAlwaysFalseQuery(false)
,m_pKeySet(nullptr)
- ,m_nNewRow(0)
,m_nUpdatedRow(0)
,m_bIsReadOnly(TRISTATE_INDET)
{
@@ -647,7 +644,7 @@ void OResultSet::getFastPropertyValue(
switch(nHandle)
{
case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= (sal_Int32)m_nResultSetConcurrency;
+ rValue <<= (sal_Int32)ResultSetConcurrency::UPDATABLE;
break;
case PROPERTY_ID_RESULTSETTYPE:
rValue <<= m_nResultSetType;
@@ -1758,8 +1755,6 @@ void SAL_CALL OResultSet::insertRow( ) throw(css::sdbc::SQLException, css::uno:
SAL_INFO("connectivity.mork", "in, m_nRowPos = " << m_nRowPos);
// m_RowStates = RowStates_Inserted;
updateRow();
- m_nOldRowPos = 0;
- m_nNewRow = 0;
//m_aQueryHelper.setRowStates(getCurrentCardNumber(),m_RowStates);
SAL_INFO("connectivity.mork", "out, m_nRowPos = " << m_nRowPos);
}
@@ -1790,7 +1785,7 @@ void SAL_CALL OResultSet::moveToCurrentRow( ) throw(css::sdbc::SQLException, cs
SAL_INFO("connectivity.mork", "m_nRowPos = " << m_nRowPos);
if (rowInserted())
{
- m_nRowPos = m_nOldRowPos;
+ m_nRowPos = 0;
fetchCurrentRow();
}
}
diff --git a/connectivity/source/drivers/mork/MResultSet.hxx b/connectivity/source/drivers/mork/MResultSet.hxx
index d46e15c353f5..cfdf6f4e53f3 100644
--- a/connectivity/source/drivers/mork/MResultSet.hxx
+++ b/connectivity/source/drivers/mork/MResultSet.hxx
@@ -77,12 +77,10 @@ namespace connectivity
css::uno::Reference< css::uno::XInterface> m_xStatement;
css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData;
sal_uInt32 m_nRowPos;
- sal_uInt32 m_nOldRowPos;
bool m_bWasNull;
sal_Int32 m_nFetchSize;
sal_Int32 m_nResultSetType;
sal_Int32 m_nFetchDirection;
- sal_Int32 m_nResultSetConcurrency;
std::shared_ptr< ::connectivity::OSQLParseTreeIterator >
@@ -232,7 +230,6 @@ protected:
sal_Int32 m_nParamIndex;
bool m_bIsAlwaysFalseQuery;
::rtl::Reference<OKeySet> m_pKeySet;
- sal_Int32 m_nNewRow; //inserted row
sal_Int32 m_nUpdatedRow; //updated row
TriState m_bIsReadOnly;
inline void resetParameters() { m_nParamIndex = 0; }
diff --git a/connectivity/source/drivers/mork/MorkParser.cxx b/connectivity/source/drivers/mork/MorkParser.cxx
index 93c7177a181b..9a4b89526c00 100644
--- a/connectivity/source/drivers/mork/MorkParser.cxx
+++ b/connectivity/source/drivers/mork/MorkParser.cxx
@@ -50,6 +50,7 @@ const char *MorkMagicHeader = "// <!-- <mdb:mork:z v=\"1.4\"/> -->";
const char *MorkDictColumnMeta = "<(a=c)>";
+static const int defaultScope_ = 0x80;
MorkParser::MorkParser() :
columns_(),
@@ -60,8 +61,6 @@ MorkParser::MorkParser() :
morkData_(),
morkPos_(0),
nextAddValueId_(0x7fffffff),
- defaultScope_(0x80),
- defaultListScope_(0x81),
defaultTableId_(1),
nowParsing_(NPValues)
{
@@ -616,7 +615,7 @@ void MorkParser::retrieveLists(std::set<std::string>& lists)
<< ( ( int ) TableIter->first < 0 ? "-" : " " )
<< TableIter->first << std::endl;
#endif
- MorkRowMap* rows = getRows( defaultListScope_, &TableIter->second );
+ MorkRowMap* rows = getRows( 0x81/*defaultListScope*/, &TableIter->second );
if (!rows) return;
for ( MorkRowMap::Map::const_iterator RowIter = rows->map.begin();
RowIter != rows->map.end(); ++RowIter )
diff --git a/connectivity/source/drivers/mork/MorkParser.hxx b/connectivity/source/drivers/mork/MorkParser.hxx
index 0d3993351f5e..6b5088c04ff8 100644
--- a/connectivity/source/drivers/mork/MorkParser.hxx
+++ b/connectivity/source/drivers/mork/MorkParser.hxx
@@ -138,8 +138,6 @@ protected: // Data
unsigned morkPos_;
int nextAddValueId_;
- int defaultScope_;
- int defaultListScope_;
int defaultTableId_;
// Indicates entity is being parsed
diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx
index ea3b1de07349..4eca0ab340ea 100644
--- a/connectivity/source/drivers/odbc/OConnection.cxx
+++ b/connectivity/source/drivers/odbc/OConnection.cxx
@@ -50,7 +50,7 @@ OConnection::OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver)
,m_aConnectionHandle(nullptr)
,m_pDriverHandleCopy(_pDriverHandle)
,m_nStatementCount(0)
- ,m_bClosed(true)
+ ,m_bClosed(false)
,m_bUseCatalog(false)
,m_bUseOldDateFormat(false)
,m_bParameterSubstitution(false)
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index 859181de4094..35077933b84e 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -97,7 +97,6 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
,m_nCurrentFetchState(0)
,m_bWasNull(true)
,m_bEOF(true)
- ,m_bFreeHandle(false)
,m_bInserting(false)
,m_bRowInserted(false)
,m_bRowDeleted(false)
@@ -184,8 +183,6 @@ void OResultSet::disposing()
::osl::MutexGuard aGuard(m_aMutex);
releaseBuffer();
- if(m_bFreeHandle)
- m_pStatement->getOwnConnection()->freeStatementHandle(m_aStatementHandle);
m_xStatement.clear();
m_xMetaData.clear();
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 89de976b0592..9ea84719f800 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -277,7 +277,7 @@ Reference< XPreparedStatement > Connection::prepareStatement( const OUString& sq
MutexGuard guard( m_refMutex->mutex );
checkClosed();
- OString byteSql = OUStringToOString( sql, m_settings.encoding );
+ OString byteSql = OUStringToOString( sql, ConnectionSettings::encoding );
PreparedStatement *stmt = new PreparedStatement( m_refMutex, this, &m_settings, byteSql );
Reference< XPreparedStatement > ret = stmt;
@@ -366,7 +366,7 @@ OUString Connection::getCatalog() throw (SQLException, RuntimeException, std::ex
OUString(), 1, Any() );
}
char * p = PQdb(m_settings.pConnection );
- return OUString( p, strlen(p) , m_settings.encoding );
+ return OUString( p, strlen(p) , ConnectionSettings::encoding );
}
void Connection::setTransactionIsolation( sal_Int32 )
@@ -524,7 +524,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
nColon = url.indexOf( ':' , 1+ nColon );
if( nColon != -1 )
{
- o = OUStringToOString( url.getStr()+nColon+1, m_settings.encoding );
+ o = OUStringToOString( url.getStr()+nColon+1, ConnectionSettings::encoding );
}
}
{
@@ -540,7 +540,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
OUString errorMessage;
if ( err != nullptr)
{
- errorMessage = OUString( err, strlen(err), m_settings.encoding );
+ errorMessage = OUString( err, strlen(err), ConnectionSettings::encoding );
free(err);
}
else
@@ -564,7 +564,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
}
}
}
- properties2arrays( args , tc, m_settings.encoding, keywords, values );
+ properties2arrays( args , tc, ConnectionSettings::encoding, keywords, values );
keywords.push_back(nullptr, SAL_NO_ACQUIRE);
values.push_back(nullptr, SAL_NO_ACQUIRE);
@@ -679,7 +679,7 @@ bool isLog(ConnectionSettings *settings, LogLevel nLevel)
void log(ConnectionSettings *settings, LogLevel nLevel, const OUString &logString)
{
- log(settings, nLevel, OUStringToOString(logString, settings->encoding ).getStr());
+ log( settings, nLevel, OUStringToOString( logString, ConnectionSettings::encoding ).getStr() );
}
void log(ConnectionSettings *settings, LogLevel nLevel, const char *str)
{
diff --git a/connectivity/source/drivers/postgresql/pq_connection.hxx b/connectivity/source/drivers/postgresql/pq_connection.hxx
index f4c24ed9f5fd..cfb4cccf1b9c 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.hxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.hxx
@@ -98,7 +98,6 @@ class Views;
struct ConnectionSettings
{
ConnectionSettings() :
- encoding( RTL_TEXTENCODING_UTF8),
pConnection(nullptr),
maxNameLen(0),
maxIndexKeys(0),
@@ -108,7 +107,7 @@ struct ConnectionSettings
logFile( nullptr ),
m_nLogLevel(LogLevel::Info)
{}
- rtl_TextEncoding encoding;
+ static const rtl_TextEncoding encoding = RTL_TEXTENCODING_UTF8;
PGconn *pConnection;
sal_Int32 maxNameLen;
sal_Int32 maxIndexKeys;
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 860ffe4324da..d809da7e3eb1 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -218,7 +218,7 @@ void PreparedStatement::checkColumnIndex( sal_Int32 parameterIndex )
buf.append( ", got " );
buf.append( parameterIndex );
buf.append( ", statement '" );
- buf.append( OStringToOUString( m_stmt, m_pSettings->encoding ) );
+ buf.append( OStringToOUString( m_stmt, ConnectionSettings::encoding ) );
buf.append( "')" );
throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any () );
}
@@ -287,7 +287,7 @@ void PreparedStatement::raiseSQLException( const char * errorMsg )
OUStringBuffer buf(128);
buf.append( "pq_driver: ");
buf.append(
- OUString( errorMsg, strlen(errorMsg) , m_pSettings->encoding ) );
+ OUString( errorMsg, strlen(errorMsg) , ConnectionSettings::encoding ) );
buf.append( " (caused by statement '" );
buf.appendAscii( m_executedStatement.getStr() );
buf.append( "')" );
@@ -521,7 +521,7 @@ void PreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x )
checkColumnIndex( parameterIndex );
OStringBuffer buf( 20 );
buf.append( "'" );
- OString y = OUStringToOString( x, m_pSettings->encoding );
+ OString y = OUStringToOString( x, ConnectionSettings::encoding );
buf.ensureCapacity( y.getLength() * 2 + 2 );
int len = PQescapeString( const_cast<char*>(buf.getStr())+1, y.getStr() , y.getLength() );
buf.setLength( 1 + len );
diff --git a/connectivity/source/drivers/postgresql/pq_resultset.cxx b/connectivity/source/drivers/postgresql/pq_resultset.cxx
index 1e7ed65b4989..e569b88da9c7 100644
--- a/connectivity/source/drivers/postgresql/pq_resultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultset.cxx
@@ -121,7 +121,7 @@ Any ResultSet::getValue( sal_Int32 columnIndex )
ret <<= OUString(
PQgetvalue( m_result, m_row , columnIndex -1 ) ,
PQgetlength( m_result, m_row , columnIndex -1 ) ,
- (*m_ppSettings)->encoding );
+ ConnectionSettings::encoding );
}
return ret;
@@ -160,7 +160,7 @@ sal_Int32 ResultSet::findColumn( const OUString& columnName )
MutexGuard guard( m_refMutex->mutex );
checkClosed();
sal_Int32 res = PQfnumber( m_result,
- OUStringToOString( columnName, (*m_ppSettings)->encoding ).getStr());
+ OUStringToOString( columnName, ConnectionSettings::encoding ).getStr());
/* PQfnumber return -1 for not found, which is what we want
* other than that we use col number as 1-based not 0-based */
if(res >= 0)
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index c2e64df1efcc..2a256a70fe14 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -144,7 +144,7 @@ ResultSetMetaData::ResultSetMetaData(
& ( m_colDesc[col].precision ),
& ( m_colDesc[col].scale ) );
char *name = PQfname( pResult, col );
- m_colDesc[col].name = OUString( name, strlen(name) , (*m_ppSettings)->encoding );
+ m_colDesc[col].name = OUString( name, strlen(name) , ConnectionSettings::encoding );
m_colDesc[col].typeOid = PQftype( pResult, col );
m_colDesc[col].type = css::sdbc::DataType::LONGVARCHAR;
}
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index f6394fd6b27c..5aaef394e089 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -243,7 +243,7 @@ void Statement::raiseSQLException(
OUStringBuffer buf(128);
buf.append( "pq_driver: ");
buf.append(
- OUString( errorMsg, strlen(errorMsg) , m_pSettings->encoding ) );
+ OUString( errorMsg, strlen(errorMsg), ConnectionSettings::encoding ) );
buf.append( " (caused by statement '" );
buf.append( sql );
buf.append( "')" );
@@ -294,9 +294,9 @@ static void raiseSQLException(
buf.append( "]" );
}
buf.append(
- OUString( errorMsg, strlen(errorMsg) , pSettings->encoding ) );
+ OUString( errorMsg, strlen(errorMsg) , ConnectionSettings::encoding ) );
buf.append( " (caused by statement '" );
- buf.append( OStringToOUString( sql, pSettings->encoding ) );
+ buf.append( OStringToOUString( sql, ConnectionSettings::encoding ) );
buf.append( "')" );
OUString error = buf.makeStringAndClear();
log(pSettings, LogLevel::Error, error);
@@ -351,7 +351,7 @@ static std::vector< OUString > lookupKeys(
{
OStringBuffer buf( 128 );
buf.append( "Can't offer updateable result set because table " );
- buf.append( OUStringToOString(name, pSettings->encoding) );
+ buf.append( OUStringToOString(name, ConnectionSettings::encoding) );
buf.append( " is duplicated, add schema to resolve ambiguity" );
log(pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
}
@@ -368,7 +368,7 @@ static std::vector< OUString > lookupKeys(
{
OStringBuffer buf( 128 );
buf.append( "Can't offer updateable result set ( table " );
- buf.append( OUStringToOString(table, pSettings->encoding) );
+ buf.append( OUStringToOString(table, ConnectionSettings::encoding) );
buf.append( " is unknown)" );
log(pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
}
@@ -415,7 +415,7 @@ static std::vector< OUString > lookupKeys(
{
OStringBuffer buf( 128 );
buf.append( "Can't offer updateable result set ( table " );
- buf.append( OUStringToOString(table, pSettings->encoding) );
+ buf.append( OUStringToOString(table, ConnectionSettings::encoding) );
buf.append( " does not have a primary key)" );
log(pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
}
@@ -454,8 +454,8 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
// in case it was a single insert, extract the name of the table,
// otherwise the table name is empty
*(data->pLastTableInserted) =
- extractTableFromInsert( OStringToOUString( cmd, pSettings->encoding ) );
- if (isLog(pSettings, LogLevel::Sql))
+ extractTableFromInsert( OStringToOUString( cmd, ConnectionSettings::encoding ) );
+ if( isLog( pSettings, LogLevel::Sql ) )
{
OStringBuffer buf( 128 );
buf.append( "executed command '" );
@@ -472,7 +472,7 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
buf.append( *(data->pLastOidInserted) );
buf.append( ", diagnosedTable=" );
buf.append(
- OUStringToOString( *data->pLastTableInserted, pSettings->encoding ) );
+ OUStringToOString( *data->pLastTableInserted, ConnectionSettings::encoding ) );
}
log(pSettings, LogLevel::Sql, buf.makeStringAndClear().getStr());
}
@@ -490,7 +490,7 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
tokenizeSQL( cmd, vec );
OUString sourceTable =
OStringToOUString(
- extractSingleTableFromSelect( vec ), pSettings->encoding );
+ extractSingleTableFromSelect( vec ), ConnectionSettings::encoding );
if( data->concurrency ==
css::sdbc::ResultSetConcurrency::UPDATABLE )
@@ -513,7 +513,7 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
if( -1 == PQfnumber(
result,
OUStringToOString( sourceTableKeys[i] ,
- pSettings->encoding ).getStr()) )
+ ConnectionSettings::encoding ).getStr()) )
{
break;
}
@@ -539,11 +539,11 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
{
OStringBuffer buf( 128 );
buf.append( "can't support updateable resultset for table " );
- buf.append( OUStringToOString( schema, pSettings->encoding ) );
+ buf.append( OUStringToOString( schema, ConnectionSettings::encoding ) );
buf.append( "." );
- buf.append( OUStringToOString( table, pSettings->encoding ) );
+ buf.append( OUStringToOString( table, ConnectionSettings::encoding ) );
buf.append( ", because resultset does not contain a part of the primary key ( column " );
- buf.append( OUStringToOString( sourceTableKeys[i], pSettings->encoding ) );
+ buf.append( OUStringToOString( sourceTableKeys[i], ConnectionSettings::encoding ) );
buf.append( " is missing )" );
aReason = buf.makeStringAndClear();
}
@@ -552,9 +552,9 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
OStringBuffer buf( 128 );
buf.append( "can't support updateable resultset for table " );
- buf.append( OUStringToOString( schema, pSettings->encoding ) );
+ buf.append( OUStringToOString( schema, ConnectionSettings::encoding ) );
buf.append( "." );
- buf.append( OUStringToOString( table, pSettings->encoding ) );
+ buf.append( OUStringToOString( table, ConnectionSettings::encoding ) );
buf.append( ", because resultset table does not have a primary key " );
aReason = buf.makeStringAndClear();
}
@@ -580,7 +580,7 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
new FakedUpdateableResultSet(
data->refMutex, data->owner,
data->ppSettings,result, schema, table,
- OStringToOUString( aReason, pSettings->encoding) );
+ OStringToOUString( aReason, ConnectionSettings::encoding) );
}
}
@@ -751,13 +751,13 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
for( int i = 0 ; i < keyColumnNames.getLength() ; i ++ )
{
OUString value;
- OString columnName = OUStringToOString( keyColumnNames[i], pConnectionSettings->encoding );
+ OString columnName = OUStringToOString( keyColumnNames[i], ConnectionSettings::encoding );
String2StringMap::const_iterator ii = namedValues.begin();
for( ; ii != namedValues.end() ; ++ii )
{
if( columnName.equalsIgnoreAsciiCase( ii->first ) )
{
- value = OStringToOUString( ii->second , pConnectionSettings->encoding );
+ value = OStringToOUString( ii->second , ConnectionSettings::encoding );
break;
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 4e6df8b0fdf2..53a75134d0be 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -96,7 +96,7 @@ OUString concatQualified( const OUString & a, const OUString &b)
static inline OString iOUStringToOString( const OUString& str, ConnectionSettings *settings) {
OSL_ENSURE(settings, "pgsql-sdbc: OUStringToOString got NULL settings");
- return OUStringToOString( str, settings->encoding );
+ return OUStringToOString( str, ConnectionSettings::encoding );
}
OString OUStringToOString( const OUString& str, ConnectionSettings *settings) {
@@ -118,7 +118,7 @@ void bufferEscapeConstant( OUStringBuffer & buf, const OUString & value, Connect
// (X/Open SQL CLI, March 1995, ISBN: 1-85912-081-4, X/Open Document Number: C451)
// 22018 is for "Invalid character value" and seems to be the best match.
// We have no good XInterface Reference to pass here, so just give NULL
- throw SQLException(OUString(errstr, strlen(errstr), settings->encoding),
+ throw SQLException(OUString(errstr, strlen(errstr), ConnectionSettings::encoding),
nullptr,
OUString("22018"),
-1,
@@ -164,7 +164,7 @@ static inline void ibufferQuoteIdentifier( OUStringBuffer & buf, const OUString
{
char *errstr = PQerrorMessage(settings->pConnection);
// Implementation-defined SQLACCESS error
- throw SQLException(OUString(errstr, strlen(errstr), settings->encoding),
+ throw SQLException(OUString(errstr, strlen(errstr), ConnectionSettings::encoding),
nullptr,
OUString("22018"),
-1,
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index ca28001d07c1..64033eb9d647 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -92,14 +92,13 @@ css::uno::Reference< css::sdbc::XCloseable > UpdateableResultSet::createFromPGRe
const OUString &table,
const std::vector< OUString > &primaryKey )
{
- ConnectionSettings *pSettings = *ppSettings;
sal_Int32 columnCount = PQnfields( result );
sal_Int32 rowCount = PQntuples( result );
std::vector< OUString > columnNames( columnCount );
for( int i = 0 ; i < columnCount ; i ++ )
{
char * name = PQfname( result, i );
- columnNames[i] = OUString( name, strlen(name), pSettings->encoding );
+ columnNames[i] = OUString( name, strlen(name), ConnectionSettings::encoding );
}
std::vector< std::vector< Any > > data( rowCount );
@@ -115,7 +114,7 @@ css::uno::Reference< css::sdbc::XCloseable > UpdateableResultSet::createFromPGRe
char * val = PQgetvalue( result, row, col );
aRow[col] = makeAny(
- OUString( val, strlen( val ) , (*ppSettings)->encoding ) );
+ OUString( val, strlen( val ), ConnectionSettings::encoding ) );
}
}
data[row] = aRow;
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index 512554a53ad7..cfb4bc5af733 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -284,10 +284,10 @@ void Columns::refresh()
{
OStringBuffer buf;
buf.append( "sdbcx.Columns get refreshed for table " );
- buf.append( OUStringToOString( m_schemaName, m_pSettings->encoding ) );
+ buf.append( OUStringToOString( m_schemaName, ConnectionSettings::encoding ) );
buf.append( "." );
- buf.append( OUStringToOString( m_tableName, m_pSettings->encoding ) );
- log(m_pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
+ buf.append( OUStringToOString( m_tableName, ConnectionSettings::encoding ) );
+ log( m_pSettings, LogLevel::Info, buf.makeStringAndClear().getStr() );
}
osl::MutexGuard guard( m_refMutex->mutex );
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
index 5446e5da2132..b8b4738a045a 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
@@ -109,8 +109,8 @@ void IndexColumns::refresh()
{
OStringBuffer buf;
buf.append( "sdbcx.IndexColumns get refreshed for index " );
- buf.append( OUStringToOString( m_indexName, m_pSettings->encoding ) );
- log(m_pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
+ buf.append( OUStringToOString( m_indexName, ConnectionSettings::encoding ) );
+ log( m_pSettings, LogLevel::Info, buf.makeStringAndClear().getStr() );
}
osl::MutexGuard guard( m_refMutex->mutex );
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.cxx b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
index cb46da6fb30a..b5f2c871eff0 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
@@ -98,10 +98,10 @@ void Indexes::refresh()
{
OStringBuffer buf;
buf.append( "sdbcx.Indexes get refreshed for table " );
- buf.append( OUStringToOString( m_schemaName, m_pSettings->encoding ) );
+ buf.append( OUStringToOString( m_schemaName, ConnectionSettings::encoding ) );
buf.append( "." );
- buf.append( OUStringToOString( m_tableName,m_pSettings->encoding ) );
- log(m_pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
+ buf.append( OUStringToOString( m_tableName, ConnectionSettings::encoding ) );
+ log( m_pSettings, LogLevel::Info, buf.makeStringAndClear().getStr() );
}
osl::MutexGuard guard( m_refMutex->mutex );
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
index 75ee394352fa..e5e1ddb748c8 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
@@ -95,10 +95,10 @@ void KeyColumns::refresh()
{
OStringBuffer buf;
buf.append( "sdbcx.KeyColumns get refreshed for table " );
- buf.append( OUStringToOString( m_schemaName, m_pSettings->encoding ) );
+ buf.append( OUStringToOString( m_schemaName, ConnectionSettings::encoding ) );
buf.append( "." );
- buf.append( OUStringToOString( m_tableName, m_pSettings->encoding ) );
- log(m_pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
+ buf.append( OUStringToOString( m_tableName, ConnectionSettings::encoding ) );
+ log( m_pSettings, LogLevel::Info, buf.makeStringAndClear().getStr() );
}
osl::MutexGuard guard( m_refMutex->mutex );
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
index f1d5de67dafe..ddfbdbca7d56 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
@@ -113,9 +113,9 @@ void Keys::refresh()
if (isLog(m_pSettings, LogLevel::Info))
{
OString buf( "sdbcx.Keys get refreshed for table " +
- OUStringToOString( m_schemaName, m_pSettings->encoding ) +
- "." + OUStringToOString( m_tableName,m_pSettings->encoding ));
- log(m_pSettings, LogLevel::Info, buf.getStr());
+ OUStringToOString( m_schemaName, ConnectionSettings::encoding ) +
+ "." + OUStringToOString( m_tableName, ConnectionSettings::encoding ));
+ log( m_pSettings, LogLevel::Info, buf.getStr() );
}
osl::MutexGuard guard( m_refMutex->mutex );
diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx
index 24492cecb995..3711aed8b473 100644
--- a/connectivity/source/inc/dbase/DTable.hxx
+++ b/connectivity/source/inc/dbase/DTable.hxx
@@ -93,7 +93,6 @@ namespace connectivity
DBFMemoHeader m_aMemoHeader;
SvStream* m_pMemoStream;
rtl_TextEncoding m_eEncoding;
- bool m_bWriteableMemo;
void alterColumn(sal_Int32 index,
const css::uno::Reference< css::beans::XPropertySet>& descriptor ,
diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx
index ef117aadf1f2..d6ac6f43835c 100644
--- a/connectivity/source/inc/odbc/OResultSet.hxx
+++ b/connectivity/source/inc/odbc/OResultSet.hxx
@@ -144,7 +144,6 @@ namespace connectivity
SQLRETURN m_nCurrentFetchState;
bool m_bWasNull;
bool m_bEOF; // after last record
- bool m_bFreeHandle;
bool m_bInserting;
bool m_bRowInserted;
bool m_bRowDeleted;