diff options
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/commontools/dbconversion.cxx | 185 | ||||
-rw-r--r-- | connectivity/source/commontools/makefile.mk | 5 | ||||
-rw-r--r-- | connectivity/source/inc/internalnode.hxx | 8 | ||||
-rw-r--r-- | connectivity/source/inc/sqlscan.hxx | 45 | ||||
-rw-r--r-- | connectivity/source/parse/internalnode.cxx | 23 | ||||
-rw-r--r-- | connectivity/source/parse/sqlbison.y | 559 | ||||
-rw-r--r-- | connectivity/source/parse/sqlflex.l | 138 | ||||
-rw-r--r-- | connectivity/source/parse/sqliterator.cxx | 454 | ||||
-rw-r--r-- | connectivity/source/parse/sqlnode.cxx | 474 | ||||
-rw-r--r-- | connectivity/source/sdbcx/VCatalog.cxx | 8 | ||||
-rw-r--r-- | connectivity/source/sdbcx/VCollection.cxx | 11 | ||||
-rw-r--r-- | connectivity/source/sdbcx/VKeyColumn.cxx | 8 |
12 files changed, 898 insertions, 1020 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx index f9125e2ab745..22b0c679a0c3 100644 --- a/connectivity/source/commontools/dbconversion.cxx +++ b/connectivity/source/commontools/dbconversion.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbconversion.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: fs $ $Date: 2000-10-05 08:50:32 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:46:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,17 +65,15 @@ #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> #endif - #ifndef _COMPHELPER_NUMBERS_HXX_ #include <comphelper/numbers.hxx> #endif -#ifndef _UNOTOOLS_DATETIME_HXX_ +#ifndef _COMPHELPER_DATETIME_HXX_ #include <comphelper/datetime.hxx> #endif #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif - #ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ #include <com/sun/star/util/NumberFormat.hpp> #endif @@ -85,6 +83,16 @@ #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> #endif +#ifndef _COM_SUN_STAR_SDB_XCOLUMNUPDATE_HPP_ +#include <com/sun/star/sdb/XColumnUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_ +#include <com/sun/star/sdb/XColumn.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + #define MAX_DAYS 3636532 @@ -95,14 +103,19 @@ namespace dbtools using namespace ::comphelper; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::sdb; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; //------------------------------------------------------------------------------ -starutil::Date DBTypeConversion::STANDARD_DB_DATE(1, 1, 1900); +Date DBTypeConversion::STANDARD_DB_DATE(1, 1, 1900); //------------------------------------------------------------------------------ -void DBTypeConversion::setValue(const staruno::Reference<starsdb::XColumnUpdate>& xVariant, - const staruno::Reference<starutil::XNumberFormatter>& xFormatter, - const starutil::Date& rNullDate, +void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant, + const Reference<XNumberFormatter>& xFormatter, + const Date& rNullDate, const ::rtl::OUString& rString, sal_Int32 nKey, sal_Int16 nFieldType, @@ -112,8 +125,8 @@ void DBTypeConversion::setValue(const staruno::Reference<starsdb::XColumnUpdate> if (rString.len()) { // Muss der String formatiert werden? - sal_Int16 nTypeClass = nKeyType & ~starutil::NumberFormat::DEFINED; - sal_Bool bTextFormat = nTypeClass == starutil::NumberFormat::TEXT; + sal_Int16 nTypeClass = nKeyType & ~NumberFormat::DEFINED; + sal_Bool bTextFormat = nTypeClass == NumberFormat::TEXT; sal_Int32 nKeyToUse = bTextFormat ? 0 : nKey; sal_Int16 nRealUsedTypeClass = nTypeClass; // bei einem Text-Format muessen wir dem Formatter etwas mehr Freiheiten einraeumen, sonst @@ -123,10 +136,10 @@ void DBTypeConversion::setValue(const staruno::Reference<starsdb::XColumnUpdate> fValue = xFormatter->convertStringToNumber(nKeyToUse, rString); sal_Int32 nRealUsedKey = xFormatter->detectNumberFormat(0, rString); if (nRealUsedKey != nKeyToUse) - nRealUsedTypeClass = getNumberFormatType(xFormatter, nRealUsedKey) & ~starutil::NumberFormat::DEFINED; + nRealUsedTypeClass = getNumberFormatType(xFormatter, nRealUsedKey) & ~NumberFormat::DEFINED; // und noch eine Sonderbehandlung, diesmal fuer Prozent-Formate - if ((starutil::NumberFormat::NUMBER == nRealUsedTypeClass) && (starutil::NumberFormat::PERCENT == nTypeClass)) + if ((NumberFormat::NUMBER == nRealUsedTypeClass) && (NumberFormat::PERCENT == nTypeClass)) { // die Formatierung soll eigentlich als Prozent erfolgen, aber der String stellt nur eine // einfache Nummer dar -> anpassen ::rtl::OUString sExpanded(rString); @@ -138,16 +151,16 @@ void DBTypeConversion::setValue(const staruno::Reference<starsdb::XColumnUpdate> switch (nRealUsedTypeClass) { - case starutil::NumberFormat::DATE: - case starutil::NumberFormat::DATETIME: + case NumberFormat::DATE: + case NumberFormat::DATETIME: xVariant->updateDouble(toStandardDbDate(rNullDate, fValue)); break; - case starutil::NumberFormat::TIME: - case starutil::NumberFormat::CURRENCY: - case starutil::NumberFormat::NUMBER: - case starutil::NumberFormat::SCIENTIFIC: - case starutil::NumberFormat::FRACTION: - case starutil::NumberFormat::PERCENT: + case NumberFormat::TIME: + case NumberFormat::CURRENCY: + case NumberFormat::NUMBER: + case NumberFormat::SCIENTIFIC: + case NumberFormat::FRACTION: + case NumberFormat::PERCENT: xVariant->updateDouble(fValue); break; default: @@ -175,16 +188,16 @@ void DBTypeConversion::setValue(const staruno::Reference<starsdb::XColumnUpdate> } //------------------------------------------------------------------------------ -void DBTypeConversion::setValue(const staruno::Reference<starsdb::XColumnUpdate>& xVariant, - const starutil::Date& rNullDate, +void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant, + const Date& rNullDate, const double& rValue, sal_Int16 nKeyType) throw(starlang::IllegalArgumentException) { - switch (nKeyType & ~starutil::NumberFormat::DEFINED) + switch (nKeyType & ~NumberFormat::DEFINED) { - case starutil::NumberFormat::DATE: - case starutil::NumberFormat::DATETIME: - // case starutil::NumberFormat::TIME: + case NumberFormat::DATE: + case NumberFormat::DATETIME: + // case NumberFormat::TIME: xVariant->updateDouble(toStandardDbDate(rNullDate, rValue)); break; default: @@ -193,17 +206,17 @@ void DBTypeConversion::setValue(const staruno::Reference<starsdb::XColumnUpdate> } //------------------------------------------------------------------------------ -double DBTypeConversion::getValue(const staruno::Reference<starsdb::XColumn>& xVariant, - const starutil::Date& rNullDate, +double DBTypeConversion::getValue(const Reference<XColumn>& xVariant, + const Date& rNullDate, sal_Int16 nKeyType) { try { - switch (nKeyType & ~starutil::NumberFormat::DEFINED) + switch (nKeyType & ~NumberFormat::DEFINED) { - case starutil::NumberFormat::DATE: - case starutil::NumberFormat::DATETIME: - // case starutil::NumberFormat::TIME: + case NumberFormat::DATE: + case NumberFormat::DATETIME: + // case NumberFormat::TIME: return toNullDate(rNullDate, xVariant->getDouble()); default: return xVariant->getDouble(); @@ -215,10 +228,10 @@ double DBTypeConversion::getValue(const staruno::Reference<starsdb::XColumn>& xV } } //------------------------------------------------------------------------------ -::rtl::OUString DBTypeConversion::getValue(const staruno::Reference<starbeans::XPropertySet>& _xColumn, - const staruno::Reference<starutil::XNumberFormatter>& _xFormatter, +::rtl::OUString DBTypeConversion::getValue(const Reference<starbeans::XPropertySet>& _xColumn, + const Reference<XNumberFormatter>& _xFormatter, const starlang::Locale& _rLocale, - const starutil::Date& _rNullDate) + const Date& _rNullDate) { sal_Int32 nKey; sal_Int16 nKeyType; @@ -237,23 +250,23 @@ double DBTypeConversion::getValue(const staruno::Reference<starsdb::XColumn>& xV if (!nKey) { - staruno::Reference<starutil::XNumberFormats> xFormats( _xFormatter->getNumberFormatsSupplier()->getNumberFormats() ); - staruno::Reference<starutil::XNumberFormatTypes> xTypeList(_xFormatter->getNumberFormatsSupplier()->getNumberFormats(), staruno::UNO_QUERY); + Reference<XNumberFormats> xFormats( _xFormatter->getNumberFormatsSupplier()->getNumberFormats() ); + Reference<XNumberFormatTypes> xTypeList(_xFormatter->getNumberFormatsSupplier()->getNumberFormats(), UNO_QUERY); nKey = dbtools::getDefaultNumberFormat(_xColumn, - staruno::Reference< starutil::XNumberFormatTypes > (xFormats, staruno::UNO_QUERY), + Reference< XNumberFormatTypes > (xFormats, UNO_QUERY), _rLocale); - nKeyType = getNumberFormatType(_xFormatter, nKey) & ~starutil::NumberFormat::DEFINED; + nKeyType = getNumberFormatType(_xFormatter, nKey) & ~NumberFormat::DEFINED; } - return DBTypeConversion::getValue(staruno::Reference< starsdb::XColumn > (_xColumn, staruno::UNO_QUERY), _xFormatter, _rNullDate, nKey, nKeyType); + return DBTypeConversion::getValue(Reference< XColumn > (_xColumn, UNO_QUERY), _xFormatter, _rNullDate, nKey, nKeyType); } //------------------------------------------------------------------------------ -::rtl::OUString DBTypeConversion::getValue(const staruno::Reference<starsdb::XColumn>& xVariant, - const staruno::Reference<starutil::XNumberFormatter>& xFormatter, - const starutil::Date& rNullDate, +::rtl::OUString DBTypeConversion::getValue(const Reference<XColumn>& xVariant, + const Reference<XNumberFormatter>& xFormatter, + const Date& rNullDate, sal_Int32 nKey, sal_Int16 nKeyType) { @@ -262,32 +275,32 @@ double DBTypeConversion::getValue(const staruno::Reference<starsdb::XColumn>& xV { try { - switch (nKeyType & ~starutil::NumberFormat::DEFINED) + switch (nKeyType & ~NumberFormat::DEFINED) { - case starutil::NumberFormat::DATE: - case starutil::NumberFormat::DATETIME: + case NumberFormat::DATE: + case NumberFormat::DATETIME: { double fValue = xVariant->getDouble(); if (!xVariant->wasNull()) xFormatter->convertNumberToString(nKey, toNullDate(rNullDate, fValue)); } break; - case starutil::NumberFormat::TIME: - case starutil::NumberFormat::NUMBER: - case starutil::NumberFormat::SCIENTIFIC: - case starutil::NumberFormat::FRACTION: - case starutil::NumberFormat::PERCENT: + case NumberFormat::TIME: + case NumberFormat::NUMBER: + case NumberFormat::SCIENTIFIC: + case NumberFormat::FRACTION: + case NumberFormat::PERCENT: { double fValue = xVariant->getDouble(); if (!xVariant->wasNull()) aString = xFormatter->convertNumberToString(nKey, fValue); } break; - case starutil::NumberFormat::CURRENCY: + case NumberFormat::CURRENCY: { double fValue = xVariant->getDouble(); if (!xVariant->wasNull()) aString = xFormatter->getInputString(nKey, fValue); } break; - case starutil::NumberFormat::TEXT: + case NumberFormat::TEXT: aString = xFormatter->formatString(nKey, xVariant->getString()); break; default: @@ -305,7 +318,7 @@ double DBTypeConversion::getValue(const staruno::Reference<starsdb::XColumn>& xV const double fMilliSecondsPerDay = 86400000.0; //------------------------------------------------------------------------------ -sal_Int32 DBTypeConversion::toINT32(const starutil::Date& rVal) +sal_Int32 DBTypeConversion::toINT32(const Date& rVal) { return ((sal_Int32)(rVal.Day%100)) + (((sal_Int32)(rVal.Month%100))*100) + @@ -313,7 +326,7 @@ sal_Int32 DBTypeConversion::toINT32(const starutil::Date& rVal) } //------------------------------------------------------------------------------ -sal_Int32 DBTypeConversion::toINT32(const starutil::Time& rVal) +sal_Int32 DBTypeConversion::toINT32(const Time& rVal) { // Zeit normalisieren sal_Int32 nSeconds = rVal.Seconds + rVal.HundredthSeconds / 100; @@ -328,7 +341,7 @@ sal_Int32 DBTypeConversion::toINT32(const starutil::Time& rVal) } //------------------------------------------------------------------------------ -sal_Int64 DBTypeConversion::toINT64(const starutil::DateTime& rVal) +sal_Int64 DBTypeConversion::toINT64(const DateTime& rVal) { // Zeit normalisieren sal_Int32 nSeconds = rVal.Seconds + rVal.HundredthSeconds / 100; @@ -347,7 +360,7 @@ sal_Int64 DBTypeConversion::toINT64(const starutil::DateTime& rVal) } //------------------------------------------------------------------------------ -sal_Int32 DBTypeConversion::getMsFromTime(const starutil::Time& rVal) +sal_Int32 DBTypeConversion::getMsFromTime(const Time& rVal) { sal_Int16 nSign = (toINT32(rVal) >= 0) ? +1 : -1; sal_Int32 nHour = rVal.Hours; @@ -388,7 +401,7 @@ static sal_Int32 implDaysInMonth(sal_Int32 _nMonth, sal_Int32 _nYear) } //------------------------------------------------------------------------------ -static sal_Int32 implRelativeToAbsoluteNull(const starutil::Date& _rDate) +static sal_Int32 implRelativeToAbsoluteNull(const Date& _rDate) { sal_Int32 nDays = 0; @@ -446,27 +459,27 @@ static void implBuildFromRelative( sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16 rDay = nTempDays; } //------------------------------------------------------------------------------ -sal_Int32 DBTypeConversion::toDays(const starutil::Date& _rVal, const starutil::Date& _rNullDate) +sal_Int32 DBTypeConversion::toDays(const Date& _rVal, const Date& _rNullDate) { return implRelativeToAbsoluteNull(_rVal) - implRelativeToAbsoluteNull(_rNullDate); } //------------------------------------------------------------------------------ -double DBTypeConversion::toDouble(const starutil::Date& rVal, const starutil::Date& _rNullDate) +double DBTypeConversion::toDouble(const Date& rVal, const Date& _rNullDate) { return (double)toDays(rVal, _rNullDate); } //------------------------------------------------------------------------------ -double DBTypeConversion::toDouble(const starutil::Time& rVal) +double DBTypeConversion::toDouble(const Time& rVal) { return (double)getMsFromTime(rVal) / fMilliSecondsPerDay; } //------------------------------------------------------------------------------ -double DBTypeConversion::toDouble(const starutil::DateTime& _rVal, const starutil::Date& _rNullDate) +double DBTypeConversion::toDouble(const DateTime& _rVal, const Date& _rNullDate) { - sal_Int64 nTime = toDays(starutil::Date(_rVal.Day, _rVal.Month, _rVal.Year), _rNullDate); + sal_Int64 nTime = toDays(Date(_rVal.Day, _rVal.Month, _rVal.Year), _rNullDate); sal_Int16 nSign = (nTime >= 0) ? +1 : -1; sal_Int32 nHour = _rVal.Hours; sal_Int32 nMin = _rVal.Minutes; @@ -478,7 +491,7 @@ double DBTypeConversion::toDouble(const starutil::DateTime& _rVal, const staruti return ((double)nTime) + (nVal * (1/fMilliSecondsPerDay)); } // ------------------------------------------------------------------------- -static void addDays(sal_Int32 nDays, starutil::Date& _rDate) +static void addDays(sal_Int32 nDays, Date& _rDate) { sal_Int32 nTempDays = implRelativeToAbsoluteNull( _rDate ); @@ -499,7 +512,7 @@ static void addDays(sal_Int32 nDays, starutil::Date& _rDate) implBuildFromRelative( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year ); } // ----------------------------------------------------------------------- -static void subDays( sal_Int32 nDays, starutil::Date& _rDate ) +static void subDays( sal_Int32 nDays, Date& _rDate ) { sal_Int32 nTempDays = implRelativeToAbsoluteNull( _rDate ); @@ -520,9 +533,9 @@ static void subDays( sal_Int32 nDays, starutil::Date& _rDate ) implBuildFromRelative( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year ); } // ------------------------------------------------------------------------- -starutil::Date DBTypeConversion::toDate(double dVal, const starutil::Date& _rNullDate) +Date DBTypeConversion::toDate(double dVal, const Date& _rNullDate) { - starutil::Date aRet = _rNullDate; + Date aRet = _rNullDate; if (dVal >= 0) addDays((sal_Int32)dVal,aRet); @@ -533,7 +546,7 @@ starutil::Date DBTypeConversion::toDate(double dVal, const starutil::Date& _rNul return aRet; } // ------------------------------------------------------------------------- -starutil::Time DBTypeConversion::toTime(double dVal) +Time DBTypeConversion::toTime(double dVal) { sal_Int32 nDays = (sal_Int32)dVal; sal_Int32 nMS = sal_Int32((dVal - (double)nDays) * fMilliSecondsPerDay + 0.5); @@ -547,7 +560,7 @@ starutil::Time DBTypeConversion::toTime(double dVal) else nSign = 1; - starutil::Time xRet; + Time xRet; // Zeit normalisieren xRet.HundredthSeconds = nMS/10; xRet.Seconds = xRet.HundredthSeconds / 100; @@ -571,12 +584,12 @@ starutil::Time DBTypeConversion::toTime(double dVal) } //------------------------------------------------------------------------------ -starutil::DateTime DBTypeConversion::toDateTime(double dVal, const starutil::Date& _rNullDate) +DateTime DBTypeConversion::toDateTime(double dVal, const Date& _rNullDate) { - starutil::Date aDate = toDate(dVal, _rNullDate); - starutil::Time aTime = toTime(dVal); + Date aDate = toDate(dVal, _rNullDate); + Time aTime = toTime(dVal); - starutil::DateTime xRet; + DateTime xRet; xRet.Day = aDate.Day; xRet.Month = aDate.Month; @@ -590,6 +603,27 @@ starutil::DateTime DBTypeConversion::toDateTime(double dVal, const starutil::Dat return xRet; } +//------------------------------------------------------------------------------ +Date DBTypeConversion::getNULLDate(const Reference< XNumberFormatsSupplier > &xSupplier) +{ + OSL_ENSHURE(xSupplier.is(), "getNULLDate : the formatter doesn't implement a supplier !"); + if (xSupplier.is()) + { + try + { + // get the null date + Date aDate; + xSupplier->getNumberFormatSettings()->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate; + return aDate; + } + catch ( ... ) + { + } + } + + return STANDARD_DB_DATE; +} + //......................................................................... } // namespace dbtools //......................................................................... @@ -598,6 +632,9 @@ starutil::DateTime DBTypeConversion::toDateTime(double dVal, const starutil::Dat /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.1 2000/10/05 08:50:32 fs + * moved the files from unotools to here + * * * Revision 1.0 29.09.00 08:17:18 fs ************************************************************************/ diff --git a/connectivity/source/commontools/makefile.mk b/connectivity/source/commontools/makefile.mk index 5840a48221bd..e7a6bdb4d83e 100644 --- a/connectivity/source/commontools/makefile.mk +++ b/connectivity/source/commontools/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: hjs $ $Date: 2000-10-12 12:46:18 $ +# last change: $Author: oj $ $Date: 2000-10-19 11:46:15 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -78,7 +78,6 @@ SLOFILES=\ $(SLO)$/dbtools.obj \ $(SLO)$/dbexception.obj \ $(SLO)$/dbconversion.obj \ - $(SLO)$/enumhelper.obj \ $(SLO)$/CommonTools.obj \ $(SLO)$/DateConversion.obj \ diff --git a/connectivity/source/inc/internalnode.hxx b/connectivity/source/inc/internalnode.hxx index 819b3dbef122..5e95518db88b 100644 --- a/connectivity/source/inc/internalnode.hxx +++ b/connectivity/source/inc/internalnode.hxx @@ -2,9 +2,9 @@ * * $RCSfile: internalnode.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:45:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,13 +78,13 @@ namespace connectivity OSQLInternalNode(const sal_Char* pNewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID = 0); - OSQLInternalNode(const ByteString& _rNewValue, + OSQLInternalNode(const ::rtl::OString& _rNewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID = 0); OSQLInternalNode(const sal_Unicode* pNewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID = 0); - OSQLInternalNode(const String& _rNewValue, + OSQLInternalNode(const ::rtl::OUString& _rNewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID = 0); diff --git a/connectivity/source/inc/sqlscan.hxx b/connectivity/source/inc/sqlscan.hxx index 70d23ca6ef67..950a85a264fd 100644 --- a/connectivity/source/inc/sqlscan.hxx +++ b/connectivity/source/inc/sqlscan.hxx @@ -2,9 +2,9 @@ * * $RCSfile: sqlscan.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:45:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,13 +63,6 @@ #include <stdarg.h> -#ifndef _DEBUG_HXX //autogen -#include <tools/debug.hxx> -#endif -#ifndef _STRING_HXX //autogen wg. String -#include <tools/string.hxx> -#endif - namespace connectivity { class OParseContext; @@ -81,10 +74,10 @@ namespace connectivity class OSQLScanner { OParseContext* m_pContext; // context for parse, knows all international stuff - ByteString m_sStatement; // statement to parse - String m_sErrorMessage; + ::rtl::OString m_sStatement; // statement to parse + ::rtl::OUString m_sErrorMessage; - xub_StrLen m_nCurrentPos; // next position to read from the statement + sal_Int32 m_nCurrentPos; // next position to read from the statement sal_Bool m_bInternational; // do we have a statement which may uses sal_Int32 m_nRule; // rule to be set @@ -92,27 +85,27 @@ namespace connectivity OSQLScanner(); ~OSQLScanner(); - virtual int SQLyygetc(void); + virtual sal_Int32 SQLyygetc(void); virtual void SQLyyerror(char *fmt); - virtual void output(int) { DBG_ERROR("Internal error in sdblex.l: output not possible"); } - virtual void ECHO(void) { DBG_ERROR("Internal error in sdblex.l: ECHO not possible"); } - virtual int getInternationalTokenID(const char* sToken) const; + virtual void output(sal_Int32) { OSL_ASSERT("Internal error in sdblex.l: output not possible"); } + virtual void ECHO(void) { OSL_ASSERT("Internal error in sdblex.l: ECHO not possible"); } + virtual sal_Int32 getInternationalTokenID(const char* sToken) const; // setting the new information before scanning - void prepareScan(const String & rNewStatement, OParseContext* pContext, sal_Bool bInternational); - const String& getErrorMessage() const {return m_sErrorMessage;} + void prepareScan(const ::rtl::OUString & rNewStatement, OParseContext* pContext, sal_Bool bInternational); + const ::rtl::OUString& getErrorMessage() const {return m_sErrorMessage;} - int SQLlex(); + sal_Int32 SQLlex(); // set this as scanner for flex void setScanner(sal_Bool _bNull=sal_False); // rules settings - void SetRule(int nRule) {m_nRule = nRule;} - int GetCurrentRule() const; - int GetGERRule() const; - int GetENGRule() const; - int GetSQLRule() const; - int GetDATERule() const; - int GetSTRINGRule() const; + void SetRule(sal_Int32 nRule) {m_nRule = nRule;} + sal_Int32 GetCurrentRule() const; + sal_Int32 GetGERRule() const; + sal_Int32 GetENGRule() const; + sal_Int32 GetSQLRule() const; + sal_Int32 GetDATERule() const; + sal_Int32 GetSTRINGRule() const; }; } diff --git a/connectivity/source/parse/internalnode.cxx b/connectivity/source/parse/internalnode.cxx index 57d5dbd6d7e6..6c5ff46a478b 100644 --- a/connectivity/source/parse/internalnode.cxx +++ b/connectivity/source/parse/internalnode.cxx @@ -2,9 +2,9 @@ * * $RCSfile: internalnode.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:47:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,9 +66,6 @@ #ifndef _CONNECTIVITY_SQLPARSE_HXX #include <connectivity/sqlparse.hxx> #endif -#ifndef _DEBUG_HXX //autogen -#include <tools/debug.hxx> -#endif using namespace connectivity; @@ -76,19 +73,19 @@ using namespace connectivity; OSQLInternalNode::OSQLInternalNode(const sal_Char* pNewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID) - :OSQLParseNode(pNewValue,eNodeType,nNodeID) + : OSQLParseNode(pNewValue,eNodeType,nNodeID) { - DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSL_ENSHURE(OSQLParser::s_pGarbageCollector, "Collector not initialized"); OSQLParser::s_pGarbageCollector->push_back(this); } //----------------------------------------------------------------------------- -OSQLInternalNode::OSQLInternalNode(const ByteString &_NewValue, +OSQLInternalNode::OSQLInternalNode(const ::rtl::OString &_NewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID) :OSQLParseNode(_NewValue,eNodeType,nNodeID) { - DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSL_ENSHURE(OSQLParser::s_pGarbageCollector, "Collector not initialized"); OSQLParser::s_pGarbageCollector->push_back(this); } @@ -98,17 +95,17 @@ OSQLInternalNode::OSQLInternalNode(const sal_Unicode* pNewValue, sal_uInt32 nNodeID) :OSQLParseNode(pNewValue,eNodeType,nNodeID) { - DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSL_ENSHURE(OSQLParser::s_pGarbageCollector, "Collector not initialized"); OSQLParser::s_pGarbageCollector->push_back(this); } //----------------------------------------------------------------------------- -OSQLInternalNode::OSQLInternalNode(const String &_NewValue, +OSQLInternalNode::OSQLInternalNode(const ::rtl::OUString &_NewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID) :OSQLParseNode(_NewValue,eNodeType,nNodeID) { - DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSL_ENSHURE(OSQLParser::s_pGarbageCollector, "Collector not initialized"); OSQLParser::s_pGarbageCollector->push_back(this); } @@ -117,7 +114,7 @@ OSQLInternalNode::OSQLInternalNode(const String &_NewValue, OSQLInternalNode::~OSQLInternalNode() { // remove the node from the garbage list - DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSL_ENSHURE(OSQLParser::s_pGarbageCollector, "Collector not initialized"); if (!OSQLParser::s_pGarbageCollector->empty()) { OSQLParser::s_pGarbageCollector->erase( diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index b191eaf6c196..91f450a7f1f6 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -1,7 +1,7 @@ %{ //-------------------------------------------------------------------------- // -// $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/connectivity/source/parse/sqlbison.y,v 1.2 2000-10-17 08:37:23 oj Exp $ +// $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/connectivity/source/parse/sqlbison.y,v 1.3 2000-10-19 11:47:14 oj Exp $ // // Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. // @@ -9,7 +9,7 @@ // OJ // // Last change: -// $Author: oj $ $Date: 2000-10-17 08:37:23 $ $Revision: 1.2 $ +// $Author: oj $ $Date: 2000-10-19 11:47:14 $ $Revision: 1.3 $ // // Description: // @@ -20,10 +20,6 @@ #include <vector> #endif -#ifndef _SOLAR_H -#include <tools/solar.h> -#endif - #ifndef _CONNECTIVITY_SQLNODE_HXX #include <connectivity/sqlnode.hxx> #endif @@ -41,7 +37,13 @@ #endif #ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ #include <com/sun/star/util/Date.hpp> -#endif +#endif
+#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
+#include <com/sun/star/util/DateTime.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_
+#include <com/sun/star/util/Time.hpp>
+#endif
#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_ #include <com/sun/star/util/XNumberFormatter.hpp> #endif @@ -59,47 +61,44 @@ #endif #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _TOOLS_SOLMATH_HXX //autogen wg. SolarMath -#include <tools/solmath.hxx> -#endif -#ifndef _ISOLANG_HXX -#include <tools/isolang.hxx> -#endif -#ifndef _DATETIME_HXX -#include <tools/datetime.hxx> -#endif -#ifndef _TOOLS_INTN_HXX //autogen wg. International -#include <tools/intn.hxx> -#endif +#endif
+#ifndef _COM_SUN_STAR_LANG_KPARSETYPE_HPP_
+#include <com/sun/star/lang/KParseType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_KPARSETOKENS_HPP_
+#include <com/sun/star/lang/KParseTokens.hpp>
+#endif
#ifndef _CONNECTIVITY_SQLSCAN_HXX #include "sqlscan.hxx" #endif #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> -#endif +#endif
+#ifndef _DBHELPER_DBCONVERSION_HXX_
+#include "connectivity/dbconversion.hxx"
+#endif
-static String aEmptyString; +static ::rtl::OUString aEmptyString; static connectivity::OSQLInternalNode* newNode(const sal_Char* pNewValue, const connectivity::SQLNodeType eNodeType, - const UINT16 nNodeID = 0) + const sal_uInt16 nNodeID = 0) { return new connectivity::OSQLInternalNode(pNewValue, eNodeType, nNodeID); } -static connectivity::OSQLInternalNode* newNode(const ByteString& _NewValue, +static connectivity::OSQLInternalNode* newNode(const ::rtl::OString& _NewValue, const connectivity::SQLNodeType eNodeType, - const UINT16 nNodeID = 0) + const sal_uInt16 nNodeID = 0) { return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID); } -static connectivity::OSQLInternalNode* newNode(const String& _NewValue, +static connectivity::OSQLInternalNode* newNode(const ::rtl::OUString& _NewValue, const connectivity::SQLNodeType eNodeType, - const UINT16 nNodeID = 0) + const sal_uInt16 nNodeID = 0) { return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID); @@ -256,7 +255,7 @@ sql_list: /* schema definition language */ - /* Note: other ``sql:'' rules appear later in the grammar */ + /* Note: other ``sql:sal_Unicode() rules appear later in the grammar */ /*** sql: schema @@ -1075,11 +1074,11 @@ boolean_term: | row_value_constructor_elem '\n' /*[^')' ',']*/ { $$ = SQL_NEW_RULE; - INT16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1); + sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1); if(nErg == 1) { OSQLParseNode* pTemp = $$; - $$ = pTemp->removeAt((ULONG)0); + $$ = pTemp->removeAt((sal_uInt32)0); delete pTemp; } else @@ -1096,7 +1095,7 @@ boolean_term: $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); - INT16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); + sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); if(nErg < 1) { delete $$; @@ -1112,7 +1111,7 @@ boolean_term: $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); - INT16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); + sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); if(nErg < 1) { delete $$; @@ -1156,11 +1155,11 @@ comparison_predicate: | comparison row_value_constructor { $$ = SQL_NEW_RULE; - INT16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$2,$1); + sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$2,$1); if(nErg == 1) { OSQLParseNode* pTemp = $$; - $$ = pTemp->removeAt((ULONG)0); + $$ = pTemp->removeAt((sal_uInt32)0); delete pTemp; } else @@ -1537,14 +1536,14 @@ op_like: $$ = SQL_NEW_RULE; $$->append($1); $$->append($2 = newNode("*", SQL_NODE_PUNCTUATION)); - xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, FALSE); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_False); } | op_like '?' { $$ = SQL_NEW_RULE; $$->append($1); $$->append($2 = newNode("?", SQL_NODE_PUNCTUATION)); - xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, FALSE); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_False); } ; */ @@ -1564,7 +1563,7 @@ literal: $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); - xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, TRUE); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_True); } else YYERROR; @@ -1576,7 +1575,7 @@ literal: $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); - xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, TRUE); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_True); } else YYERROR; @@ -1588,7 +1587,7 @@ literal: $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); - xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, TRUE); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_True); } else YYERROR; @@ -1600,7 +1599,7 @@ literal: $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); - xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, TRUE); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, sal_True); } else YYERROR; @@ -2814,19 +2813,19 @@ column: SQL_TOKEN_NAME | SQL_TOKEN_POSITION { - UINT16 nNod = $$->getRuleID(); + sal_uInt16 nNod = $$->getRuleID(); delete $$; $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); } | SQL_TOKEN_CHAR_LENGTH { - UINT16 nNod = $$->getRuleID(); + sal_uInt16 nNod = $$->getRuleID(); delete $$; $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); } | SQL_TOKEN_EXTRACT { - UINT16 nNod = $$->getRuleID(); + sal_uInt16 nNod = $$->getRuleID(); delete $$; $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); } @@ -2889,8 +2888,10 @@ sql: using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::osl; +using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util; +using namespace ::osl;
+using namespace ::dbtools; // using namespace connectivity; //============================================================ @@ -2903,8 +2904,9 @@ struct _ConstAsciiString_ sal_Char const* str; operator rtl::OUString () const { return rtl::OUString(str, length, RTL_TEXTENCODING_ASCII_US); } -// operator String () const { return String(str, length, RTL_TEXTENCODING_ASCII_US); } - operator const sal_Char * () const { return str; } +// operator ::rtl::OUString () const { return ::rtl::OUString(str, length, RTL_TEXTENCODING_ASCII_US); } + operator const sal_Char * () const { return str; }
+ operator ::rtl::OString() const { return str; } }; #define IMPLEMENT_CONSTASCII_STRING( name, string ) \ @@ -2923,8 +2925,8 @@ IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_INT_COMPARE, "The field can not be IMPLEMENT_CONSTASCII_STRING(KEY_STR_LIKE, "LIKE"); IMPLEMENT_CONSTASCII_STRING(KEY_STR_NOT, "NOT"); IMPLEMENT_CONSTASCII_STRING(KEY_STR_NULL, "NULL"); -IMPLEMENT_CONSTASCII_STRING(KEY_STR_TRUE, "TRUE"); -IMPLEMENT_CONSTASCII_STRING(KEY_STR_FALSE, "FALSE"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_TRUE, "sal_True"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_FALSE, "sal_False"); IMPLEMENT_CONSTASCII_STRING(KEY_STR_IS, "IS"); IMPLEMENT_CONSTASCII_STRING(KEY_STR_BETWEEN, "BETWEEN"); IMPLEMENT_CONSTASCII_STRING(KEY_STR_OR, "OR"); @@ -2947,31 +2949,28 @@ IMPLEMENT_CONSTASCII_STRING(STR_SQL_TOKEN, "SQL_TOKEN_"); //========================================================================== //= OParseContext //========================================================================== -DBG_NAME(OParseContext); //----------------------------------------------------------------------------- OParseContext::OParseContext() { - DBG_CTOR(OParseContext,NULL); } //----------------------------------------------------------------------------- OParseContext::~OParseContext() { - DBG_DTOR(OParseContext,NULL); } //----------------------------------------------------------------------------- -String OParseContext::getErrorMessage(ErrorCode _eCode) const +::rtl::OUString OParseContext::getErrorMessage(ErrorCode _eCode) const { - String aMsg; + ::rtl::OUString aMsg; switch (_eCode) { - case ERROR_GENERAL: aMsg = ERROR_STR_GENERAL; break; - case ERROR_GENERAL_HINT: aMsg = ERROR_STR_GENERAL_HINT; break; - case ERROR_VALUE_NO_LIKE: aMsg = ERROR_STR_VALUE_NO_LIKE; break; - case ERROR_FIELD_NO_LIKE: aMsg = ERROR_STR_FIELD_NO_LIKE; break; - case ERROR_INVALID_COMPARE: aMsg = ERROR_STR_INVALID_COMPARE; break; - case ERROR_INVALID_INT_COMPARE: aMsg = ERROR_STR_INVALID_INT_COMPARE; break; + case ERROR_GENERAL: aMsg = ERROR_STR_GENERAL; break; + case ERROR_GENERAL_HINT: aMsg = ERROR_STR_GENERAL_HINT; break; + case ERROR_VALUE_NO_LIKE: aMsg = ERROR_STR_VALUE_NO_LIKE; break; + case ERROR_FIELD_NO_LIKE: aMsg = ERROR_STR_FIELD_NO_LIKE; break; + case ERROR_INVALID_COMPARE: aMsg = ERROR_STR_INVALID_COMPARE; break; + case ERROR_INVALID_INT_COMPARE: aMsg = ERROR_STR_INVALID_INT_COMPARE; break; case ERROR_INVALID_STRING_COMPARE: aMsg = ERROR_STR_INVALID_STRING_COMPARE; break; case ERROR_INVALID_DATE_COMPARE: aMsg = ERROR_STR_INVALID_DATE_COMPARE; break; case ERROR_INVALID_REAL_COMPARE: aMsg = ERROR_STR_INVALID_REAL_COMPARE; break; @@ -2980,31 +2979,31 @@ String OParseContext::getErrorMessage(ErrorCode _eCode) const } //----------------------------------------------------------------------------- -ByteString OParseContext::getIntlKeywordAscii(InternationalKeyCode _eKey) const +::rtl::OString OParseContext::getIntlKeywordAscii(InternationalKeyCode _eKey) const { - ByteString aKeyword; + ::rtl::OString aKeyword; switch (_eKey) { - case KEY_LIKE: aKeyword = KEY_STR_LIKE; break; - case KEY_NOT: aKeyword = KEY_STR_NOT; break; - case KEY_NULL: aKeyword = KEY_STR_NULL; break; - case KEY_TRUE: aKeyword = KEY_STR_TRUE; break; - case KEY_FALSE: aKeyword = KEY_STR_FALSE; break; - case KEY_IS: aKeyword = KEY_STR_IS; break; - case KEY_BETWEEN: aKeyword = KEY_STR_BETWEEN; break; - case KEY_OR: aKeyword = KEY_STR_OR; break; - case KEY_AND: aKeyword = KEY_STR_AND; break; - case KEY_AVG: aKeyword = KEY_STR_AVG; break; - case KEY_COUNT: aKeyword = KEY_STR_COUNT; break; - case KEY_MAX: aKeyword = KEY_STR_MAX; break; - case KEY_MIN: aKeyword = KEY_STR_MIN; break; - case KEY_SUM: aKeyword = KEY_STR_SUM; break; + case KEY_LIKE: aKeyword = KEY_STR_LIKE; break; + case KEY_NOT: aKeyword = KEY_STR_NOT; break; + case KEY_NULL: aKeyword = KEY_STR_NULL; break; + case KEY_TRUE: aKeyword = KEY_STR_TRUE; break; + case KEY_FALSE: aKeyword = KEY_STR_FALSE; break; + case KEY_IS: aKeyword = KEY_STR_IS; break; + case KEY_BETWEEN: aKeyword = KEY_STR_BETWEEN; break; + case KEY_OR: aKeyword = KEY_STR_OR; break; + case KEY_AND: aKeyword = KEY_STR_AND; break; + case KEY_AVG: aKeyword = KEY_STR_AVG; break; + case KEY_COUNT: aKeyword = KEY_STR_COUNT; break; + case KEY_MAX: aKeyword = KEY_STR_MAX; break; + case KEY_MIN: aKeyword = KEY_STR_MIN; break; + case KEY_SUM: aKeyword = KEY_STR_SUM; break; } return aKeyword; } //----------------------------------------------------------------------------- -OParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const ByteString& rToken) const +OParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const ::rtl::OString& rToken) const { static OParseContext::InternationalKeyCode Intl_TokenID[] = { @@ -3017,8 +3016,8 @@ OParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const ByteStri sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0]; for (sal_uInt32 i = 0; i < nCount; i++) { - ByteString aKey = getIntlKeywordAscii(Intl_TokenID[i]); - if (rToken.EqualsIgnoreCaseAscii(aKey)) + ::rtl::OString aKey = getIntlKeywordAscii(Intl_TokenID[i]); + if (rToken.equalsIgnoreCase(aKey)) return Intl_TokenID[i]; } @@ -3026,18 +3025,25 @@ OParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const ByteStri } //------------------------------------------------------------------------------ -const International& OParseContext::getDefaultInternational() +const Locale& OParseContext::getDefaultLocale() { - static International aIntl(LANGUAGE_ENGLISH_US); - static BOOL bInitialized = FALSE; + static Locale aIntl(::rtl::OUString::createFromAscii("en_US"),::rtl::OUString::createFromAscii("en_US"),::rtl::OUString()); + static sal_Bool bInitialized = sal_False; if (!bInitialized) - { // ensure that the two members we're interested in are really set + {
+ // ensure that the two members we're interested in are really set // (if the system doesn't know the locale en_US aIntl would be initialized with the // system language which may be anything - which we don't want ...) - // 74342 - 21.03.00 - FS - aIntl.SetNumThousandSep(','); - aIntl.SetNumDecimalSep('.'); - bInitialized = TRUE; + // 74342 - 21.03.00 - FS
+
+ // TODO check the decimal sep and thousand sep
+// if(!m_xLocaleData.is())
+// m_xLocaleData = Reference<XLocaleData>(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.lang.LocaleData")),UNO_QUERY);
+//
+// m_xLocaleData->getLocaleItem(*m_pLocale). +// aIntl.SetNumThousandSep(','); +// aIntl.SetNumDecimalSep('.'); + bInitialized = sal_True; } return aIntl; } @@ -3054,32 +3060,11 @@ const International& OParseContext::getDefaultInternational() const double fMilliSecondsPerDay = 86400000.0; //------------------------------------------------------------------------------ -Date getNULLDate(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > &xSupplier) -{ - DBG_ASSERT(xSupplier.is(), "getNULLDate : the formatter doesn't implement a supplier !"); - if (xSupplier.is()) - { - try - { - // get the null date - ::com::sun::star::util::Date aDate; - xSupplier->getNumberFormatSettings()->getPropertyValue(FIELD_STR_NULLDATE) >>= aDate; - return Date(aDate.Day, aDate.Month, aDate.Year); - } - catch ( ... ) - { - } - } - - return Date(1,1,1900); -} - -//------------------------------------------------------------------------------ Any getNumberFormatProperty(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > &xSupplier, sal_Int32 nKey, const rtl::OUString& aPropertyName) { - DBG_ASSERT(xSupplier.is(), "getNumberFormatProperty : the formatter doesn't implement a supplier !"); + OSL_ENSHURE(xSupplier.is(), "getNumberFormatProperty : the formatter doesn't implement a supplier !"); Reference< ::com::sun::star::util::XNumberFormats > xFormats = xSupplier->getNumberFormats(); if (xFormats.is()) @@ -3096,140 +3081,67 @@ Any getNumberFormatProperty(const Reference< ::com::sun::star::util::XNumberForm return Any(); } -// date time conversion -//------------------------------------------------------------------ -DateTime ToDateTime(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier, - const double& fSbxDate) -{ - - long nDays = (long)fSbxDate; - long nMSeconds = long((fSbxDate - (double)nDays) * fMilliSecondsPerDay + 0.5); - - // Datum: - DateTime x(getNULLDate(xSupplier)); - - if (nDays >= 0) - x += (sal_uInt32)nDays; - else - x -= (sal_uInt32)(-nDays); - - // Zeit: - x.MakeTimeFromMS(nMSeconds); - if (x.GetTime() < 0) - x += Time(23,59,59,99); - return x; -} - -//------------------------------------------------------------------ -double ToDouble(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier, const Date& rDate) -{ - long nDays = 0; - Date aNullDate(getNULLDate(xSupplier)); - if (aNullDate >= rDate) - { - nDays = (long)(aNullDate - rDate); - nDays *= -1; - } - else - nDays = (long)(rDate - aNullDate); - - return (double)nDays; -} - -//------------------------------------------------------------------ -double ToDouble(const Time& rTime) -{ - return (double)rTime.GetMSFromTime() / fMilliSecondsPerDay; -} - -//------------------------------------------------------------------ -Date ToDate(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier, const double& fSbxDate) -{ - // count the days - long nDays = (long)fSbxDate; - Date aNullDate(getNULLDate(xSupplier)); - - if (nDays >= 0) - aNullDate += (sal_uInt32)nDays; - else - aNullDate -= (sal_uInt32)(-nDays); - - return aNullDate; -} - -//------------------------------------------------------------------ -Time ToTime(const double& fSbxDate) -{ - long nDays = (long)fSbxDate; - long nMSeconds = long((fSbxDate - (double)nDays) * fMilliSecondsPerDay + 0.5); - - Time x; - x.MakeTimeFromMS(nMSeconds); - if (x.GetTime() < 0) - x += Time(23,59,59,99); - return x; -} - //------------------------------------------------------------------ -String ToDateString(const Date& rDate) +::rtl::OUString ToDateString(const Date& rDate) { sal_Char s[11]; sprintf(s,"%04d-%02d-%02d", - (int)rDate.GetYear(), - (int)rDate.GetMonth(), - (int)rDate.GetDay()); + (int)rDate.Year, + (int)rDate.Month, + (int)rDate.Day); s[10] = 0; - return String::CreateFromAscii(s); + return ::rtl::OUString::createFromAscii(s); } //------------------------------------------------------------------ -String ToTimeString(const Time& rTime) +::rtl::OUString ToTimeString(const Time& rTime) { sal_Char s[9]; sprintf(s,"%02d:%02d:%02d", - (int)rTime.GetHour(), - (int)rTime.GetMin(), - (int)rTime.GetSec()); + (int)rTime.Hours, + (int)rTime.Minutes, + (int)rTime.Seconds); s[8] = 0; - return String::CreateFromAscii(s); + return ::rtl::OUString::createFromAscii(s); } //------------------------------------------------------------------ -String ToDateTimeString(const DateTime& rDateTime) -{ - String aTemp(ToDateString(rDateTime)); - aTemp += String::CreateFromAscii(" "); - aTemp += ToTimeString(rDateTime); +::rtl::OUString ToDateTimeString(const ::com::sun::star::util::DateTime& _rDateTime) +{
+ Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year);
+ ::rtl::OUString aTemp(ToDateString(aDate)); + aTemp += ::rtl::OUString::createFromAscii(" ");
+ Time aTime(0,_rDateTime.Seconds,_rDateTime.Minutes,_rDateTime.Hours); + aTemp += ToTimeString(aTime); return aTemp; } - //------------------------------------------------------------------ -String ConvertLikeToken(const OSQLParseNode* pTokenNode, const OSQLParseNode* pEscapeNode, sal_Bool bInternational) +::rtl::OUString ConvertLikeToken(const OSQLParseNode* pTokenNode, const OSQLParseNode* pEscapeNode, sal_Bool bInternational) { - String aMatchStr; + ::rtl::OUString aMatchStr; if (pTokenNode->isToken()) { - char cEscape = 0; + sal_Char cEscape = 0; if (pEscapeNode->count()) - cEscape = pEscapeNode->getChild(1)->getTokenValue().GetChar(0); + cEscape = pEscapeNode->getChild(1)->getTokenValue().toChar(); // Platzhalter austauschen aMatchStr = pTokenNode->getTokenValue(); - sal_uInt16 nLen = aMatchStr.Len(); - const char* sSearch = bInternational ? "%_" : "*?"; - const char* sReplace = bInternational ? "*?" : "%_"; + sal_uInt16 nLen = aMatchStr.getLength(); + const sal_Char* sSearch = bInternational ? "%_" : "*?"; + const sal_Char* sReplace = bInternational ? "*?" : "%_"; for (sal_uInt16 i = 0; i < nLen; i++) { - char c = aMatchStr.GetChar(i); + sal_Char c = aMatchStr.getStr()[i]; if (c == sSearch[0] || c == sSearch[1]) { - if (i > 0 && aMatchStr.GetChar(i-1) == cEscape) + if (i > 0 && aMatchStr.getStr()[i-1] == cEscape) continue; else if (c == sSearch[0]) - aMatchStr.SetChar(i,sReplace[0]); + aMatchStr.replaceAt(i ,1, ::rtl::OUString::createFromAscii((const sal_Char*)sReplace[0])); else - aMatchStr.SetChar(i,sReplace[1]); + aMatchStr.replaceAt(i ,1, ::rtl::OUString::createFromAscii((const sal_Char*)sReplace[1])); } } } @@ -3239,7 +3151,6 @@ String ConvertLikeToken(const OSQLParseNode* pTokenNode, const OSQLParseNode* pE //========================================================================== //= OSQLParser //========================================================================== -DBG_NAME(OSQLParser); sal_uInt32 OSQLParser::s_nRuleIDs[OSQLParseNode::rule_count + 1]; OParseContext OSQLParser::s_aDefaultContext; @@ -3250,13 +3161,14 @@ OSQLScanner* OSQLParser::s_pScanner = 0; OSQLParseNodes* OSQLParser::s_pGarbageCollector = 0; //----------------------------------------------------------------------------- -OSQLParser::OSQLParser(OParseContext* _pContext) +OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory,OParseContext* _pContext) :m_pContext(_pContext) ,m_pParseTree(NULL) - ,m_pIntl(NULL) - ,m_nFormatKey(0) + ,m_pLocale(NULL) + ,m_nFormatKey(0)
+ ,m_xServiceFactory(_xServiceFactory) { - DBG_CTOR(OSQLParser,NULL); + xxx_pGLOBAL_SQLPARSER = this; @@ -3272,7 +3184,10 @@ OSQLParser::OSQLParser(OParseContext* _pContext) { s_pScanner = new OSQLScanner(); s_pScanner->setScanner(); - s_pGarbageCollector = new OSQLParseNodes(); + s_pGarbageCollector = new OSQLParseNodes();
+
+ if(!m_xLocaleData.is())
+ m_xLocaleData = Reference<XLocaleData>(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.lang.LocaleData")),UNO_QUERY); // auf 0 zuruecksetzen memset(OSQLParser::s_nRuleIDs,0,sizeof(sal_uInt16) * OSQLParseNode::rule_count+1); @@ -3289,7 +3204,7 @@ OSQLParser::~OSQLParser() { { ::osl::MutexGuard aGuard(s_aMutex); - DBG_ASSERT(s_nRefCount > 0, "OSQLParser::~OSQLParser() : suspicious call : have a refcount of 0 !"); + OSL_ENSHURE(s_nRefCount > 0, "OSQLParser::~OSQLParser() : suspicious call : have a refcount of 0 !"); if (!--s_nRefCount) { s_pScanner->setScanner(sal_True); @@ -3298,12 +3213,9 @@ OSQLParser::~OSQLParser() delete s_pGarbageCollector; s_pGarbageCollector = NULL; - } + }
+ m_xLocaleData = NULL; } - - delete m_pIntl; - - DBG_DTOR(OSQLParser,NULL); } // ------------------------------------------------------------------------- void OSQLParser::setParseTree(OSQLParseNode * pNewParseTree) @@ -3312,11 +3224,11 @@ void OSQLParser::setParseTree(OSQLParseNode * pNewParseTree) m_pParseTree = pNewParseTree;
} //----------------------------------------------------------------------------- -OSQLParseNode* OSQLParser::parseTree(String& rErrorMessage, - const String& rStatement, +OSQLParseNode* OSQLParser::parseTree(::rtl::OUString& rErrorMessage, + const ::rtl::OUString& rStatement, sal_Bool bInternational) { - DBG_CHKTHIS(OSQLParser,NULL); + // Guard the parsing ::osl::MutexGuard aGuard(s_aMutex);
@@ -3330,15 +3242,15 @@ OSQLParseNode* OSQLParser::parseTree(String& rErrorMessage, SQLyylval.pParseNode = NULL; // SQLyypvt = NULL; m_pParseTree = NULL; - m_sErrorMessage.Erase(); + m_sErrorMessage = ::rtl::OUString(); // ... und den Parser anwerfen ... if (SQLyyparse() != 0) { // only set the error message, if it's not already set - if (!m_sErrorMessage.Len()) + if (!m_sErrorMessage.getLength()) m_sErrorMessage = s_pScanner->getErrorMessage(); - if (!m_sErrorMessage.Len()) + if (!m_sErrorMessage.getLength()) m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL); rErrorMessage = m_sErrorMessage; @@ -3359,25 +3271,25 @@ OSQLParseNode* OSQLParser::parseTree(String& rErrorMessage, // Das Ergebnis liefern (den Root Parse Node): - // DBG_ASSERT(Sdbyyval.pParseNode != NULL,"OSQLParser: Parser hat keinen ParseNode geliefert"); + // OSL_ENSHURE(Sdbyyval.pParseNode != NULL,"OSQLParser: Parser hat keinen ParseNode geliefert"); // return Sdbyyval.pParseNode; // geht nicht wegen Bug in MKS YACC-erzeugtem Code (es wird ein falscher ParseNode // geliefert). // Stattdessen setzt die Parse-Routine jetzt den Member pParseTree // - einfach diesen zurueckliefern: - DBG_ASSERT(m_pParseTree != NULL,"OSQLParser: Parser hat keinen ParseTree geliefert"); + OSL_ENSHURE(m_pParseTree != NULL,"OSQLParser: Parser hat keinen ParseTree geliefert"); return m_pParseTree; } } -static char* __READONLY_DATA PREDICATE_CHECK = "PREDICATE "; +// static sal_Char* __READONLY_DATA PREDICATE_CHECK = "PREDICATE "; //----------------------------------------------------------------------------- -OSQLParseNode* OSQLParser::predicateTree(String& rErrorMessage, const String& rStatement, +OSQLParseNode* OSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const ::rtl::OUString& rStatement, const Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter, const Reference< XPropertySet > & xField) { - DBG_CHKTHIS(OSQLParser,NULL); + // mutex for parsing static ::osl::Mutex aMutex; @@ -3385,9 +3297,9 @@ OSQLParseNode* OSQLParser::predicateTree(String& rErrorMessage, const String& rS // Guard the parsing ::osl::MutexGuard aGuard(s_aMutex); - // reset the parser - if (!m_pIntl) - m_pIntl = new International(m_pContext->getDefaultInternational()); + // reset the parser
+ if (!m_pLocale) + m_pLocale = new Locale(m_pContext->getDefaultLocale()); m_xField = xField; m_xFormatter = xFormatter; @@ -3423,18 +3335,13 @@ OSQLParseNode* OSQLParser::predicateTree(String& rErrorMessage, const String& rS if (m_nFormatKey && m_xFormatter.is()) { Any aValue = getNumberFormatProperty(m_xFormatter->getNumberFormatsSupplier(), m_nFormatKey, FIELD_STR_LOCALE); - DBG_ASSERT(aValue.getValueType() == ::getCppuType((const ::com::sun::star::lang::Locale*)0), "OSQLParser::PredicateTree : invalid language property !"); + OSL_ENSHURE(aValue.getValueType() == ::getCppuType((const ::com::sun::star::lang::Locale*)0), "OSQLParser::PredicateTree : invalid language property !"); if (aValue.getValueType() == ::getCppuType((const ::com::sun::star::lang::Locale*)0)) - { - com::sun::star::lang::Locale aLocale; - aValue >>= aLocale; - *m_pIntl = International(ConvertIsoNamesToLanguage(aLocale.Language.getStr(), - aLocale.Country.getStr())); - } + aValue >>= *m_pLocale;
} else - *m_pIntl = m_pContext->getDefaultInternational(); + *m_pLocale = m_pContext->getDefaultLocale(); switch (nType) { @@ -3448,8 +3355,8 @@ OSQLParseNode* OSQLParser::predicateTree(String& rErrorMessage, const String& rS case DataType::LONGVARCHAR: s_pScanner->SetRule(s_pScanner->GetSTRINGRule()); break; - default: - if (m_pIntl->GetNumDecimalSep() == ',') + default:
+ if (m_pLocale && m_xLocaleData->getLocaleItem(*m_pLocale).decimalSeparator.toChar() == ',') s_pScanner->SetRule(s_pScanner->GetGERRule()); else s_pScanner->SetRule(s_pScanner->GetENGRule()); @@ -3464,19 +3371,19 @@ OSQLParseNode* OSQLParser::predicateTree(String& rErrorMessage, const String& rS SQLyylval.pParseNode = NULL; // SQLyypvt = NULL; m_pParseTree = NULL; - m_sErrorMessage.Erase(); + m_sErrorMessage= ::rtl::OUString(); // ... und den Parser anwerfen ... if (SQLyyparse() != 0) { - m_sFieldName.Erase(); + m_sFieldName= ::rtl::OUString(); m_xField = NULL; m_xFormatter = NULL; m_nFormatKey = 0; - if (!m_sErrorMessage.Len()) + if (!m_sErrorMessage.getLength()) m_sErrorMessage = s_pScanner->getErrorMessage(); - if (!m_sErrorMessage.Len()) + if (!m_sErrorMessage.getLength()) m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL); rErrorMessage = m_sErrorMessage; @@ -3495,7 +3402,7 @@ OSQLParseNode* OSQLParser::predicateTree(String& rErrorMessage, const String& rS { s_pGarbageCollector->clear(); - m_sFieldName.Erase(); + m_sFieldName= ::rtl::OUString(); m_xField = NULL; m_xFormatter = NULL; m_nFormatKey = 0; @@ -3504,31 +3411,31 @@ OSQLParseNode* OSQLParser::predicateTree(String& rErrorMessage, const String& rS // Stattdessen setzt die Parse-Routine jetzt den Member pParseTree // - einfach diesen zurueckliefern: - DBG_ASSERT(m_pParseTree != NULL,"OSQLParser: Parser hat keinen ParseTree geliefert"); + OSL_ENSHURE(m_pParseTree != NULL,"OSQLParser: Parser hat keinen ParseTree geliefert"); return m_pParseTree; } } //----------------------------------------------------------------------------- -ByteString OSQLParser::TokenIDToStr(sal_uInt32 nTokenID, OParseContext* pContext) +::rtl::OString OSQLParser::TokenIDToStr(sal_uInt32 nTokenID, OParseContext* pContext) { - ByteString aStr; + ::rtl::OString aStr; if (pContext) aStr = pContext->getIntlKeywordAscii((OParseContext::InternationalKeyCode)nTokenID); - if (!aStr.Len()) + if (!aStr.getLength()) { aStr = yytname[YYTRANSLATE(nTokenID)]; - if(aStr.EqualsIgnoreCaseAscii("SQL_TOKEN_",0,10)) - aStr.Erase(0,10); + if(!aStr.compareTo("SQL_TOKEN_",10)) + aStr = aStr.copy(10); } return aStr; } //----------------------------------------------------------------------------- -/*sal_uInt32 OSQLParser::StrToTokenID(const ByteString & rName) +/*sal_uInt32 OSQLParser::StrToTokenID(const ::rtl::OString & rName) { - ByteString aName; + ::rtl::OString aName; if (rName.IsAlphaNumericAscii()) aName = rName; else @@ -3550,14 +3457,14 @@ ByteString OSQLParser::TokenIDToStr(sal_uInt32 nTokenID, OParseContext* pContext }*/ //----------------------------------------------------------------------------- -String OSQLParser::RuleIDToStr(sal_uInt32 nRuleID) +::rtl::OUString OSQLParser::RuleIDToStr(sal_uInt32 nRuleID) { OSL_ENSHURE(nRuleID >= (sizeof yytname/sizeof yytname[0]), "Invalid nRuleId!"); - return String::CreateFromAscii(yytname[nRuleID]); + return ::rtl::OUString::createFromAscii(yytname[nRuleID]); } //----------------------------------------------------------------------------- -sal_uInt32 OSQLParser::StrToRuleID(const ByteString & rValue) +sal_uInt32 OSQLParser::StrToRuleID(const ::rtl::OString & rValue) { // In yysvar nach dem angegebenen Namen suchen, den ::com::sun::star::sdbcx::Index zurueckliefern // (oder 0, wenn nicht gefunden) @@ -3730,12 +3637,38 @@ sal_uInt32 OSQLParser::RuleID(OSQLParseNode::Rule eRule) case OSQLParseNode::value_exp: s_nRuleIDs[eRule] = StrToRuleID("value_exp"); break; default: - DBG_ERROR("interner Fehler: Regel nicht bekannt, in OSQLParser::RuleID nachtragen!"); + OSL_ASSERT("interner Fehler: Regel nicht bekannt, in OSQLParser::RuleID nachtragen!"); } } return s_nRuleIDs[(sal_uInt16)eRule]; +}
+// -------------------------------------------------------------------------
+::rtl::OUString OSQLParser::stringToDouble(const ::rtl::OUString& _rValue,sal_Int16 _nScale)
+{
+ ::rtl::OUString aValue;
+ if(!m_xCharClass.is())
+ m_xCharClass = Reference<XCharacterClassification>(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.lang.CharacterClassification")),UNO_QUERY);
+ if(m_xCharClass.is() && m_xLocaleData.is())
+ {
+ try
+ {
+ ParseResult aResult = m_xCharClass->parsePredefinedToken(KParseType::ANY_NUMBER,_rValue,0,*m_pLocale,0,::rtl::OUString(),KParseType::ANY_NUMBER,::rtl::OUString());
+ if((aResult.TokenType & KParseType::IDENTNAME) && aResult.EndPos == _rValue.getLength())
+ {
+ aValue = ::rtl::OUString::valueOf(aResult.Value);
+ sal_Int32 nPos = aValue.lastIndexOf(::rtl::OUString::createFromAscii("."));
+ if((nPos+_nScale) < aValue.getLength())
+ aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale,::rtl::OUString());
+ aValue.replaceAt(aValue.lastIndexOf(nPos),1,m_xLocaleData->getLocaleItem(*m_pLocale).decimalSeparator);
+ return aValue;
+ }
+ }
+ catch(...)
+ {
+ }
+ }
+ return aValue;
} - //----------------------------------------------------------------------------- sal_Int16 OSQLParser::buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare) { @@ -3760,7 +3693,8 @@ sal_Int16 OSQLParser::buildNode_STR_NUM(OSQLParseNode*& pAppend,OSQLParseNode*& if (m_nFormatKey) { - sal_Int16 nScale = 0; + sal_Int16 nScale = 0;
+ ::rtl::OUString aDec; try { Any aValue = getNumberFormatProperty(m_xFormatter->getNumberFormatsSupplier(), @@ -3771,11 +3705,7 @@ sal_Int16 OSQLParser::buildNode_STR_NUM(OSQLParseNode*& pAppend,OSQLParseNode*& { } - int nErrno=0; - double dValue = SolarMath::StringToDouble(pLiteral->getTokenValue().GetBuffer(), *m_pIntl, nErrno); - String aValue; - SolarMath::DoubleToString(aValue, dValue, 'F', nScale, m_pIntl->GetNumDecimalSep(), sal_True); - pComp->append(new OSQLInternalNode(aValue,SQL_NODE_STRING)); + pComp->append(new OSQLInternalNode(stringToDouble(pLiteral->getTokenValue(),nScale),SQL_NODE_STRING)); } else pComp->append(new OSQLInternalNode(pLiteral->getTokenValue(),SQL_NODE_STRING)); @@ -3798,42 +3728,43 @@ sal_Int16 OSQLParser::buildNode_Date(const double& fValue, sal_Int16 nType, OSQL pComp->append(pCompare); OSQLParseNode* pNewNode = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::set_fct_spec)); - pNewNode->append(new OSQLInternalNode(String::CreateFromAscii("{"), SQL_NODE_PUNCTUATION)); + pNewNode->append(new OSQLInternalNode(::rtl::OUString::createFromAscii("{"), SQL_NODE_PUNCTUATION)); OSQLParseNode* pDateNode = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::odbc_fct_spec)); pNewNode->append(pDateNode); - pNewNode->append(new OSQLInternalNode(String::CreateFromAscii("}"), SQL_NODE_PUNCTUATION)); + pNewNode->append(new OSQLInternalNode(::rtl::OUString::createFromAscii("}"), SQL_NODE_PUNCTUATION)); switch (nType) { case DataType::DATE: { - Date aDate = ToDate(m_xFormatter->getNumberFormatsSupplier(), fValue); - String aString = ToDateString(aDate); + Date aDate = DBTypeConversion::toDate(fValue,DBTypeConversion::getNULLDate(m_xFormatter->getNumberFormatsSupplier())); + ::rtl::OUString aString = ToDateString(aDate); pDateNode->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, SQL_TOKEN_D)); pDateNode->append(new OSQLInternalNode(aString, SQL_NODE_STRING)); break; } case DataType::TIME: { - Time aTime = ToTime(fValue); - String aString = ToTimeString(aTime); + Time aTime = DBTypeConversion::toTime(fValue); + ::rtl::OUString aString = ToTimeString(aTime); pDateNode->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, SQL_TOKEN_T)); pDateNode->append(new OSQLInternalNode(aString, SQL_NODE_STRING)); break; } case DataType::TIMESTAMP: { - DateTime aDateTime = ToDateTime(m_xFormatter->getNumberFormatsSupplier(), fValue); - if (aDateTime.GetMSFromTime() / fMilliSecondsPerDay) + DateTime aDateTime = DBTypeConversion::toDateTime(fValue,DBTypeConversion::getNULLDate(m_xFormatter->getNumberFormatsSupplier())); + if (aDateTime.Seconds && aDateTime.Minutes && aDateTime.Hours) { - String aString = ToDateTimeString(aDateTime); + ::rtl::OUString aString = ToDateTimeString(aDateTime); pDateNode->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, SQL_TOKEN_TS)); pDateNode->append(new OSQLInternalNode(aString, SQL_NODE_STRING)); } else - { + {
+ Date aDate(aDateTime.Day,aDateTime.Month,aDateTime.Year); pDateNode->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, SQL_TOKEN_D)); - pDateNode->append(new OSQLInternalNode(ToDateString(aDateTime), SQL_NODE_STRING)); + pDateNode->append(new OSQLInternalNode(ToDateString(aDate), SQL_NODE_STRING)); } break; } @@ -3902,11 +3833,7 @@ sal_Int16 OSQLParser::buildLikeRule(OSQLParseNode*& pAppend, OSQLParseNode*& pLi { } - int nErrno=0; - String aValue; - double dValue = SolarMath::StringToDouble(pLiteral->getTokenValue().GetBuffer(), OParseContext::getDefaultInternational(), nErrno); - SolarMath::DoubleToString(aValue, dValue, 'F', nScale, '.', sal_True); - pAppend->append(new OSQLInternalNode(aValue,SQL_NODE_STRING)); + pAppend->append(new OSQLInternalNode(stringToDouble(pLiteral->getTokenValue(),nScale),SQL_NODE_STRING)); } else pAppend->append(new OSQLInternalNode(pLiteral->getTokenValue(),SQL_NODE_STRING)); @@ -3917,7 +3844,7 @@ sal_Int16 OSQLParser::buildLikeRule(OSQLParseNode*& pAppend, OSQLParseNode*& pLi default: { m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_VALUE_NO_LIKE); - m_sErrorMessage.SearchAndReplace(String::CreateFromAscii("#1"),pLiteral->getTokenValue()); + m_sErrorMessage.replaceAt(m_sErrorMessage.indexOf(::rtl::OUString::createFromAscii("#1")),2,pLiteral->getTokenValue()); } } } @@ -3963,7 +3890,7 @@ sal_Int16 OSQLParser::buildStringNodes(OSQLParseNode*& pLiteral) //----------------------------------------------------------------------------- sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral) { - OSQLParseNode* pComp = new OSQLInternalNode(String('='), SQL_NODE_EQUAL); + OSQLParseNode* pComp = new OSQLInternalNode(::rtl::OUString::createFromAscii("="), SQL_NODE_EQUAL); return buildComparsionRule(pAppend,pLiteral,pComp); } @@ -4020,7 +3947,7 @@ sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* try { // do we have a date - double fValue = m_xFormatter->convertStringToNumber(m_nFormatKey, pLiteral->getTokenValue().GetBuffer()); + double fValue = m_xFormatter->convertStringToNumber(m_nFormatKey, pLiteral->getTokenValue().getStr()); nErg = buildNode_Date(fValue, nType, pAppend,pLiteral,pCompare); } catch ( ... ) @@ -4031,15 +3958,9 @@ sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* Reference< ::com::sun::star::util::XNumberFormatTypes > xFormatTypes(xFormatSup->getNumberFormats(),UNO_QUERY); if (xFormatTypes.is()) { - String sLanguage, sCountry; - ConvertLanguageToIsoNames(m_pIntl->GetLanguage(), sLanguage, sCountry); - ::com::sun::star::lang::Locale aLocale(sLanguage.GetBuffer(), - sCountry.GetBuffer(), - rtl::OUString()); - double fValue = m_xFormatter->convertStringToNumber( - xFormatTypes->getStandardFormat(::com::sun::star::util::NumberFormat::DATE, aLocale), - pLiteral->getTokenValue().GetBuffer()); + xFormatTypes->getStandardFormat(::com::sun::star::util::NumberFormat::DATE, *m_pLocale), + pLiteral->getTokenValue().getStr()); nErg = buildNode_Date(fValue, nType, pAppend,pLiteral,pCompare); } else @@ -4075,7 +3996,7 @@ sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* try { // do we have a date - double fValue = m_xFormatter->convertStringToNumber(m_nFormatKey, pLiteral->getTokenValue().GetBuffer()); + double fValue = m_xFormatter->convertStringToNumber(m_nFormatKey, pLiteral->getTokenValue().getStr()); nErg = buildNode_Date(fValue, nType, pAppend,pLiteral,pCompare); } catch ( ... ) @@ -4086,15 +4007,9 @@ sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* Reference< ::com::sun::star::util::XNumberFormatTypes > xFormatTypes(xFormatSup->getNumberFormats(),UNO_QUERY); if (xFormatTypes.is()) { - String sLanguage, sCountry; - ConvertLanguageToIsoNames(m_pIntl->GetLanguage(), sLanguage, sCountry); - ::com::sun::star::lang::Locale aLocale(sLanguage.GetBuffer(), - sCountry.GetBuffer(), - rtl::OUString()); - double fValue = m_xFormatter->convertStringToNumber( - xFormatTypes->getStandardFormat(::com::sun::star::util::NumberFormat::DATE, aLocale), - pLiteral->getTokenValue().GetBuffer()); + xFormatTypes->getStandardFormat(::com::sun::star::util::NumberFormat::DATE, *m_pLocale), + pLiteral->getTokenValue().getStr()); nErg = buildNode_Date(fValue, nType, pAppend,pLiteral,pCompare); } else @@ -4133,14 +4048,14 @@ sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* case DataType::REAL: case DataType::DOUBLE: // kill thousand seperators if any - if (m_pIntl->GetNumDecimalSep() == ',' ) + if (m_xLocaleData->getLocaleItem(*m_pLocale).decimalSeparator.toChar() == ',' ) { - pLiteral->m_aNodeValue.SearchAndReplaceAll('.', String()); + pLiteral->m_aNodeValue.replace('.', sal_Unicode()); // and replace decimal - pLiteral->m_aNodeValue.SearchAndReplaceAll(',', '.'); + pLiteral->m_aNodeValue.replace(',', '.'); } else - pLiteral->m_aNodeValue.SearchAndReplaceAll(',', String()); + pLiteral->m_aNodeValue.replace(',', sal_Unicode()); nErg = buildNode(pAppend,pLiteral,pCompare); break; case DataType::CHAR: @@ -4162,14 +4077,14 @@ sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* if (inPredicateCheck()) { // kill thousand seperators if any - if (m_pIntl->GetNumDecimalSep() == ',' ) + if (m_xLocaleData->getLocaleItem(*m_pLocale).decimalSeparator.toChar() == ',' ) { - pLiteral->m_aNodeValue.SearchAndReplaceAll('.', String()); + pLiteral->m_aNodeValue.replace('.', sal_Unicode()); // and replace decimal - pLiteral->m_aNodeValue.SearchAndReplaceAll(',', '.'); + pLiteral->m_aNodeValue.replace(',', '.'); } else - pLiteral->m_aNodeValue.SearchAndReplaceAll(',', String()); + pLiteral->m_aNodeValue.replace(',', sal_Unicode()); } nErg = buildNode(pAppend,pLiteral,pCompare); break; @@ -4196,13 +4111,13 @@ sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* //----------------------------------------------------------------------------- void OSQLParser::reduceLiteral(OSQLParseNode*& pLiteral, sal_Bool bAppendBlank) { - DBG_ASSERT(pLiteral->isRule(), "This is no ::com::sun::star::chaos::Rule"); - DBG_ASSERT(pLiteral->count() == 2, "OSQLParser::ReduceLiteral() Invalid count"); + OSL_ENSHURE(pLiteral->isRule(), "This is no ::com::sun::star::chaos::Rule"); + OSL_ENSHURE(pLiteral->count() == 2, "OSQLParser::ReduceLiteral() Invalid count"); OSQLParseNode* pTemp = pLiteral; - String aValue; + ::rtl::OUString aValue; if (bAppendBlank) { - ((aValue = pLiteral->getChild(0)->getTokenValue()) += String(' ')) += + ((aValue = pLiteral->getChild(0)->getTokenValue()) += ::rtl::OUString::createFromAscii(" ")) += pLiteral->getChild(1)->getTokenValue(); } else @@ -4213,14 +4128,14 @@ void OSQLParser::reduceLiteral(OSQLParseNode*& pLiteral, sal_Bool bAppendBlank) delete pTemp; } // ------------------------------------------------------------------------- -void OSQLParser::error(char *fmt) +void OSQLParser::error(sal_Char *fmt) { - if(!m_sErrorMessage.Len()) + if(!m_sErrorMessage.getLength()) { m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL); - m_sErrorMessage.AppendAscii(": "); + m_sErrorMessage += ::rtl::OUString::createFromAscii(": "); m_sErrorMessage += m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL_HINT); - m_sErrorMessage.SearchAndReplaceAscii("#",String::CreateFromAscii(fmt)); + m_sErrorMessage.replaceAt(m_sErrorMessage.indexOf('#'),1,::rtl::OUString::createFromAscii(fmt)); } } // ------------------------------------------------------------------------- diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index 446ec2454aea..d95b1624d26e 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -2,7 +2,7 @@ //-------------------------------------------------------------------------- // -// $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/connectivity/source/parse/sqlflex.l,v 1.1.1.1 2000-09-18 16:14:28 hr Exp $ +// $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/connectivity/source/parse/sqlflex.l,v 1.2 2000-10-19 11:47:14 oj Exp $ // // Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. // @@ -10,7 +10,7 @@ // OJ // // Last change: -// $Author: hr $ $Date: 2000-09-18 16:14:28 $ $Revision: 1.1.1.1 $ +// $Author: oj $ $Date: 2000-10-19 11:47:14 $ $Revision: 1.2 $ // // Description: // @@ -26,9 +26,6 @@ #ifndef _INC_STRING #include <string.h> #endif -#ifndef _SOLAR_H -#include <tools/solar.h> -#endif #ifndef _CONNECTIVITY_SQLINTERNALNODE_HXX #include "internalnode.hxx" @@ -59,11 +56,11 @@ using namespace connectivity; // Erzeugung der Blaetter fuer die Token // Blaetter werden generell vom Lexer erzeugt -static String aEmptyString; +static ::rtl::OUString aEmptyString; -static int gatherString(int delim, int nTyp); -static int gatherName(const char*); -static int gatherNamePre(const char* ); +static sal_Int32 gatherString(sal_Int32 delim, sal_Int32 nTyp); +static sal_Int32 gatherName(const sal_Char*); +static sal_Int32 gatherNamePre(const sal_Char* ); // has to be set before the parser starts OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; @@ -73,13 +70,13 @@ OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; #define SQL_NEW_KEYWORD(token) \ SQLyylval.pParseNode = new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, (token)); -#define SQL_NEW_NAME SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_NAME) -#define SQL_NEW_INTNUM SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_INTNUM) -#define SQL_NEW_APPROXNUM SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_APPROXNUM) -#define SQL_NEW_STRING SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_STRING) -#define SQL_NEW_COMPARISON SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_COMPARISON) -#define SQL_NEW_AMMSC SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_AMMSC) -#define SQL_NEW_DATE SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_ACCESS_DATE) +#define SQL_NEW_NAME SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_NAME) +#define SQL_NEW_INTNUM SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_INTNUM) +#define SQL_NEW_APPROXNUM SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_APPROXNUM) +#define SQL_NEW_STRING SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_STRING) +#define SQL_NEW_COMPARISON SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_COMPARISON) +#define SQL_NEW_AMMSC SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_AMMSC) +#define SQL_NEW_DATE SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_ACCESS_DATE) #define YY_INPUT(buf,result,max_size) \ { \ @@ -271,13 +268,13 @@ OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; [Zz][Oo][Nn][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_ZONE); return SQL_TOKEN_ZONE; } -"<" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_LESS);return LESS;} -">" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_GREAT);return GREAT;} -"=" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_EQUAL);return EQUAL;} -"<=" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_LESSEQ);return LESSEQ;} -">=" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_GREATEQ);return GREATEQ;} -"<>" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_NOTEQUAL);return NOTEQUAL;} -"!=" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_NOTEQUAL);return NOTEQUAL;} +"<" { SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_LESS);return LESS;} +">" { SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_GREAT);return GREAT;} +"=" { SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_EQUAL);return EQUAL;} +"<=" { SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_LESSEQ);return LESSEQ;} +">=" { SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_GREATEQ);return GREATEQ;} +"<>" { SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_NOTEQUAL);return NOTEQUAL;} +"!=" { SQL_NEW_NODE(::rtl::OUString::createFromAscii(SQLyytext), SQL_NODE_NOTEQUAL);return NOTEQUAL;} [-+*/:(),.;?{}] { return SQLyytext[0]; } @@ -349,14 +346,14 @@ OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; * nTyp == 1 -> SQL_NODE_STRING * nTyp == 2 -> SQL_NODE_ACCESS_DATE */ -int gatherString( int delim, int nTyp) +sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp) { - int ch; + sal_Int32 ch; static sal_Int32 BUFFERSIZE = 256; - static char* Buffer = new char[BUFFERSIZE]; + static sal_Char* Buffer = new sal_Char[BUFFERSIZE]; - char *s = Buffer; - int nPos = 0; + sal_Char *s = Buffer; + sal_Int32 nPos = 0; while ((ch = yyinput()) != EOF) { @@ -372,13 +369,13 @@ int gatherString( int delim, int nTyp) switch(nTyp) { case 0: - SQL_NEW_NODE(String(Buffer,RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); + SQL_NEW_NODE(::rtl::OUString(Buffer,BUFFERSIZE,RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); return SQL_TOKEN_NAME; case 1: - SQL_NEW_NODE(String(Buffer,RTL_TEXTENCODING_UTF8), SQL_NODE_STRING); + SQL_NEW_NODE(::rtl::OUString(Buffer,BUFFERSIZE,RTL_TEXTENCODING_UTF8), SQL_NODE_STRING); return SQL_TOKEN_STRING; case 2: - SQL_NEW_NODE(String(Buffer,RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE); + SQL_NEW_NODE(::rtl::OUString(Buffer,BUFFERSIZE,RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE); return SQL_TOKEN_ACCESS_DATE; } } @@ -387,12 +384,12 @@ int gatherString( int delim, int nTyp) *s++ = ch; if (++nPos == BUFFERSIZE) { - ByteString aBuf(Buffer); + ::rtl::OString aBuf(Buffer); delete Buffer; BUFFERSIZE *=2; - Buffer = new char[BUFFERSIZE]; - for(xub_StrLen i=0;i<aBuf.Len();++i,++Buffer) - *Buffer = aBuf.GetChar(i); + Buffer = new sal_Char[BUFFERSIZE]; + for(sal_Int32 i=0;i<aBuf.getLength();++i,++Buffer) + *Buffer = aBuf.getStr()[i]; s = &Buffer[nPos]; } } @@ -405,12 +402,12 @@ int gatherString( int delim, int nTyp) *s++ = ch; if (++nPos == BUFFERSIZE) { - ByteString aBuf(Buffer); + ::rtl::OString aBuf(Buffer); delete Buffer; BUFFERSIZE *=2; - Buffer = new char[BUFFERSIZE]; - for(xub_StrLen i=0;i<aBuf.Len();++i,++Buffer) - *Buffer = aBuf.GetChar(i); + Buffer = new sal_Char[BUFFERSIZE]; + for(sal_Int32 i=0;i<aBuf.getLength();++i,++Buffer) + *Buffer = aBuf.getStr()[i]; s = &Buffer[nPos]; } } @@ -425,10 +422,10 @@ int gatherString( int delim, int nTyp) * Valid Names or internatioanl keywords: * As we have international keywords, we test first on them */ -int gatherName(const char* text) +sal_Int32 gatherName(const sal_Char* text) { OSL_ENSHURE(xxx_pGLOBAL_SQLSCAN,"You forgot to set the scanner!"); - int nToken = xxx_pGLOBAL_SQLSCAN->getInternationalTokenID(text); + sal_Int32 nToken = xxx_pGLOBAL_SQLSCAN->getInternationalTokenID(text); switch (nToken) { case SQL_TOKEN_LIKE: @@ -448,7 +445,7 @@ int gatherName(const char* text) SQL_NEW_KEYWORD(nToken); return nToken; default: - SQL_NEW_NODE(String::CreateFromAscii(text), SQL_NODE_NAME); + SQL_NEW_NODE(::rtl::OUString::createFromAscii(text), SQL_NODE_NAME); return SQL_TOKEN_NAME; } } @@ -457,10 +454,10 @@ int gatherName(const char* text) Valid Names or internatioanl keywords: As we have international keywords, we test first on them */ -int gatherNamePre(const char* text) +sal_Int32 gatherNamePre(const sal_Char* text) { OSL_ENSHURE(xxx_pGLOBAL_SQLSCAN,"You forgot to set the scanner!"); - int nToken = xxx_pGLOBAL_SQLSCAN->getInternationalTokenID(text); + sal_Int32 nToken = xxx_pGLOBAL_SQLSCAN->getInternationalTokenID(text); switch (nToken) { case SQL_TOKEN_LIKE: @@ -483,12 +480,12 @@ int gatherNamePre(const char* text) // we need a special handling for parameter if (yy_hold_char == ':') { - SQL_NEW_NODE(String::CreateFromAscii(text), SQL_NODE_NAME); + SQL_NEW_NODE(::rtl::OUString::createFromAscii(text), SQL_NODE_NAME); return SQL_TOKEN_NAME; } else { - SQL_NEW_NODE(String::CreateFromAscii(text), SQL_NODE_STRING); + SQL_NEW_NODE(::rtl::OUString::createFromAscii(text), SQL_NODE_STRING); return SQL_TOKEN_STRING; } } @@ -504,8 +501,6 @@ static sal_uInt32 Intl_TokenID[] = SQL_TOKEN_MIN, SQL_TOKEN_SUM }; -DBG_NAME(OSQLScanner); - //------------------------------------------------------------------------------ OSQLScanner::OSQLScanner() : m_nCurrentPos(0) @@ -513,68 +508,65 @@ OSQLScanner::OSQLScanner() , m_pContext(NULL) , m_nRule(0) // 0 is INITIAL { - DBG_CTOR(OSQLScanner,NULL); } //------------------------------------------------------------------------------ OSQLScanner::~OSQLScanner() { - DBG_DTOR(OSQLScanner,NULL); } //------------------------------------------------------------------------------ -void OSQLScanner::SQLyyerror(char *fmt) +void OSQLScanner::SQLyyerror(sal_Char *fmt) { - DBG_ASSERT(m_pContext, "OSQLScanner::SQLyyerror: No Context set"); + OSL_ENSHURE(m_pContext, "OSQLScanner::SQLyyerror: No Context set"); m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL); - if (m_nCurrentPos < m_sStatement.Len()) + if (m_nCurrentPos < m_sStatement.getLength()) { - m_sErrorMessage.AppendAscii(": "); - m_sErrorMessage += m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL_HINT); - m_sErrorMessage.SearchAndReplaceAscii("#",String::CreateFromAscii(SQLyytext)); + m_sErrorMessage += ::rtl::OUString::createFromAscii(": "); + m_sErrorMessage += m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL_HINT);
+ + m_sErrorMessage.replaceAt(m_sErrorMessage.indexOf('#',0),1,::rtl::OUString::createFromAscii(SQLyytext)); } } //------------------------------------------------------------------------------ -void OSQLScanner::prepareScan(const String & rNewStatement, OParseContext* pContext, sal_Bool bInternational) +void OSQLScanner::prepareScan(const ::rtl::OUString & rNewStatement, OParseContext* pContext, sal_Bool bInternational) { - DBG_CHKTHIS(OSQLScanner,NULL); - BEGIN(m_nRule); - m_sErrorMessage.Erase(); - m_sStatement = ByteString(rNewStatement, RTL_TEXTENCODING_UTF8); + m_sErrorMessage = ::rtl::OUString(); + m_sStatement = ::rtl::OString(rNewStatement,rNewStatement.getLength(), RTL_TEXTENCODING_UTF8); m_nCurrentPos = 0; m_bInternational = bInternational; m_pContext = pContext; } //------------------------------------------------------------------------------ -int OSQLScanner::SQLyygetc(void) +sal_Int32 OSQLScanner::SQLyygetc(void) { - return (m_nCurrentPos >= m_sStatement.Len()) ? -1 : m_sStatement.GetChar(m_nCurrentPos++); + return (m_nCurrentPos >= m_sStatement.getLength()) ? -1 : m_sStatement.getStr()[m_nCurrentPos++]; } //------------------------------------------------------------------------------ -int OSQLScanner::getInternationalTokenID(const char* sToken) const +sal_Int32 OSQLScanner::getInternationalTokenID(const sal_Char* sToken) const { - DBG_ASSERT(m_pContext, "OSQLScanner::getInternationalTokenID: No Context set"); - return (m_bInternational) ? m_pContext->getIntlKeyCode(ByteString(sToken, RTL_TEXTENCODING_ASCII_US)) : 0; + OSL_ENSHURE(m_pContext, "OSQLScanner::getInternationalTokenID: No Context set"); + return (m_bInternational) ? m_pContext->getIntlKeyCode(::rtl::OString(sToken, RTL_TEXTENCODING_ASCII_US)) : 0; } // ------------------------------------------------------------------------- -int OSQLScanner::GetCurrentRule() const { return m_nRule; } -int OSQLScanner::GetGERRule() const { return PREDICATE_GER; } -int OSQLScanner::GetENGRule() const { return PREDICATE_ENG; } -int OSQLScanner::GetSQLRule() const { return SQL; } -int OSQLScanner::GetDATERule() const { return DATE; } -int OSQLScanner::GetSTRINGRule() const { return STRING; } +sal_Int32 OSQLScanner::GetCurrentRule() const { return m_nRule; } +sal_Int32 OSQLScanner::GetGERRule() const { return PREDICATE_GER; } +sal_Int32 OSQLScanner::GetENGRule() const { return PREDICATE_ENG; } +sal_Int32 OSQLScanner::GetSQLRule() const { return SQL; } +sal_Int32 OSQLScanner::GetDATERule() const { return DATE; } +sal_Int32 OSQLScanner::GetSTRINGRule() const { return STRING; } // ------------------------------------------------------------------------- void OSQLScanner::setScanner(sal_Bool _bNull) { xxx_pGLOBAL_SQLSCAN = _bNull ? NULL : this; } // ------------------------------------------------------------------------- -int OSQLScanner::SQLlex() +sal_Int32 OSQLScanner::SQLlex() { return SQLyylex(); } diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 1247dbc5a26a..3b73e2233208 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sqliterator.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2000-09-29 15:12:21 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:47:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,7 +97,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; DBG_NAME(OSQLParseTreeIterator); -static String aEmptyString; +static ::rtl::OUString aEmptyString; class OPrivateColumns : public sdbcx::OCollection { @@ -159,7 +159,6 @@ OSQLParseTreeIterator::OSQLParseTreeIterator() , m_xTables(NULL) , m_xDatabaseMetaData(NULL) { - DBG_CTOR(OSQLParseTreeIterator,NULL); m_aSelectColumns = new OSQLColumns(); } //----------------------------------------------------------------------------- @@ -171,7 +170,6 @@ OSQLParseTreeIterator::OSQLParseTreeIterator(const Reference< XNameAccess>& _xTa , m_aTables(_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()) , m_aCaseEqual(_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()) { - DBG_CTOR(OSQLParseTreeIterator,NULL); m_aSelectColumns = new OSQLColumns();// must be done because we need an empty column at zero setParseTree(pRoot); } @@ -181,15 +179,12 @@ OSQLParseTreeIterator::OSQLParseTreeIterator(const OSQLParseTreeIterator & rIter ,m_pParseTree(NULL) , m_xDatabaseMetaData(NULL) { - DBG_CTOR(OSQLParseTreeIterator,NULL); - - DBG_ERROR("OSQLParseTreeIterator: Copy-Konstruktor nicht implementiert!"); + OSL_ASSERT("OSQLParseTreeIterator: Copy-Konstruktor nicht implementiert!"); } //----------------------------------------------------------------------------- OSQLParseTreeIterator::~OSQLParseTreeIterator() { - DBG_DTOR(OSQLParseTreeIterator,NULL); m_aTables.clear(); } // ------------------------------------------------------------------------- @@ -216,11 +211,6 @@ Reference< XNameAccess > OSQLParseTreeIterator::getTablesAsNameAccess(::cppu::OW //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); - // alle Eingaben zur"uck setzen - // aIteratorStatus.Clear(); -// for(ULONG i=0; i< m_aTables.count();i++) -// delete m_aTables.getObject(i); m_aTables.clear(); m_aSelectColumns->clear(); @@ -235,8 +225,6 @@ void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree) // falls m_pParseTree aber keine Connection, dann Fehler if(!m_xTables.is()) { - //aIteratorStatus.setInvalidStatement(); - CallError(RET_BREAK); return; } @@ -276,28 +264,27 @@ void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree) { m_eStatementType = SQL_STATEMENT_UNKNOWN; //aIteratorStatus.setInvalidStatement(); - CallError(RET_BREAK); return; } } //----------------------------------------------------------------------------- -void OSQLParseTreeIterator::traverseOneTableName(const OSQLParseNode * pTableName, const String & rTableRange) +void OSQLParseTreeIterator::traverseOneTableName(const OSQLParseNode * pTableName, const ::rtl::OUString & rTableRange) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); - DBG_ASSERT(pTableName != NULL,"OSQLParseTreeIterator::traverseOneTableName: pTableName == NULL"); - String aTableName; - String aTableRange(rTableRange); + OSL_ENSHURE(pTableName != NULL,"OSQLParseTreeIterator::traverseOneTableName: pTableName == NULL"); + + ::rtl::OUString aTableName; + ::rtl::OUString aTableRange(rTableRange); // Tabellenname abholen - pTableName->parseNodeToStr(aTableName,m_xDatabaseMetaData,NULL,FALSE,FALSE); + pTableName->parseNodeToStr(aTableName,m_xDatabaseMetaData,NULL,sal_False,sal_False); // Wenn keine Range Variable angegeben, dann den Tabellennamen verwenden. - if (!aTableRange.Len()) + if (!aTableRange.getLength()) aTableRange = aTableName; - if(aTableName.Len()) + if(aTableName.getLength()) { try { @@ -334,24 +321,20 @@ void OSQLParseTreeIterator::traverseOneTableName(const OSQLParseNode * pTableNam m_aTables[aTableRange] = xSet; }catch(...) { - if (CallError(RET_CONTINUE)) - m_aTables[aTableRange] = NULL; // ich soll den Fehler ignorieren } } - else - CallError(RET_BREAK,rTableRange); } //----------------------------------------------------------------------------- -OSQLParseNode * OSQLParseTreeIterator::getQualified_join(OSQLParseNode *pTableRef,String& aTableRange) +OSQLParseNode * OSQLParseTreeIterator::getQualified_join(OSQLParseNode *pTableRef,::rtl::OUString& aTableRange) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); - aTableRange.Erase(); + + aTableRange = ::rtl::OUString(); OSQLParseNode *pNode = getTableRef(pTableRef->getChild(0),aTableRange); if(pNode) traverseOneTableName(pNode,aTableRange); - ULONG nPos = 4; + sal_uInt32 nPos = 4; if(SQL_ISRULE(pTableRef,cross_union) || pTableRef->getChild(1)->getTokenID() != SQL_TOKEN_NATURAL) nPos = 3; @@ -362,9 +345,9 @@ OSQLParseNode * OSQLParseTreeIterator::getQualified_join(OSQLParseNode *pTableRe return pNode; } //----------------------------------------------------------------------------- -OSQLParseNode * OSQLParseTreeIterator::getTableRef(OSQLParseNode *pTableRef,String& aTableRange) +OSQLParseNode * OSQLParseTreeIterator::getTableRef(OSQLParseNode *pTableRef,::rtl::OUString& aTableRange) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + OSQLParseNode *pTableName = pTableRef; if (pTableName->count() == 4 ) { @@ -378,7 +361,7 @@ OSQLParseNode * OSQLParseTreeIterator::getTableRef(OSQLParseNode *pTableRef,Stri // Tabellennamen gefunden if(!SQL_ISRULE(pTableName,table_name)) pTableName = pTableRef->getChild(0); - aTableRange.Erase(); + aTableRange = ::rtl::OUString(); if(pTableRef->count() == 4) aTableRange = pTableRef->getChild(2)->getTokenValue(); // Tabellenrange an Pos 2 } @@ -406,7 +389,6 @@ OSQLParseNode * OSQLParseTreeIterator::getTableRef(OSQLParseNode *pTableRef,Stri getSelect_statement(pTableRef->getChild(0)); // query_exp SQL_TOKEN_UNION all query_term else {// nyi: tiefere Verschachtelung m"oglch - CallError(4); } } return pTableName; @@ -414,7 +396,7 @@ OSQLParseNode * OSQLParseTreeIterator::getTableRef(OSQLParseNode *pTableRef,Stri //----------------------------------------------------------------------------- void OSQLParseTreeIterator::getSelect_statement(OSQLParseNode *pSelect) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if(SQL_ISRULE(pSelect,union_statement)) { getSelect_statement(pSelect->getChild(0)); @@ -423,14 +405,14 @@ void OSQLParseTreeIterator::getSelect_statement(OSQLParseNode *pSelect) } OSQLParseNode * pTableRefCommalist = pSelect->getChild(3)->getChild(0)->getChild(1); - DBG_ASSERT(pTableRefCommalist != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pTableRefCommalist,table_ref_commalist),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableRefCommalist != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pTableRefCommalist,table_ref_commalist),"OSQLParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pTableName = NULL; - String aTableRange; - for (ULONG i = 0; i < pTableRefCommalist->count(); i++) + ::rtl::OUString aTableRange; + for (sal_uInt32 i = 0; i < pTableRefCommalist->count(); i++) { // from clause durchlaufen - aTableRange.Erase(); + aTableRange = ::rtl::OUString(); if (SQL_ISRULE(pTableRefCommalist->getChild(i),table_name)) { @@ -462,10 +444,6 @@ void OSQLParseTreeIterator::getSelect_statement(OSQLParseNode *pSelect) // '(' qualified_join ')' getQualified_join(pTableRefCommalist->getChild(i)->getChild(1),aTableRange); } - else - { - CallError(3,aTableRange); - } // if (! aIteratorStatus.IsSuccessful()) break; } @@ -473,17 +451,16 @@ void OSQLParseTreeIterator::getSelect_statement(OSQLParseNode *pSelect) //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseTableNames() { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // aIteratorStatus.Clear(); if (m_pParseTree == NULL) { //aIteratorStatus.setInvalidStatement(); - CallError(3); return; } OSQLParseNode * pTableName = NULL; - String aTableRange; + ::rtl::OUString aTableRange; // pTableName auf den (einzigen) Tabellennamen im Statement setzen. // Je nach Statement (SELECT, INSERT, UPDATE, DELETE) an anderer Position. @@ -509,16 +486,13 @@ void OSQLParseTreeIterator::traverseTableNames() { pTableName = m_pParseTree->getChild(2); traverseOneTableName(pTableName,aTableRange); - } else - { - CallError(5,aTableRange); } } //----------------------------------------------------------------------------- -String OSQLParseTreeIterator::getColumnAlias(const OSQLParseNode* pDerivedColumn) const +::rtl::OUString OSQLParseTreeIterator::getColumnAlias(const OSQLParseNode* pDerivedColumn) const { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); - String aColumnAlias; + + ::rtl::OUString aColumnAlias; if(pDerivedColumn->getChild(1)->count() == 2) aColumnAlias = pDerivedColumn->getChild(1)->getChild(1)->getTokenValue(); else if(!pDerivedColumn->getChild(1)->isRule()) @@ -527,17 +501,17 @@ String OSQLParseTreeIterator::getColumnAlias(const OSQLParseNode* pDerivedColumn } //----------------------------------------------------------------------------- -void OSQLParseTreeIterator::getColumnRange(const OSQLParseNode* pColumnRef,String &rColumnName,String &rTableRange) const +void OSQLParseTreeIterator::getColumnRange(const OSQLParseNode* pColumnRef,::rtl::OUString &rColumnName,::rtl::OUString &rTableRange) const { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); - rColumnName.Erase(); - rTableRange.Erase(); + + rColumnName = ::rtl::OUString(); + rTableRange = ::rtl::OUString(); if(SQL_ISRULE(pColumnRef,column_ref))// ab hier ist es sicher eine Columnref { if(pColumnRef->count() > 1) { - for(INT32 i=0;i<((INT32)pColumnRef->count())-2;i++) // mu"s signed sein, falls count == 1 - pColumnRef->getChild(i)->parseNodeToStr(rTableRange,m_xDatabaseMetaData,NULL,FALSE,FALSE); + for(sal_Int32 i=0;i<((sal_Int32)pColumnRef->count())-2;i++) // mu"s signed sein, falls count == 1 + pColumnRef->getChild(i)->parseNodeToStr(rTableRange,m_xDatabaseMetaData,NULL,sal_False,sal_False); // Spaltenname rColumnName = pColumnRef->getChild(pColumnRef->count()-1)->getChild(0)->getTokenValue(); } @@ -553,14 +527,14 @@ void OSQLParseTreeIterator::getColumnRange(const OSQLParseNode* pColumnRef,Strin } //----------------------------------------------------------------------------- -BOOL OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, String &rTableRange) const +sal_Bool OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, ::rtl::OUString &rTableRange) const { // Ermitteln ob alle Spalten zu einer Tabelle gehoeren if (SQL_ISRULE(pNode,column_ref)) { - String aColName, aTableRange; + ::rtl::OUString aColName, aTableRange; getColumnRange(pNode, aColName, aTableRange); - if (!aTableRange.Len()) // keinen gefunden + if (!aTableRange.getLength()) // keinen gefunden { // dann die Spalte in den Tabellen suchen for (ConstOSQLTablesIterator aIter = m_aTables.begin(); aIter != m_aTables.end(); ++aIter) @@ -584,37 +558,36 @@ BOOL OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, Stri } } } - if (!aTableRange.Len()) - return FALSE; + if (!aTableRange.getLength()) + return sal_False; } - if (!rTableRange.Len()) + if (!rTableRange.getLength()) rTableRange = aTableRange; else if (rTableRange != aTableRange) - return FALSE; + return sal_False; } else { - for (UINT32 i = 0, ncount = pNode->count(); i < ncount; i++) + for (sal_uInt32 i = 0, ncount = pNode->count(); i < ncount; i++) { if (!getColumnTableRange(pNode->getChild(i), rTableRange)) - return FALSE; + return sal_False; } } - return TRUE; + return sal_True; } //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSelectNode) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // aIteratorStatus.Clear(); if (!pSelectNode || m_eStatementType != SQL_STATEMENT_SELECT || !m_aTables.size()) { //aIteratorStatus.setInvalidStatement(); - CallError(3); return; } @@ -629,35 +602,35 @@ void OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele if (pSelectNode->getChild(2)->isRule() && SQL_ISPUNCTUATION(pSelectNode->getChild(2)->getChild(0),"*")) { // SELECT * ... - setSelectColumnName(String::CreateFromAscii("*"), aEmptyString,aEmptyString); + setSelectColumnName(::rtl::OUString::createFromAscii("*"), aEmptyString,aEmptyString); } else if (SQL_ISRULE(pSelectNode->getChild(2),scalar_exp_commalist)) { // SELECT column(,column) oder SELECT COUNT(*) ... OSQLParseNode * pSelection = pSelectNode->getChild(2); - for (ULONG i = 0; i < pSelection->count(); i++) + for (sal_uInt32 i = 0; i < pSelection->count(); i++) { OSQLParseNode *pColumnRef = pSelection->getChild(i); if (SQL_ISRULE(pColumnRef,select_sublist)) { // alle Spalten der Tabelle - String aTableRange; - pColumnRef->getChild(0)->parseNodeToStr(aTableRange,m_xDatabaseMetaData,NULL,FALSE,FALSE); - setSelectColumnName(String::CreateFromAscii("*"), aEmptyString,aTableRange); + ::rtl::OUString aTableRange; + pColumnRef->getChild(0)->parseNodeToStr(aTableRange,m_xDatabaseMetaData,NULL,sal_False,sal_False); + setSelectColumnName(::rtl::OUString::createFromAscii("*"), aEmptyString,aTableRange); continue; }else if (SQL_ISRULE(pColumnRef,derived_column)) { - String aColumnAlias(getColumnAlias(pColumnRef)); // kann leer sein - String aColumnName; - String aTableRange; - BOOL bFkt(FALSE); + ::rtl::OUString aColumnAlias(getColumnAlias(pColumnRef)); // kann leer sein + ::rtl::OUString aColumnName; + ::rtl::OUString aTableRange; + sal_Bool bFkt(sal_False); pColumnRef = pColumnRef->getChild(0); if (SQL_ISRULE(pColumnRef,column_ref)) { getColumnRange(pColumnRef,aColumnName,aTableRange); - DBG_ASSERT(aColumnName.Len(),"Columnname darf nicht leer sein"); + OSL_ENSHURE(aColumnName.getLength(),"Columnname darf nicht leer sein"); } else /*if (SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec) || SQL_ISRULE(pColumnRef,position_exp) || SQL_ISRULE(pColumnRef,extract_exp) || @@ -665,7 +638,7 @@ void OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term))*/ { /* Funktionsaufruf vorhanden */ - pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,FALSE,TRUE); + pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,sal_False,sal_True); // gehoeren alle beteiligten Spalten der Funktion zu einer Tabelle if (m_aTables.size() == 1) @@ -676,7 +649,7 @@ void OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele { getColumnTableRange(pColumnRef,aTableRange); } - bFkt = TRUE; + bFkt = sal_True; } /* else @@ -685,16 +658,12 @@ void OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele return; } */ - if(!aColumnAlias.Len()) + if(!aColumnAlias.getLength()) aColumnAlias = aColumnName; setSelectColumnName(aColumnName,aColumnAlias,aTableRange,bFkt); } } - } else - { - //aIteratorStatus.setInvalidStatement(); - CallError(3); } } @@ -702,19 +671,17 @@ void OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseOrderByColumnNames(const OSQLParseNode* pSelectNode) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // aIteratorStatus.Clear(); if (pSelectNode == NULL) { //aIteratorStatus.setInvalidStatement(); - CallError(3); return; } if (m_eStatementType != SQL_STATEMENT_SELECT) { - CallError(3); //aIteratorStatus.setInvalidStatement(); return; } @@ -726,64 +693,64 @@ void OSQLParseTreeIterator::traverseOrderByColumnNames(const OSQLParseNode* pSel return; } - DBG_ASSERT(pSelectNode->count() >= 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pSelectNode->count() >= 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pTableExp = pSelectNode->getChild(3); - DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pOptOrderByClause = pTableExp->getChild(4); - DBG_ASSERT(pOptOrderByClause != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pOptOrderByClause,opt_order_by_clause),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pOptOrderByClause != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pOptOrderByClause,opt_order_by_clause),"OSQLParseTreeIterator: Fehler im Parse Tree"); if (pOptOrderByClause->count() == 0) return; - DBG_ASSERT(pOptOrderByClause->count() == 3,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pOptOrderByClause->count() == 3,"OSQLParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pOrderingSpecCommalist = pOptOrderByClause->getChild(2); - DBG_ASSERT(pOrderingSpecCommalist != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pOrderingSpecCommalist->count() > 0,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pOrderingSpecCommalist != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pOrderingSpecCommalist->count() > 0,"OSQLParseTreeIterator: Fehler im Parse Tree"); - String aColumnName,aColumnAlias; - String aTableRange; - for (UINT32 i = 0; i < pOrderingSpecCommalist->count(); i++) + ::rtl::OUString aColumnName,aColumnAlias; + ::rtl::OUString aTableRange; + for (sal_uInt32 i = 0; i < pOrderingSpecCommalist->count(); i++) { OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(i); - DBG_ASSERT(pOrderingSpec != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pOrderingSpec,ordering_spec),"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pOrderingSpec->count() == 2,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pOrderingSpec != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pOrderingSpec->count() == 2,"OSQLParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0); - aTableRange.Erase(); - aColumnName.Erase(); + aTableRange = ::rtl::OUString(); + aColumnName = ::rtl::OUString(); if(SQL_ISRULE(pColumnRef,column_ref)) { // Column-Name (und TableRange): if(SQL_ISRULE(pColumnRef,column_ref)) getColumnRange(pColumnRef,aColumnName,aTableRange); else // eine Expression - pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,FALSE,FALSE); + pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,sal_False,sal_False); - DBG_ASSERT(aColumnName.Len(),"aColumnName darf nicht leer sein"); + OSL_ENSHURE(aColumnName.getLength(),"aColumnName darf nicht leer sein"); } else { // here I found a predicate - pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,FALSE,FALSE); + pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,sal_False,sal_False); } - DBG_ASSERT(pColumnRef != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pColumnRef != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); // Ascending/Descending OSQLParseNode * pOptAscDesc = pOrderingSpec->getChild(1); - DBG_ASSERT(pOptAscDesc != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pOptAscDesc != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - BOOL bAscending = TRUE; + sal_Bool bAscending = sal_True; if(pOptAscDesc) { if (SQL_ISTOKEN(pOptAscDesc,ASC)) - bAscending = TRUE; + bAscending = sal_True; else if (SQL_ISTOKEN(pOptAscDesc,DESC)) - bAscending = FALSE; + bAscending = sal_False; } setOrderByColumnName(aColumnName, aTableRange,bAscending); @@ -796,12 +763,11 @@ void OSQLParseTreeIterator::traverseOrderByColumnNames(const OSQLParseNode* pSel //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSelectNode) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // aIteratorStatus.Clear(); if (pSelectNode == NULL) { - CallError(3); //aIteratorStatus.setInvalidStatement(); return; } @@ -819,26 +785,26 @@ void OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele traverseSelectionCriteria(pSelectNode->getChild(3)); return; } - DBG_ASSERT(pSelectNode->count() >= 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pSelectNode->count() >= 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pTableExp = pSelectNode->getChild(3); - DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); pWhereClause = pTableExp->getChild(1); } else if (SQL_ISRULE(pSelectNode,update_statement_searched)) { - DBG_ASSERT(pSelectNode->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pSelectNode->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); pWhereClause = pSelectNode->getChild(4); } else if (SQL_ISRULE(pSelectNode,update_statement_positioned)) { // nyi - DBG_ERROR("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi"); + OSL_ASSERT("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi"); } else if (SQL_ISRULE(pSelectNode,delete_statement_searched)) { - DBG_ASSERT(pSelectNode->count() == 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pSelectNode->count() == 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); pWhereClause = pSelectNode->getChild(3); } else if (SQL_ISRULE(pSelectNode,delete_statement_positioned)) { // nyi - DBG_ERROR("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi"); + OSL_ASSERT("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi"); } else { // Anderes Statement. Keine Selektionskriterien. return; @@ -847,15 +813,15 @@ void OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele if (! SQL_ISRULE(pWhereClause,where_clause)) { // Die Where Clause ist meistens optional, d. h. es koennte sich auch // um "optional_where_clause" handeln. - DBG_ASSERT(SQL_ISRULE(pWhereClause,opt_where_clause),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pWhereClause,opt_where_clause),"OSQLParseTreeIterator: Fehler im Parse Tree"); return; } // Wenn es aber eine where_clause ist, dann darf sie nicht leer sein: - DBG_ASSERT(pWhereClause->count() == 2,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pWhereClause->count() == 2,"OSQLParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1); - DBG_ASSERT(pComparisonPredicate != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pComparisonPredicate != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); // @@ -875,7 +841,7 @@ void OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if ( pSearchCondition->count() == 3 && @@ -934,7 +900,7 @@ void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition) //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if ( SQL_ISRULE(pSearchCondition,boolean_primary) && @@ -986,9 +952,9 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition else if (pPrec->getNodeType() == SQL_NODE_GREAT) ePredicateType = SQL_PRED_GREATER; - String aValue; - pSearchCondition->getChild(2)->parseNodeToStr(aValue,m_xDatabaseMetaData,NULL,FALSE,FALSE); - traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aValue,FALSE,pSearchCondition->getChild(2)); + ::rtl::OUString aValue; + pSearchCondition->getChild(2)->parseNodeToStr(aValue,m_xDatabaseMetaData,NULL,sal_False,sal_False); + traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aValue,sal_False,pSearchCondition->getChild(2)); // if (! aIteratorStatus.IsSuccessful()) // return; } @@ -996,7 +962,7 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition { OSQLPredicateType ePredicateType; - DBG_ASSERT(pSearchCondition->count() >= 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pSearchCondition->count() >= 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); sal_Int32 nCurentPos = pSearchCondition->count()-2; @@ -1008,8 +974,8 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition else ePredicateType = SQL_PRED_LIKE; - DBG_ASSERT(pNum_value_exp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pOptEscape != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pNum_value_exp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pOptEscape != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); if (pOptEscape->count() != 0) { @@ -1017,7 +983,7 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition return; } - String aValue; + ::rtl::OUString aValue; OSQLParseNode * pParam = NULL; if (SQL_ISRULE(pNum_value_exp,parameter)) pParam = pNum_value_exp; @@ -1026,11 +992,11 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition aValue = pNum_value_exp->getTokenValue(); else { - pNum_value_exp->parseNodeToStr(aValue,m_xDatabaseMetaData,NULL,FALSE,FALSE); + pNum_value_exp->parseNodeToStr(aValue,m_xDatabaseMetaData,NULL,sal_False,sal_False); pParam = pNum_value_exp; } - traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aValue,FALSE,pParam); + traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aValue,sal_False,pParam); // if (! aIteratorStatus.IsSuccessful()) // return; } @@ -1038,16 +1004,16 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition { OSQLPredicateType ePredicateType; - DBG_ASSERT(pSearchCondition->count() >= 3,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISTOKEN(pSearchCondition->getChild(1),IS),"OSQLParseTreeIterator: Fehler im Parse Tree") + OSL_ENSHURE(pSearchCondition->count() >= 3,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISTOKEN(pSearchCondition->getChild(1),IS),"OSQLParseTreeIterator: Fehler im Parse Tree"); if (SQL_ISTOKEN(pSearchCondition->getChild(2),NOT) ) ePredicateType = SQL_PRED_ISNOTNULL; else ePredicateType = SQL_PRED_ISNULL; - String aString; - traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aString,TRUE,NULL); + ::rtl::OUString aString; + traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aString,sal_True,NULL); // if (! aIteratorStatus.IsSuccessful()) return; } else { // Etwas anderes unterstuetzen wir (noch) nicht. Basta! @@ -1060,45 +1026,45 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition void OSQLParseTreeIterator::traverseOnePredicate( OSQLParseNode * pColumnRef, OSQLPredicateType ePredicateType, - String& rValue, - BOOL bCompareNull, + ::rtl::OUString& rValue, + sal_Bool bCompareNull, OSQLParseNode * pParseNode) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // Column-Name (und TableRange): - String aColumnName; - String aTableRange; + ::rtl::OUString aColumnName; + ::rtl::OUString aTableRange; getColumnRange(pColumnRef,aColumnName,aTableRange); - String aName; + ::rtl::OUString aName; if (pParseNode) //event. Parameter, oder Columnref oder { if (SQL_ISRULE(pParseNode,parameter)) { - DBG_ASSERT(pParseNode->count() > 0,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pParseNode->count() > 0,"OSQLParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pMark = pParseNode->getChild(0); - String aParameterName; + ::rtl::OUString aParameterName; if (SQL_ISPUNCTUATION(pMark,"?")) { // Name = "?", da kein Parametername verfuegbar (z. B. bei Native SQL) - rValue = '?'; - aName = '?'; + rValue = ::rtl::OUString::createFromAscii("?"); + aName = ::rtl::OUString::createFromAscii("?"); } else if (SQL_ISPUNCTUATION(pMark,":")) { rValue = pParseNode->getChild(1)->getTokenValue(); - aName = ':'; + aName = ::rtl::OUString::createFromAscii(":"); } else if (SQL_ISPUNCTUATION(pMark,"[")) { rValue = pParseNode->getChild(1)->getTokenValue(); - aName = '['; + aName = ::rtl::OUString::createFromAscii("["); } else { - DBG_ERROR("OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ASSERT("OSQLParseTreeIterator: Fehler im Parse Tree"); } } else if (SQL_ISRULE(pParseNode,column_ref))// Column-Name (und TableRange): @@ -1108,7 +1074,7 @@ void OSQLParseTreeIterator::traverseOnePredicate( // "set"-Routine aufrufen ... if (bCompareNull) { // nyi: was soll das? Vergleich auf NULL geht nur ueber IS NULL oder IS NOT NULL! - setPredicate(aColumnName, aTableRange,ePredicateType, String(), String()); + setPredicate(aColumnName, aTableRange,ePredicateType, ::rtl::OUString(), ::rtl::OUString()); } else { setPredicate(aColumnName, aTableRange, ePredicateType, rValue, aName); } @@ -1119,15 +1085,15 @@ void OSQLParseTreeIterator::traverseOnePredicate( //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseAssignments() { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); - DBG_ERROR("OSQLParseTreeIterator::traverseAssignments: noch nicht implementiert"); + + OSL_ASSERT("OSQLParseTreeIterator::traverseAssignments: noch nicht implementiert"); } //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseAll() { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + traverseTableNames(); // if (! aIteratorStatus.IsSuccessful()) return; @@ -1152,19 +1118,16 @@ void OSQLParseTreeIterator::traverseAll() // return; } else if (m_eStatementType == SQL_STATEMENT_INSERT) { // schon alles erledigt - } else { - CallError(3); - //aIteratorStatus.setInvalidStatement(); } } // Dummy-Implementationen: //----------------------------------------------------------------------------- -void OSQLParseTreeIterator::setTableName(const String & rTableName, const String & rDBName, const String& rOwner, - const String & rTableRange) +void OSQLParseTreeIterator::setTableName(const ::rtl::OUString & rTableName, const ::rtl::OUString & rDBName, const ::rtl::OUString& rOwner, + const ::rtl::OUString & rTableRange) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... #ifdef SQL_TEST_PARSETREEITERATOR @@ -1178,7 +1141,7 @@ void OSQLParseTreeIterator::setTableName(const String & rTableName, const String //----------------------------------------------------------------------------- void OSQLParseTreeIterator::appendColumns(const OSQLTable& _rTable) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if (!_rTable.is()) return; @@ -1210,34 +1173,33 @@ void OSQLParseTreeIterator::appendColumns(const OSQLTable& _rTable) } } //----------------------------------------------------------------------------- -void OSQLParseTreeIterator::setSelectColumnName(const String & rColumnName,const String & rColumnAlias, const String & rTableRange,BOOL bFkt) +void OSQLParseTreeIterator::setSelectColumnName(const ::rtl::OUString & rColumnName,const ::rtl::OUString & rColumnAlias, const ::rtl::OUString & rTableRange,sal_Bool bFkt) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); - if(rColumnName.GetChar(0) == '*' && !rTableRange.Len()) + + if(rColumnName.toChar() == '*' && !rTableRange.getLength()) { // Suche "uber alle vorkommenden Tabellen for(ConstOSQLTablesIterator aIter = m_aTables.begin(); aIter != m_aTables.end();++aIter) appendColumns(aIter->second); } - else if(rColumnName.GetChar(0) == '*' && rTableRange.Len()) // alle Columns aus dieser Tabelle + else if(rColumnName.toChar() == '*' && rTableRange.getLength()) // alle Columns aus dieser Tabelle { ConstOSQLTablesIterator aFind = m_aTables.find(rTableRange); if(aFind == m_aTables.end()) { - String strExpression = rTableRange; - strExpression += '.'; + ::rtl::OUString strExpression = rTableRange; + strExpression += ::rtl::OUString::createFromAscii("."); strExpression += rColumnName; - CallError(2, strExpression); } else appendColumns(aFind->second); } - else if(!rTableRange.Len())// ein Columnname existiert + else if(!rTableRange.getLength())// ein Columnname existiert { if(!bFkt) { - UINT32 ncount = m_aSelectColumns->size(); + sal_uInt32 ncount = m_aSelectColumns->size(); for(OSQLTablesIterator aIter = m_aTables.begin(); aIter != m_aTables.end(); ++aIter) { if (aIter->second.is()) @@ -1247,7 +1209,7 @@ void OSQLParseTreeIterator::setSelectColumnName(const String & rColumnName,const Reference< XFastPropertySet > xColumn; if(xColumns->getByName(rColumnName) >>= xColumn) { - String aNewColName(getUniqueColumnName(rColumnAlias)); + ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); OParseColumn* pColumn = new OParseColumn(xColumn,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); pColumn->setTableName(aIter->first); @@ -1262,16 +1224,15 @@ void OSQLParseTreeIterator::setSelectColumnName(const String & rColumnName,const } if (ncount == m_aSelectColumns->size()) { - String strExpression = rTableRange; - if (strExpression.Len()) - strExpression += '.'; + ::rtl::OUString strExpression = rTableRange; + if (strExpression.getLength()) + strExpression += ::rtl::OUString::createFromAscii("."); strExpression += rColumnName; - CallError(2, strExpression); } } else { - String aNewColName(getUniqueColumnName(rColumnAlias)); + ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); @@ -1286,13 +1247,13 @@ void OSQLParseTreeIterator::setSelectColumnName(const String & rColumnName,const { ConstOSQLTablesIterator aFind = m_aTables.find(rTableRange); - BOOL bError = FALSE; + sal_Bool bError = sal_False; if (aFind->second.is()) { if (bFkt) { - String aNewColName(getUniqueColumnName(rColumnAlias)); + ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); @@ -1308,7 +1269,7 @@ void OSQLParseTreeIterator::setSelectColumnName(const String & rColumnName,const Reference< XFastPropertySet > xColumn; if (aFind->second->getColumns()->getByName(rColumnName) >>= xColumn) { - String aNewColName(getUniqueColumnName(rColumnAlias)); + ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); OParseColumn* pColumn = new OParseColumn(xColumn,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); pColumn->setName(aNewColName); @@ -1319,23 +1280,21 @@ void OSQLParseTreeIterator::setSelectColumnName(const String & rColumnName,const m_aSelectColumns->push_back(xCol); } else - bError = TRUE; + bError = sal_True; } } else - bError = TRUE; + bError = sal_True; // Tabelle existiert nicht oder Feld nicht vorhanden if (bError) { - String strExpression = rTableRange; - if (strExpression.Len()) - strExpression += '.'; + ::rtl::OUString strExpression = rTableRange; + if (strExpression.getLength()) + strExpression += ::rtl::OUString::createFromAscii("."); strExpression += rColumnName; - if (!CallError(2, strExpression)) - return; - String aNewColName(getUniqueColumnName(rColumnAlias)); + ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); @@ -1348,7 +1307,7 @@ void OSQLParseTreeIterator::setSelectColumnName(const String & rColumnName,const } } //----------------------------------------------------------------------------- -String OSQLParseTreeIterator::getUniqueColumnName(const String & rColumnName) const +::rtl::OUString OSQLParseTreeIterator::getUniqueColumnName(const ::rtl::OUString & rColumnName) const { ::rtl::OUString aAlias(rColumnName); @@ -1362,16 +1321,16 @@ String OSQLParseTreeIterator::getUniqueColumnName(const String & rColumnName) return aAlias; } //----------------------------------------------------------------------------- -void OSQLParseTreeIterator::setOrderByColumnName(const String & rColumnName, const String & rTableRange,BOOL bAscending) +void OSQLParseTreeIterator::setOrderByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange,sal_Bool bAscending) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... #ifdef SQL_TEST_PARSETREEITERATOR cout << "OSQLParseTreeIterator::setOrderByColumnName: " << (const char *) rColumnName << ", " << (const char *) rTableRange << ", " - << (bAscending ? "TRUE" : "FALSE") + << (bAscending ? "sal_True" : "sal_False") << "\n"; #endif } @@ -1379,7 +1338,7 @@ void OSQLParseTreeIterator::setOrderByColumnName(const String & rColumnName, con //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setORCriteriaPre() { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... #ifdef SQL_TEST_PARSETREEITERATOR @@ -1390,7 +1349,7 @@ void OSQLParseTreeIterator::setORCriteriaPre() //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setORCriteriaPost() { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... #ifdef SQL_TEST_PARSETREEITERATOR @@ -1401,7 +1360,7 @@ void OSQLParseTreeIterator::setORCriteriaPost() //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setANDCriteriaPre() { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... #ifdef SQL_TEST_PARSETREEITERATOR @@ -1412,7 +1371,7 @@ void OSQLParseTreeIterator::setANDCriteriaPre() //----------------------------------------------------------------------------- void OSQLParseTreeIterator::setANDCriteriaPost() { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... #ifdef SQL_TEST_PARSETREEITERATOR @@ -1421,13 +1380,13 @@ void OSQLParseTreeIterator::setANDCriteriaPost() } //----------------------------------------------------------------------------- -void OSQLParseTreeIterator::setPredicate(const String & rColumnName, - const String & rTableRange, +void OSQLParseTreeIterator::setPredicate(const ::rtl::OUString & rColumnName, + const ::rtl::OUString & rTableRange, OSQLPredicateType ePredicateType, - const String & rValue, - const String & rParameterName) + const ::rtl::OUString & rValue, + const ::rtl::OUString & rParameterName) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... #ifdef SQL_TEST_PARSETREEITERATOR @@ -1443,18 +1402,18 @@ void OSQLParseTreeIterator::setPredicate(const String & rColumnName, //----------------------------------------------------------------------------- -void OSQLParseTreeIterator::setAssign(const String & rColumnName, - const String & rValue, BOOL bsetNull, - const String & rParameterName) +void OSQLParseTreeIterator::setAssign(const ::rtl::OUString & rColumnName, + const ::rtl::OUString & rValue, sal_Bool bsetNull, + const ::rtl::OUString & rParameterName) { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... #ifdef SQL_TEST_PARSETREEITERATOR cout << "OSQLParseTreeIterator::setAssign: " << (const char *) rColumnName << ", " << (const char *) rValue << ", " - << (bsetNull ? "TRUE" : "FALSE") << ", " + << (bsetNull ? "sal_True" : "sal_False") << ", " << (const char *) rParameterName << "\n"; #endif @@ -1463,7 +1422,7 @@ void OSQLParseTreeIterator::setAssign(const String & rColumnName, //----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if (!m_pParseTree) return NULL; @@ -1473,11 +1432,11 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const OSQLParseNode * pWhereClause = NULL; if(getStatementType() == SQL_STATEMENT_SELECT) { - DBG_ASSERT(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pTableExp = m_pParseTree->getChild(3); - DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); pWhereClause = pTableExp->getChild(1); } @@ -1494,7 +1453,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const //----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) return NULL; @@ -1502,11 +1461,11 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const // Parse Tree analysieren (je nach Statement-Typ) // und Zeiger auf ORDER-Klausel setzen: OSQLParseNode * pOrderClause = NULL; - DBG_ASSERT(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pTableExp = m_pParseTree->getChild(3); - DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); pOrderClause = pTableExp->getChild(4); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: @@ -1517,7 +1476,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const //----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) return NULL; @@ -1525,11 +1484,11 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const // Parse Tree analysieren (je nach Statement-Typ) // und Zeiger auf ORDER-Klausel setzen: OSQLParseNode * pGroupClause = NULL; - DBG_ASSERT(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pTableExp = m_pParseTree->getChild(3); - DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); pGroupClause = pTableExp->getChild(3); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: @@ -1540,7 +1499,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const //----------------------------------------------------------------------------- const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const { - DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) return NULL; @@ -1548,11 +1507,11 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const // Parse Tree analysieren (je nach Statement-Typ) // und Zeiger auf ORDER-Klausel setzen: OSQLParseNode * pHavingClause = NULL; - DBG_ASSERT(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); OSQLParseNode * pTableExp = m_pParseTree->getChild(3); - DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); - DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSL_ENSHURE(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); pHavingClause = pTableExp->getChild(3); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: @@ -1560,26 +1519,5 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const pHavingClause = NULL; return pHavingClause; } -//----------------------------------------------------------------------------- -BOOL OSQLParseTreeIterator::CallError(USHORT nError,const String& rExpression) -{ -// SdbParseIteratorErrorInfo aErrorInfo; -// aErrorInfo.aStatus = rStatus; -// aErrorInfo.nErrorCode = nError; -// aErrorInfo.aExpression = rExpression; -// -// long nResult = aErrorHdl.Call(&aErrorInfo); -// if (nResult == RET_CONTINUE) - return TRUE; - -// if (nResult == RET_HANDLED) -// { -// // aIteratorStatus.set(SQL_STAT_SUCCESS); -// return FALSE; -// } -// -// aIteratorStatus = rStatus; -// return FALSE; -// -} + diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 4a7864b04f74..041738d5aa30 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sqlnode.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-09-29 15:13:06 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:47:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,16 +79,23 @@ #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> #endif -#ifndef _TOOLS_INTN_HXX //autogen wg. International -#include <tools/intn.hxx> -#endif -#ifndef _ISOLANG_HXX -#include <tools/isolang.hxx> -#endif #ifndef __SGI_STL_ROPE #include <stl/rope> #endif +#ifndef _DBHELPER_DBCONVERSION_HXX_ +#include "connectivity/dbconversion.hxx" +#endif +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_ +#include <com/sun/star/util/Time.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ +#include <com/sun/star/util/Date.hpp> +#endif + using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::util; using namespace ::com::sun::star::beans; @@ -96,22 +103,20 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::osl; using namespace connectivity; +using namespace dbtools; extern Any getNumberFormatProperty(const Reference< XNumberFormatsSupplier > & xFormatter, sal_Int32 nKey, const rtl::OUString& ); -extern double ToDouble(const Time& rTime); -extern double ToDouble(const Reference< XNumberFormatsSupplier > & xSupplier, const Date& rDate); -extern String ConvertLikeToken(const OSQLParseNode* pTokenNode, const OSQLParseNode* pEscapeNode, sal_Bool bInternational); - +extern ::rtl::OUString ConvertLikeToken(const OSQLParseNode* pTokenNode, const OSQLParseNode* pEscapeNode, sal_Bool bInternational); //------------------------------------------------------------------ -OSQLParseNode::SQLParseNodeParameter::SQLParseNodeParameter(const String& _rIdentifierQuote, const String& _rCatalogSep, - const Reference< XNumberFormatter > & _xFormatter, const Reference< XPropertySet > & _xField, const International& _rIntl, - const OParseContext* _pContext, sal_Bool _bIntl, sal_Bool _bQuote, char _cDecSep, +OSQLParseNode::SQLParseNodeParameter::SQLParseNodeParameter(const ::rtl::OUString& _rIdentifierQuote, const ::rtl::OUString& _rCatalogSep, + const Reference< XNumberFormatter > & _xFormatter, const Reference< XPropertySet > & _xField, const ::com::sun::star::lang::Locale& _rLocale, + const OParseContext* _pContext, sal_Bool _bIntl, sal_Bool _bQuote, sal_Char _cDecSep, sal_Bool _bPredicate) :aIdentifierQuote(_rIdentifierQuote) ,aCatalogSeparator(_rCatalogSep) - ,rIntl(_rIntl) + ,rLocale(_rLocale) ,rContext(_pContext ? *_pContext : OSQLParser::s_aDefaultContext) ,bInternational(_bIntl) ,bQuote(_bQuote) @@ -123,95 +128,90 @@ OSQLParseNode::SQLParseNodeParameter::SQLParseNodeParameter(const String& _rIden } //------------------------------------------------------------------ -String SetQuotation(const String& rValue, const String& rQuot, const String& rQuotToReplace) +::rtl::OUString SetQuotation(const ::rtl::OUString& rValue, const ::rtl::OUString& rQuot, const ::rtl::OUString& rQuotToReplace) { - String rNewValue = rQuot; + ::rtl::OUString rNewValue = rQuot; rNewValue += rValue; + sal_Int32 nIndex = (sal_Int32)-1; // Quotes durch zweifache Quotes ersetzen, sonst kriegt der Parser Probleme - xub_StrLen nIndex = (xub_StrLen)-1; // Quotes durch zweifache Quotes ersetzen, sonst kriegt der Parser Probleme - - if (rQuot.Len()) + if (rQuot.getLength()) { do { - nIndex+= 2; - nIndex = rNewValue.SearchAndReplace(rQuot,rQuotToReplace,nIndex); - } while (nIndex != STRING_NOTFOUND); + nIndex += 2; + nIndex = rNewValue.indexOf(rQuot,nIndex); + if(nIndex != -1) + rNewValue = rNewValue.replaceAt(nIndex,rQuot.getLength(),rQuotToReplace); + } while (nIndex != -1); } - // rNewValue.SearchAndReplaceAll(rQuot,rQuotToReplace); rNewValue += rQuot; return rNewValue; } +// ------------------------------------------------------------------------- +sal_Int32 getToken(const ::rtl::OUString& _rValue,const ::rtl::OUString& _rToken,sal_uInt32 _nPos) +{ + sal_Int32 nLen = _rValue.getLength(); + sal_Int32 nFirstIndex = 0; + sal_Int32 nSecondIndex = _rValue.indexOf(::rtl::OUString::createFromAscii("-"), nFirstIndex); + while(_nPos--) + { + nFirstIndex = nSecondIndex; + nSecondIndex = _rValue.indexOf(::rtl::OUString::createFromAscii("-"), nFirstIndex); + } - + return _rValue.copy(nFirstIndex,nSecondIndex-1).toInt32(); +} //----------------------------------------------------------------------------- -String OSQLParseNode::convertDateString(const SQLParseNodeParameter& rParam, const String& rString) const +::rtl::OUString OSQLParseNode::convertDateString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const { - xub_StrLen nIndex = 0; - sal_Int32 nYear = rString.GetToken(0,'-', nIndex).ToInt32(), - nMonth = rString.GetToken(0,'-', nIndex).ToInt32(), - nDay = rString.GetToken(0,'-', nIndex).ToInt32(); + // get the token out of a string + sal_Int32 nYear = getToken(rString,::rtl::OUString::createFromAscii("-"),0); + sal_Int32 nMonth = getToken(rString,::rtl::OUString::createFromAscii("-"),1); + sal_Int32 nDay = getToken(rString,::rtl::OUString::createFromAscii("-"),2); Date aDate(nDay,nMonth,nYear); - Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); - Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); - - String sLanguage, sCountry; - ConvertLanguageToIsoNames(rParam.rIntl.GetLanguage(), sLanguage, sCountry); - Locale aLocale(sLanguage,sCountry,rtl::OUString()); + Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); + Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); - double fDate = ToDouble(xSupplier, aDate); - sal_Int32 nKey = xTypes->getStandardIndex(aLocale) + 36; // XXX hack + double fDate = DBTypeConversion::toDouble(aDate,DBTypeConversion::getNULLDate(xSupplier)); + sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 36; // XXX hack return rParam.xFormatter->convertNumberToString(nKey, fDate); } //----------------------------------------------------------------------------- -String OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rParam, const String& rString) const +::rtl::OUString OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const { - xub_StrLen nIndex = 0; - sal_Int32 nYear = rString.GetToken(0,'-', nIndex).ToInt32(), - nMonth = rString.GetToken(0,'-', nIndex).ToInt32(), - nDay = rString.GetToken(0,'-', nIndex).ToInt32(); - - nIndex = 10; // eat white space - sal_Int32 nHour = rString.GetToken(0,':', nIndex).ToInt32(), - nMinute = rString.GetToken(0,':', nIndex).ToInt32(), - nSecond = rString.GetToken(0,':', nIndex).ToInt32(); - - Date aDate(nDay,nMonth,nYear); - Time aTime(nHour,nMinute,nSecond); + sal_Int32 nYear = getToken(rString,::rtl::OUString::createFromAscii("-"),0); + sal_Int32 nMonth = getToken(rString,::rtl::OUString::createFromAscii("-"),1); + sal_Int32 nDay = getToken(rString,::rtl::OUString::createFromAscii("-"),2); + sal_Int32 nHour = getToken(rString,::rtl::OUString::createFromAscii(":"),0); + sal_Int32 nMinute = getToken(rString,::rtl::OUString::createFromAscii(":"),1); + sal_Int32 nSecond = getToken(rString,::rtl::OUString::createFromAscii(":"),2); + + DateTime aDate(0,nSecond,nMinute,nHour,nDay,nMonth,nYear); Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); - String sLanguage, sCountry; - ConvertLanguageToIsoNames(rParam.rIntl.GetLanguage(), sLanguage, sCountry); - Locale aLocale(sLanguage,sCountry,rtl::OUString()); - - double fDateTime = ToDouble(xSupplier, aDate) + ToDouble(aTime); - sal_Int32 nKey = xTypes->getStandardIndex(aLocale) + 51; // XXX hack + double fDateTime = DBTypeConversion::toDouble(aDate,DBTypeConversion::getNULLDate(xSupplier)); + sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 51; // XXX hack return rParam.xFormatter->convertNumberToString(nKey, fDateTime); } //----------------------------------------------------------------------------- -String OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, const String& rString) const +::rtl::OUString OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const { - xub_StrLen nIndex = 0; - sal_Int32 nHour = rString.GetToken(0,':', nIndex).ToInt32(), - nMinute = rString.GetToken(0,':', nIndex).ToInt32(), - nSecond = rString.GetToken(0,':', nIndex).ToInt32(); + sal_Int32 nHour = getToken(rString,::rtl::OUString::createFromAscii(":"),0); + sal_Int32 nMinute = getToken(rString,::rtl::OUString::createFromAscii(":"),1); + sal_Int32 nSecond = getToken(rString,::rtl::OUString::createFromAscii(":"),2); - Time aTime(nHour,nMinute,nSecond); + Time aTime(0,nHour,nMinute,nSecond); Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); - String sLanguage, sCountry; - ConvertLanguageToIsoNames(rParam.rIntl.GetLanguage(), sLanguage, sCountry); - Locale aLocale(sLanguage,sCountry,rtl::OUString()); - - double fTime = ToDouble(aTime); - sal_Int32 nKey = xTypes->getStandardIndex(aLocale) + 41; // XXX hack + double fTime = DBTypeConversion::toDouble(aTime); + sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 41; // XXX hack return rParam.xFormatter->convertNumberToString(nKey, fTime); } @@ -220,25 +220,25 @@ DBG_NAME(OSQLParseNode); OSQLParseNode::OSQLParseNode(const sal_Char * pNewValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID) - : m_aNodeValue(String::CreateFromAscii(pNewValue)) + : m_aNodeValue(::rtl::OUString::createFromAscii(pNewValue)) , m_eNodeType(eNewNodeType) , m_nNodeID(nNewNodeID) , m_pParent(NULL) { - DBG_CTOR(OSQLParseNode,NULL); - DBG_ASSERT(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); + + OSL_ENSHURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); } //----------------------------------------------------------------------------- -OSQLParseNode::OSQLParseNode(const ByteString &_rNewValue, +OSQLParseNode::OSQLParseNode(const ::rtl::OString &_rNewValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID) - : m_aNodeValue(String::CreateFromAscii(_rNewValue.GetBuffer())) + : m_aNodeValue(::rtl::OUString::createFromAscii(_rNewValue.getStr())) , m_eNodeType(eNewNodeType) , m_nNodeID(nNewNodeID) , m_pParent(NULL) { - DBG_CTOR(OSQLParseNode,NULL); - DBG_ASSERT(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); + + OSL_ENSHURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); } //----------------------------------------------------------------------------- OSQLParseNode::OSQLParseNode(const sal_Unicode * pNewValue, @@ -249,11 +249,11 @@ OSQLParseNode::OSQLParseNode(const sal_Unicode * pNewValue, , m_nNodeID(nNewNodeID) , m_pParent(NULL) { - DBG_CTOR(OSQLParseNode,NULL); - DBG_ASSERT(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); + + OSL_ENSHURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); } //----------------------------------------------------------------------------- -OSQLParseNode::OSQLParseNode(const String &_rNewValue, +OSQLParseNode::OSQLParseNode(const ::rtl::OUString &_rNewValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID) : m_aNodeValue(_rNewValue) @@ -261,13 +261,13 @@ OSQLParseNode::OSQLParseNode(const String &_rNewValue, , m_nNodeID(nNewNodeID) , m_pParent(NULL) { - DBG_CTOR(OSQLParseNode,NULL); - DBG_ASSERT(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); + + OSL_ENSHURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); } //----------------------------------------------------------------------------- OSQLParseNode::OSQLParseNode(const OSQLParseNode& rParseNode) { - DBG_CTOR(OSQLParseNode,NULL); + // klemm den getParent auf NULL m_pParent = NULL; @@ -292,7 +292,7 @@ OSQLParseNode::OSQLParseNode(const OSQLParseNode& rParseNode) //----------------------------------------------------------------------------- OSQLParseNode& OSQLParseNode::operator=(const OSQLParseNode& rParseNode) { - DBG_CHKTHIS(OSQLParseNode,NULL); + if (this != &rParseNode) { @@ -317,8 +317,6 @@ OSQLParseNode& OSQLParseNode::operator=(const OSQLParseNode& rParseNode) //----------------------------------------------------------------------------- sal_Bool OSQLParseNode::operator==(OSQLParseNode& rParseNode) const { - DBG_CHKTHIS(OSQLParseNode,NULL); - // die member muessen gleich sein sal_Bool bResult = (m_nNodeID == rParseNode.m_nNodeID) && (m_eNodeType == rParseNode.m_eNodeType) && @@ -338,8 +336,6 @@ sal_Bool OSQLParseNode::operator==(OSQLParseNode& rParseNode) const //----------------------------------------------------------------------------- OSQLParseNode::~OSQLParseNode() { - DBG_DTOR(OSQLParseNode,NULL); - for (::std::vector<OSQLParseNode*>::const_iterator i = m_aChilds.begin(); i != m_aChilds.end(); i++) delete *i; @@ -348,10 +344,10 @@ OSQLParseNode::~OSQLParseNode() //----------------------------------------------------------------------------- void OSQLParseNode::append(OSQLParseNode* pNewNode) { - DBG_CHKTHIS(OSQLParseNode,NULL); - DBG_ASSERT(pNewNode != NULL, "OSQLParseNode: ungueltiger NewSubTree"); - DBG_ASSERT(pNewNode->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); - DBG_ASSERT(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewNode) == m_aChilds.end(), + + OSL_ENSHURE(pNewNode != NULL, "OSQLParseNode: ungueltiger NewSubTree"); + OSL_ENSHURE(pNewNode->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); + OSL_ENSHURE(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewNode) == m_aChilds.end(), "OSQLParseNode::append() Node already element of parent"); // stelle Verbindung zum getParent her: @@ -361,74 +357,76 @@ void OSQLParseNode::append(OSQLParseNode* pNewNode) } //----------------------------------------------------------------------------- -void OSQLParseNode::parseNodeToStr(String& rString, +void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString, const Reference< XDatabaseMetaData > & xMeta, OParseContext* pContext, sal_Bool _bIntl, sal_Bool _bQuote) const { - DBG_CHKTHIS(OSQLParseNode,NULL); + parseNodeToStr(rString, xMeta, Reference< XNumberFormatter >(), - Reference< XPropertySet >(), OParseContext::getDefaultInternational(), pContext, _bIntl, _bQuote, '.', sal_False); + Reference< XPropertySet >(), OParseContext::getDefaultLocale(), pContext, _bIntl, _bQuote, '.', sal_False); } //----------------------------------------------------------------------------- -void OSQLParseNode::parseNodeToPredicateStr(String& rString, +void OSQLParseNode::parseNodeToPredicateStr(::rtl::OUString& rString, const Reference< XDatabaseMetaData > & xMeta, const Reference< XNumberFormatter > & xFormatter, - const International& rIntl, + const ::com::sun::star::lang::Locale& rIntl, + sal_Char _cDec, OParseContext* pContext ) const { - DBG_CHKTHIS(OSQLParseNode,NULL); - DBG_ASSERT(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!"); + + OSL_ENSHURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!"); if (xFormatter.is()) - parseNodeToStr(rString, xMeta, xFormatter, Reference< XPropertySet >(), rIntl, pContext, sal_True, sal_True, rIntl.GetNumDecimalSep(), sal_True); + parseNodeToStr(rString, xMeta, xFormatter, Reference< XPropertySet >(), rIntl, pContext, sal_True, sal_True, _cDec, sal_True); } //----------------------------------------------------------------------------- -void OSQLParseNode::parseNodeToPredicateStr(String& rString, +void OSQLParseNode::parseNodeToPredicateStr(::rtl::OUString& rString, const Reference< XDatabaseMetaData > & xMeta, const Reference< XNumberFormatter > & xFormatter, const Reference< XPropertySet > & _xField, - const International& rIntl, + const ::com::sun::star::lang::Locale& rIntl, + sal_Char _cDec, OParseContext* pContext ) const { - DBG_CHKTHIS(OSQLParseNode,NULL); - DBG_ASSERT(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!"); + + OSL_ENSHURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!"); if (xFormatter.is()) - parseNodeToStr(rString, xMeta, xFormatter, _xField, rIntl, pContext, sal_True, sal_True, rIntl.GetNumDecimalSep(), sal_True); + parseNodeToStr(rString, xMeta, xFormatter, _xField, rIntl, pContext, sal_True, sal_True, _cDec, sal_True); } //----------------------------------------------------------------------------- -void OSQLParseNode::parseNodeToStr(String& rString, +void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString, const Reference< XDatabaseMetaData > & xMeta, const Reference< XNumberFormatter > & xFormatter, const Reference< XPropertySet > & _xField, - const International& rIntl, + const ::com::sun::star::lang::Locale& rIntl, OParseContext* pContext, sal_Bool _bIntl, sal_Bool _bQuote, - char _cDecSep, + sal_Char _cDecSep, sal_Bool bPredicate) const { - DBG_CHKTHIS(OSQLParseNode,NULL); - DBG_ASSERT(xMeta.is(), "OSQLParseNode::parseNodeToStr:: no meta data!"); + + OSL_ENSHURE(xMeta.is(), "OSQLParseNode::parseNodeToStr:: no meta data!"); if (xMeta.is()) { - String aIdentifierQuote(xMeta->getIdentifierQuoteString()); - String aCatalogSeparator(xMeta->getCatalogSeparator()); + ::rtl::OUString aIdentifierQuote(xMeta->getIdentifierQuoteString()); + ::rtl::OUString aCatalogSeparator(xMeta->getCatalogSeparator()); OSQLParseNode::parseNodeToStr(rString, SQLParseNodeParameter(aIdentifierQuote, aCatalogSeparator, xFormatter, _xField, rIntl, pContext, _bIntl, _bQuote, _cDecSep, bPredicate)); } } //----------------------------------------------------------------------------- -void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& rParam) const +void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const { - DBG_CHKTHIS(OSQLParseNode,NULL); + if (!isToken()) { @@ -438,8 +436,8 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& // parameter erhalten sonderbehandlung if (SQL_ISRULE(this,parameter)) { - if(rString.Len()) - rString += ' '; + if(rString.getLength()) + rString += ::rtl::OUString::createFromAscii(" "); if (nCount == 1) // ? m_aChilds[0]->parseNodeToStr(rString, rParam); else if (nCount == 2) // :Name @@ -475,7 +473,7 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& aNewParam.bQuote = sal_False; m_aChilds[0]->parseNodeToStr(rString, aNewParam); - String aStringPara; + ::rtl::OUString aStringPara; for (sal_uInt32 i=1; i<nCount; i++) { const OSQLParseNode * pSubTree = m_aChilds[i]; @@ -485,10 +483,10 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& // bei den CommaListen zwischen alle Subtrees Commas setzen if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i < (nCount - 1))) - aStringPara += String(','); + aStringPara += ::rtl::OUString::createFromAscii(","); } } - aStringPara.EraseTrailingChars(' '); + aStringPara.trim(); rString += aStringPara; } } @@ -511,12 +509,12 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& { sal_Bool bFilter = sal_False; // retrieve the fields name - String aFieldName; + ::rtl::OUString aFieldName; try { // retrieve the fields name rtl::OUString aString; - rParam.xField->getPropertyValue(String::CreateFromAscii("Name")) >>= aString; + rParam.xField->getPropertyValue(::rtl::OUString::createFromAscii("Name")) >>= aString; aFieldName = aString.getStr(); } catch ( ... ) @@ -524,8 +522,8 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& } const OSQLParseNode* pCol = pSubTree->m_aChilds[pSubTree->count()-1]; - if ((SQL_ISRULE(pCol,column_val) && pCol->getChild(0)->getTokenValue().EqualsIgnoreCaseAscii(aFieldName)) || - pCol->getTokenValue().EqualsIgnoreCaseAscii(aFieldName)) + if ((SQL_ISRULE(pCol,column_val) && pCol->getChild(0)->getTokenValue().equalsIgnoreCase(aFieldName)) || + pCol->getTokenValue().equalsIgnoreCase(aFieldName)) bFilter = sal_True; // ok we found the field, if the following node is the @@ -552,7 +550,7 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& // bei den CommaListen zwischen alle Subtrees Commas setzen if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i != m_aChilds.end())) - rString += String(','); + rString += ::rtl::OUString::createFromAscii(","); } } else @@ -564,9 +562,9 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i != m_aChilds.end())) { if (SQL_ISRULE(this,value_exp_commalist) && rParam.bPredicate) - rString += String(';'); + rString += ::rtl::OUString::createFromAscii(";"); else - rString += String(','); + rString += ::rtl::OUString::createFromAscii(","); } } } @@ -581,73 +579,73 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& { case SQL_NODE_KEYWORD: { - if (rString.Len()) - rString += ' '; + if (rString.getLength()) + rString += ::rtl::OUString::createFromAscii(" "); - rString += String::CreateFromAscii( - OSQLParser::TokenIDToStr(m_nNodeID, &const_cast<OParseContext&>(rParam.rContext)).GetBuffer()); + rString += ::rtl::OUString::createFromAscii( + OSQLParser::TokenIDToStr(m_nNodeID, &const_cast<OParseContext&>(rParam.rContext)).getStr()); } break; case SQL_NODE_STRING: - if (rString.Len()) - rString += ' '; - rString += SetQuotation(m_aNodeValue,String::CreateFromAscii("\'"),String::CreateFromAscii("\'\'")); + if (rString.getLength()) + rString += ::rtl::OUString::createFromAscii(" "); + rString += SetQuotation(m_aNodeValue,::rtl::OUString::createFromAscii("\'"),::rtl::OUString::createFromAscii("\'\'")); break; case SQL_NODE_NAME: - if (rString.Len()) + if (rString.getLength()) { - switch(ByteString::ConvertFromUnicode(rString.GetChar((rString.Len()-1)),RTL_TEXTENCODING_ASCII_US) ) + switch(rString.getStr()[rString.getLength()-1] ) { case ' ' : case '.' : break; default : - if (!rParam.aCatalogSeparator.Len() || rString.GetChar((sal_uInt32)(rString.Len()-1)) != rParam.aCatalogSeparator.GetChar(0)) - rString += ' '; break; + if (!rParam.aCatalogSeparator.getLength() || rString.getStr()[rString.getLength()-1] != rParam.aCatalogSeparator.toChar()) + rString += ::rtl::OUString::createFromAscii(" "); break; } } if (rParam.bQuote) { if (rParam.bPredicate) { - rString.AppendAscii("["); + rString+= ::rtl::OUString::createFromAscii("["); rString += m_aNodeValue; - rString.AppendAscii("]"); + rString+= ::rtl::OUString::createFromAscii("]"); } else - rString += SetQuotation(m_aNodeValue, rParam.aIdentifierQuote.GetChar(0), rParam.aIdentifierQuote.GetChar(0)); + rString += SetQuotation(m_aNodeValue, rParam.aIdentifierQuote, rParam.aIdentifierQuote); } else rString += m_aNodeValue; break; case SQL_NODE_ACCESS_DATE: - if (rString.Len()) - rString += ' '; - rString += '#'; + if (rString.getLength()) + rString += ::rtl::OUString::createFromAscii(" "); + rString += ::rtl::OUString::createFromAscii("#"); rString += m_aNodeValue; - rString += '#'; + rString += ::rtl::OUString::createFromAscii("#"); break; case SQL_NODE_INTNUM: case SQL_NODE_APPROXNUM: { - String aTmp = m_aNodeValue; + ::rtl::OUString aTmp = m_aNodeValue; if (rParam.bInternational && rParam.bPredicate && rParam.cDecSep != '.') - aTmp.SearchAndReplaceAll('.', rParam.cDecSep); + aTmp.replace('.', rParam.cDecSep); - if (rString.Len()) - rString += ' '; + if (rString.getLength()) + rString += ::rtl::OUString::createFromAscii(" "); rString += aTmp; } break; // fall through default: - if (rString.Len() && m_aNodeValue.GetChar(0) != '.' && m_aNodeValue.GetChar(0) != ':' ) + if (rString.getLength() && m_aNodeValue.toChar() != '.' && m_aNodeValue.toChar() != ':' ) { - switch( ByteString::ConvertFromUnicode(rString.GetChar(rString.Len()-1),RTL_TEXTENCODING_ASCII_US) ) + switch( rString.getStr()[rString.getLength()-1] ) { case ' ' : case '.' : break; default : - if (!rParam.aCatalogSeparator.Len() || rString.GetChar(rString.Len()-1) != rParam.aCatalogSeparator.GetChar(0)) - rString += ' '; break; + if (!rParam.aCatalogSeparator.getLength() || rString.getStr()[rString.getLength()-1] != rParam.aCatalogSeparator.toChar()) + rString += ::rtl::OUString::createFromAscii(" "); break; } } rString += m_aNodeValue; @@ -656,7 +654,7 @@ void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& } //----------------------------------------------------------------------------- -sal_Bool OSQLParseNode::addDateValue(String& rString, const SQLParseNodeParameter& rParam) const +sal_Bool OSQLParseNode::addDateValue(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const { // special display for date/time values if (rParam.bPredicate && SQL_ISRULE(this,set_fct_spec) && SQL_ISPUNCTUATION(m_aChilds[0],"{")) @@ -669,9 +667,9 @@ sal_Bool OSQLParseNode::addDateValue(String& rString, const SQLParseNodeParamete SQL_ISTOKEN(pODBCNodeChild, T) || SQL_ISTOKEN(pODBCNodeChild, TS) )) { - if (rString.Len()) - rString += ' '; - rString += '#'; + if (rString.getLength()) + rString += ::rtl::OUString::createFromAscii(" "); + rString += ::rtl::OUString::createFromAscii("#"); if (SQL_ISTOKEN(pODBCNodeChild, D)) rString += convertDateString(rParam, pODBCNode->m_aChilds[1]->getTokenValue()); else if (SQL_ISTOKEN(pODBCNodeChild, T)) @@ -679,7 +677,7 @@ sal_Bool OSQLParseNode::addDateValue(String& rString, const SQLParseNodeParamete else rString += convertDateTimeString(rParam, pODBCNode->m_aChilds[1]->getTokenValue()); - rString += '#'; + rString += ::rtl::OUString::createFromAscii("#"); return sal_True; } } @@ -687,7 +685,7 @@ sal_Bool OSQLParseNode::addDateValue(String& rString, const SQLParseNodeParamete } //----------------------------------------------------------------------------- -void OSQLParseNode::replaceNodeValue(const String& rTableAlias,const String& rColumnName) +void OSQLParseNode::replaceNodeValue(const ::rtl::OUString& rTableAlias,const ::rtl::OUString& rColumnName) { for (sal_uInt32 i=0;i<count();++i) { @@ -695,7 +693,7 @@ void OSQLParseNode::replaceNodeValue(const String& rTableAlias,const String& rCo { OSQLParseNode * pCol = removeAt((sal_uInt32)0); append(new OSQLParseNode(rTableAlias,SQL_NODE_NAME)); - append(new OSQLParseNode(String::CreateFromAscii("."),SQL_NODE_PUNCTUATION)); + append(new OSQLParseNode(::rtl::OUString::createFromAscii("."),SQL_NODE_PUNCTUATION)); append(pCol); } else @@ -704,10 +702,10 @@ void OSQLParseNode::replaceNodeValue(const String& rTableAlias,const String& rCo } //----------------------------------------------------------------------------- -void OSQLParseNode::tableRangeNodeToStr(String& rString, const SQLParseNodeParameter& rParam) const +void OSQLParseNode::tableRangeNodeToStr(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const { sal_uInt32 nCount(count()); - rString += ' '; + rString += ::rtl::OUString::createFromAscii(" "); SQLParseNodeParameter aNewParam(rParam); aNewParam.bQuote = sal_False; @@ -730,9 +728,9 @@ void OSQLParseNode::tableRangeNodeToStr(String& rString, const SQLParseNodeParam } //----------------------------------------------------------------------------- -void OSQLParseNode::likeNodeToStr(String& rString, const SQLParseNodeParameter& rParam) const +void OSQLParseNode::likeNodeToStr(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const { - DBG_ASSERT(count() >= 4,"count != 5: Prepare for GPF"); + OSL_ENSHURE(count() >= 4,"count != 5: Prepare for GPF"); const OSQLParseNode* pEscNode = NULL; const OSQLParseNode* pParaNode = NULL; @@ -745,12 +743,12 @@ void OSQLParseNode::likeNodeToStr(String& rString, const SQLParseNodeParameter& if (rParam.xField.is()) { // retrieve the fields name - String aFieldName; + ::rtl::OUString aFieldName; try { // retrieve the fields name rtl::OUString aString; - rParam.xField->getPropertyValue(String::CreateFromAscii("Name")) >>= aString; + rParam.xField->getPropertyValue(::rtl::OUString::createFromAscii("Name")) >>= aString; aFieldName = aString.getStr(); } catch ( ... ) @@ -758,8 +756,8 @@ void OSQLParseNode::likeNodeToStr(String& rString, const SQLParseNodeParameter& } const OSQLParseNode* pCol = m_aChilds[0]->getChild(m_aChilds[0]->count()-1); - if ((SQL_ISRULE(pCol,column_val) && pCol->getChild(0)->getTokenValue().EqualsIgnoreCaseAscii(aFieldName)) || - pCol->getTokenValue().EqualsIgnoreCaseAscii(aFieldName) ) + if ((SQL_ISRULE(pCol,column_val) && pCol->getChild(0)->getTokenValue().equalsIgnoreCase(aFieldName)) || + pCol->getTokenValue().equalsIgnoreCase(aFieldName) ) bAddName = sal_False; } @@ -775,9 +773,9 @@ void OSQLParseNode::likeNodeToStr(String& rString, const SQLParseNodeParameter& if (pParaNode->isToken() && rParam.bInternational) { - String aStr = ConvertLikeToken(pParaNode, pEscNode, sal_True); - rString += ' '; - rString += SetQuotation(aStr,String::CreateFromAscii("\'"),String::CreateFromAscii("\'\'")); + ::rtl::OUString aStr = ConvertLikeToken(pParaNode, pEscNode, sal_True); + rString += ::rtl::OUString::createFromAscii(" "); + rString += SetQuotation(aStr,::rtl::OUString::createFromAscii("\'"),::rtl::OUString::createFromAscii("\'\'")); } else pParaNode->parseNodeToStr(rString, aNewParam); @@ -802,18 +800,18 @@ OSQLParseNode* OSQLParseNode::getByRule(OSQLParseNode::Rule eRule) const //----------------------------------------------------------------------------- OSQLParseNode* MakeANDNode(OSQLParseNode *pLeftLeaf,OSQLParseNode *pRightLeaf) { - OSQLParseNode* pNewNode = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_term)); + OSQLParseNode* pNewNode = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_term)); pNewNode->append(pLeftLeaf); - pNewNode->append(new OSQLParseNode(String::CreateFromAscii("AND"),SQL_NODE_KEYWORD,SQL_TOKEN_AND)); + pNewNode->append(new OSQLParseNode(::rtl::OUString::createFromAscii("AND"),SQL_NODE_KEYWORD,SQL_TOKEN_AND)); pNewNode->append(pRightLeaf); return pNewNode; } //----------------------------------------------------------------------------- OSQLParseNode* MakeORNode(OSQLParseNode *pLeftLeaf,OSQLParseNode *pRightLeaf) { - OSQLParseNode* pNewNode = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::search_condition)); + OSQLParseNode* pNewNode = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::search_condition)); pNewNode->append(pLeftLeaf); - pNewNode->append(new OSQLParseNode(String::CreateFromAscii("OR"),SQL_NODE_KEYWORD,SQL_TOKEN_OR)); + pNewNode->append(new OSQLParseNode(::rtl::OUString::createFromAscii("OR"),SQL_NODE_KEYWORD,SQL_TOKEN_OR)); pNewNode->append(pRightLeaf); return pNewNode; } @@ -913,9 +911,9 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_B OSQLParseNode* pRight = pSearchCondition->getChild(2); if(bNegate) { - OSQLParseNode* pNewNode = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_term)); + OSQLParseNode* pNewNode = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_term)); pNewNode->append(pSearchCondition->removeAt((sal_uInt32)0)); - pNewNode->append(new OSQLParseNode(String::CreateFromAscii("AND"),SQL_NODE_KEYWORD,SQL_TOKEN_AND)); + pNewNode->append(new OSQLParseNode(::rtl::OUString::createFromAscii("AND"),SQL_NODE_KEYWORD,SQL_TOKEN_AND)); pNewNode->append(pSearchCondition->removeAt((sal_uInt32)1)); pSearchCondition->getParent()->replace(pSearchCondition, pNewNode); delete pSearchCondition; @@ -933,9 +931,9 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_B OSQLParseNode* pRight = pSearchCondition->getChild(2); if(bNegate) { - OSQLParseNode* pNewNode = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::search_condition)); + OSQLParseNode* pNewNode = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::search_condition)); pNewNode->append(pSearchCondition->removeAt((sal_uInt32)0)); - pNewNode->append(new OSQLParseNode(String::CreateFromAscii("OR"),SQL_NODE_KEYWORD,SQL_TOKEN_OR)); + pNewNode->append(new OSQLParseNode(::rtl::OUString::createFromAscii("OR"),SQL_NODE_KEYWORD,SQL_TOKEN_OR)); pNewNode->append(pSearchCondition->removeAt((sal_uInt32)1)); pSearchCondition->getParent()->replace(pSearchCondition, pNewNode); delete pSearchCondition; @@ -967,22 +965,22 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_B switch(pComparison->getNodeType()) { case SQL_NODE_EQUAL: - pNewComparison = new OSQLParseNode(String::CreateFromAscii("<>"),SQL_NODE_NOTEQUAL,NOTEQUAL); + pNewComparison = new OSQLParseNode(::rtl::OUString::createFromAscii("<>"),SQL_NODE_NOTEQUAL,NOTEQUAL); break; case SQL_NODE_LESS: - pNewComparison = new OSQLParseNode(String::CreateFromAscii(">="),SQL_NODE_GREATEQ,GREATEQ); + pNewComparison = new OSQLParseNode(::rtl::OUString::createFromAscii(">="),SQL_NODE_GREATEQ,GREATEQ); break; case SQL_NODE_GREAT: - pNewComparison = new OSQLParseNode(String::CreateFromAscii("<="),SQL_NODE_LESSEQ,LESSEQ); + pNewComparison = new OSQLParseNode(::rtl::OUString::createFromAscii("<="),SQL_NODE_LESSEQ,LESSEQ); break; case SQL_NODE_LESSEQ: - pNewComparison = new OSQLParseNode(String::CreateFromAscii(">"),SQL_NODE_GREAT,GREAT); + pNewComparison = new OSQLParseNode(::rtl::OUString::createFromAscii(">"),SQL_NODE_GREAT,GREAT); break; case SQL_NODE_GREATEQ: - pNewComparison = new OSQLParseNode(String::CreateFromAscii("<"),SQL_NODE_LESS,LESS); + pNewComparison = new OSQLParseNode(::rtl::OUString::createFromAscii("<"),SQL_NODE_LESS,LESS); break; case SQL_NODE_NOTEQUAL: - pNewComparison = new OSQLParseNode(String::CreateFromAscii("="),SQL_NODE_EQUAL,EQUAL); + pNewComparison = new OSQLParseNode(::rtl::OUString::createFromAscii("="),SQL_NODE_EQUAL,EQUAL); break; } pSearchCondition->replace(pComparison, pNewComparison); @@ -1008,9 +1006,9 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_B OSQLParseNode* pNot = pSearchCondition->getChild(nNotPos); OSQLParseNode* pNotNot = NULL; if(pNot->isRule()) - pNotNot = new OSQLParseNode(String::CreateFromAscii("NOT"),SQL_NODE_KEYWORD,SQL_TOKEN_NOT); + pNotNot = new OSQLParseNode(::rtl::OUString::createFromAscii("NOT"),SQL_NODE_KEYWORD,SQL_TOKEN_NOT); else - pNotNot = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::not)); + pNotNot = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::not)); pSearchCondition->replace(pNot, pNotNot); delete pNot; } @@ -1165,10 +1163,10 @@ void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(2); OSQLParseNode* pNode = MakeORNode(pLeft,pRight); - OSQLParseNode* pNewRule = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); - pNewRule->append(new OSQLParseNode(String::CreateFromAscii("("),SQL_NODE_PUNCTUATION)); + OSQLParseNode* pNewRule = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNewRule->append(new OSQLParseNode(::rtl::OUString::createFromAscii("("),SQL_NODE_PUNCTUATION)); pNewRule->append(pNode); - pNewRule->append(new OSQLParseNode(String::CreateFromAscii(")"),SQL_NODE_PUNCTUATION)); + pNewRule->append(new OSQLParseNode(::rtl::OUString::createFromAscii(")"),SQL_NODE_PUNCTUATION)); OSQLParseNode::eraseBraces(pLeft); OSQLParseNode::eraseBraces(pRight); @@ -1184,10 +1182,10 @@ void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(2); OSQLParseNode* pNode = MakeORNode(pLeft,pRight); - OSQLParseNode* pNewRule = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); - pNewRule->append(new OSQLParseNode(String::CreateFromAscii("("),SQL_NODE_PUNCTUATION)); + OSQLParseNode* pNewRule = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNewRule->append(new OSQLParseNode(::rtl::OUString::createFromAscii("("),SQL_NODE_PUNCTUATION)); pNewRule->append(pNode); - pNewRule->append(new OSQLParseNode(String::CreateFromAscii(")"),SQL_NODE_PUNCTUATION)); + pNewRule->append(new OSQLParseNode(::rtl::OUString::createFromAscii(")"),SQL_NODE_PUNCTUATION)); OSQLParseNode::eraseBraces(pLeft); OSQLParseNode::eraseBraces(pRight); @@ -1203,10 +1201,10 @@ void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt((sal_uInt32)0); OSQLParseNode* pNode = MakeORNode(pLeft,pRight); - OSQLParseNode* pNewRule = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); - pNewRule->append(new OSQLParseNode(String::CreateFromAscii("("),SQL_NODE_PUNCTUATION)); + OSQLParseNode* pNewRule = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNewRule->append(new OSQLParseNode(::rtl::OUString::createFromAscii("("),SQL_NODE_PUNCTUATION)); pNewRule->append(pNode); - pNewRule->append(new OSQLParseNode(String::CreateFromAscii(")"),SQL_NODE_PUNCTUATION)); + pNewRule->append(new OSQLParseNode(::rtl::OUString::createFromAscii(")"),SQL_NODE_PUNCTUATION)); OSQLParseNode::eraseBraces(pLeft); OSQLParseNode::eraseBraces(pRight); @@ -1222,10 +1220,10 @@ void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt((sal_uInt32)0); OSQLParseNode* pNode = MakeORNode(pLeft,pRight); - OSQLParseNode* pNewRule = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); - pNewRule->append(new OSQLParseNode(String::CreateFromAscii("("),SQL_NODE_PUNCTUATION)); + OSQLParseNode* pNewRule = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNewRule->append(new OSQLParseNode(::rtl::OUString::createFromAscii("("),SQL_NODE_PUNCTUATION)); pNewRule->append(pNode); - pNewRule->append(new OSQLParseNode(String::CreateFromAscii(")"),SQL_NODE_PUNCTUATION)); + pNewRule->append(new OSQLParseNode(::rtl::OUString::createFromAscii(")"),SQL_NODE_PUNCTUATION)); OSQLParseNode::eraseBraces(pLeft); OSQLParseNode::eraseBraces(pRight); @@ -1238,20 +1236,20 @@ void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) } } //----------------------------------------------------------------------------- -void OSQLParseNode::showParseTree(String& rString, sal_uInt32 nLevel) +void OSQLParseNode::showParseTree(::rtl::OUString& rString, sal_uInt32 nLevel) { - DBG_CHKTHIS(OSQLParseNode,NULL); + if (!isToken()) { - for (sal_uInt32 j=0; j<nLevel; j++) {rString.AppendAscii("\t");}; + for (sal_uInt32 j=0; j<nLevel; j++) {rString+= ::rtl::OUString::createFromAscii("\t");}; // Regelnamen als rule: ... - rString.AppendAscii("RULE_ID:\t "); - rString += (String) getRuleID(); - rString.AppendAscii("("); + rString+= ::rtl::OUString::createFromAscii("RULE_ID:\t "); + rString += ::rtl::OUString::valueOf( (sal_Int32)getRuleID()); + rString+= ::rtl::OUString::createFromAscii("("); rString += OSQLParser::RuleIDToStr(getRuleID()); - rString.AppendAscii(")"); - rString.AppendAscii("\n"); + rString+= ::rtl::OUString::createFromAscii(")"); + rString+= ::rtl::OUString::createFromAscii("\n"); // einmal auswerten wieviel Subtrees dieser Knoten besitzt sal_uInt32 nStop = count(); @@ -1263,62 +1261,62 @@ void OSQLParseNode::showParseTree(String& rString, sal_uInt32 nLevel) else { // ein Token gefunden // tabs fuer das Einruecken entsprechend nLevel - for (sal_uInt32 j=0; j<nLevel; j++) {rString.AppendAscii("\t");}; + for (sal_uInt32 j=0; j<nLevel; j++) {rString+= ::rtl::OUString::createFromAscii("\t");}; switch (m_eNodeType) { case SQL_NODE_KEYWORD: - {rString.AppendAscii("SQL_KEYWORD:\t"); - rString += String::CreateFromAscii(OSQLParser::TokenIDToStr(getTokenID()).GetBuffer()); - rString.AppendAscii("\n"); + {rString+= ::rtl::OUString::createFromAscii("SQL_KEYWORD:\t"); + rString += ::rtl::OUString::createFromAscii(OSQLParser::TokenIDToStr(getTokenID()).getStr()); + rString+= ::rtl::OUString::createFromAscii("\n"); break;} case SQL_NODE_COMPARISON: - {rString.AppendAscii("SQL_COMPARISON:\t"); + {rString+= ::rtl::OUString::createFromAscii("SQL_COMPARISON:\t"); rString += m_aNodeValue; // haenge Nodevalue an - rString.AppendAscii("\n"); // und beginne neu Zeile + rString+= ::rtl::OUString::createFromAscii("\n"); // und beginne neu Zeile break;} case SQL_NODE_NAME: - {rString.AppendAscii("SQL_NAME:\t"); - rString.AppendAscii("\""); + {rString+= ::rtl::OUString::createFromAscii("SQL_NAME:\t"); + rString+= ::rtl::OUString::createFromAscii("\""); rString += m_aNodeValue; - rString.AppendAscii("\""); - rString.AppendAscii("\n"); + rString+= ::rtl::OUString::createFromAscii("\""); + rString+= ::rtl::OUString::createFromAscii("\n"); break;} case SQL_NODE_STRING: - {rString .AppendAscii("SQL_STRING:\t'"); + {rString += ::rtl::OUString::createFromAscii("SQL_STRING:\t'"); rString += m_aNodeValue; - rString .AppendAscii("'\n"); + rString += ::rtl::OUString::createFromAscii("'\n"); break;} case SQL_NODE_INTNUM: - {rString .AppendAscii("SQL_INTNUM:\t"); + {rString += ::rtl::OUString::createFromAscii("SQL_INTNUM:\t"); rString += m_aNodeValue; - rString .AppendAscii("\n"); + rString += ::rtl::OUString::createFromAscii("\n"); break;} case SQL_NODE_APPROXNUM: - {rString .AppendAscii("SQL_APPROXNUM:\t"); + {rString += ::rtl::OUString::createFromAscii("SQL_APPROXNUM:\t"); rString += m_aNodeValue; - rString .AppendAscii("\n"); + rString += ::rtl::OUString::createFromAscii("\n"); break;} case SQL_NODE_PUNCTUATION: - {rString .AppendAscii("SQL_PUNCTUATION:\t"); + {rString += ::rtl::OUString::createFromAscii("SQL_PUNCTUATION:\t"); rString += m_aNodeValue; // haenge Nodevalue an - rString .AppendAscii("\n"); // und beginne neu Zeile + rString += ::rtl::OUString::createFromAscii("\n"); // und beginne neu Zeile break;} case SQL_NODE_AMMSC: - {rString .AppendAscii("SQL_AMMSC:\t"); + {rString += ::rtl::OUString::createFromAscii("SQL_AMMSC:\t"); rString += m_aNodeValue; // haenge Nodevalue an - rString .AppendAscii("\n"); // und beginne neu Zeile + rString += ::rtl::OUString::createFromAscii("\n"); // und beginne neu Zeile break;} default: - DBG_ERROR("OSQLParser::ShowParseTree: unzulaessiger NodeType"); + OSL_ASSERT("OSQLParser::ShowParseTree: unzulaessiger NodeType"); } }; } @@ -1327,8 +1325,8 @@ void OSQLParseNode::showParseTree(String& rString, sal_uInt32 nLevel) //----------------------------------------------------------------------------- void OSQLParseNode::insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree) { - DBG_ASSERT(pNewSubTree != NULL, "OSQLParseNode: ungueltiger NewSubTree"); - DBG_ASSERT(pNewSubTree->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); + OSL_ENSHURE(pNewSubTree != NULL, "OSQLParseNode: ungueltiger NewSubTree"); + OSL_ENSHURE(pNewSubTree->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); // stelle Verbindung zum getParent her: pNewSubTree->setParent( this ); @@ -1351,7 +1349,7 @@ OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos) //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::remove(OSQLParseNode* pSubTree) { - DBG_ASSERT(pSubTree != NULL, "OSQLParseNode: ungueltiger SubTree"); + OSL_ENSHURE(pSubTree != NULL, "OSQLParseNode: ungueltiger SubTree"); ::std::vector<OSQLParseNode*>::iterator aPos = ::std::find(m_aChilds.begin(), m_aChilds.end(), pSubTree); if (aPos != m_aChilds.end()) { @@ -1368,10 +1366,10 @@ OSQLParseNode* OSQLParseNode::remove(OSQLParseNode* pSubTree) //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubNode) { - DBG_ASSERT(pNewSubNode != NULL, "OSQLParseNode: invalid nodes"); - DBG_ASSERT(pNewSubNode->getParent() == NULL, "OSQLParseNode: node already has getParent"); - DBG_ASSERT(nPos < m_aChilds.size(), "OSQLParseNode: invalid position"); - DBG_ASSERT(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewSubNode) == m_aChilds.end(), + OSL_ENSHURE(pNewSubNode != NULL, "OSQLParseNode: invalid nodes"); + OSL_ENSHURE(pNewSubNode->getParent() == NULL, "OSQLParseNode: node already has getParent"); + OSL_ENSHURE(nPos < m_aChilds.size(), "OSQLParseNode: invalid position"); + OSL_ENSHURE(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewSubNode) == m_aChilds.end(), "OSQLParseNode::Replace() Node already element of parent"); OSQLParseNode* pOldSubNode = m_aChilds[nPos]; @@ -1387,11 +1385,11 @@ OSQLParseNode* OSQLParseNode::replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubN //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::replace (OSQLParseNode* pOldSubNode, OSQLParseNode* pNewSubNode ) { - DBG_ASSERT(pOldSubNode != NULL && pNewSubNode != NULL, "OSQLParseNode: invalid nodes"); - DBG_ASSERT(pNewSubNode->getParent() == NULL, "OSQLParseNode: node already has getParent"); - DBG_ASSERT(::std::find(m_aChilds.begin(), m_aChilds.end(), pOldSubNode) != m_aChilds.end(), + OSL_ENSHURE(pOldSubNode != NULL && pNewSubNode != NULL, "OSQLParseNode: invalid nodes"); + OSL_ENSHURE(pNewSubNode->getParent() == NULL, "OSQLParseNode: node already has getParent"); + OSL_ENSHURE(::std::find(m_aChilds.begin(), m_aChilds.end(), pOldSubNode) != m_aChilds.end(), "OSQLParseNode::Replace() Node not element of parent"); - DBG_ASSERT(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewSubNode) == m_aChilds.end(), + OSL_ENSHURE(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewSubNode) == m_aChilds.end(), "OSQLParseNode::Replace() Node already element of parent"); pOldSubNode->setParent( NULL ); diff --git a/connectivity/source/sdbcx/VCatalog.cxx b/connectivity/source/sdbcx/VCatalog.cxx index 586c4d8b04da..67d393d0016e 100644 --- a/connectivity/source/sdbcx/VCatalog.cxx +++ b/connectivity/source/sdbcx/VCatalog.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VCatalog.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-10-06 12:05:10 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:45:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -166,4 +166,8 @@ void ODescriptor::construct() sal_Int32 nAttrib = isNew() ? 0 : ::com::sun::star::beans::PropertyAttribute::READONLY; registerProperty(connectivity::PROPERTY_NAME, PROPERTY_ID_NAME ,nAttrib,&m_Name,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } +// ------------------------------------------------------------------------- +ODescriptor::~ODescriptor() +{ +} diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx index b5ee03bf2c66..5e25ffc58a15 100644 --- a/connectivity/source/sdbcx/VCollection.cxx +++ b/connectivity/source/sdbcx/VCollection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VCollection.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2000-10-17 08:36:20 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:45:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,8 +62,8 @@ #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include "connectivity/sdbcx/VCollection.hxx" #endif -#ifndef _CONNECTIVITY_ENUMHELPER_HXX_ -#include "enumhelper.hxx" +#ifndef _COMPHELPER_ENUMHELPER_HXX_ +#include <comphelper/enumhelper.hxx> #endif #ifndef _COMPHELPER_CONTAINER_HXX_ #include <comphelper/container.hxx> @@ -71,6 +71,7 @@ using namespace connectivity::sdbcx; using namespace connectivity; +using namespace comphelper; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -249,6 +250,6 @@ sal_Int32 SAL_CALL OCollection::findColumn( const ::rtl::OUString& columnName ) Reference< XEnumeration > SAL_CALL OCollection::createEnumeration( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); - return new connectivity::OEnumerationByIndex( static_cast< XIndexAccess*>(this)); + return new OEnumerationByIndex( static_cast< XIndexAccess*>(this)); } diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx index 25fab0a9c2c0..a26fe23badd0 100644 --- a/connectivity/source/sdbcx/VKeyColumn.cxx +++ b/connectivity/source/sdbcx/VKeyColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VKeyColumn.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * last change: $Author: oj $ $Date: 2000-10-19 11:45:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,6 +103,10 @@ OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn, construct(); } // ------------------------------------------------------------------------- +OKeyColumn::~OKeyColumn() +{ +} +// ------------------------------------------------------------------------- void OKeyColumn::construct() { sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; |