List:MySQL++« Previous MessageNext Message »
From:Adrian Cornish Date:November 2 2010 5:43pm
Subject:Re: SSQLS and timestamps
View as plain text  
On Tue, Nov 2, 2010 at 11:38 AM, Simon Pickles <sipickles@stripped> wrote:
>
>
> On 02/11/2010 16:20, Adrian Cornish wrote:
>>
>> Simon
>>
>> Have you tried these classes instead
>>
>> http://tangentsoft.net/mysql++/doc/html/refman/classmysqlpp_1_1DateTime.html
>>
>> Adrian
>>
> Well, I tried passing mysqlpp::DateTime::now() to the ssqls c'tor, if that
> is what you mean. Still get the same empty time string.
>
> Thanks

Hmm interesting, works for me.

I am using mysql++ 3.1 Revision: 2676 and mysql Server version:
5.5.4-m3-log Source distribution

Maybe you could try this sample code and see if it works for you


#include <mysql++.h>
#include <ssqls.h>

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 )
int main()
{
   mysqlpp::Connection conn;
   conn.connect("test", "localhost", "adrianc");
   mysqlpp::Query query=conn.query();

   event_log row(mysqlpp::DateTime::now(), 1, 2, 3, 4, "a test string");
   query.insert(row);
   query.exec();

   return 0;
}

And when I run it I get
mysql> select * from event_log;
+---------------------+----+------+------+------+---------------+
| time                | id | type | sidx | sidz | detail        |
+---------------------+----+------+------+------+---------------+
| 2010-11-02 11:37:13 |  1 |    2 |    3 |    4 | a test string |
+---------------------+----+------+------+------+---------------+
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