From 50b75377127f5a8c1d85e117f712b3eae977549c Mon Sep 17 00:00:00 2001 From: fgerlits Date: Thu, 24 Mar 2005 11:40:29 +0000 Subject: [PATCH] In PostgresqlSchedule and PostgresqlPlayLog, now we read and write UniqueId's as string's instead of Long's (which should be == long long, but due to a bug in libodbc++, it is in fact == long). --- .../core/include/LiveSupport/Core/UniqueId.h | 8 ++++---- .../products/scheduler/src/PostgresqlPlayLog.cxx | 12 +++++++----- .../products/scheduler/src/PostgresqlSchedule.cxx | 14 +++++++------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/livesupport/modules/core/include/LiveSupport/Core/UniqueId.h b/livesupport/modules/core/include/LiveSupport/Core/UniqueId.h index 6b1642a42..77a233a11 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/UniqueId.h +++ b/livesupport/modules/core/include/LiveSupport/Core/UniqueId.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.8 $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/UniqueId.h,v $ ------------------------------------------------------------------------------*/ @@ -60,7 +60,7 @@ namespace Core { * A class representing globally unique identifiers. * * @author $Author: fgerlits $ - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ class UniqueId { @@ -131,7 +131,7 @@ class UniqueId * @return a new UniqueId with the specified ID value. */ static Ptr::Ref - fromDecimalString(const std::string idStr) throw () + fromDecimalString(const std::string idStr) throw () { IdType id; // TODO: error checking @@ -148,7 +148,7 @@ class UniqueId * @return a new string containing the value of the UniqueId. */ Ptr::Ref - toDecimalString(void) throw () + toDecimalString(void) const throw () { std::stringstream idWriter; idWriter << std::dec << id; diff --git a/livesupport/products/scheduler/src/PostgresqlPlayLog.cxx b/livesupport/products/scheduler/src/PostgresqlPlayLog.cxx index c54f6b038..1e1f9c5ee 100644 --- a/livesupport/products/scheduler/src/PostgresqlPlayLog.cxx +++ b/livesupport/products/scheduler/src/PostgresqlPlayLog.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlPlayLog.cxx,v $ ------------------------------------------------------------------------------*/ @@ -181,9 +181,9 @@ PostgresqlPlayLog :: addPlayLogEntry( Ptr::Ref pstmt(conn->prepareStatement( addPlayLogEntryStmt)); id = UniqueId::generateId(); - pstmt->setLong(1, id->getId()); + pstmt->setString(1, *id->toDecimalString()); - pstmt->setLong(2, audioClipId->getId()); + pstmt->setString(2, *audioClipId->toDecimalString()); timestamp = Conversion::ptimeToTimestamp(clipTimestamp); pstmt->setTimestamp(3, *timestamp); @@ -231,8 +231,10 @@ PostgresqlPlayLog :: getPlayLogEntries( Ptr::Ref rs(pstmt->executeQuery()); while (rs->next()) { - Ptr::Ref id(new UniqueId(rs->getLong(1))); - Ptr::Ref audioClipId(new UniqueId(rs->getLong(2))); + Ptr::Ref id = UniqueId::fromDecimalString( + rs->getString(1)); + Ptr::Ref audioClipId = UniqueId::fromDecimalString( + rs->getString(2)); *timestamp = rs->getTimestamp(3); Ptr::Ref clipTimestamp diff --git a/livesupport/products/scheduler/src/PostgresqlSchedule.cxx b/livesupport/products/scheduler/src/PostgresqlSchedule.cxx index 57d122563..9cf07a4dc 100644 --- a/livesupport/products/scheduler/src/PostgresqlSchedule.cxx +++ b/livesupport/products/scheduler/src/PostgresqlSchedule.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.9 $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PostgresqlSchedule.cxx,v $ ------------------------------------------------------------------------------*/ @@ -275,9 +275,9 @@ PostgresqlSchedule :: schedulePlaylist( Ptr::Ref pstmt(conn->prepareStatement( schedulePlaylistStmt)); id = UniqueId::generateId(); - pstmt->setLong(1, id->getId()); + pstmt->setString(1, *id->toDecimalString()); - pstmt->setLong(2, playlist->getId()->getId()); + pstmt->setString(2, *playlist->getId()->toDecimalString()); timestamp = Conversion::ptimeToTimestamp(playtime); pstmt->setTimestamp(3, *timestamp); @@ -422,7 +422,7 @@ PostgresqlSchedule :: scheduleEntryExists( conn = cm->getConnection(); Ptr::Ref pstmt(conn->prepareStatement( scheduleEntryExistsStmt)); - pstmt->setLong(1, entryId->getId()); + pstmt->setString(1, *entryId->toDecimalString()); Ptr::Ref rs(pstmt->executeQuery()); result = (rs->next()) ? (rs->getLong(1) == 1) : false; @@ -454,7 +454,7 @@ PostgresqlSchedule :: removeFromSchedule( conn = cm->getConnection(); Ptr::Ref pstmt(conn->prepareStatement( removeFromScheduleStmt)); - pstmt->setLong(1, entryId->getId()); + pstmt->setString(1, *entryId->toDecimalString()); result = pstmt->executeUpdate() == 1; @@ -486,7 +486,7 @@ PostgresqlSchedule :: getScheduleEntry(Ptr::Ref entryId) conn = cm->getConnection(); Ptr::Ref pstmt(conn->prepareStatement( getScheduleEntryStmt)); - pstmt->setLong(1, entryId->getId()); + pstmt->setString(1, *entryId->toDecimalString()); Ptr::Ref rs(pstmt->executeQuery()); if (rs->next()) { @@ -555,7 +555,7 @@ PostgresqlSchedule :: reschedule(Ptr::Ref entryId, timestamp = Conversion::ptimeToTimestamp(ends); pstmt->setTimestamp(2, *timestamp); - pstmt->setLong(3, entryId->getId()); + pstmt->setString(3, *entryId->toDecimalString()); result = pstmt->executeUpdate() == 1;