List:MySQL++« Previous MessageNext Message »
From:Simon Pickles Date:November 2 2010 1:52pm
Subject:SSQLS and timestamps
View as plain text  
Hello,

I am having trouble getting a timestamp entered into a table. Here my 
current approach:

*TABLE STRUCTURE*

CREATE TABLE `event_log` (
   `time` datetime NOT NULL,
   `id` int(10) unsigned NOT NULL,
   `type` smallint(5) unsigned NOT NULL,
   `sidx` int(11) NOT NULL,
   `sidz` int(11) NOT NULL,
   `detail` varchar(256) NOT NULL,
   PRIMARY KEY  (`time`)
) ;

*SSQLS DECLARATION*

   sql_create_6( event_log,
                 1, 6, // COMPCOUNT, SETCOUNT
                 mysqlpp::sql_datetime, time,
                 mysqlpp::sql_int_unsigned, id,
                 mysqlpp::sql_int_unsigned, type,
                 mysqlpp::sql_int, sidx,
                 mysqlpp::sql_int, sidz,
                 mysqlpp::sql_character_varying, detail )


No matter how I try I always get the time field set to "0000-00-00 
00:00:00". I have tried with time as datetime and timestamp (with and 
without default CURRENT_TIMESTAMP ).

I am filling in the ssqls like this:

       event_log row( mysqlpp::sql_timestamp(), // also tried 
mysqlpp::datetime::now()
                      i,
                      (int)type,
                      sectorid.x,
                      sectorid.z,
                      detail.str() );

Can anyone see my mistake?

Thanks

Simon

Thread
SSQLS and timestampsSimon Pickles2 Nov
  • Re: SSQLS and timestampsAdrian Cornish2 Nov
    • Re: SSQLS and timestampsSimon Pickles2 Nov
      • Re: SSQLS and timestampsAdrian Cornish2 Nov
        • Re: SSQLS and timestampsSimon Pickles3 Nov
          • Re: SSQLS and timestampsSimon Pickles4 Nov
    • Re: SSQLS and timestampsWarren Young2 Nov