Uploaded image for project: 'FreeSWITCH'
  1. FreeSWITCH
  2. FS-12001

mod_callcenter: Can't use mod_mariadb with MySQL due to keyword on table schema

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.10.0
    • Fix Version/s: 20.19.6, 1.10.1
    • Component/s: mod_callcenter
    • Labels:
      None
    • Environment:
      Xen VM
    • CPU Architecture:
      x86-64
    • Kernel:
      Linux
    • uname:
      Linux callcenter 5.2.5-1.el7.elrepo.x86_64 #1 SMP Wed Jul 31 07:09:47 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux
    • Userland:
      GNU/Linux
    • Distribution:
      CentOS
    • lsb_release:
      Hide
      LSB Version: :core-4.1-amd64:core-4.1-noarch
      Distributor ID: CentOS
      Description: CentOS Linux release 7.6.1810 (Core)
      Release: 7.6.1810
      Codename: Core
      Show
      LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.6.1810 (Core) Release: 7.6.1810 Codename: Core
    • Compiler:
      gcc
    • Compiler Version:
      gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
    • FreeSWITCH GIT Revision:
      6fe1a87e3e
    • GIT Master Revision hash::
      6fe1a87e3e1a37e1d4a3a57174571ff8dcc021a9

      Description

      The mod_callcenter uses the column name `system` on the tables members and agents.

      But in MySQL, the keyword system is reserved for an internal command of MySQL and this generate an error while creating those tables or while QUERYING.

      This can be fixed with backticks `, with can be used on MySQL and SQLite to escape column names.

      However, on PostgreSQL this backtick escape is not supported.

      static char members_sql[] = "CREATE TABLE members (\n"
      "   queue      VARCHAR(255),\n"
      "   `system`      VARCHAR(255),\n"
      "   uuid      VARCHAR(255) NOT NULL DEFAULT '',\n"
      ...
      
       } else if (!strcasecmp(key, "contact")) { } else if (!strcasecmp(key, "contact")) { 
           sql = switch_mprintf("UPDATE agents SET contact = '%q', `system` = 'single_box' WHERE name = '%q'", value, agent);
      
      ...

      This form is the right for escape a column on MySQL, but not on PostgresSQL.

      So, how to make mod_callcenter compatible with mod_mariadb keeping it compatible with SQLite and PostgreSQL?

        Attachments

          Activity

            People

            • Assignee:
              andywolk Andrey Volk
              Reporter:
              fernandojdk Fernando - NextBilling IP Solutions
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: