[asterisk-dev] [Code Review] extra ast_strlen_zero() check in cel_odbc prevents integer eventtype in database

mlehner reviewboard at asterisk.org
Tue Mar 29 01:41:00 CDT 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1149/
-----------------------------------------------------------

(Updated 2011-03-29 01:41:00.189297)


Review request for Asterisk Developers.


Changes
-------

Added database schema.


Summary
-------

event_type could not be an integer datatype in a ODBC database because an extra ast_strlen_zero() check was wrapped around the code that did the work. ast_strlen_zero() check is done in the second branch of the if statement, after the check for eventtype is done. Changes are very simple, just removing the "overzealous" ast_strlen_zero() check, while keeping braces to prevent compilation errors and warnings with variable re-definitions. 


Diffs
-----

  /tags/1.8.3.2/cel/cel_odbc.c 311686 

Diff: https://reviewboard.asterisk.org/r/1149/diff


Testing (updated)
-------

Tested on a local install of Asterisk 1.8.3.2. Compiles and creates the expected records in the database. Database schema is as follows:

CREATE TABLE `cel_int` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `eventtype` int(11) NOT NULL,
  `eventtime` timestamp NOT NULL,
  `userdeftype` varchar(255) DEFAULT NULL,
  `cid_name` varchar(100) DEFAULT NULL,
  `cid_num` varchar(100) DEFAULT NULL,
  `cid_ani` varchar(100) DEFAULT NULL,
  `cid_rdnis` varchar(100) DEFAULT NULL,
  `cid_dnid` varchar(100) DEFAULT NULL,
  `exten` varchar(100) DEFAULT NULL,
  `context` varchar(100) DEFAULT NULL,
  `channame` varchar(100) DEFAULT NULL,
  `appname` varchar(100) DEFAULT NULL,
  `appdata` varchar(100) DEFAULT NULL,
  `accountcode` varchar(20) DEFAULT NULL,
  `peeraccount` varchar(100) DEFAULT NULL,
  `uniqueid` varchar(32) DEFAULT NULL,
  `linkedid` varchar(32) DEFAULT NULL,
  `amaflags` int(11) NOT NULL,
  `userfield` varchar(255) DEFAULT NULL,
  `peer` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM;


Thanks,

mlehner

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110329/3c839a77/attachment.htm>


More information about the asterisk-dev mailing list