Yes, I tought the same since there is included "sqlbox_mysql.h" file at the begining of "sqlbox_mysql.c". BUT it means that "time conversion" is done in sql script insted C++. What is better solution when we talk about speed if it is done on-the-fly????

I think that "time conversion" should be done before calling INSERT script, in C++. And it sould be part of configuration in future version of sqlbox .... Count on sqlbox rather on Sql server......

What I did:
I have changed SQLBOX_MYSQL_CREATE_INSERT_TABLE queries in part of changing "time BIGINT(20)" to "time DATETIME" and now tables are natively created (and recreated if deleted at later) as I need. So I have prerequirements.

Now, it is necessary to change "sqlbox_mysql.c" not to send timestamp to sql that should be converterted by sql, but to first convert timestamp to datetime and then call INSERT query:

I think, not sure, that this should be done here (sqlbox_mysql.c) :
///////////////////////
void mysql_save_msg(Msg *msg, Octstr *momt /*, Octstr smsbox_id */)
{
   Octstr *sql;
   Octstr *stuffer[30];
   int stuffcount = 0;
<<<<<<<<<here to put code to convert timestamp(st_num(msg->sms.time)) TO datetime(st_num(msg->sms.time)) >>>>>>>>>>>>>> sql = octstr_format(SQLBOX_MYSQL_INSERT_QUERY, sqlbox_logtable, st_str(momt), st_str(msg->sms.sender), st_str(msg->sms.receiver), st_str(msg->sms.udhdata), st_str(msg->sms.msgdata), st_num(msg->sms.time), st_str(msg->sms.smsc_id), st_str(msg->sms.service), st_str(msg->sms.account), st_num(msg->sms.sms_type), st_num(msg->sms.mclass), st_num(msg->sms.mwi), st_num(msg->sms.coding), st_num(msg->sms.compress), st_num(msg->sms.validity), st_num(msg->sms.deferred), st_num(msg->sms.dlr_mask), st_str(msg->sms.dlr_url), st_num(msg->sms.pid), st_num(msg->sms.alt_dcs), st_num(msg->sms.rpi), st_str(msg->sms.charset), st_str(msg->sms.boxc_id), st_str(msg->sms.binfo), st_str(msg->sms.meta_data));
   sql_update(sql);
   while (stuffcount > 0) {
       octstr_destroy(stuffer[--stuffcount]);
   }
   octstr_destroy(sql);
}
//////////////////////////

Any sugestions about this c++ code??





--------------------------------------------------
From: "Rene Kluwen" <rene.klu...@chimit.nl>
Sent: Friday, February 24, 2012 5:18 PM
To: "'Willy Mularto'" <sangpr...@gmail.com>; "'Knut Olafson'" <ac...@t-com.me>
Cc: <users@kannel.org>
Subject: RE: Using SQLBOX - unix timestamp

I think the SQL statements are gathered in the header files, not the source
files.

So for the mysql engine, you need sqlbox_mysql.h and then in particular the
line that says SQLBOX_MYSQL_INSERT_QUERY.

== Rene

-----Original Message-----
From: users-boun...@kannel.org [mailto:users-boun...@kannel.org] On Behalf
Of Willy Mularto
Sent: Friday, 24 February, 2012 09:56
To: Knut Olafson
Cc: users@kannel.org
Subject: Re: Using SQLBOX - unix timestamp

You need to do a little hack here. Go to SQLBox source code
(gw/sqlbox_yourdb.c) and find the line where it injects the INSERT query,
from here you must be able to figure it out (needs skill SQL)



On Feb 24, 2012, at 3:45 PM, Knut Olafson wrote:


Hi there,
I have the same problem. I would like to have datetime in readable format
in
db instead of timestamp. Reading this I have changed that column in db
from
bigint(20) to datetime and now, have something like this (for all
entries):
0000-00-00 00:00:00
How to resolve this ??
Thanks.
A.


Willy Mularto-2 wrote:

change the type to datetime ;)


On Mar 21, 2011, at 5:47 PM, ha...@aeon.pk wrote:

Hi,

While using sqlbox, the column 'time' in sent_sms column of kannel
database is having timestamp values in unix time. Is there a parameter
in
config by which I could control it to paste values in normal timestamps
in the table?

Thanks,
H

Willy Mularto
F300HD+MR18DE (NLC1725)











--
View this message in context:
http://old.nabble.com/Using-SQLBOX---unix-timestamp-tp31199396p33383570.html
Sent from the Kannel - User mailing list archive at Nabble.com.



Willy Mularto
F300HD+MR18DE (NLC1725)













Reply via email to