[Home]

Summary:ASTERISK-30023: cdr_adaptive_odbc: does not support DATETIME database columns
Reporter:Gregory Massel (gmza)Labels:
Date Opened:2022-04-19 22:02:09Date Closed:2022-04-25 15:39:48
Priority:MinorRegression?No
Status:Closed/CompleteComponents:CDR/cdr_adaptive_odbc
Versions:18.11.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Ubuntu 18.04 LTS, Ubuntu 20.04 LTS, Asterisk 18.10.1, Asterisk 18.11.2, MySQL ODBC connector 8.0.28.Attachments:
Description:When configuring cdr_adaptive_odbc with recent and/or latest versions of the MySQL ODBC connector and UnixODBC, and MySQL 8 (wasn't an issue on v5.7 with older connectors), cdr_adaptive_odbc no longer supports the 'start' column being a DATETIME column.

It will log:

{noformat}WARNING[1925399]: cdr_adaptive_odbc.c:731 odbc_log: Column type 9 (field 'asterisk-cdr-connector:cdr:start') is unsupported at this time.{noformat}

The simple way to fix this from the database side is to alter the column from a DATETIME to a TIMESTAMP type. However, this is not immediately obvious to most and, there is no good reason why cdr_adaptive_odbc shouldn't support a DATETIME column type.

To support DATETIME columns properly requires just a single additional line of code:

{noformat}
*** cdr/cdr_adaptive_odbc.c~    2022-04-14 23:53:34.000000000 +0200
--- cdr/cdr_adaptive_odbc.c     2022-04-20 05:00:08.956054103 +0200
***************
*** 564,569 ****
--- 564,570 ----
                                       break;
                               case SQL_TYPE_TIMESTAMP:
                               case SQL_TIMESTAMP:
+                               case SQL_DATETIME:
                                       if (ast_strlen_zero(colptr)) {
                                               continue;
                                       } else {
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2022-04-19 22:02:09.831-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Friendly Automation (friendly-automation) 2022-04-25 15:39:49.080-0500

Change 18410 merged by Friendly Automation:
cdr_adaptive_odbc: Add support for SQL_DATETIME field type.

[https://gerrit.asterisk.org/c/asterisk/+/18410|https://gerrit.asterisk.org/c/asterisk/+/18410]

By: Friendly Automation (friendly-automation) 2022-04-25 15:44:02.911-0500

Change 18421 merged by Friendly Automation:
cdr_adaptive_odbc: Add support for SQL_DATETIME field type.

[https://gerrit.asterisk.org/c/asterisk/+/18421|https://gerrit.asterisk.org/c/asterisk/+/18421]

By: Friendly Automation (friendly-automation) 2022-04-25 15:44:47.097-0500

Change 18422 merged by Friendly Automation:
cdr_adaptive_odbc: Add support for SQL_DATETIME field type.

[https://gerrit.asterisk.org/c/asterisk/+/18422|https://gerrit.asterisk.org/c/asterisk/+/18422]

By: Friendly Automation (friendly-automation) 2022-04-25 18:35:11.356-0500

Change 18420 merged by Kevin Harwell:
cdr_adaptive_odbc: Add support for SQL_DATETIME field type.

[https://gerrit.asterisk.org/c/asterisk/+/18420|https://gerrit.asterisk.org/c/asterisk/+/18420]