summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Gomez <agomez@igalia.com>2013-06-04 13:51:40 +0300
committerJavier Fernandez <jfernandez@igalia.com>2013-06-06 09:37:44 +0000
commit31870fee1d9beef0ce537061361fef8619bf36ff (patch)
tree59a0ee2ebffd0c63aafb1f7eeee910f7f5d42134
parentfb-sdbc: test file moved to a generic place (diff)
downloadcore-31870fee1d9beef0ce537061361fef8619bf36ff.tar.gz
core-31870fee1d9beef0ce537061361fef8619bf36ff.zip
fb-sdbc: Added logging support
Remember that in order to enable the logging output it is needed to properly set the SAL_LOG environment variable. For example: $ SAL_LOG="+INFO.connectivity.firebird" solver/unxlngx6/installation/opt/program/soffice.bin
-rw-r--r--connectivity/source/drivers/firebird/FConnection.cxx39
-rw-r--r--connectivity/source/drivers/firebird/FDatabaseMetaData.cxx31
-rw-r--r--connectivity/source/drivers/firebird/FDriver.cxx3
-rw-r--r--connectivity/source/drivers/firebird/FPreparedStatement.cxx33
-rw-r--r--connectivity/source/drivers/firebird/FResultSet.cxx18
-rw-r--r--connectivity/source/drivers/firebird/FStatement.cxx20
-rw-r--r--include/sal/log-areas.dox1
7 files changed, 84 insertions, 61 deletions
diff --git a/connectivity/source/drivers/firebird/FConnection.cxx b/connectivity/source/drivers/firebird/FConnection.cxx
index c4429fb921db..82549ada89d5 100644
--- a/connectivity/source/drivers/firebird/FConnection.cxx
+++ b/connectivity/source/drivers/firebird/FConnection.cxx
@@ -76,7 +76,7 @@ OConnection::~OConnection()
//-----------------------------------------------------------------------------
void SAL_CALL OConnection::release() throw()
{
- printf("DEBUG !!! connectivity.firebird => OConnection::release() \n" );
+ SAL_INFO("connectivity.firebird", "=> OConnection::release().");
relase_ChildImpl();
}
@@ -88,21 +88,20 @@ void SAL_CALL OConnection::release() throw()
*/
static int pr_error (long* status, char* operation)
{
- printf("[\n");
- printf("PROBLEM ON \"%s\".\n", operation);
+ SAL_WARN("connectivity.firebird", "=> OConnection static pr_error().");
isc_print_status(status);
- printf("SQLCODE:%d\n", isc_sqlcode(status));
-
- printf("]\n");
+ SAL_WARN("connectivity.firebird", "=> OConnection static pr_error(). "
+ "PROBLEM ON " << operation << ". "
+ "SQLCODE: " << isc_sqlcode(status) << ".");
return 1;
}
void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
{
- printf("DEBUG !!! connectivity.firebird => OConnection::construct() \n" );
+ SAL_INFO("connectivity.firebird", "=> OConnection::construct()." );
osl_atomic_increment( &m_refCount );
@@ -123,7 +122,7 @@ IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.firebird.OConnect
// --------------------------------------------------------------------------------
Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException)
{
- printf("DEBUG !!! connectivity.firebird => OConnection::createStatement got called \n");
+ SAL_INFO("connectivity.firebird", "=> OConnection::createStatement().");
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
@@ -137,8 +136,8 @@ Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLExcep
// --------------------------------------------------------------------------------
Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
{
- printf("DEBUG !!! connectivity.firebird => OConnection::prepareStatement got called with sql: %s \n",
- OUStringToOString(_sSql , RTL_TEXTENCODING_ASCII_US ).getStr());
+ SAL_INFO("connectivity.firebird", "=> OConnection::prepareStatement(). "
+ "Got called with sql: " << _sSql);
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
@@ -147,14 +146,16 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::
if(m_aTypeInfo.empty())
buildTypeInfo();
- printf("DEBUG !!! connectivity.firebird => OConnection::prepareStatement Creating prepared statement. \n");
+ SAL_INFO("connectivity.firebird", "=> OConnection::prepareStatement(). "
+ "Creating prepared statement.");
// create a statement
// the statement can only be executed more than once
Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,m_aTypeInfo,_sSql);
m_aStatements.push_back(WeakReferenceHelper(xReturn));
- printf("DEBUG !!! connectivity.firebird => OConnection::prepareStatement Prepared Statement created. \n");
+ SAL_INFO("connectivity.firebird", "=> OConnection::prepareStatement(). "
+ "Prepared Statement created.");
return xReturn;
}
@@ -220,7 +221,7 @@ sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException
// --------------------------------------------------------------------------------
Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
{
- printf ("DEBUG !!! connectivity.firebird => OConnection::getMetaData() \n");
+ SAL_INFO("connectivity.firebird", "=> OConnection::getMetaData().");
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
@@ -309,7 +310,7 @@ void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::contai
// XCloseable
void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
{
- printf("DEBUG !!! connectivity.firebird => OConnection::close() \n" );
+ SAL_INFO("connectivity.firebird", "=> OConnection::close().");
// we just dispose us
{
@@ -334,7 +335,7 @@ void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeExceptio
//--------------------------------------------------------------------
void OConnection::buildTypeInfo() throw( SQLException)
{
- printf("DEBUG !!! connectivity.firebird => OConnection::buildTypeInfo() got called \n");
+ SAL_INFO("connectivity.firebird", "=> OConnection::buildTypeInfo().");
::osl::MutexGuard aGuard( m_aMutex );
@@ -373,19 +374,21 @@ void OConnection::buildTypeInfo() throw( SQLException)
m_aTypeInfo.push_back(aInfo);
}
- printf("DEBUG !!! connectivity.firebird => OConnection::buildTypeInfo() type info built. \n");
+ SAL_INFO("connectivity.firebird", "=> OConnection::buildTypeInfo(). "
+ "Type info built.");
// Close the result set/statement.
Reference< XCloseable> xClose(xRs,UNO_QUERY);
xClose->close();
- printf("DEBUG !!! connectivity.firebird => OConnection::buildTypeInfo() closed. \n");
+ SAL_INFO("connectivity.firebird", "=> OConnection::buildTypeInfo(). "
+ "Closed.");
}
//------------------------------------------------------------------------------
void OConnection::disposing()
{
- printf("DEBUG !!! connectivity.firebird => OConnection::disposing(). \n");
+ SAL_INFO("connectivity.firebird", "=> OConnection::disposing().");
// we noticed that we should be destroied in near future so we have to dispose our statements
::osl::MutexGuard aGuard(m_aMutex);
diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
index b20ec5463ab4..c952c0f50220 100644
--- a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
@@ -790,7 +790,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE
// -------------------------------------------------------------------------
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException)
{
- printf("DEBUG !!! connectivity.firebird => ODatabaseMetaData::getTypeInfo got called \n");
+ SAL_INFO("connectivity.firebird", "=> ODatabaseMetaData::getTypeInfo().");
// this returns an empty resultset where the column-names are already set
// in special the metadata of the resultset already returns the right columns
@@ -858,9 +858,9 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
const Any& catalog, const ::rtl::OUString& schemaPattern,
const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
{
- printf("DEBUG !!! connectivity.firebird => ODatabaseMetaData::getTables() got called with schemaPattern: %s and tableNamePattern: %s \n",
- OUStringToOString( schemaPattern, RTL_TEXTENCODING_ASCII_US ).getStr(),
- OUStringToOString( tableNamePattern, RTL_TEXTENCODING_ASCII_US ).getStr());
+ SAL_INFO("connectivity.firebird", "=> ODatabaseMetaData::getTables(). "
+ "Got called with schemaPattern: " << schemaPattern << " , "
+ "TableNamePattern: " << tableNamePattern);
ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
Reference< XResultSet > xResultSet = pResultSet;
@@ -873,13 +873,15 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
"AND 'schema' LIKE ? "
"AND RDB$RELATION_NAME LIKE ? ");
- printf("DEBUG !!! connectivity.firebird => ODatabaseMetaData::getTables() Setting query parameters. \n");
+ SAL_INFO("connectivity.firebird", "=> ODatabaseMetaData::getTables(). "
+ "Setting query parameters.");
Reference< XParameters > parameters( statement, UNO_QUERY_THROW );
parameters->setString( 1 , schemaPattern );
parameters->setString( 2 , tableNamePattern );
- printf("DEBUG !!! connectivity.firebird => ODatabaseMetaData::getTables() About to execute the query. \n");
+ SAL_INFO("connectivity.firebird", "=> ODatabaseMetaData::getTables(). "
+ "About to execute the query.");
Reference< XResultSet > rs = statement->executeQuery();
Reference< XRow > xRow( rs, UNO_QUERY_THROW );
@@ -897,14 +899,17 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
rows++;
if (rows < 10)
- printf("DEBUG !!! row %i : ", rows);
+ SAL_INFO("connectivity.firebird", "=> ODatabaseMetaData::getTables(). "
+ "Row: " << rows);
else
- printf("DEBUG !!! row %i: ", rows);
- printf("%s | ", OUStringToOString( schema, RTL_TEXTENCODING_UTF8 ).getStr());
- printf("%s | ", OUStringToOString( aTableName, RTL_TEXTENCODING_UTF8 ).getStr());
- printf("%i | ", systemFlag);
- printf("%i | ", systemFlag);
- printf("%s | \n", OUStringToOString( desc, RTL_TEXTENCODING_UTF8 ).getStr());
+ SAL_INFO("connectivity.firebird", "=> ODatabaseMetaData::getTables(). "
+ "Row: " << rows);
+ SAL_INFO("connectivity.firebird", "=> ODatabaseMetaData::getTables(). "
+ << schema << " | "
+ << aTableName << " | "
+ << systemFlag << " | "
+ << systemFlag << " | "
+ << OUStringToOString);
OUString aTableType;
if( 1 == systemFlag )
diff --git a/connectivity/source/drivers/firebird/FDriver.cxx b/connectivity/source/drivers/firebird/FDriver.cxx
index 98be858a6704..d58fb20cc45a 100644
--- a/connectivity/source/drivers/firebird/FDriver.cxx
+++ b/connectivity/source/drivers/firebird/FDriver.cxx
@@ -49,6 +49,7 @@ namespace connectivity
//------------------------------------------------------------------
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL FirebirdDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
{
+ SAL_INFO("connectivity.firebird", "=> ODriver_BASE::FirebirdDriver_CreateInstance()" );
return *(new FirebirdDriver());
}
}
@@ -120,6 +121,8 @@ Sequence< ::rtl::OUString > SAL_CALL FirebirdDriver::getSupportedServiceNames(
// --------------------------------------------------------------------------------
Reference< XConnection > SAL_CALL FirebirdDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
{
+ SAL_INFO("connectivity.firebird", "=> ODriver_BASE::connect(), URL: " << url );
+
// create a new connection with the given properties and append it to our vector
OConnection* pCon = new OConnection(this);
Reference< XConnection > xCon = pCon; // important here because otherwise the connection could be deleted inside (refcount goes -> 0)
diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.cxx b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
index 3e058aa46b24..6a146acfbb39 100644
--- a/connectivity/source/drivers/firebird/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
@@ -65,14 +65,13 @@ IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.firebird.PreparedS
*/
static int pr_error (long* status, char* operation)
{
- printf("[\n");
- printf("PROBLEM ON \"%s\".\n", operation);
+ SAL_WARN("connectivity.firebird", "=> OPreparedStatement static pr_error().");
isc_print_status(status);
- printf("SQLCODE:%d\n", isc_sqlcode(status));
-
- printf("]\n");
+ SAL_WARN("connectivity.firebird", "=> OPreparedStatement static pr_error(). "
+ "PROBLEM ON " << operation << ". "
+ "SQLCODE: " << isc_sqlcode(status) << ".");
return 1;
}
@@ -85,6 +84,9 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInf
,m_sSqlStatement(sql)
,m_nNumParams(0)
{
+ SAL_INFO("connectivity.firebird", "=> OPreparedStatement::OPreparedStatement_BASE(). "
+ "sql: " << sql);
+
ISC_STATUS_ARRAY status; // status vector
isc_db_handle db = _pConnection->getDBHandler(); // database handle
@@ -253,7 +255,7 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) thr
void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException)
{
- printf("DEBUG !!! connectivity.firebird => OPreparedStatement::close() \n");
+ SAL_INFO("connectivity.firebird", "=> OPreparedStatement::close()");
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
@@ -297,18 +299,23 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run
void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
{
+ SAL_INFO("connectivity.firebird", "=> OPreparedStatement::setString(). "
+ "parameterIndex: " << parameterIndex << " , "
+ "x: " << x);
+
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
if (NULL == m_INsqlda)
{
- printf ("DEBUG !!! OPreparedStatement::setString => The query has not input parameters \n.");
+ SAL_WARN("connectivity.firebird", "=> OPreparedStatement::setString(). "
+ "The query has not input parameters.");
return;
}
OString str = OUStringToOString(x , RTL_TEXTENCODING_UTF8 );
- printf ("DEBUG !!! OPreparedStatement::setString => Setting parameter %i as: %s \n.",
- parameterIndex, str.getStr());
+ SAL_INFO("connectivity.firebird", "=> OPreparedStatement::setString(). "
+ "Setting parameter as: " << str);
XSQLVAR *var = m_INsqlda->sqlvar + (parameterIndex - 1);
@@ -340,9 +347,8 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ
Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
{
- char *sqlStr = strdup(OUStringToOString( m_sSqlStatement, RTL_TEXTENCODING_ASCII_US ).getStr());
- printf("DEBUG !!! connectivity.firebird => OPreparedStatement::executeQuery() got called with sql: %s \n", sqlStr);
- free(sqlStr);
+ SAL_INFO("connectivity.firebird", "=> OPreparedStatement::executeQuery(). "
+ "Got called with sql: " << m_sSqlStatement);
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
@@ -369,7 +375,8 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE
if (pr_error(status, "start transaction"))
return NULL;
- printf("DEBUG !!! connectivity.firebird => OPreparedStatement::executeQuery() Query executed.\n");
+ SAL_INFO("connectivity.firebird", "=> OPreparedStatement::executeQuery(). "
+ "Query executed.");
return xRS;
}
diff --git a/connectivity/source/drivers/firebird/FResultSet.cxx b/connectivity/source/drivers/firebird/FResultSet.cxx
index 07d68d55f74b..6a2dcabde8a9 100644
--- a/connectivity/source/drivers/firebird/FResultSet.cxx
+++ b/connectivity/source/drivers/firebird/FResultSet.cxx
@@ -60,14 +60,13 @@ using namespace com::sun::star::util;
*/
static int pr_error (long* status, char* operation)
{
- printf("[\n");
- printf("PROBLEM ON \"%s\".\n", operation);
+ SAL_WARN("connectivity.firebird", "=> OResultSet static pr_error().");
isc_print_status(status);
- printf("SQLCODE:%d\n", isc_sqlcode(status));
-
- printf("]\n");
+ SAL_WARN("connectivity.firebird", "=> OResultSet static pr_error(). "
+ "PROBLEM ON " << operation << ". "
+ "SQLCODE: " << isc_sqlcode(status) << ".");
return 1;
}
@@ -109,6 +108,8 @@ OResultSet::OResultSet(OStatement_Base* pStmt)
,m_bWasNull(sal_True)
,m_row(-1)
{
+ SAL_INFO("connectivity.firebird", "=> OResultSet::OResultSet().");
+
isc_stmt_handle stmt = m_pStatement->getSTMTHandler();
XSQLDA *sqlda = m_pStatement->getOUTsqlda();
if (sqlda == NULL)
@@ -137,7 +138,8 @@ OResultSet::OResultSet(OStatement_Base* pStmt)
}
if (retcode != 100L)
{
- printf("DEBUG !!! retcode %i: ", retcode);
+ SAL_INFO("connectivity.firebird", "=> OResultSet::OResultSet(). "
+ "Retcode: " << retcode);
if (pr_error(status, "fetch data"))
return;
}
@@ -152,7 +154,7 @@ OResultSet::~OResultSet()
// -------------------------------------------------------------------------
void OResultSet::disposing(void)
{
- printf("DEBUG !!! connectivity.firebird => OResultSet::disposing() \n" );
+ SAL_INFO("connectivity.firebird", "=> OResultSet::disposing().");
OPropertySetHelper::disposing();
@@ -464,7 +466,7 @@ void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
{
- printf("DEBUG !!! connectivity.firebird => OResultSet::close() \n" );
+ SAL_INFO("connectivity.firebird", "=> OResultSet::close().");
{
::osl::MutexGuard aGuard( m_aMutex );
diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx
index 42195e84f336..6d3a9ed3c789 100644
--- a/connectivity/source/drivers/firebird/FStatement.cxx
+++ b/connectivity/source/drivers/firebird/FStatement.cxx
@@ -85,7 +85,7 @@ void OStatement_Base::disposeResultSet()
//------------------------------------------------------------------------------
void OStatement_BASE2::disposing()
{
- printf("DEBUG !!! connectivity.firebird => OStatement_BASE2::disposing() \n");
+ SAL_INFO("connectivity.firebird", "=> OStatement_BASE2::disposing().");
::osl::MutexGuard aGuard(m_aMutex);
@@ -146,7 +146,7 @@ void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
{
- printf("DEBUG !!! connectivity.firebird => OStatement_Base::close() \n");
+ SAL_INFO("connectivity.firebird", "=> OStatement_Base::close().");
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -178,23 +178,24 @@ sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(S
*/
static int pr_error (long* status, char* operation)
{
- printf("[\n");
- printf("PROBLEM ON \"%s\".\n", operation);
+ SAL_WARN("connectivity.firebird", "=> OStatement_Base static pr_error().");
isc_print_status(status);
- printf("SQLCODE:%d\n", isc_sqlcode(status));
-
- printf("]\n");
+ SAL_WARN("connectivity.firebird", "=> OStatement_Base static pr_error(). "
+ "PROBLEM ON " << operation << ". "
+ "SQLCODE: " << isc_sqlcode(status) << ".");
return 1;
}
Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
{
+ SAL_INFO("connectivity.firebird", "=> OStatement_Base::executeQuery(). "
+ "Got called with sql: " << sql);
+
char sqlStr[128];
strcpy(sqlStr, OUStringToOString( sql, RTL_TEXTENCODING_ASCII_US ).getStr());
- printf("DEBUG !!! connectivity.firebird => OStatement_Base::executeQuery() got called with sql: %s \n", sqlStr);
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
@@ -243,7 +244,8 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUS
if (isc_commit_transaction (status, &trans))
isc_print_status(status);
- printf("DEBuG !!! connectivity.firebird => OStatement_Base::executeQuery() Changes committed.\n");
+ SAL_INFO("connectivity.firebird", "=> OStatement_Base::executeQuery(). "
+ "Changes committed.");
m_xResultSet = xRS; // we nedd a reference to it for later use
return xRS;
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index a6d14de10475..072e1e5a865e 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -53,6 +53,7 @@ certain functionality.
@li @c connectivity.cpool
@li @c connectivity.commontools
+@li @c connectivity.firebird
@li @c connectivity.mork
@li @c connectivity.flat
@li @c connectivity.parse