Activity log for bug #950570

Date Who What changed Old value New value Message
2012-03-09 06:23:13 Henrik Ingo bug added bug
2012-03-09 06:24:03 Henrik Ingo drizzle: importance Undecided Wishlist
2012-03-09 06:24:10 Henrik Ingo drizzle: status New Confirmed
2012-03-09 06:24:37 Henrik Ingo tags low-hanging-fruit refactor
2012-03-29 19:14:53 Sharan Kumar drizzle: assignee M.Sharan Kumar (sharan-monikantan)
2012-03-29 19:15:10 Sharan Kumar drizzle: status Confirmed In Progress
2012-03-30 20:36:14 Sharan Kumar description Item objects keep time information in a format inherited from MySQL. If you want to get that time as a unix timestamp you end up writing quite many lines of code. It would be convenient to have this as a utility function so you don't have to copy the code every time you need to do this conversion. (For instance, it could be a method of the Item class(es). For an example of how unix timestamp is computed, see drizzled/function/time/unix_timestamp.cc ...which provides the functionality to call UNIX_TIMESTAMP() in SQL. This issue is a feature request to provide a utility function for Drizzle internal use. An example consumer of this utility function is found in plugin/js/js.cc:195: // DATE/TIME values are also STRING_RESULT, make them a Date type in v8 // Now we need to get the unix timestamp integer, surprisingly tricky... // TODO: This should really be just args[n]->get_epoch_seconds(). I need to write a separate patch for Item class one of these days. type::Time ltime; Timestamp temporal; args[n]->get_date(ltime, 0); temporal.set_years(ltime.year); temporal.set_months(ltime.month); temporal.set_days(ltime.day); temporal.set_hours(ltime.hour); temporal.set_minutes(ltime.minute); temporal.set_seconds(ltime.second); temporal.set_epoch_seconds(); if (temporal.is_valid()) { time_t tmp; temporal.to_time_t(tmp); // Pay attention, Ecmascript defines a date as *milliseconds* since unix epoch // Also, on platforms where time_t is 32 bit, we need explicit cast to 64 bit integer a->Set( n-1, v8::Date::New(((uint64_t)tmp)*1000) ); } else { a->Set( n-1, v8::String::New(args[n]->val_str(str)->c_str() ) ); } It should be possible to simply replace this code with a if ( time_t tsamp = args[n]->get_epoch_seconds() ) { // Pay attention, Ecmascript defines a date as *milliseconds* since unix epoch // Also, on platforms where time_t is 32 bit, we need explicit cast to 64 bit integer a->Set( n-1, v8::Date::New(((uint64_t) tstamp )*1000) ); } else { a->Set( n-1, v8::String::New(args[n]->val_str(str)->c_str() ) ); } Item objects keep time information in a format inherited from MySQL. If you want to get that time as a unix timestamp you end up writing quite many lines of code. It would be convenient to have this as a utility function so you don't have to copy the code every time you need to do this conversion. (For instance, it could be a method of the Item class(es). For an example of how unix timestamp is computed, see drizzled/function/time/unix_timestamp.cc ...which provides the functionality to call UNIX_TIMESTAMP() in SQL. This issue is a feature request to provide a utility function for Drizzle internal use. An example consumer of this utility function is found in plugin/js/js.cc:195:         // DATE/TIME values are also STRING_RESULT, make them a Date type in v8         // Now we need to get the unix timestamp integer, surprisingly tricky...         // TODO: This should really be just args[n]->get_epoch_seconds(). I need to write a separate patch for Item class one of these days.         type::Time ltime;         Timestamp temporal;         args[n]->get_date(ltime, 0);         temporal.set_years(ltime.year);         temporal.set_months(ltime.month);         temporal.set_days(ltime.day);         temporal.set_hours(ltime.hour);         temporal.set_minutes(ltime.minute);         temporal.set_seconds(ltime.second);         temporal.set_epoch_seconds();         if (temporal.is_valid())         {           time_t tmp;           temporal.to_time_t(tmp);           // Pay attention, Ecmascript defines a date as *milliseconds* since unix epoch           // Also, on platforms where time_t is 32 bit, we need explicit cast to 64 bit integer           a->Set( n-1, v8::Date::New(((uint64_t)tmp)*1000) );         } else {           a->Set( n-1, v8::String::New(args[n]->val_str(str)->c_str() ) );         } It should be possible to simply replace this code with a         if ( time_t tsamp = args[n]->get_epoch_seconds() )         {           // Pay attention, Ecmascript defines a date as *milliseconds* since unix epoch           // Also, on platforms where time_t is 32 bit, we need explicit cast to 64 bit integer           a->Set( n-1, v8::Date::New(((uint64_t) tstamp )*1000) );         } else {           a->Set( n-1, v8::String::New(args[n]->val_str(str)->c_str() ) );         }
2012-05-23 11:52:24 Sharan Kumar drizzle: assignee M.Sharan Kumar (sharan-monikantan)
2013-05-24 04:08:22 Rob Smith branch linked lp:~kormoc/drizzle/950570
2017-07-01 14:25:16 tangsir branch unlinked lp:~kormoc/drizzle/950570