Commit 83aa2701 authored by Claes Sjofors's avatar Claes Sjofors

Sev storage of pwr_tTime types didn't work

parent 37dcaf5f
......@@ -978,8 +978,16 @@ int sev_dbms::store_value( pwr_tStatus *sts, int item_idx, int attr_idx,
*sts = time_AtoAscii( &time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
if ( EVEN(*sts)) return 0;
timstr[19] = 0;
*sts = cdh_AttrValueToString( m_items[item_idx].attr[attr_idx].type, buf, bufstr, sizeof(bufstr));
if ( EVEN(*sts)) return 0;
switch ( m_items[item_idx].attr[attr_idx].type) {
case pwr_eType_Time:
*sts = time_AtoAscii( (pwr_tTime *)buf, time_eFormat_NumDateAndTime, bufstr, sizeof(bufstr));
if ( EVEN(*sts)) return 0;
break;
default:
*sts = cdh_AttrValueToString( m_items[item_idx].attr[attr_idx].type, buf, bufstr, sizeof(bufstr));
if ( EVEN(*sts)) return 0;
}
char colname[255];
strcpy(colname, "value");
......@@ -989,6 +997,7 @@ int sev_dbms::store_value( pwr_tStatus *sts, int item_idx, int attr_idx,
// Posix time, high resolution
switch ( m_items[item_idx].attr[attr_idx].type) {
case pwr_eType_String:
case pwr_eType_Time:
sprintf( query, "insert into %s (time, ntime, %s) values (%ld,%ld,'%s')",
m_items[item_idx].tablename, colname,
(long int)time.tv_sec, (long int)time.tv_nsec, bufstr);
......@@ -1008,6 +1017,7 @@ int sev_dbms::store_value( pwr_tStatus *sts, int item_idx, int attr_idx,
// Posix time, low resolution
switch ( m_items[item_idx].attr[attr_idx].type) {
case pwr_eType_String:
case pwr_eType_Time:
sprintf( query, "insert into %s (time, %s) values (%ld,'%s')",
m_items[item_idx].tablename, colname, (long int)time.tv_sec, bufstr);
break;
......@@ -1026,6 +1036,7 @@ int sev_dbms::store_value( pwr_tStatus *sts, int item_idx, int attr_idx,
// Sql time, high resolution
switch ( m_items[item_idx].attr[attr_idx].type) {
case pwr_eType_String:
case pwr_eType_Time:
sprintf( query, "insert into %s (time, ntime, %s) values ('%s',%ld,'%s')",
m_items[item_idx].tablename, colname,
timstr, (long int)time.tv_nsec, bufstr);
......@@ -1045,6 +1056,7 @@ int sev_dbms::store_value( pwr_tStatus *sts, int item_idx, int attr_idx,
// Sql time, low resolution
switch ( m_items[item_idx].attr[attr_idx].type) {
case pwr_eType_String:
case pwr_eType_Time:
sprintf( query, "insert into %s (time, %s) values ('%s','%s')",
m_items[item_idx].tablename, colname, timstr, bufstr);
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment