RE: [PATCH] No PANIC on failing store_load()

"Rene Kluwen" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Agreed with Stipe here.
If the users enters a different value for sms_type, it is their
responsibility.

What is covered here, is an accidental wrong value for sms_type, because
nowhere is documented that sms_type should be set to MT (value '2') because
otherwise Kannel will panic.

Attached is a simple solution that will benefit everyone. Which is ready to
be committed.

== Rene

-----Original Message-----
From: devel [mailto:[email protected]] On Behalf Of Stipe Tolj
Sent: dinsdag 17 september 2013 17:55
Cc: kannel_dev_mailinglist devel@kannel. org
Subject: Re: [PATCH] No PANIC on failing store_load()

Am 17.09.2013 17:22, schrieb Willy Mularto:
> Sorry,  it doesn't mean setting default value during table creation 
> right? Because this approach will still might be interupted by user's 
> value. Thanks.

The default value is defined during table creation, yes. The point is: 
IF the user doesn't insert a specific value for the field THEN the default
is applied. If the user specifically inserts -1 then he will get -1. But
that makes no logical sense.

Stipe

--
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture      Kannel Software Foundation (KSF)
http://www.tolj.org/              http://www.kannel.org/

mailto:st_{at}_tolj.org           mailto:stolj_{at}_kannel.org
-------------------------------------------------------------------
default.diff (application/octet-stream, 1.4 KB)
Index: gw/sqlbox_mysql.h
===================================================================
--- gw/sqlbox_mysql.h	(revision 54)
+++ gw/sqlbox_mysql.h	(working copy)
@@ -7,7 +7,7 @@
 momt ENUM('MO', 'MT', 'DLR') NULL, sender VARCHAR(20) NULL, \
 receiver VARCHAR(20) NULL, udhdata BLOB NULL, msgdata TEXT NULL, \
 time BIGINT(20) NULL, smsc_id VARCHAR(255) NULL, service VARCHAR(255) NULL, \
-account VARCHAR(255) NULL, id BIGINT(20) NULL, sms_type BIGINT(20) NULL, \
+account VARCHAR(255) NULL, id BIGINT(20) NULL, sms_type BIGINT(20) NOT NULL DEFAULT 2, \
 mclass BIGINT(20) NULL, mwi BIGINT(20) NULL, coding BIGINT(20) NULL, \
 compress BIGINT(20) NULL, validity BIGINT(20) NULL, deferred BIGINT(20) NULL, \
 dlr_mask BIGINT(20) NULL, dlr_url VARCHAR(255) NULL, pid BIGINT(20) NULL, \
@@ -20,7 +20,7 @@
 momt ENUM('MO', 'MT') NULL, sender VARCHAR(20) NULL, \
 receiver VARCHAR(20) NULL, udhdata BLOB NULL, msgdata TEXT NULL, \
 time BIGINT(20) NULL, smsc_id VARCHAR(255) NULL, service VARCHAR(255) NULL, \
-account VARCHAR(255) NULL, id BIGINT(20) NULL, sms_type BIGINT(20) NULL, \
+account VARCHAR(255) NULL, id BIGINT(20) NULL, sms_type BIGINT(20) NOT NULL DEFAULT 2, \
 mclass BIGINT(20) NULL, mwi BIGINT(20) NULL, coding BIGINT(20) NULL, \
 compress BIGINT(20) NULL, validity BIGINT(20) NULL, deferred BIGINT(20) NULL, \
 dlr_mask BIGINT(20) NULL, dlr_url VARCHAR(255) NULL, pid BIGINT(20) NULL, \
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.