diff options
-rw-r--r-- | connectivity/source/drivers/mozab/MResultSet.cxx | 289 | ||||
-rw-r--r-- | connectivity/source/drivers/mozab/MResultSet.hxx | 11 | ||||
-rw-r--r-- | connectivity/source/drivers/mozab/MStatement.cxx | 34 | ||||
-rw-r--r-- | connectivity/source/drivers/mozab/MTable.cxx | 16 | ||||
-rw-r--r-- | connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx | 280 | ||||
-rw-r--r-- | connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx | 147 | ||||
-rw-r--r-- | connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx | 8 |
7 files changed, 314 insertions, 471 deletions
diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx index 137054aa667c..5cae0a3c82c2 100644 --- a/connectivity/source/drivers/mozab/MResultSet.cxx +++ b/connectivity/source/drivers/mozab/MResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MResultSet.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mmaher $ $Date: 2001-10-31 17:24:22 $ + * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -462,12 +462,8 @@ sal_Bool OResultSet::fetchRow(sal_uInt32 rowIndex) throw(SQLException, RuntimeEx if ( validRow( rowIndex ) == sal_False ) return sal_False; -#ifndef DARREN_WORK (*m_aRow)[0] = (sal_Int32)rowIndex; for( sal_Int32 i = 1; i < xNames->getCount(); i++ ) { -#else /* DARREN_WORK */ - for( sal_Int32 i = 1; i < xNames->getCount(); i++ ) { -#endif /* DARREN_WORK */ if ( (*m_aRow)[i].isBound() ) { OSL_TRACE("Row[%d] is Bound", i ); xNames->getByIndex(i-1) >>= xTableColumn; @@ -507,33 +503,6 @@ const ORowSetValue& OResultSet::getValue(sal_uInt32 rowIndex, sal_Int32 columnIn m_bWasNull = (*m_aRow)[columnIndex].isNull(); return (*m_aRow)[columnIndex]; -#ifdef DARREN_WORK - ORowSetValue value; - ::rtl::OUString sTableColumnName; - Reference<XPropertySet> xTableColumn; - Reference<XIndexAccess> xNames(m_xTableColumns,UNO_QUERY); - OSL_ENSURE( columnIndex < xNames->getCount(), "Invalid Column Index"); - - const ::rtl::OUString sPropertyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); - - OSL_TRACE("In/Out: OResultSet::getValue" ); - OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!"); - - xNames->getByIndex(columnIndex) >>= xTableColumn; - OSL_ENSURE(xTableColumn.is(), "OResultSet::getValue: invalid table column!"); - if (xTableColumn.is()) - xTableColumn->getPropertyValue(sPropertyName) >>= sTableColumnName; - else - sTableColumnName = ::rtl::OUString(); - - // - // Everything in the addressbook is a string! - // - m_aQuery.getRowValue( value, rowIndex, sTableColumnName, DataType::VARCHAR ); - OSL_TRACE("getValue : %s returned", OUtoCStr( value ) ); - m_bWasNull = value.isNull(); - return value; -#endif /* DARREN_WORK */ } // ------------------------------------------------------------------------- @@ -557,24 +526,6 @@ const ORowSetValue& OResultSet::getValue(sal_uInt32 rowIndex, sal_Int32 columnIn else return getValue( m_nRowPos, mapColumn( columnIndex ) ); -#ifdef DARREN_WORK - const ::rtl::OUString sPropertyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); - - ORowSetValue value; - ::rtl::OUString columnName; - ((m_xColumns.getBody())[columnIndex-1])->getPropertyValue( sPropertyName ) >>= columnName; - // If this query was sorted then we should have a valid KeySet, so use it - if ( m_pKeySet.isValid() ) { - OSL_TRACE( "%u <= %u", m_nRowPos, m_pKeySet->size()); - OSL_ENSURE( m_nRowPos > 0 && m_nRowPos <= m_pKeySet->size(), "Invalid Row Position"); - m_aQuery.getRowValue( value, (*m_pKeySet)[m_nRowPos-1], columnName, DataType::VARCHAR ); - } - else - m_aQuery.getRowValue( value, m_nRowPos, columnName, DataType::VARCHAR ); - OSL_TRACE("getString : %s returned", OUtoCStr( value ) ); - m_bWasNull = sal_False; - return value; -#endif /* DARREN_WORK */ } // ------------------------------------------------------------------------- @@ -1127,15 +1078,6 @@ void OResultSet::getFastPropertyValue( { switch(nHandle) { -#ifdef DARREN_WORK - case PROPERTY_ID_ISBOOKMARKABLE: - case PROPERTY_ID_CURSORNAME: - case PROPERTY_ID_RESULTSETCONCURRENCY: - case PROPERTY_ID_RESULTSETTYPE: - case PROPERTY_ID_FETCHDIRECTION: - case PROPERTY_ID_FETCHSIZE: - ; -#else /* DARREN_WORK */ case PROPERTY_ID_ISBOOKMARKABLE: // rValue = bool2any(isBookmarkable()); rValue = bool2any(m_nIsBookmarkable); @@ -1155,7 +1097,6 @@ void OResultSet::getFastPropertyValue( case PROPERTY_ID_FETCHSIZE: rValue <<= m_nFetchSize; break; -#endif /* DARREN_WORK */ } } // ----------------------------------------------------------------------------- @@ -1184,106 +1125,6 @@ void OResultSet::initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount) } } -// ----------------------------------------------------------------------------- - -// ------------------------------------------------------------------------- -void OResultSet::fillColumns() -{ -#ifdef DARREN_WORK - - OSL_TRACE( "IN OResultSet::fillColumns()\n" ); - - - ::rtl::OUString aTypeName; - - m_aAttributeStrings.clear(); - m_aAttributeStrings.push_back( ::rtl::OUString::createFromAscii("card:URI") ); - - Reference< XDatabaseMetaData > xMtd = m_pConnection->getMetaData(); - ::comphelper::UStringMixEqual aCase(xMtd->storesMixedCaseQuotedIdentifiers()); - - Reference< XResultSet > xRes = xMtd->getColumns( Any(), - ::rtl::OUString(), - m_Name, - ::rtl::OUString::createFromAscii("%")); - Reference<XRow> xRow(xRes,UNO_QUERY); - - // clear the whole vector stuff - if(!m_aColumns.isValid()) - m_aColumns = new OSQLColumns(); - else - m_aColumns->clear(); - - m_aTypes.clear(); - m_aPrecisions.clear(); - m_aScales.clear(); - // reserve some space to speed up this think - m_aAttributeStrings.reserve(m_nNR_OF_FIELDS+1); - m_aColumns->reserve(m_nNR_OF_FIELDS); - m_aTypes.reserve(m_nNR_OF_FIELDS); - m_aPrecisions.reserve(m_nNR_OF_FIELDS); - m_aScales.reserve(m_nNR_OF_FIELDS); - - for (sal_Int32 i = 1; i <= m_nNR_OF_FIELDS; i++) - { - ::rtl::OUString aColumnName; - sal_Int32 eType = DataType::OTHER; - sal_Bool bCurrency = sal_False; - sal_Int32 nPrecision = 0; //! ... - sal_Int32 nDecimals = 0; //! ... - sal_Int32 nNullable = ColumnValue::NULLABLE; - - if(xRes.is() && xRes->next()) - { - aColumnName = xRow->getString(4); - eType = xRow->getShort(5); - aTypeName = xRow->getString(6); - nPrecision = xRow->getInt(7); - nDecimals = xRow->getInt(9); - nNullable = xRow->getInt(11); - } - else - { - OSL_TRACE(0,"OResultSet::fillColumns: getColumns doesn't return a resultset!"); - } - // getColumnInfo( i, aColumnName, eType ); - - OSL_TRACE( "inserting string %s\n", OUtoCStr( aColumnName ) ); - m_aAttributeStrings.push_back( aColumnName ); - - // check if the column name already exists - ::rtl::OUString aAlias = aColumnName; - OSQLColumns::const_iterator aFind = connectivity::find(m_aColumns->begin(),m_aColumns->end(),aAlias,aCase); - sal_Int32 nExprCnt = 0; - while(aFind != m_aColumns->end()) - { - (aAlias = aColumnName) += ::rtl::OUString::valueOf((sal_Int32)++nExprCnt); - aFind = connectivity::find(m_aColumns->begin(),m_aColumns->end(),aAlias,aCase); - } - - sdbcx::OColumn* pColumn = new sdbcx::OColumn( aAlias, aTypeName, ::rtl::OUString(), - nNullable, nPrecision, nDecimals, - eType, sal_False, sal_False, bCurrency, - aCase.isCaseSensitive() ); - Reference< XPropertySet> xCol = pColumn; - m_aColumns->push_back(xCol); - m_aTypes.push_back(eType); - m_aPrecisions.push_back(nPrecision); - m_aScales.push_back(nDecimals); - } - - - OSL_TRACE( "\tOUT OResultSet::fillColumns()\n" ); - -#endif /* DARREN_WORK */ -} - -// ------------------------------------------------------------------------- -#ifdef DARREN_WORK -#if defined DEBUG || defined DBG_UTIL -extern void printParseTree( const OSQLParseNode* parseTree, rtl::OString tab ); -#endif -#endif /* DARREN_WORK */ // ------------------------------------------------------------------------- void OResultSet::parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString ) { @@ -1315,29 +1156,27 @@ void OResultSet::parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMat } } -void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, - ::std::vector< ::rtl::OUString > &matchItems, - ::std::vector< MQuery::eSqlOppr > &matchOper, - ::std::vector< ::rtl::OUString > &matchValues, - connectivity::OSQLParseTreeIterator& m_aSQLIterator) +void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, + MQueryExpression &queryExpression, + connectivity::OSQLParseTreeIterator& aSQLIterator) { ::rtl::OUString columnName; - MQuery::eSqlOppr op; + MQueryOp::cond_type op; ::rtl::OUString matchString; if ( parseTree == NULL ) return; - if ( m_aSQLIterator.getParseTree() != NULL ) { + if ( aSQLIterator.getParseTree() != NULL ) { OSL_TRACE("FULL QUERY IS : \n" ); #ifdef DARREN_WORK #if defined DEBUG || defined DBG_UTIL - printParseTree( m_aSQLIterator.getParseTree(), "XX " ); + printParseTree( aSQLIterator.getParseTree(), "XX " ); #endif #endif /* DARREN_WORK */ OSL_TRACE("FULL QUERY IS : \n" ); - ::vos::ORef<OSQLColumns> xColumns = m_aSQLIterator.getParameters(); + ::vos::ORef<OSQLColumns> xColumns = aSQLIterator.getParameters(); if(xColumns.isValid()) { ::rtl::OUString aTabName,aColName,aParameterName,aParameterValue; @@ -1370,12 +1209,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, OSL_TRACE("analyseSQL : Got WHERE clause\n"); // Reset Parameter Counter resetParameters(); - analyseWhereClause( parseTree->getChild( 1 ), matchItems, matchOper, matchValues, m_aSQLIterator); - } - else if ( SQL_ISRULE(parseTree,where_clause) ) - { - OSL_TRACE("analyseSQL : Got WHERE clause\n"); - analyseWhereClause( parseTree->getChild( 1 ), matchItems, matchOper, matchValues, m_aSQLIterator); + analyseWhereClause( parseTree->getChild( 1 ), queryExpression, aSQLIterator); } else if ( parseTree->count() == 3 && // Handle ()'s SQL_ISPUNCTUATION(parseTree->getChild(0),"(") && @@ -1383,7 +1217,9 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, { OSL_TRACE("analyseSQL : Got Punctuation ()\n"); - analyseWhereClause( parseTree->getChild( 1 ), matchItems, matchOper, matchValues,m_aSQLIterator ); + MQueryExpression *subExpression = new MQueryExpression(); + analyseWhereClause( parseTree->getChild( 1 ), *subExpression, aSQLIterator ); + queryExpression.getExpressions().push_back( subExpression ); } else if ((SQL_ISRULE(parseTree,search_condition) || (SQL_ISRULE(parseTree,boolean_term))) && parseTree->count() == 3) // Handle AND/OR @@ -1392,8 +1228,18 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, OSL_TRACE("analyseSQL : Got AND/OR clause\n"); // TODO - Need to take care or AND, for now match is always OR - analyseWhereClause( parseTree->getChild( 0 ), matchItems, matchOper, matchValues, m_aSQLIterator ); - analyseWhereClause( parseTree->getChild( 2 ), matchItems, matchOper, matchValues, m_aSQLIterator ); + analyseWhereClause( parseTree->getChild( 0 ), queryExpression, aSQLIterator ); + analyseWhereClause( parseTree->getChild( 2 ), queryExpression, aSQLIterator ); + + if (SQL_ISTOKEN(parseTree->getChild(1),OR)) { // OR-Operator + queryExpression.setExpressionCondition( MQueryExpression::OR ); + } + else if (SQL_ISTOKEN(parseTree->getChild(1),AND)) { // AND-Operator + queryExpression.setExpressionCondition( MQueryExpression::AND ); + } + else { + OSL_ASSERT("analyseSQL: Error in Parse Tree"); + } } else if (SQL_ISRULE(parseTree,comparison_predicate)) { @@ -1414,13 +1260,13 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, OSQLParseNode *pPrec = parseTree->getChild(1); if (pPrec->getNodeType() == SQL_NODE_EQUAL) - op = MQuery::matchIs; + op = MQueryOp::Is; else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL) - op = MQuery::matchIsNot; + op = MQueryOp::IsNot; ::rtl::OUString sTableRange; if(SQL_ISRULE(parseTree->getChild(0),column_ref)) - m_aSQLIterator.getColumnRange(parseTree->getChild(0),columnName,sTableRange); + aSQLIterator.getColumnRange(parseTree->getChild(0),columnName,sTableRange); else if(parseTree->getChild(0)->isToken()) columnName = parseTree->getChild(0)->getTokenValue(); @@ -1431,14 +1277,12 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, matchString = parseTree->getChild(2)->getTokenValue(); } - if ( columnName.compareToAscii("0") ==0 && op == MQuery::matchIs && + if ( columnName.compareToAscii("0") ==0 && op == MQueryOp::Is && matchString.compareToAscii("1") == 0 ) { OSL_TRACE("Query always evaluates to FALSE"); m_nIsAlwaysFalseQuery = sal_True; } - matchItems.push_back( columnName ); - matchOper.push_back( op ); - matchValues.push_back( matchString ); + queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString )); } else if (SQL_ISRULE(parseTree,like_predicate)) { @@ -1467,20 +1311,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_STRING ) ) ) { -#ifdef DARREN_WORK -#if defined DEBUG || defined DBG_UTIL - printParseTree( pAtom, "AnalyseSQL " ); -#endif -#endif /* DARREN_WORK */ OSL_TRACE("analyseSQL : pAtom->count() = %d\n", pAtom->count() ); -#ifdef DBG_UTIL - for ( sal_uInt32 i = 0; i < pAtom->count(); ++i ) - OSL_TRACE("analyseSQL : pAtom (%d) : %d, %d = %s\n", i, - (sal_Int32)pAtom->getRuleID(), - pAtom->getChild(i)->getNodeType(), - OUtoCStr(pAtom->getChild(i)->getTokenValue())); -#endif - ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii("Invalid Statement - Not a String"),NULL); @@ -1492,7 +1323,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, ::rtl::OUString sTableRange; if(SQL_ISRULE(pColumn,column_ref)) - m_aSQLIterator.getColumnRange(pColumn,columnName,sTableRange); + aSQLIterator.getColumnRange(pColumn,columnName,sTableRange); OSL_TRACE("ColumnName = %s\n", OUtoCStr( columnName ) ); @@ -1512,7 +1343,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, if ( matchString.equals( ::rtl::OUString::valueOf( WILDCARD ) ) ) { // String containing only a '%' and nothing else - op = MQuery::matchExists; + op = MQueryOp::Exists; // Will be ignored for Exists case, but clear anyway. matchString = ::rtl::OUString::createFromAscii(""); } @@ -1521,9 +1352,9 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, { // Simple string , eg. "to match" if ( parseTree->count() == 5 ) - op = MQuery::matchDoesNotContain; + op = MQueryOp::DoesNotContain; else - op = MQuery::matchContains; + op = MQueryOp::Contains; } else if ( matchString.indexOf ( WILDCARD ) == 0 && matchString.lastIndexOf ( WILDCARD ) == matchString.getLength() -1 @@ -1537,9 +1368,9 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() ); if ( parseTree->count() == 5 ) - op = MQuery::matchDoesNotContain; + op = MQueryOp::DoesNotContain; else - op = MQuery::matchContains; + op = MQueryOp::Contains; } else if ( parseTree->count() == 5 ) { @@ -1557,19 +1388,19 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, // One occurance of '%' - no '_' matches... if ( matchString.indexOf ( WILDCARD ) == 0 ) { - op = MQuery::matchEndsWith; + op = MQueryOp::EndsWith; matchString = matchString.replaceAt( 0, 1, rtl::OUString()); } else if ( matchString.indexOf ( WILDCARD ) == matchString.getLength() -1 ) { - op = MQuery::matchBeginsWith; + op = MQueryOp::BeginsWith; matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() ); } else { sal_Int32 pos = matchString.indexOf ( WILDCARD ); matchString = matchString.replaceAt( pos, 1,::rtl::OUString::createFromAscii(".*") ); - op = MQuery::matchRegExp; + op = MQueryOp::RegExp; } } @@ -1588,13 +1419,11 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, matchString = matchString.replaceAt( pos, 1, ::rtl::OUString::createFromAscii(".") ); } - op = MQuery::matchRegExp; + op = MQueryOp::RegExp; } } - matchItems.push_back( columnName ); - matchOper.push_back( op ); - matchValues.push_back( matchString ); + queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString )); } else if (SQL_ISRULE(parseTree,test_for_null)) { @@ -1612,14 +1441,12 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree, ::rtl::OUString::createFromAscii("Statement too complex"),NULL); } else - op = MQuery::matchExists; + op = MQueryOp::Exists; ::rtl::OUString sTableRange; - m_aSQLIterator.getColumnRange(parseTree->getChild(0),columnName,sTableRange); + aSQLIterator.getColumnRange(parseTree->getChild(0),columnName,sTableRange); - matchItems.push_back( columnName ); - matchOper.push_back( op ); - matchValues.push_back( rtl::OUString() ); + queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op )); } else { @@ -1639,9 +1466,7 @@ void OResultSet::fillRowData() OSL_ENSURE( m_pStatement, "Require a statement" ); - ::std::vector< ::rtl::OUString > matchItems; - ::std::vector< MQuery::eSqlOppr > matchOper; - ::std::vector< ::rtl::OUString > matchValues; + MQueryExpression queryExpression; OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get()); m_xColumns = m_aSQLIterator.getSelectColumns(); @@ -1672,31 +1497,25 @@ void OResultSet::fillRowData() OSL_TRACE("\tHave a Where Clause\n"); - analyseWhereClause( pParseTree, matchItems, matchOper, matchValues ,m_aSQLIterator); + analyseWhereClause( pParseTree, queryExpression, m_aSQLIterator); } else { OSL_TRACE("\tDon't have a Where Clause\n"); + MQueryExpression::ExprVector eVector; + // LDAP does not allow a query without restriction, so we add a dummy // for FirstName // For other types we stick to the old behaviour of using // card:nsIAbCard. OSL_ENSURE(m_pStatement, "Cannot determine Parent Statement"); if (xConnection->isLDAP()) - matchItems.push_back( ::rtl::OUString::createFromAscii("FirstName") ); + eVector.push_back( new MQueryExpressionString(::rtl::OUString::createFromAscii("FirstName"), MQueryOp::Exists) ); else - matchItems.push_back( ::rtl::OUString::createFromAscii("card:nsIAbCard") ); + eVector.push_back( new MQueryExpressionString(::rtl::OUString::createFromAscii("card:nsIAbCard"), MQueryOp::Exists) ); - matchOper.push_back( MQuery::matchExists ); - matchValues.push_back( ::rtl::OUString() ); - -// matchItems.push_back( ::rtl::OUString::createFromAscii("DisplayName") ); -// matchOper.push_back( MQuery::matchBeginsWith ); -// matchValues.push_back( ::rtl::OUString::createFromAscii("Darren") ); -// matchItems.push_back( ::rtl::OUString::createFromAscii("PrimaryEmail") ); -// matchOper.push_back( MQuery::matchBeginsWith ); -// matchValues.push_back( ::rtl::OUString::createFromAscii("Darren") ); + queryExpression.setExpressions( eVector ); } // If the query is a 0=1 then set Row count to 0 and return @@ -1705,9 +1524,7 @@ void OResultSet::fillRowData() return; } - m_aQuery.setMatchItems( matchItems ); - m_aQuery.setSqlOppr( matchOper ); - m_aQuery.setMatchValues( matchValues ); + m_aQuery.setExpression( queryExpression ); // We need a unique id for caching mechanism so should fetch card:URI m_aQuery.setAttributes( m_aAttributeStrings ); @@ -2088,12 +1905,10 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset ) return sal_True; } // ----------------------------------------------------------------------------- -#ifndef DARREN_WORK void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping) { m_aColMapping = _aColumnMapping; for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ ) OSL_TRACE("Set Mapped: %d -> %d", i, m_aColMapping[i] ); } -#endif /* DARREN_WORK */ diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx index f484cdefacc5..84493f10026f 100644 --- a/connectivity/source/drivers/mozab/MResultSet.hxx +++ b/connectivity/source/drivers/mozab/MResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MResultSet.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hr $ $Date: 2001-10-17 18:38:07 $ + * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -347,14 +347,11 @@ protected: ::vos::ORef<connectivity::OSQLColumns> m_xColumns; // this are the select columns ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; - void fillColumns(); void parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString ); void fillRowData() throw( ::com::sun::star::sdbc::SQLException ); void initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount); - void analyseWhereClause( const OSQLParseNode* parseTree, - ::std::vector< ::rtl::OUString > &matchItems, - ::std::vector< MQuery::eSqlOppr > &matchOper, - ::std::vector< ::rtl::OUString > &matchValues, + void analyseWhereClause( const OSQLParseNode* parseTree, + MQueryExpression &queryExpression, connectivity::OSQLParseTreeIterator& aSQLIterator); sal_Bool isCount() const; diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx index a50222b02e05..92fb27180a4f 100644 --- a/connectivity/source/drivers/mozab/MStatement.cxx +++ b/connectivity/source/drivers/mozab/MStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MStatement.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: hr $ $Date: 2001-10-17 18:45:09 $ + * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -276,35 +276,6 @@ void OStatement_Base::parseSql( const ::rtl::OUString& sql ) ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Driver requires a single table to be specified in query"),NULL); // at this moment we support only one table per select statement - #ifdef DARREN_WORK - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTabs.begin()->second,UNO_QUERY); - if(xTunnel.is()) - { - if(m_pTable) - m_pTable->release(); - m_pTable = (OFileTable*)xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()); - if(m_pTable) - m_pTable->acquire(); - } - OSL_ENSURE(m_pTable,"No table!"); - m_xColNames = m_pTable->getColumns(); - Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY); - // set the binding of the resultrow - m_aRow = new OValueVector(xNames->getCount()); - (*m_aRow)[0].setBound(sal_True); - ::std::for_each(m_aRow->begin()+1,m_aRow->end(),TSetBound(sal_False)); - // create teh column mapping - createColumnMapping(); - - m_pSQLAnalyzer = createAnalyzer(); - - OSL_ENSURE(m_pTable,"We need a table object!"); - Reference<XIndexesSupplier> xIndexSup(xTunnel,UNO_QUERY); - if(xIndexSup.is()) - m_pSQLAnalyzer->setIndexes(xIndexSup->getIndexes()); - - anylizeSQL(); - #else OSQLTables::const_iterator citer; for( citer = xTabs.begin(); citer != xTabs.end(); ++citer ) { OSL_TRACE("SELECT Table : %s\n", OUtoCStr(citer->first) ); @@ -323,7 +294,6 @@ void OStatement_Base::parseSql( const ::rtl::OUString& sql ) createColumnMapping(); analyseSQL(); - #endif /* DARREN_WORK */ } else ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Problem parsing SQL!"),NULL); diff --git a/connectivity/source/drivers/mozab/MTable.cxx b/connectivity/source/drivers/mozab/MTable.cxx index 88d2abd642d1..d4399ebc8f0e 100644 --- a/connectivity/source/drivers/mozab/MTable.cxx +++ b/connectivity/source/drivers/mozab/MTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MTable.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hr $ $Date: 2001-10-17 18:24:52 $ + * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -188,18 +188,6 @@ sal_Int64 OTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (Runtim : OTable_TYPEDEF::getSomething(rId); } -#ifdef DARREN_WORK -// ----------------------------------------------------------------------------- -void SAL_CALL OTable::acquire() throw() -{ - OTable_TYPEDEF::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OTable::release() throw() -{ - OTable_TYPEDEF::release(); -} -#endif /* DARREN_WORK */ // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx index acdd7ea81a7e..bc7847029f71 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MQuery.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mmaher $ $Date: 2001-10-31 17:24:23 $ + * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -213,61 +213,6 @@ void MQuery::setAddressbook(::rtl::OUString &ab) return(m_aAddressbook); } // ------------------------------------------------------------------------- -void MQuery::setMatchItems(::std::vector< ::rtl::OUString> &mi) -{ - OSL_TRACE("IN MQuery::setMatchItems()\n"); - ::osl::MutexGuard aGuard(m_aMutex); - - ::std::vector< ::rtl::OUString>::iterator aIter = mi.begin(); - ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap; - - m_aMatchItems.clear(); - m_aMatchItems.reserve(mi.size()); - for(aIter; aIter != mi.end();++aIter) - { - aIterMap = m_aColumnAliasMap.find(*aIter); - if (aIterMap == m_aColumnAliasMap.end()) { - // Not found. - m_aMatchItems.push_back(*aIter); - } - else { - m_aMatchItems.push_back(aIterMap->second); - } - } - OSL_TRACE("\tOUT MQuery::setMatchItems()\n"); - - return; -} -// ------------------------------------------------------------------------- -const ::std::vector< ::rtl::OUString> &MQuery::getMatchItems() const -{ - OSL_TRACE("IN MQuery::getMatchItems()\n"); - - OSL_TRACE("\tOUT MQuery::getMatchItems()\n"); - - return(m_aMatchItems); -} -// ------------------------------------------------------------------------- -void MQuery::setMatchValues(::std::vector< ::rtl::OUString>& mv) -{ - OSL_TRACE("IN MQuery::setMatchValues()\n"); - ::osl::MutexGuard aGuard(m_aMutex); - m_aMatchValues.clear(); - m_aMatchValues = mv; - OSL_TRACE("\tOUT MQuery::setMatchValues()\n"); - - return; -} -// ------------------------------------------------------------------------- -const ::std::vector< ::rtl::OUString>& MQuery::getMatchValues( void ) const -{ - OSL_TRACE("IN MQuery::getMatchValues()\n"); - - OSL_TRACE("\tOUT MQuery::getMatchValue()\n"); - - return(m_aMatchValues); -} -// ------------------------------------------------------------------------- void MQuery::setMaxNrOfReturns(const sal_Int32 mnr) { OSL_TRACE( "IN MQuery::setMaxNrOfReturns()\n" ); @@ -308,27 +253,136 @@ sal_Bool MQuery::getQuerySubDirs() const return(m_bQuerySubDirs); } // ------------------------------------------------------------------------- -void MQuery::setSqlOppr(::std::vector< MQuery::eSqlOppr > &so) +void MQuery::setExpression( MQueryExpression &_expr ) { - OSL_TRACE("IN MQuery::setSqlOppr()\n"); + OSL_TRACE("IN MQuery::setExpression()\n"); ::osl::MutexGuard aGuard(m_aMutex); - m_aSqlOppr.clear(); - m_aSqlOppr = so; - - OSL_TRACE("\tOUT MQuery::setSqlOppr()\n"); + m_aExpr = _expr; - return; + OSL_TRACE("\tOUT MQuery::setExpression()\n"); } // ------------------------------------------------------------------------- -const ::std::vector< MQuery::eSqlOppr > &MQuery::getSqlOppr() const +static sal_Int32 generateExpression( MQuery* _aQuery, MQueryExpression* _aExpr, + nsIAbBooleanExpression* queryExpression ) { - OSL_TRACE("IN MQuery::getSqlOppr()\n"); + nsresult rv; // Store return values. + // Array that holds all matchItems, to be passed to DoQuery(). + nsCOMPtr<nsISupportsArray> matchItems; + NS_NewISupportsArray(getter_AddRefs(matchItems)); + + // Add every individual boolString to matchItems array. + nsString matchValue; + // Initialise the matchItems container. + MQueryExpression::ExprVector::iterator evIter; + for( evIter = _aExpr->getExpressions().begin(); + evIter != _aExpr->getExpressions().end(); + ++evIter ) + { + if ( (*evIter)->isStringExpr() ) { + nsCOMPtr<nsIAbBooleanConditionString> boolString = do_CreateInstance (kBooleanConditionStringCID, &rv); + NS_ENSURE_SUCCESS( rv, rv ); + + MQueryExpressionString* evStr = static_cast<MQueryExpressionString*> (*evIter); + + // Set the 'name' property of the boolString. + // Check if it's an alias first... + rtl::OUString attrName; + ::std::map< ::rtl::OUString, ::rtl::OUString>::iterator aIterMap; + aIterMap = _aQuery->getColumnAliasMap().find(evStr->getName()); + if (aIterMap == _aQuery->getColumnAliasMap().end()) { + // Not found. + attrName = evStr->getName(); + } else { + attrName = aIterMap->second; + } + string aMiName = MTypeConverter::ouStringToStlString(attrName); + boolString->SetName(strdup(aMiName.c_str())); + OSL_TRACE("Name = %s ;", aMiName.c_str() ); + // Set the 'matchType' property of the boolString. Check for equal length. + sal_Bool requiresValue = sal_True; + switch(evStr->getCond()) { + case MQueryOp::Exists: + OSL_TRACE("MQueryOp::Exists; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::Exists); + requiresValue = sal_False; + break; + case MQueryOp::DoesNotExist: + OSL_TRACE("MQueryOp::DoesNotExist; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotExist); + requiresValue = sal_False; + break; + case MQueryOp::Contains: + OSL_TRACE("MQueryOp::Contains; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::Contains); + break; + case MQueryOp::DoesNotContain: + OSL_TRACE("MQueryOp::DoesNotContain; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotContain); + break; + case MQueryOp::Is: + OSL_TRACE("MQueryOp::Is; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::Is); + break; + case MQueryOp::IsNot: + OSL_TRACE("MQueryOp::IsNot; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::IsNot); + break; + case MQueryOp::BeginsWith: + OSL_TRACE("MQueryOp::BeginsWith; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::BeginsWith); + break; + case MQueryOp::EndsWith: + OSL_TRACE("MQueryOp::EndsWith; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::EndsWith); + break; + case MQueryOp::SoundsLike: + OSL_TRACE("MQueryOp::SoundsLike; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::SoundsLike); + break; + case MQueryOp::RegExp: + OSL_TRACE("MQueryOp::RegExp; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::RegExp); + break; + default: + OSL_TRACE("(default) MQueryOp::Is; "); + boolString->SetCondition(nsIAbBooleanConditionTypes::Is); + break; + } + // Set the 'matchValue' property of the boolString. Value returned in unicode. + if ( requiresValue ) + { + OSL_TRACE("Value = %s \n", OUtoCStr( evStr->getValue() ) ); + MTypeConverter::ouStringToNsString( evStr->getValue(), matchValue); + boolString->SetValue(matchValue.get ()); + } + // Add the individual boolString to the container of matchItems. + matchItems->AppendElement(boolString); + } + else if ( (*evIter)->isExpr() ) { + nsCOMPtr< nsIAbBooleanExpression > subQueryExpr = do_CreateInstance( kBooleanExpressionCID , &rv); + NS_ENSURE_SUCCESS( rv, rv ); + rv = generateExpression( _aQuery, static_cast< MQueryExpression* >(*evIter), + subQueryExpr ); + NS_ENSURE_SUCCESS( rv, rv ); + matchItems->AppendElement(subQueryExpr); + } + else { + // Should never see this... + OSL_ASSERT("Unknown Expression Type!"); + return( NS_ERROR_UNEXPECTED ); + } + } - OSL_TRACE("\tOUT MQuery::getSqlOppr()\n"); + queryExpression->SetExpressions(matchItems); + if ( _aExpr->getExpressionCondition() == MQueryExpression::AND ) + queryExpression->SetOperation(nsIAbBooleanOperationTypes::AND); + else + queryExpression->SetOperation(nsIAbBooleanOperationTypes::OR); - return(m_aSqlOppr); + return( NS_OK ); } + // ------------------------------------------------------------------------- sal_Int32 MQuery::executeQuery(sal_Bool _bIsOutlookExpress, OConnection* _pCon) { @@ -374,88 +428,10 @@ sal_Int32 MQuery::executeQuery(sal_Bool _bIsOutlookExpress, OConnection* _pCon) OSL_TRACE("Not using a Query Proxy, Query i/f supported by directory\n"); #endif /* DEBUG */ - // Array that holds all matchItems, to be passed to DoQuery(). - nsCOMPtr<nsISupportsArray> matchItems; - NS_NewISupportsArray(getter_AddRefs(matchItems)); - - // Add every individual boolString to matchItems array. - ::std::vector< ::rtl::OUString>::iterator aIterMi = m_aMatchItems.begin(); - ::std::vector< eSqlOppr >::iterator aIterOp = m_aSqlOppr.begin(); - ::std::vector< ::rtl::OUString>::iterator aIterVal = m_aMatchValues.begin(); - nsString matchValue; - // Initialise the matchItems container. - for(aIterMi; aIterMi != m_aMatchItems.end();++aIterMi, ++aIterOp, ++aIterVal) - { - nsCOMPtr<nsIAbBooleanConditionString> boolString = do_CreateInstance (kBooleanConditionStringCID, &rv); - NS_ENSURE_SUCCESS( rv, rv ); - // Set the 'name' property of the boolString. - string aMiName = MTypeConverter::ouStringToStlString(*aIterMi); - boolString->SetName(strdup(aMiName.c_str())); - OSL_TRACE("Name = %s ;", aMiName.c_str() ); - // Set the 'matchType' property of the boolString. Check for equal length. - if (aIterOp == m_aSqlOppr.end() && aIterMi != m_aMatchItems.end()) { - m_aSqlOppr.push_back(matchIs); // Add matchIs for non-set value. - } - switch(*aIterOp) { - case matchExists: - OSL_TRACE("matchExists; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::Exists); - break; - case matchDoesNotExist: - OSL_TRACE("matchDoesNotExist; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotExist); - break; - case matchContains: - OSL_TRACE("matchContains; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::Contains); - break; - case matchDoesNotContain: - OSL_TRACE("matchDoesNotContain; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotContain); - break; - case matchIs: - OSL_TRACE("matchIs; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::Is); - break; - case matchIsNot: - OSL_TRACE("matchIsNot; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::IsNot); - break; - case matchBeginsWith: - OSL_TRACE("matchBeginsWith; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::BeginsWith); - break; - case matchEndsWith: - OSL_TRACE("matchEndsWith; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::EndsWith); - break; - case matchSoundsLike: - OSL_TRACE("matchSoundsLike; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::SoundsLike); - break; - case matchRegExp: - OSL_TRACE("matchRegExp; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::RegExp); - break; - default: - OSL_TRACE("(default) matchIs; "); - boolString->SetCondition(nsIAbBooleanConditionTypes::Is); - break; - } - // Set the 'matchValue' property of the boolString. Value returned in unicode. - if ( (*aIterVal) ) - { - OSL_TRACE("Value = %s \n", OUtoCStr( (*aIterVal) ) ); - MTypeConverter::ouStringToNsString( (*aIterVal), matchValue); - boolString->SetValue(matchValue.ToNewUnicode ()); - } - // Add the individual boolString to the container of matchItems. - matchItems->AppendElement(boolString); - } nsCOMPtr< nsIAbBooleanExpression > queryExpression = do_CreateInstance( kBooleanExpressionCID , &rv); NS_ENSURE_SUCCESS( rv, rv ); - queryExpression->SetExpressions(matchItems); - queryExpression->SetOperation(nsIAbBooleanOperationTypes::OR); + rv = generateExpression( this, &m_aExpr, queryExpression ); + NS_ENSURE_SUCCESS( rv, rv ); // Add every atribute we're interested in to the return properties array. ::std::vector< ::rtl::OUString>::iterator aIterAttr = m_aAttributes.begin(); @@ -490,6 +466,10 @@ sal_Int32 MQuery::executeQuery(sal_Bool _bIsOutlookExpress, OConnection* _pCon) rv = m_aQueryDirectory->directory->DoQuery(arguments, m_aQueryHelper, m_nMaxNrOfReturns, -1, &m_aQueryDirectory->contextId); + for ( sal_Int32 j = 0; returnProperties && returnProperties[j]; j++ ) { + free( returnProperties[j] ); // use free for mem allocated with strdup() + } + if (NS_FAILED(rv)) { m_aQueryDirectory->contextId = -1; OSL_TRACE( "****** DoQuery failed\n"); @@ -552,7 +532,7 @@ sal_Bool MQuery::checkRowAvailable( sal_Int32 nDBRow ) throw( ::com::sun::star::sdbc::SQLException ) { - while( !queryComplete() && m_aQueryHelper->getRealCount() <= nDBRow ) + while( !queryComplete() && m_aQueryHelper->getRealCount() <= (sal_uInt32)nDBRow ) m_aQueryHelper->waitForRow( nDBRow ); return( getRowCount() > nDBRow ); @@ -595,10 +575,10 @@ MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow, rtl::OUString& aDBC OSL_TRACE( "\tOUT MQuery::getRowValue()\n"); } // ------------------------------------------------------------------------- + MNameMapper* MQuery::CreateNameMapper() { return( new MNameMapper() ); } - diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx index d02d021381fa..97fe43e350c0 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MQuery.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mmaher $ $Date: 2001-10-31 17:24:23 $ + * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,7 +79,112 @@ namespace connectivity class MQueryHelper; struct MQueryDirectory; - //class MQuery : public nsIAbDirectoryQueryResultListener + 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( ) { return m_eNodeType == Unknown; } + sal_Bool isStringExpr( ) { return m_eNodeType == StringExpr; } + sal_Bool isExpr( ) { 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() { return m_aName; } + const MQueryOp::cond_type getCond() { return m_aBooleanCondition; } + const ::rtl::OUString& getValue() { return m_aValue; } + }; + + class MQuery; + + class MQueryExpression : public MQueryExpressionBase + { + friend MQuery; + + 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( ) + { return m_aExprCondType; } + + MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ), + m_aExprCondType( OR ) + { m_aExprVector.clear(); } + + + protected: + ExprVector m_aExprVector; + bool_cond m_aExprCondType; + + }; + class MQuery { /* @@ -126,36 +231,21 @@ namespace connectivity * the default SQL operation is 'matchIs'. * */ - public: - typedef enum { - matchExists = 0, - matchDoesNotExist = 1, - matchContains = 2, - matchDoesNotContain = 3, - matchIs = 4, - matchIsNot = 5, - matchBeginsWith = 6, - matchEndsWith = 7, - matchSoundsLike = 8, - matchRegExp = 9 - } eSqlOppr; - private: MQueryDirectory *m_aQueryDirectory; MQueryHelper *m_aQueryHelper; MNameMapper *m_aNameMapper; ::std::vector< ::rtl::OUString> m_aAttributes; ::rtl::OUString m_aAddressbook; - ::std::vector< ::rtl::OUString> m_aMatchItems; - ::std::vector< ::rtl::OUString> m_aMatchValues; sal_Int32 m_nMaxNrOfReturns; sal_Bool m_bQuerySubDirs; - ::std::vector<eSqlOppr> m_aSqlOppr; + MQueryExpression m_aExpr; ::std::map< ::rtl::OUString, - ::rtl::OUString> m_aColumnAliasMap; + ::rtl::OUString> m_aColumnAliasMap; void construct(); protected: ::osl::Mutex m_aMutex; + public: /* * - Contains accessors to the members of this class. @@ -163,18 +253,21 @@ namespace connectivity */ void setAttributes( ::std::vector< ::rtl::OUString>&); const ::std::vector< ::rtl::OUString> &getAttributes(void) const; + void setAddressbook( ::rtl::OUString&); ::rtl::OUString getAddressbook(void) const; - void setMatchItems( ::std::vector< ::rtl::OUString>&); - const ::std::vector< ::rtl::OUString> &getMatchItems(void) const; - void setMatchValues( ::std::vector< ::rtl::OUString>&); - const ::std::vector< ::rtl::OUString> &getMatchValues(void) const; + + ::std::map< ::rtl::OUString, + ::rtl::OUString> &getColumnAliasMap() { return m_aColumnAliasMap; } + + void setExpression( MQueryExpression &_expr ); + void setMaxNrOfReturns( const sal_Int32); sal_Int32 getMaxNrOfReturns(void) const; + void setQuerySubDirs( sal_Bool&); sal_Bool getQuerySubDirs(void) const; - void setSqlOppr( ::std::vector< eSqlOppr >&); - const ::std::vector< eSqlOppr > &getSqlOppr(void) const; + sal_Int32 executeQuery(sal_Bool _bIsOutlookExpress, OConnection* _pCon); sal_Int32 getRowCount( void ); diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx index 54966f1cf5d7..ebe088d91a4d 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MQueryHelper.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $ + * last change: $Author: dkenny $ $Date: 2001-11-07 10:49:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -473,8 +473,8 @@ NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result) // Default value for PerferMailFormat is mime type text/plain. // Mapping for PreferMailFormat values to Mime-types. if (strcmp(name, "PreferMailFormat") == 0) { - nsCAutoString val_c; - val_c.AssignWithConversion(value); + nsCAutoString val_c; + val_c.AssignWithConversion(value); if (strcmp((char *) val_c.get(), mozPreferMailFormatTypes[0]) == 0) { // unknown, insert plain/text mime type sValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]); |