[Libreoffice-commits] .: Branch 'feature/mork' - connectivity/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Sep 16 05:12:55 PDT 2012
connectivity/source/drivers/mork/MConnection.cxx | 44 +
connectivity/source/drivers/mork/MConnection.hxx | 3
connectivity/source/drivers/mork/MDatabaseMetaData.hxx | 1
connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx | 1
connectivity/source/drivers/mork/MDriver.cxx | 3
connectivity/source/drivers/mork/MErrorResource.hxx | 71 ++
connectivity/source/drivers/mork/MQueryHelper.cxx | 22
connectivity/source/drivers/mork/MQueryHelper.hxx | 119 +++
connectivity/source/drivers/mork/MResultSet.cxx | 389 +++++++++--
connectivity/source/drivers/mork/MResultSet.hxx | 4
connectivity/source/drivers/mork/MStatement.cxx | 16
connectivity/source/inc/resource/conn_shared_res.hrc | 2
connectivity/source/inc/resource/mork_res.hrc | 63 +
13 files changed, 660 insertions(+), 78 deletions(-)
New commits:
commit e1dcf3bfb8308c586e764d56697379c0c86073b8
Author: David Ostrovsky <david at ostrovsky.org>
Date: Sun Sep 16 14:10:14 2012 +0200
mork driver: add Sorting
Change-Id: I4442bf72e75912a6fc4eeed0020549c481b60fb8
diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx
index 9a7ae5b..bb16d72 100644
--- a/connectivity/source/drivers/mork/MConnection.cxx
+++ b/connectivity/source/drivers/mork/MConnection.cxx
@@ -20,6 +20,7 @@
#include <connectivity/dbexception.hxx>
#include <connectivity/sqlerror.hxx>
+#include "resource/mork_res.hrc"
#include "resource/common_res.hrc"
#include <com/sun/star/sdbc/ColumnValue.hpp>
@@ -346,7 +347,50 @@ Reference< XTablesSupplier > SAL_CALL OConnection::createCatalog()
}
// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Reference< XInterface >& _rxContext )
+{
+ if ( _rError.getResId() != 0 )
+ {
+ OSL_ENSURE( ( _rError.getErrorCondition() == 0 ),
+ "OConnection::throwSQLException: unsupported error code combination!" );
+ ::rtl::OUString sParameter( _rError.getParameter() );
+ if ( !sParameter.isEmpty() )
+ {
+ const ::rtl::OUString sError( getResources().getResourceStringWithSubstitution(
+ _rError.getResId(),
+ "$1$", sParameter
+ ) );
+ ::dbtools::throwGenericSQLException( sError, _rxContext );
+ OSL_FAIL( "OConnection::throwSQLException: unreachable (1)!" );
+ }
+
+ throwGenericSQLException( _rError.getResId(), _rxContext );
+ OSL_FAIL( "OConnection::throwSQLException: unreachable (2)!" );
+ }
+
+ if ( _rError.getErrorCondition() != 0 )
+ {
+ SQLError aErrorHelper( getDriver()->getFactory() );
+ ::rtl::OUString sParameter( _rError.getParameter() );
+ if ( !sParameter.isEmpty() )
+ aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter );
+ else
+ aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext);
+ OSL_FAIL( "OConnection::throwSQLException: unreachable (3)!" );
+ }
+
+ throwGenericSQLException( STR_UNSPECIFIED_ERROR, _rxContext );
+}
+
+// -----------------------------------------------------------------------------
+void OConnection::throwSQLException( const sal_uInt16 _nErrorResourceId, const Reference< XInterface >& _rxContext )
+{
+ ErrorDescriptor aError;
+ aError.setResId( _nErrorResourceId );
+ throwSQLException( aError, _rxContext );
+}
} } // namespace connectivity::mork
diff --git a/connectivity/source/drivers/mork/MConnection.hxx b/connectivity/source/drivers/mork/MConnection.hxx
index fd478ff..5dd1a78 100644
--- a/connectivity/source/drivers/mork/MConnection.hxx
+++ b/connectivity/source/drivers/mork/MConnection.hxx
@@ -109,6 +109,9 @@ namespace connectivity
// Added to enable me to use SQLInterpreter which requires an
// XNameAccess i/f to access tables.
::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog();
+
+ void throwSQLException( const ErrorDescriptor& _rError, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
+ void throwSQLException( const sal_uInt16 _nErrorResourceId, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
};
}
}
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.hxx b/connectivity/source/drivers/mork/MDatabaseMetaData.hxx
index e0cbe18..28c84de 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaData.hxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaData.hxx
@@ -14,6 +14,7 @@
#include "connectivity/OSubComponent.hxx"
#include "MConnection.hxx"
+#include "MDatabaseMetaDataHelper.hxx"
#include "TDatabaseMetaDataBase.hxx"
#include <com/sun/star/beans/PropertyValue.hpp>
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx
index 553c630..d855315 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx
@@ -13,6 +13,7 @@
#include <comphelper/proparrhlp.hxx>
#include <comphelper/propertycontainer.hxx>
#include "FDatabaseMetaDataResultSet.hxx"
+#include "MErrorResource.hxx"
#include <MConnection.hxx>
#include <com/sun/star/uno/Sequence.hxx>
diff --git a/connectivity/source/drivers/mork/MDriver.cxx b/connectivity/source/drivers/mork/MDriver.cxx
index 04fdc16..c599892 100644
--- a/connectivity/source/drivers/mork/MDriver.cxx
+++ b/connectivity/source/drivers/mork/MDriver.cxx
@@ -11,6 +11,9 @@
#include "MConnection.hxx"
#include "MNSProfileDiscover.hxx"
+#include "resource/mork_res.hrc"
+#include "resource/common_res.hrc"
+
using namespace connectivity::mork;
namespace connectivity
diff --git a/connectivity/source/drivers/mork/MErrorResource.hxx b/connectivity/source/drivers/mork/MErrorResource.hxx
new file mode 100644
index 0000000..d0e4263
--- /dev/null
+++ b/connectivity/source/drivers/mork/MErrorResource.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECITIVITY_MORK_ERROR_RESOURCE_HXX
+#define CONNECITIVITY_MORK_ERROR_RESOURCE_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace connectivity
+{
+ namespace mork
+ {
+ class ErrorDescriptor
+ {
+ private:
+ sal_uInt16 m_nErrorResourceId;
+ sal_Int32 m_nErrorCondition;
+ ::rtl::OUString m_sParameter;
+
+ public:
+ ErrorDescriptor()
+ :m_nErrorResourceId(0)
+ ,m_nErrorCondition(0)
+ ,m_sParameter()
+ {
+ }
+
+ inline void set( const sal_uInt16 _nErrorResourceId, const sal_Int32 _nErrorCondition, const ::rtl::OUString& _rParam )
+ {
+ m_nErrorResourceId = _nErrorResourceId;
+ m_nErrorCondition = _nErrorCondition;
+ m_sParameter = _rParam;
+ }
+ inline void setResId( const sal_uInt16 _nErrorResourceId )
+ {
+ m_nErrorResourceId = _nErrorResourceId;
+ }
+ inline void reset()
+ {
+ m_nErrorResourceId = 0;
+ m_nErrorCondition = 0;
+ }
+
+ inline sal_uInt16 getResId() const { return m_nErrorResourceId; }
+ inline sal_Int32 getErrorCondition() const { return m_nErrorCondition; }
+ inline const ::rtl::OUString& getParameter() const { return m_sParameter; }
+
+ inline bool is() const { return ( m_nErrorResourceId != 0 ) || ( m_nErrorCondition != 0 ); }
+ };
+ }
+}
+
+#endif // CONNECITIVITY_MORK_ERROR_RESOURCE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx
index 7803d67..74fd046 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.cxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.cxx
@@ -88,6 +88,27 @@ MQueryHelper::~MQueryHelper()
OSL_TRACE("OUT MQueryHelper::~MQueryHelper()");
}
+// -------------------------------------------------------------------------
+void MQueryHelper::setAddressbook(::rtl::OUString &ab)
+{
+ OSL_TRACE("IN MQueryHelper::setAddressbook()");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ m_aAddressbook = ab;
+
+ OSL_TRACE("\tOUT MQuery::setAddressbook()");
+}
+// -------------------------------------------------------------------------
+void MQueryHelper::setExpression( MQueryExpression &_expr )
+{
+ OSL_TRACE("IN MQueryHelper::setExpression()");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ m_aExpr = _expr;
+
+ OSL_TRACE("\tOUT MQuery::setExpression()");
+}
+
void MQueryHelper::append(MQueryHelperResultEntry* resEnt)
{
// SAL_INFO("connectivity.mork", "MQueryHelper::append()" );
@@ -205,7 +226,6 @@ sal_Bool MQueryHelper::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const
sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection)
{
-// OSL_FAIL( "MQueryHelper::executeQuery" );
SAL_INFO("connectivity.mork", "MQueryHelper::executeQuery()" );
reset();
diff --git a/connectivity/source/drivers/mork/MQueryHelper.hxx b/connectivity/source/drivers/mork/MQueryHelper.hxx
index 8275837..5c5a6b8 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.hxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.hxx
@@ -30,11 +30,120 @@
#include <boost/unordered_map.hpp>
+#include "MErrorResource.hxx"
+
namespace connectivity
{
namespace mork
{
class OConnection;
+ class MQueryHelper;
+ class ErrorDescriptor;
+
+ namespace MQueryOp {
+ typedef enum {
+ Exists = 0,
+ DoesNotExist = 1,
+ Contains = 2,
+ DoesNotContain = 3,
+ Is = 4,
+ IsNot = 5,
+ BeginsWith = 6,
+ EndsWith = 7,
+ SoundsLike = 8,
+ RegExp = 9
+ } cond_type;
+ }
+
+ class MQueryExpressionBase {
+ public:
+ typedef enum {
+ Unknown,
+ StringExpr,
+ Expr
+ } node_type;
+
+ protected:
+ node_type m_eNodeType;
+
+ MQueryExpressionBase() : m_eNodeType( Unknown ) {}
+ MQueryExpressionBase( node_type _eNodeType ) : m_eNodeType( _eNodeType ) {}
+
+ public:
+ sal_Bool isUnknown( ) const { return m_eNodeType == Unknown; }
+ sal_Bool isStringExpr( ) const { return m_eNodeType == StringExpr; }
+ sal_Bool isExpr( ) const { return m_eNodeType == Expr; }
+ };
+
+ class MQueryExpressionString : public MQueryExpressionBase {
+ protected:
+ ::rtl::OUString m_aName; // LHS
+ MQueryOp::cond_type m_aBooleanCondition;
+ ::rtl::OUString m_aValue; // RHS
+
+ public:
+
+ MQueryExpressionString( ::rtl::OUString& lhs,
+ MQueryOp::cond_type cond,
+ ::rtl::OUString rhs )
+ : MQueryExpressionBase( MQueryExpressionBase::StringExpr )
+ , m_aName( lhs )
+ , m_aBooleanCondition( cond )
+ , m_aValue( rhs )
+ {
+ }
+
+ MQueryExpressionString( ::rtl::OUString& lhs,
+ MQueryOp::cond_type cond )
+ : MQueryExpressionBase( MQueryExpressionBase::StringExpr )
+ , m_aName( lhs )
+ , m_aBooleanCondition( cond )
+ , m_aValue( ::rtl::OUString() )
+ {
+ }
+
+ const ::rtl::OUString& getName() const { return m_aName; }
+ MQueryOp::cond_type getCond() const { return m_aBooleanCondition; }
+ const ::rtl::OUString& getValue() const { return m_aValue; }
+ };
+
+ class MQueryExpression : public MQueryExpressionBase
+ {
+ friend class MQueryHelper;
+
+ public:
+ typedef ::std::vector< MQueryExpressionBase* > ExprVector;
+
+ typedef enum {
+ AND,
+ OR
+ } bool_cond;
+
+ void setExpressions( ExprVector& _exprVector )
+ { m_aExprVector = _exprVector; }
+
+ // All expressions on a peer level use same condition operator
+ void setExpressionCondition( bool_cond _cond )
+ { m_aExprCondType = _cond; }
+
+ ExprVector& getExpressions( )
+ { return m_aExprVector; }
+
+ // All expressions on a peer level use same condition operator
+ bool_cond getExpressionCondition( ) const
+ { return m_aExprCondType; }
+
+ MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ),
+ m_aExprCondType( OR )
+ { m_aExprVector.clear(); }
+
+
+ protected:
+ ExprVector m_aExprVector;
+ bool_cond m_aExprCondType;
+
+ };
+
class MQueryHelperResultEntry
{
private:
@@ -66,6 +175,9 @@ namespace connectivity
void append(MQueryHelperResultEntry* resEnt );
void clear_results();
OColumnAlias m_rColumnAlias;
+ ErrorDescriptor m_aError;
+ ::rtl::OUString m_aAddressbook;
+ MQueryExpression m_aExpr;
/*
void clearResultOrComplete();
@@ -87,6 +199,13 @@ namespace connectivity
sal_Bool checkRowAvailable( sal_Int32 nDBRow );
sal_Bool getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType );
sal_Int32 executeQuery(OConnection* xConnection);
+
+ bool hadError() const { return m_aError.is(); }
+ inline const ErrorDescriptor& getError() const { return m_aError; }
+
+ void setAddressbook( ::rtl::OUString&);
+ void setExpression( MQueryExpression &_expr );
+
};
}
}
diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx
index 8363901..45b4782 100644
--- a/connectivity/source/drivers/mork/MResultSet.cxx
+++ b/connectivity/source/drivers/mork/MResultSet.cxx
@@ -38,6 +38,8 @@
#include "MResultSet.hxx"
#include "MResultSetMetaData.hxx"
#include "FDatabaseMetaDataResultSet.hxx"
+
+#include "resource/mork_res.hrc"
#include "resource/common_res.hrc"
#if OSL_DEBUG_LEVEL > 0
@@ -99,7 +101,6 @@ OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< conne
,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
,m_pSQLIterator( _pSQLIterator )
,m_pParseTree( _pSQLIterator->getParseTree() )
- // TODO
//,m_aQuery( pStmt->getOwnConnection()->getColumnAlias() )
,m_aQueryHelper(pStmt->getOwnConnection()->getColumnAlias())
,m_pTable(NULL)
@@ -395,10 +396,9 @@ sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw(
// Everything in the addressbook is a string!
//
if ( !m_aQueryHelper.getRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
- OSL_FAIL( "getRowValue: failed!" );
-// {
-// m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
-// }
+ {
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
+ }
}
}
return sal_True;
@@ -509,10 +509,11 @@ void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
}
// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
+void SAL_CALL OResultSet::close() throw(SQLException, RuntimeException)
{
ResultSetEntryGuard aGuard( *this );
OSL_TRACE("In/Out: OResultSet::close" );
+ OSL_FAIL( "OResultSet::close: going to dispose()" );
dispose();
}
// -------------------------------------------------------------------------
@@ -620,8 +621,7 @@ void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
OSL_TRACE("In/Out: OResultSet::refreshRow" );
if (fetchRow(getCurrentCardNumber(),sal_True)) {
//force fetch current row will cause we lose all change to the current row
- //m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_REFRESH_ROW, *this );
- SAL_WARN("connectivity.mork", "OResultSet::refreshRow(): STR_ERROR_REFRESH_ROW!");
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_REFRESH_ROW, *this );
}
}
// -------------------------------------------------------------------------
@@ -763,7 +763,6 @@ void OResultSet::parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMat
#endif
}
-#if 0
void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree,
MQueryExpression &queryExpression)
{
@@ -1052,13 +1051,101 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT
m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
}
}
-#endif
// -----------------------------------------------------------------------------
void OResultSet::fillRowData()
throw( ::com::sun::star::sdbc::SQLException )
{
+ OSL_ENSURE( m_pStatement, "Require a statement" );
+
+ MQueryExpression queryExpression;
+
+ OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
+ m_xColumns = m_pSQLIterator->getSelectColumns();
+
+ OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
+
+ OSQLColumns::Vector::const_iterator aIter = m_xColumns->get().begin();
+ const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
+ ::rtl::OUString sName;
+ m_aAttributeStrings.clear();
+ m_aAttributeStrings.reserve(m_xColumns->get().size());
+ for (sal_Int32 i = 1; aIter != m_xColumns->get().end();++aIter, i++)
+ {
+ (*aIter)->getPropertyValue(sProprtyName) >>= sName;
+#if OSL_DEBUG_LEVEL > 0
+ OSL_TRACE("Query Columns : (%d) %s", i, OUtoCStr(sName) );
+#endif
+ m_aAttributeStrings.push_back( sName );
+ }
+
+ // Generate Match Conditions for Query
+ const OSQLParseNode* pParseTree = m_pSQLIterator->getWhereTree();
+
+ m_bIsAlwaysFalseQuery = sal_False;
+ if ( pParseTree != NULL )
+ {
+ // Extract required info
+
+ OSL_TRACE("\tHave a Where Clause");
+
+ analyseWhereClause( pParseTree, queryExpression );
+ }
+#if 0
+ else
+ {
+ OSL_TRACE("\tDon't have a Where Clause");
+
+ MQueryExpression::ExprVector eVector;
+
+ // LDAP does not allow a query without restriction, so we add a dummy
+ // for PrimaryEmail
+ // For other types we stick to the old behaviour of using
+ // card:nsIAbCard.
+ OSL_ENSURE(m_pStatement, "Cannot determine Parent Statement");
+ ::rtl::OUString aStr;
+ if (xConnection->isLDAP())
+ aStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail"));
+ else
+ aStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("card:nsIAbCard"));
+ eVector.push_back( new MQueryExpressionString(aStr, MQueryOp::Exists) );
+
+ queryExpression.setExpressions( eVector );
+ }
+#endif
+
+ // If the query is a 0=1 then set Row count to 0 and return
+ if ( m_bIsAlwaysFalseQuery )
+ {
+ m_bIsReadOnly = 1;
+ return;
+ }
+
+ m_aQueryHelper.setExpression( queryExpression );
+
+ rtl::OUString aStr( m_pTable->getName() );
+ m_aQueryHelper.setAddressbook( aStr );
+
+ sal_Int32 rv = m_aQueryHelper.executeQuery(xConnection);
+ if ( rv == -1 ) {
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERR_EXECUTING_QUERY, *this );
+ }
+ //determine whether the address book is readonly
+ determineReadOnly();
+
+#if OSL_DEBUG_LEVEL > 0
+ OSL_TRACE( "executeQuery returned %d", rv );
+
+ OSL_TRACE( "\tOUT OResultSet::fillRowData()" );
+#endif
+}
+
+#if 0
+// -----------------------------------------------------------------------------
+void OResultSet::fillRowData()
+ throw( ::com::sun::star::sdbc::SQLException )
+{
SAL_INFO("connectivity.mork", "=> OResultSet::fillRowData()" );
OSL_ENSURE( m_pStatement, "Require a statement" );
@@ -1074,8 +1161,6 @@ void OResultSet::fillRowData()
OSL_FAIL( "Error in executeQuery!" );
}
-
-/*
MQueryExpression queryExpression;
OSQLColumns::Vector::const_iterator aIter = m_xColumns->get().begin();
@@ -1107,6 +1192,7 @@ void OResultSet::fillRowData()
analyseWhereClause( pParseTree, queryExpression );
}
+#if 0
else
{
OSL_TRACE("\tDon't have a Where Clause");
@@ -1127,6 +1213,7 @@ void OResultSet::fillRowData()
queryExpression.setExpressions( eVector );
}
+#endif
// If the query is a 0=1 then set Row count to 0 and return
if ( m_bIsAlwaysFalseQuery )
@@ -1135,12 +1222,12 @@ void OResultSet::fillRowData()
return;
}
- m_aQuery.setExpression( queryExpression );
+ m_aQueryHelper.setExpression( queryExpression );
rtl::OUString aStr( m_pTable->getName() );
- m_aQuery.setAddressbook( aStr );
+ m_aQueryHelper.setAddressbook( aStr );
- sal_Int32 rv = m_aQuery.executeQuery(xConnection);
+ sal_Int32 rv = m_aQueryHelper.executeQuery(xConnection);
if ( rv == -1 ) {
m_pStatement->getOwnConnection()->throwSQLException( STR_ERR_EXECUTING_QUERY, *this );
}
@@ -1152,11 +1239,10 @@ void OResultSet::fillRowData()
OSL_TRACE( "\tOUT OResultSet::fillRowData()" );
#endif
-*/
}
+#endif
-#if 0
// -----------------------------------------------------------------------------
static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 )
{
@@ -1176,7 +1262,6 @@ static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 )
// If we get to here the rows match
return sal_True;
}
-#endif
sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum)
{
@@ -1195,13 +1280,12 @@ sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum)
}
}
- // TODO
- //m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
- OSL_FAIL( "STR_INVALID_BOOKMARK!" );
+ m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
return 0;
}
+#if 0
// -----------------------------------------------------------------------------
void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLException,
::com::sun::star::uno::RuntimeException)
@@ -1215,8 +1299,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
{
const OSQLTables& xTabs = m_pSQLIterator->getTables();
if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is()) {
- OSL_FAIL( " STR_QUERY_TOO_COMPLEX!" );
-// m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
}
m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get());
@@ -1228,12 +1311,11 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
fillRowData();
m_pKeySet = new OKeySet();
- //m_pSortIndex = new OSortIndex(SQL_ORDERBYKEY_DOUBLE, m_aOrderbyAscending);
- //m_pKeySet = m_pSortIndex->CreateKeySet();
+ m_pSortIndex = new OSortIndex(SQL_ORDERBYKEY_DOUBLE, m_aOrderbyAscending);
+ m_pKeySet = m_pSortIndex->CreateKeySet();
OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
-/*
switch( m_pSQLIterator->getStatementType() )
{
case SQL_STATEMENT_SELECT:
@@ -1244,7 +1326,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
else if(isCount())
{
OSL_FAIL( "STR_NO_COUNT_SUPPORT!" );
- //m_pStatement->getOwnConnection()->throwSQLException( STR_NO_COUNT_SUPPORT, *this );
+ m_pStatement->getOwnConnection()->throwSQLException( STR_NO_COUNT_SUPPORT, *this );
}
else
{
@@ -1304,13 +1386,13 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
// values.
OSL_TRACE("Query is to be sorted");
- if( ! m_aQuery.queryComplete() )
- if ( !m_aQuery.waitForQueryComplete() )
+ if( ! m_aQueryHelper.queryComplete() )
+ if ( !m_aQueryHelper.waitForQueryComplete() )
{
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
}
- OSL_ENSURE( m_aQuery.queryComplete(), "Query not complete!!");
+ OSL_ENSURE( m_aQueryHelper.queryComplete(), "Query not complete!!");
m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
@@ -1319,7 +1401,186 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
for ( ::std::vector<sal_Int32>::size_type i = 0; i < m_aColMapping.size(); i++ )
OSL_TRACE("Mapped: %d -> %d", i, m_aColMapping[i] );
#endif
- for ( sal_Int32 nRow = 1; nRow <= m_aQuery.getRowCount(); nRow++ ) {
+ for ( sal_Int32 nRow = 1; nRow <= m_aQueryHelper.getRowCount(); nRow++ ) {
+
+ OKeyValue* pKeyValue = OKeyValue::createKeyValue((nRow));
+
+ ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
+ for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
+ {
+ const ORowSetValue& value = getValue(nRow, *aIter);
+
+ OSL_TRACE( "Adding Value: (%d,%d) : %s", nRow, *aIter,OUtoCStr( value ));
+
+ pKeyValue->pushKey(new ORowSetValueDecorator(value));
+ }
+
+ m_pSortIndex->AddKeyValue( pKeyValue );
+ }
+
+ m_pKeySet = m_pSortIndex->CreateKeySet();
+ m_CurrentRowCount = static_cast<sal_Int32>(m_pKeySet->get().size());
+#if OSL_DEBUG_LEVEL > 0
+ for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
+ OSL_TRACE("Sorted: %d -> %d", i, (m_pKeySet->get())[i] );
+#endif
+
+ m_pSortIndex = NULL;
+ beforeFirst(); // Go back to start
+ }
+ else //we always need m_pKeySet now
+ m_pKeySet = new OKeySet();
+
+ // Handle the DISTINCT case
+ if ( bDistinct && m_pKeySet.is() )
+ {
+ OValueRow aSearchRow = new OValueVector( m_aRow->get().size() );
+
+ for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
+ {
+ fetchRow( (m_pKeySet->get())[i] ); // Fills m_aRow
+ if ( matchRow( m_aRow, aSearchRow ) )
+ {
+ (m_pKeySet->get())[i] = 0; // Marker for later to be removed
+ }
+ else
+ {
+ // They don't match, so it's not a duplicate.
+ // Use the current Row as the next one to match against
+ *aSearchRow = *m_aRow;
+ }
+ }
+ // Now remove any keys marked with a 0
+ m_pKeySet->get().erase(::std::remove_if(m_pKeySet->get().begin(),m_pKeySet->get().end()
+ ,::std::bind2nd(::std::equal_to<sal_Int32>(),0))
+ ,m_pKeySet->get().end());
+
+ }
+ }
+ } break;
+
+ case SQL_STATEMENT_UPDATE:
+ case SQL_STATEMENT_DELETE:
+ case SQL_STATEMENT_INSERT:
+ break;
+ default:
+ m_pStatement->getOwnConnection()->throwSQLException( STR_STMT_TYPE_NOT_SUPPORTED, *this );
+ break;
+ }
+}
+// -----------------------------------------------------------------------------
+#endif
+
+// -----------------------------------------------------------------------------
+void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ResultSetEntryGuard aGuard( *this );
+
+ OSL_ENSURE( m_pTable, "Need a Table object");
+ if(!m_pTable)
+ {
+ const OSQLTables& xTabs = m_pSQLIterator->getTables();
+ if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
+
+ m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get());
+
+ }
+
+ m_nRowPos = 0;
+
+ fillRowData();
+
+ OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
+
+ switch( m_pSQLIterator->getStatementType() )
+ {
+ case SQL_STATEMENT_SELECT:
+ {
+ if(m_bIsAlwaysFalseQuery) {
+ break;
+ }
+ else if(isCount())
+ {
+ m_pStatement->getOwnConnection()->throwSQLException( STR_NO_COUNT_SUPPORT, *this );
+ }
+ else
+ {
+ sal_Bool bDistinct = sal_False;
+ OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
+ if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT)
+ {
+ if(!IsSorted())
+ {
+ m_aOrderbyColumnNumber.push_back(m_aColMapping[1]);
+ m_aOrderbyAscending.push_back(SQL_DESC);
+ }
+ bDistinct = sal_True;
+ }
+
+ OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
+ ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
+ for ( ::std::vector<sal_Int16>::size_type i = 0; aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
+ {
+ OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index");
+ switch ((m_aRow->get().begin()+*aOrderByIter)->getTypeKind())
+ {
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ eKeyType[i] = SQL_ORDERBYKEY_STRING;
+ break;
+
+ case DataType::OTHER:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::DATE:
+ case DataType::TIME:
+ case DataType::TIMESTAMP:
+ case DataType::BIT:
+ eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
+ break;
+
+ // Other types aren't implemented (so they are always FALSE)
+ default:
+ eKeyType[i] = SQL_ORDERBYKEY_NONE;
+ OSL_FAIL("MResultSet::executeQuery: Order By Data Type not implemented");
+ break;
+ }
+ }
+
+ if (IsSorted())
+ {
+ // Implement Sorting
+
+ // So that we can sort we need to wait until the executed
+ // query to the mozilla addressbooks has returned all
+ // values.
+
+ OSL_TRACE("Query is to be sorted");
+#if 0
+ if( ! m_aQueryHelper.queryComplete() )
+ if ( !m_aQueryHelper.waitForQueryComplete() )
+ {
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
+ }
+#endif
+
+ OSL_ENSURE( m_aQueryHelper.queryComplete(), "Query not complete!!");
+
+ m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
+
+ OSL_TRACE("OrderbyColumnNumber->size() = %d",m_aOrderbyColumnNumber.size());
+#if OSL_DEBUG_LEVEL > 0
+ for ( ::std::vector<sal_Int32>::size_type i = 0; i < m_aColMapping.size(); i++ )
+ OSL_TRACE("Mapped: %d -> %d", i, m_aColMapping[i] );
+#endif
+ for ( sal_Int32 nRow = 1; nRow <= m_aQueryHelper.getResultCount(); nRow++ ) {
OKeyValue* pKeyValue = OKeyValue::createKeyValue((nRow));
@@ -1385,11 +1646,11 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
m_pStatement->getOwnConnection()->throwSQLException( STR_STMT_TYPE_NOT_SUPPORTED, *this );
break;
}
-*/
}
// -----------------------------------------------------------------------------
+
void OResultSet::setBoundedColumns(const OValueRow& _rRow,
const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
const Reference<XIndexAccess>& _xNames,
@@ -1488,11 +1749,7 @@ sal_Bool OResultSet::isCount() const
//
sal_Bool OResultSet::validRow( sal_uInt32 nRow)
{
-// OSL_FAIL( "OResultSet::validRow() is not implemented" );
-
-
sal_Int32 nNumberOfRecords = m_aQueryHelper.getResultCount();
-//m_aQuery.getRealRowCount();
while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQueryHelper.queryComplete() ) {
#if OSL_DEBUG_LEVEL > 0
@@ -1503,12 +1760,12 @@ sal_Bool OResultSet::validRow( sal_uInt32 nRow)
OSL_TRACE("validRow(%u): return False", nRow);
return sal_False;
}
-#if 0
- if ( m_aQuery.hadError() )
+
+ if ( m_aQueryHelper.hadError() )
{
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
}
-#endif
+
nNumberOfRecords = m_aQueryHelper.getResultCount();
}
@@ -1552,8 +1809,7 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
ResultSetEntryGuard aGuard( *this );
if ( !m_pKeySet.is() )
- OSL_FAIL( "OResultSet::STR_ILLEGAL_MOVEMENT" );
-// m_pStatement->getOwnConnection()->throwSQLException( STR_ILLEGAL_MOVEMENT, *this );
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ILLEGAL_MOVEMENT, *this );
sal_Int32 nNumberOfRecords = m_aQueryHelper.getResultCount();
sal_Int32 nRetrivedRows = currentRowCount();
@@ -1603,16 +1859,18 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
else //The requested row has not been retrived until now. We should get the right card for it.
nCurCard = nCurPos + deletedCount();
-/*
+ // davido: what is this loop for?
+ // it leads to infinite loop, once nCurCard is greater then nNumberOfRecords
+#if 0
while ( nCurCard > nNumberOfRecords ) {
- m_aQuery.checkRowAvailable( nCurCard );
- if ( m_aQuery.hadError() )
+ m_aQueryHelper.checkRowAvailable( nCurCard );
+ if ( m_aQueryHelper.hadError() )
{
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
}
nNumberOfRecords = m_aQueryHelper.getResultCount();
}
-*/
+#endif
if ( nCurCard > nNumberOfRecords) {
fillKeySet(nNumberOfRecords);
@@ -1643,8 +1901,7 @@ void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMappin
OSL_TRACE("getBookmark, m_nRowPos = %u", m_nRowPos );
ResultSetEntryGuard aGuard( *this );
if ( fetchCurrentRow() == sal_False ) {
-// m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
- OSL_FAIL( "STR_ERROR_GET_ROW" );
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
}
OSL_ENSURE((!m_aRow->isDeleted()),"getBookmark called for deleted row");
@@ -1676,8 +1933,7 @@ sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, c
sal_Int32 nResult=0;
if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) ) {
- OSL_FAIL( "STR_INVALID_BOOKMARK" );
-// m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
+ m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
}
if(nFirst < nSecond)
@@ -1734,8 +1990,7 @@ void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw
OSL_TRACE("updateValue, m_nRowPos = %u", m_nRowPos );
ResultSetEntryGuard aGuard( *this );
if ( fetchCurrentRow() == sal_False ) {
- //m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
- OSL_FAIL( "STR_ERROR_GET_ROW" );
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
}
checkPendingUpdate();
@@ -1755,9 +2010,7 @@ void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException
OSL_TRACE("updateNull, m_nRowPos = %u", m_nRowPos );
ResultSetEntryGuard aGuard( *this );
if ( fetchCurrentRow() == sal_False )
-// m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
- OSL_FAIL( "STR_ERROR_GET_ROW" );
-
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
checkPendingUpdate();
checkIndex(columnIndex );
@@ -1887,7 +2140,7 @@ void SAL_CALL OResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLExcepti
updateRow();
m_nOldRowPos = 0;
m_nNewRow = 0;
- //m_aQuery.setRowStates(getCurrentCardNumber(),m_RowStates);
+ //m_aQueryHelper.setRowStates(getCurrentCardNumber(),m_RowStates);
OSL_TRACE("insertRow out, m_nRowPos = %u", m_nRowPos );
}
// -------------------------------------------------------------------------
@@ -1901,8 +2154,7 @@ void SAL_CALL OResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLExcepti
if (!m_nRowPos || m_pKeySet->get().size() < m_nRowPos )
{
- OSL_FAIL( "STR_INVALID_ROW_UPDATE" );
-// m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_ROW_UPDATE, *this );
+ m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_ROW_UPDATE, *this );
}
const sal_Int32 nCurrentCard = getCurrentCardNumber();
@@ -1913,11 +2165,11 @@ void SAL_CALL OResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLExcepti
m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_CAN_NOT_SAVE, *this );
}
- if (!m_aQuery.commitRow(nCurrentCard))
+ if (!m_aQueryHelper.commitRow(nCurrentCard))
{
m_RowStates = RowStates_Error;
m_nUpdatedRow = 0;
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
}
m_nUpdatedRow = 0;
@@ -1940,11 +2192,11 @@ void SAL_CALL OResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLExcepti
if (!nCurrentRow)
m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
- sal_Bool m_bRowDeleted = ( m_aQuery.deleteRow( nCurrentRow ) > 0 );
+ sal_Bool m_bRowDeleted = ( m_aQueryHelper.deleteRow( nCurrentRow ) > 0 );
if (!m_bRowDeleted)
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
- m_aQuery.setRowStates(nCurrentRow,RowStates_Deleted);
+ m_aQueryHelper.setRowStates(nCurrentRow,RowStates_Deleted);
m_pKeySet->get().erase(m_pKeySet->get().begin() + m_nRowPos -1);
m_RowStates = RowStates_Deleted;
OSL_TRACE("deleteRow out, m_nRowPos = %u", m_nRowPos );
@@ -1979,7 +2231,7 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLE
if (m_nRowPos && !pushCard(getCurrentCardNumber()))
throw SQLException();
}
- m_nNewRow = m_aQuery.createNewCard();
+ m_nNewRow = m_aQueryHelper.createNewCard();
if (!m_nNewRow)
m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CREATE_ROW, *this );
@@ -2008,12 +2260,13 @@ void SAL_CALL OResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQL
sal_Bool OResultSet::determineReadOnly()
{
- OSL_FAIL( "OResultSet::determineReadOnly( ) not implemented" );
+// OSL_FAIL( "OResultSet::determineReadOnly( ) not implemented" );
if (m_bIsReadOnly == -1)
{
+ m_bIsReadOnly = sal_True;
// OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
-// m_bIsReadOnly = !m_aQuery.isWritable(xConnection) || m_bIsAlwaysFalseQuery;
+// m_bIsReadOnly = !m_aQueryHelper.isWritable(xConnection) || m_bIsAlwaysFalseQuery;
}
return m_bIsReadOnly != 0;
diff --git a/connectivity/source/drivers/mork/MResultSet.hxx b/connectivity/source/drivers/mork/MResultSet.hxx
index 9c9c926..e4feaee 100644
--- a/connectivity/source/drivers/mork/MResultSet.hxx
+++ b/connectivity/source/drivers/mork/MResultSet.hxx
@@ -249,8 +249,8 @@ protected:
void parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString );
void fillRowData() throw( ::com::sun::star::sdbc::SQLException );
-// void analyseWhereClause( const OSQLParseNode* parseTree,
-// MQueryExpression &queryExpression);
+ void analyseWhereClause( const OSQLParseNode* parseTree,
+ MQueryExpression &queryExpression);
sal_Bool isCount() const;
diff --git a/connectivity/source/drivers/mork/MStatement.cxx b/connectivity/source/drivers/mork/MStatement.cxx
index 9b23410..6547a17 100644
--- a/connectivity/source/drivers/mork/MStatement.cxx
+++ b/connectivity/source/drivers/mork/MStatement.cxx
@@ -44,6 +44,9 @@
#include "MResultSet.hxx"
#include "MDatabaseMetaData.hxx"
+#include "resource/mork_res.hrc"
+#include "resource/common_res.hrc"
+
#if OSL_DEBUG_LEVEL > 0
# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
#else /* OSL_DEBUG_LEVEL */
@@ -209,10 +212,10 @@ OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUStrin
m_pSQLIterator->traverseAll();
const OSQLTables& xTabs = m_pSQLIterator->getTables();
- // TODO
- SAL_WARN("connectivity.mork", "STR_QUERY_AT_LEAST_ONE_TABLES!");
- // if(xTabs.empty())
- // getOwnConnection()->throwSQLException( STR_QUERY_AT_LEAST_ONE_TABLES, *this );
+ if (xTabs.empty())
+ {
+ getOwnConnection()->throwSQLException( STR_QUERY_AT_LEAST_ONE_TABLES, *this );
+ }
#if OSL_DEBUG_LEVEL > 0
OSQLTables::const_iterator citer;
@@ -257,9 +260,7 @@ OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUStrin
return parseSql(sql + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("(""E-mail"" caracter)")),sal_True);
}
- // TODO:
- SAL_WARN("connectivity.mork", "STR_QUERY_TOO_COMPLEX!");
- //getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
+ getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
OSL_FAIL( "OCommonStatement::parseSql: unreachable!" );
return eSelect;
@@ -311,6 +312,7 @@ void OCommonStatement::clearCachedResultSet()
}
catch( const DisposedException& )
{
+ SAL_INFO("connectivity.mork", "=> OCommonStatement::clearCachedResultSet()" );
DBG_UNHANDLED_EXCEPTION();
}
diff --git a/connectivity/source/inc/resource/conn_shared_res.hrc b/connectivity/source/inc/resource/conn_shared_res.hrc
index 47171b8..e854dd2 100644
--- a/connectivity/source/inc/resource/conn_shared_res.hrc
+++ b/connectivity/source/inc/resource/conn_shared_res.hrc
@@ -24,6 +24,8 @@
// Mozilla driver resource ids
#define STR_MOZAB_BASE 1000
+// either mozab or mork is actually used
+#define STR_MORK_BASE 1000
// common resource ids
#define STR_COMMON_BASE 1200
diff --git a/connectivity/source/inc/resource/mork_res.hrc b/connectivity/source/inc/resource/mork_res.hrc
new file mode 100644
index 0000000..c8d44ed
--- /dev/null
+++ b/connectivity/source/inc/resource/mork_res.hrc
@@ -0,0 +1,63 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_RESOURCE_MORK_HRC
+#define CONNECTIVITY_RESOURCE_MORK_HRC
+
+#include "resource/conn_shared_res.hrc"
+
+// ============================================================================
+// = the mozab driver's resource strings
+// ============================================================================
+
+#define STR_MOZILLA_ADDRESSBOOKS ( STR_MORK_BASE + 0 )
+#define STR_THUNDERBIRD_ADDRESSBOOKS ( STR_MORK_BASE + 1 )
+#define STR_OE_ADDRESSBOOK ( STR_MORK_BASE + 2 )
+#define STR_OUTLOOK_MAPI_ADDRESSBOOK ( STR_MORK_BASE + 3 )
+ // FREE
+#define STR_NO_TABLE_CREATION_SUPPORT ( STR_MORK_BASE + 5 )
+#define STR_MOZILLA_IS_RUNNING ( STR_MORK_BASE + 6 )
+#define STR_COULD_NOT_RETRIEVE_AB_ENTRY ( STR_MORK_BASE + 7 )
+#define STR_COULD_NOT_GET_DIRECTORY_NAME ( STR_MORK_BASE + 8 )
+#define STR_TIMEOUT_WAITING ( STR_MORK_BASE + 9 )
+#define STR_ERR_EXECUTING_QUERY ( STR_MORK_BASE + 10 )
+#define STR_MOZILLA_IS_RUNNIG_NO_CHANGES ( STR_MORK_BASE + 11 )
+#define STR_FOREIGN_PROCESS_CHANGED_AB ( STR_MORK_BASE + 12 )
+#define STR_CANT_FIND_ROW ( STR_MORK_BASE + 13 )
+#define STR_CANT_FIND_CARD_FOR_ROW ( STR_MORK_BASE + 14 )
+#define STR_QUERY_INVALID_IS_NULL_COLUMN ( STR_MORK_BASE + 15 )
+#define STR_NO_HOSTNAME ( STR_MORK_BASE + 16 )
+#define STR_NO_BASEDN ( STR_MORK_BASE + 17 )
+#define STR_COULD_NOT_CONNECT_LDAP ( STR_MORK_BASE + 18 )
+#define STR_ERROR_REFRESH_ROW ( STR_MORK_BASE + 19 )
+#define STR_ILLEGAL_MOVEMENT ( STR_MORK_BASE + 20 )
+#define STR_ERROR_GET_ROW ( STR_MORK_BASE + 21 )
+#define STR_COMMIT_ROW ( STR_MORK_BASE + 22 )
+#define STR_INVALID_ROW_UPDATE ( STR_MORK_BASE + 23 )
+#define STR_ROW_CAN_NOT_SAVE ( STR_MORK_BASE + 24 )
+#define STR_CAN_NOT_CANCEL_ROW_UPDATE ( STR_MORK_BASE + 25 )
+#define STR_CAN_NOT_CREATE_ROW ( STR_MORK_BASE + 26 )
+#define STR_QUERY_AT_LEAST_ONE_TABLES ( STR_MORK_BASE + 27 )
+#define STR_NO_COUNT_SUPPORT ( STR_MORK_BASE + 28 )
+#define STR_STMT_TYPE_NOT_SUPPORTED ( STR_MORK_BASE + 29 )
+#define STR_COULD_NOT_LOAD_LIB ( STR_MORK_BASE + 30 )
+#define STR_UNSPECIFIED_ERROR ( STR_MORK_BASE + 31 )
+#define STR_COULD_NOT_CREATE_ADDRESSBOOK ( STR_MORK_BASE + 32 )
+
+#endif // CONNECTIVITY_RESOURCE_MOZAB_HRC
+
More information about the Libreoffice-commits
mailing list