[asterisk-bugs] [Asterisk 0015170]: [patch] MySQL ENUM Type Not Detected

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Oct 6 13:21:26 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15170 
====================================================================== 
Reported By:                leobrown
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   15170
Category:                   Addons/cdr_addon_mysql
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-05-21 07:45 CDT
Last Modified:              2010-10-06 13:21 CDT
====================================================================== 
Summary:                    [patch] MySQL ENUM Type Not Detected
Description: 
The raw values for the AMAFLAGS column are detected by a switch case that
checks all numeric types. Unfortunately ENUM is not in the list. ENUM is
technically a numeric type. So if you have the column definition:

  amaflags ENUM('DOCUMENTATION','BILLING','OMIT')

This will work. However, if you have the definition:

  amaflags ENUM('info','outbound','inbound')

This will *not* work and the column will be set to NULL due to an
unparsable value. By adding the ENUM column type instead, both syntaxes
will work!

====================================================================== 

---------------------------------------------------------------------- 
 (0127763) leobrown (reporter) - 2010-10-06 13:21
 https://issues.asterisk.org/view.php?id=15170#c127763 
---------------------------------------------------------------------- 
Tilghman,

I'm just trying to provide something that solves all cases. Since my patch
includes a configuration option, I hoped this would meet both my case and
the standard usage that you preferred.

There is no way to automatically detect what column preference most users
have. Many people who don't know SQL very well will have a CHAR(n) field to
store the BILLING, OMIT etc, but they are wasting a lot of bytes in the
CDR.

Other users will apply the 0,1,2 mode of AMAFLAGS because they want to
save space. The problem with this is that it is not very human-readable.

The best solution is to use ENUM, and ENUM(BILLING, OMIT, DOCUMENTATION)
would be fine, but with most people's systems they find that those three
terms to not accurately describe three distinct CDR types.

Hence, in my case, the use of Inbound, Outbound, and Info. I.e. toll-free
billing, outbound billing, and unbilled inbound calls.

The problem is that I can not have this elegant solution, because
app_addon_cdr.so does not let me use MySQL's built-in "ENUM as INT" feature
which was designed exactly to meet this need.

Could you please provide me more information guiding me to produce a patch
that reflects your interests and wishes, and then I can ensure that this is
useful for someone.

Thanks in advance,
Leo 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-10-06 13:21 leobrown       Note Added: 0127763                          
======================================================================




More information about the asterisk-bugs mailing list