Bugzilla – Attachment 112603 Details for
Bug 85190
REPORTBUILDER - cannot deal with MySQL bogus '0000-00-00' date and timestamps
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to transform zero dates to NULL
FOO (text/plain), 4.90 KB, created by
Lionel Elie Mamane
on 2015-01-21 14:36:24 UTC
(
hide
)
Description:
patch to transform zero dates to NULL
Filename:
MIME Type:
Creator:
Lionel Elie Mamane
Created:
2015-01-21 14:36:24 UTC
Size:
4.90 KB
patch
obsolete
>diff --git a/mysqlc/source/mysqlc_resultset.cxx b/mysqlc/source/mysqlc_resultset.cxx >index e0527ce..d9917a3 100644 >--- a/mysqlc/source/mysqlc_resultset.cxx >+++ b/mysqlc/source/mysqlc_resultset.cxx >@@ -78,6 +78,7 @@ OResultSet::OResultSet(OCommonStatement * pStmt, sql::ResultSet * result, rtl_Te > ,m_aStatement((OWeakObject*)pStmt) > ,m_xMetaData(NULL) > ,m_result(result) >+ ,m_bForcedNull(false) > ,fieldCount( 0 ) > ,m_encoding( _encoding ) > { >@@ -189,6 +190,7 @@ sal_Bool SAL_CALL OResultSet::getBoolean(sal_Int32 column) > > checkColumnIndex(column); > try { >+ m_bForcedNull = false; > return m_result->getBoolean(column)? sal_True:sal_False; > } catch (const sql::SQLException &e) { > mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding); >@@ -205,6 +207,7 @@ sal_Int8 SAL_CALL OResultSet::getByte(sal_Int32 column) > > checkColumnIndex(column); > try { >+ m_bForcedNull = false; > return m_result->getInt(column); > } catch (const sql::SQLException &e) { > mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding); >@@ -220,6 +223,7 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes(sal_Int32 column) > checkDisposed(OResultSet_BASE::rBHelper.bDisposed); > MutexGuard aGuard(m_aMutex); > >+ m_bForcedNull = false; > sql::SQLString val = m_result->getString(column); > if (!val.length()) { > return Sequence< sal_Int8>(); >@@ -273,6 +277,7 @@ double SAL_CALL OResultSet::getDouble(sal_Int32 column) > > checkColumnIndex(column); > try { >+ m_bForcedNull = false; > return m_result->getDouble(column); > } catch (const sql::SQLException &e) { > mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding); >@@ -289,6 +294,7 @@ float SAL_CALL OResultSet::getFloat(sal_Int32 column) > > checkColumnIndex(column); > try { >+ m_bForcedNull = false; > return m_result->getDouble(column); > } catch (const sql::SQLException &e) { > mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding); >@@ -305,6 +311,7 @@ sal_Int32 SAL_CALL OResultSet::getInt(sal_Int32 column) > > checkColumnIndex(column); > try { >+ m_bForcedNull = false; > return m_result->getInt(column); > } catch (const sql::SQLException &e) { > mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding); >@@ -336,6 +343,7 @@ sal_Int64 SAL_CALL OResultSet::getLong(sal_Int32 column) > > checkColumnIndex(column); > try { >+ m_bForcedNull = false; > return m_result->getInt64(column); > } catch (const sql::SQLException &e) { > mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding); >@@ -431,6 +439,7 @@ sal_Int16 SAL_CALL OResultSet::getShort(sal_Int32 column) > checkDisposed(OResultSet_BASE::rBHelper.bDisposed); > > try { >+ m_bForcedNull = false; > return (sal_Int16) m_result->getInt(column); > } catch (const sql::SQLException &e) { > mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding); >@@ -448,6 +457,7 @@ rtl::OUString SAL_CALL OResultSet::getString(sal_Int32 column) > checkColumnIndex(column); > > try { >+ m_bForcedNull = false; > sql::SQLString val = m_result->getString(column); > if (!m_result->wasNull()) { > return rtl::OUString( val.c_str(), val.length(), m_encoding ); >@@ -506,12 +516,19 @@ DateTime SAL_CALL OResultSet::getTimestamp(sal_Int32 column) > Date d = getDate(column); > Time t = getTime(column); > >- dt.Year = d.Year; >- dt.Month = d.Month; >- dt.Day = d.Day; >- dt.Hours = t.Hours; >- dt.Minutes = t.Minutes; >- dt.Seconds = t.Seconds; >+ if (d.Year || d.Month || d.Day || t.Hours || t.Minutes || t.Seconds) >+ { >+ dt.Year = d.Year; >+ dt.Month = d.Month; >+ dt.Day = d.Day; >+ dt.Hours = t.Hours; >+ dt.Minutes = t.Minutes; >+ dt.Seconds = t.Seconds; >+ } >+ else >+ { >+ m_bForcedNull = true; >+ } > return dt; > } > >@@ -755,7 +772,7 @@ sal_Bool SAL_CALL OResultSet::wasNull() > checkDisposed(OResultSet_BASE::rBHelper.bDisposed); > > try { >- return m_result->wasNull()? sal_True:sal_False; >+ return (m_bForcedNull || m_result->wasNull()) ? sal_True : sal_False; > } catch (const sql::SQLException &e) { > mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding); > } >diff --git a/mysqlc/source/mysqlc_resultset.hxx b/mysqlc/source/mysqlc_resultset.hxx >index 33c7a41..96db310 100644 >--- a/mysqlc/source/mysqlc_resultset.hxx >+++ b/mysqlc/source/mysqlc_resultset.hxx >@@ -74,6 +74,7 @@ namespace connectivity > ::com::sun::star::uno::WeakReferenceHelper m_aStatement; > ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; > sql::ResultSet *m_result; >+ bool m_bForcedNull; > unsigned int fieldCount; > rtl_TextEncoding m_encoding; > // OPropertyArrayUsageHelper
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 85190
:
108062
|
112594
|
112597
| 112603