24 #if !defined(Safir_Databases_Odbc_Columns_h)
25 #define Safir_Databases_Odbc_Columns_h
28 #include "Safir/Databases/Odbc/Internal/InternalDefs.h"
29 #include "Safir/Databases/Odbc/Internal/Column.h"
30 #include "Safir/Databases/Odbc/Internal/BinaryColumn.h"
31 #include "Safir/Databases/Odbc/Internal/WideStringColumn.h"
34 #include <boost/date_time/posix_time/posix_time.hpp>
55 class TimeColumn :
public Internal::Column<SQL_C_TYPE_TIMESTAMP, TIMESTAMP_STRUCT>
65 typedef Internal::Column<SQL_C_TYPE_TIMESTAMP, TIMESTAMP_STRUCT> InstantiatedColumn;
72 typedef Internal::Column<SQL_C_FLOAT, Safir::Dob::Typesystem::Float32>
Float32Column;
74 typedef Internal::Column<SQL_C_DOUBLE, Safir::Dob::Typesystem::Float64>
Float64Column;
76 typedef Internal::Column<SQL_C_SLONG, Safir::Dob::Typesystem::Int32>
Int32Column;
78 typedef Internal::Column<SQL_C_SBIGINT, Safir::Dob::Typesystem::Int64>
Int64Column;
86 Internal::Column<SQL_C_BIT, unsigned char>::SetValue(bValue ? 1 : 0);
91 return Internal::Column<SQL_C_BIT, unsigned char>::GetValue() == 1;
100 InstantiatedColumn::SetValue( tsTime );
105 boost::posix_time::ptime pTime;
106 TIMESTAMP_STRUCT value;
109 value.year =
static_cast<SQLSMALLINT
>(pTime.date().year());
110 value.month =
static_cast<SQLUSMALLINT
>(pTime.date().month());
111 value.day =
static_cast<SQLUSMALLINT
>(pTime.date().day());
112 value.hour =
static_cast<SQLUSMALLINT
>(pTime.time_of_day().hours());
113 value.minute =
static_cast<SQLUSMALLINT
>(pTime.time_of_day().minutes());
114 value.second =
static_cast<SQLUSMALLINT
>(pTime.time_of_day().seconds());
115 value.fraction =
static_cast<SQLUINTEGER
>(pTime.time_of_day().fractional_seconds());
116 InstantiatedColumn::SetValue( value );
121 return InstantiatedColumn::GetValue();
126 return InstantiatedColumn::GetValue();
131 boost::gregorian::date pDate(m_value.year, m_value.month, m_value.day);
132 boost::posix_time::time_duration pTimeDuration(m_value.hour, m_value.minute, m_value.second, m_value.fraction);
133 boost::posix_time::ptime pTime(pDate, pTimeDuration);
144 #endif // Safir_Databases_Odbc_Columns_h
bool GetValue() const
Definition: Columns.h:89
static boost::posix_time::ptime ToPtime(const Safir::Dob::Typesystem::Si64::Second utcTime)
Get specified UTC time in boost::posix_time::ptime representation.
void SetTimeStamp(const TIMESTAMP_STRUCT &tsTime)
Definition: Columns.h:98
const TIMESTAMP_STRUCT & GetTimeStamp() const
Definition: Columns.h:119
Internal::Column< SQL_C_FLOAT, Safir::Dob::Typesystem::Float32 > Float32Column
Definition: Columns.h:72
static Safir::Dob::Typesystem::Si64::Second ToDouble(const boost::posix_time::ptime &utcTime)
Convert specified UTC time to a Double.
Internal::WideStringColumn WideStringColumn
Definition: Columns.h:70
Float64 Second
64 bit representation of Second.
Definition: Defs.h:198
Internal::BinaryColumn BinaryColumn
Definition: Columns.h:68
void SetValue(Safir::Dob::Typesystem::Si64::Second time)
Definition: Columns.h:103
Internal::Column< SQL_C_SBIGINT, Safir::Dob::Typesystem::Int64 > Int64Column
Definition: Columns.h:78
Internal::Column< SQL_C_DOUBLE, Safir::Dob::Typesystem::Float64 > Float64Column
Definition: Columns.h:74
Internal::Column< SQL_C_SLONG, Safir::Dob::Typesystem::Int32 > Int32Column
Definition: Columns.h:76
void SetValue(bool bValue)
Definition: Columns.h:84
void GetValue(Safir::Dob::Typesystem::Si64::Second &time) const
Definition: Columns.h:129