diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-01-22 08:14:22 +0100 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-01-22 08:14:22 +0100 |
commit | 02f6eae3aacc973f98fce99219ee74ddb75f2c9a (patch) | |
tree | 1fb8a7de46e2937ac2957a5957d744100064d677 /connectivity/source | |
parent | cb2da11da570cdac0e1721609a91b78eee6a59e0 (diff) |
dba33f: #i108548# extend SingleSelectQueryComposer appendFilterByColumn with additonal parameter
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/commontools/DateConversion.cxx | 58 | ||||
-rw-r--r-- | connectivity/source/commontools/propertyids.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/inc/propertyids.hxx | 2 | ||||
-rw-r--r-- | connectivity/source/parse/PColumn.cxx | 3 |
4 files changed, 60 insertions, 5 deletions
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx index 010cfbcf5f34..e57820a645f3 100644 --- a/connectivity/source/commontools/DateConversion.cxx +++ b/connectivity/source/commontools/DateConversion.cxx @@ -129,9 +129,27 @@ using namespace ::com::sun::star::beans; case DataType::TIMESTAMP: { DateTime aDateTime; + bool bOk = false; + if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE) + { + double nValue = 0.0; + _rVal >>= nValue; + aDateTime = DBTypeConversion::toDateTime(nValue); + bOk = true; + } + else if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING) + { + ::rtl::OUString sValue; + _rVal >>= sValue; + aDateTime = DBTypeConversion::toDateTime(sValue); + bOk = true; + } + else + bOk = _rVal >>= aDateTime; + OSL_VERIFY_RES( bOk, "DBTypeConversion::toSQLString: _rVal is not datetime!"); // check if this is really a timestamp or only a date - if ( _rVal >>= aDateTime ) + if ( bOk ) { if (bQuote) aRet.appendAscii("{TS '"); @@ -145,7 +163,24 @@ using namespace ::com::sun::star::beans; case DataType::DATE: { Date aDate; - OSL_VERIFY_RES( _rVal >>= aDate, "DBTypeConversion::toSQLString: _rVal is not date!"); + bool bOk = false; + if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE) + { + double nValue = 0.0; + _rVal >>= nValue; + aDate = DBTypeConversion::toDate(nValue); + bOk = true; + } + else if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING) + { + ::rtl::OUString sValue; + _rVal >>= sValue; + aDate = DBTypeConversion::toDate(sValue); + bOk = true; + } + else + bOk = _rVal >>= aDate; + OSL_VERIFY_RES( bOk, "DBTypeConversion::toSQLString: _rVal is not date!"); if (bQuote) aRet.appendAscii("{D '"); aRet.append(DBTypeConversion::toDateString(aDate)); @@ -155,7 +190,24 @@ using namespace ::com::sun::star::beans; case DataType::TIME: { Time aTime; - OSL_VERIFY_RES( _rVal >>= aTime,"DBTypeConversion::toSQLString: _rVal is not time!"); + bool bOk = false; + if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE) + { + double nValue = 0.0; + _rVal >>= nValue; + aTime = DBTypeConversion::toTime(nValue); + bOk = true; + } + else if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING) + { + ::rtl::OUString sValue; + _rVal >>= sValue; + aTime = DBTypeConversion::toTime(sValue); + bOk = true; + } + else + bOk = _rVal >>= aTime; + OSL_VERIFY_RES( bOk,"DBTypeConversion::toSQLString: _rVal is not time!"); if (bQuote) aRet.appendAscii("{T '"); aRet.append(DBTypeConversion::toTimeString(aTime)); diff --git a/connectivity/source/commontools/propertyids.cxx b/connectivity/source/commontools/propertyids.cxx index b5858652fcc8..b3074ea7fcfd 100644 --- a/connectivity/source/commontools/propertyids.cxx +++ b/connectivity/source/commontools/propertyids.cxx @@ -96,6 +96,7 @@ namespace dbtools const sal_Char* getPROPERTY_ID_FIELDTYPE() { return "FieldType"; } const sal_Char* getPROPERTY_ID_VALUE() { return "Value"; } const sal_Char* getPROPERTY_ID_ACTIVE_CONNECTION() { return "ActiveConnection"; } + const sal_Char* getPROPERTY_ID_LABEL() { return "Label"; } //============================================================ //= error messages @@ -183,6 +184,7 @@ namespace dbtools case PROPERTY_ID_HAVINGCLAUSE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_HAVINGCLAUSE() ); break; } case PROPERTY_ID_ISSIGNED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_ISSIGNED() ); break; } case PROPERTY_ID_ISSEARCHABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_ISSEARCHABLE() ); break; } + case PROPERTY_ID_LABEL: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_LABEL() ); break; } case PROPERTY_ID_APPLYFILTER: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_APPLYFILTER() ); break; } case PROPERTY_ID_FILTER: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_FILTER() ); break; } case PROPERTY_ID_MASTERFIELDS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_MASTERFIELDS() ); break; } diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx index 27b2008fc7a6..ebfdbd41ea7f 100644 --- a/connectivity/source/inc/propertyids.hxx +++ b/connectivity/source/inc/propertyids.hxx @@ -136,7 +136,7 @@ pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaCon #define PROPERTY_ID_INVALID_INDEX 41 #define PROPERTY_ID_HY010 43 - // FREE +#define PROPERTY_ID_LABEL 44 #define PROPERTY_ID_DELIMITER 45 #define PROPERTY_ID_FORMATKEY 46 #define PROPERTY_ID_LOCALE 47 diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx index 0c1c357cb0d4..7c61411e7f29 100644 --- a/connectivity/source/parse/PColumn.cxx +++ b/connectivity/source/parse/PColumn.cxx @@ -155,6 +155,7 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe ) ); pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) ); pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos )); + pColumn->setLabel(sLabel); return pColumn; } @@ -171,7 +172,7 @@ void OParseColumn::construct() registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME), PROPERTY_ID_REALNAME, 0, &m_aRealName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DBASEPRECISIONCHANGED), PROPERTY_ID_DBASEPRECISIONCHANGED, 0, &m_bDbasePrecisionChanged, ::getCppuType(reinterpret_cast<sal_Bool*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISSEARCHABLE), PROPERTY_ID_ISSEARCHABLE, 0, &m_bIsSearchable, ::getCppuType(reinterpret_cast< sal_Bool*>(NULL))); - + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_LABEL), PROPERTY_ID_LABEL, 0, &m_sLabel, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OParseColumn::createArrayHelper() const |