Further tracing with strace and SQL Profiler shows this:
Strace output:
write(7, "15:36:11.403232 20842 (write.c:140):tds_put_string converting 298
bytes of \"INSERT INTO euro_sent_sms00 (momt, sender, receiver, udhdata,
msgdata, xtime, smsc_id, service, account, sms_type, mclass, mwi, coding,
compress, validity, deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, charset,
boxc_id, binfo, meta_data, foreign_id) VALUES ('MT', '353872115934', '53535',
NULL, '\"\n", 376) = 376
SQL Profiler output:
INSERT INTO euro_sent_sms00 (momt, sender, receiver, udhdata, msgdata, xtime,
smsc_id, service, account, sms_type, mclass, mwi, coding, compress, validity,
deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, charset, boxc_id, binfo,
meta_data, foreign_id) VALUES ('MT', '353872115934', '53535', NULL, '
From: Ciaran Scolard
Sent: 28 April 2014 10:34
To: [email protected]
Cc: Pedro Quintas
Subject: Strange sqlbox/kannel bug(?)
Hi All,
I've encountered a very strange bug(?) to do with kannel and sqlbox.
I'm wondering if anyone can shed some light on it.
When I insert into send_sms and specify the charset field, things start to go
strange.
When I do this.
INSERT INTO send_sms00 (momt, sender, receiver, udhdata, msgdata, smsc_id,
sms_type, coding, compress, validity, dlr_mask ) VALUES ('MT', '353872115934',
'53535', NULL, 'abcde12345', 'euro', 2, 2, NULL, 4200, 0 )
Everything works fine.
This is without the charset field.
When I do this:
INSERT INTO euro_send_sms00 (charset, momt, sender, receiver, udhdata, msgdata,
smsc_id, sms_type, coding, compress, validity, dlr_mask ) VALUES ('utf-8',
'MT', '353872115934', '53535', NULL, 'charset', 'euro', 2, 2, NULL, 4200, 0 )
Things go strange.
This is with the charset field.
Using the freetds debug log and wireshark I can see that the SELECT TOP 1 from
send_sms is working fine.
But interstingley
1) the charset field is not honoured. When I specify utf-8 it goes out as
UCS-2.
2) When doing the insert into sent_sms the transaction is being truncated.
This is the command being sent to mssql:
INSERT INTO sent_sms00 (momt, sender, receiver, udhdata, msgdata, xtime,
smsc_id, service, account, sms_type, mclass, mwi, coding, compress, validity,
deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, charset, boxc_id, binfo,
meta_data, foreign_id) VALUES ('MT', '353872115934', '53535', NULL, '
For comparison purposes here is a successful INSERT into sent_sms generated
earlier by not specifying the charset field.
INSERT INTO sent_sms00 (momt, sender, receiver, udhdata, msgdata, xtime,
smsc_id, service, account, sms_type, mclass, mwi, coding, compress, validity,
deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, charset, boxc_id, binfo,
meta_data, foreign_id) VALUES ('MT', '353872115934', '53535', NULL,
'abcde12345', 0, 'euro', NULL, NULL, 2, 0, 0, 2, 0, 4200, 0, 0, NULL, 0, 0, 0,
NULL, NULL, NULL, NULL, '80069')