Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7549

CONNECT doesn't put quotes around DATETIME values returned from local functions

    XMLWordPrintable

    Details

      Description

      CONNECT doesn't put quotes around DATETIME values returned from local functions.

      For example, consider the now() function:

      MariaDB [tmp]> SELECT * From datetime_table where modifiedon > now();
      ERROR 1296 (HY000): Got error 174 '[FreeTDS][SQL Server]Incorrect syntax near '16'.' from CONNECT
       
      MariaDB [tmp]> SELECT NOW();
      +---------------------+
      | NOW()               |
      +---------------------+
      | 2015-02-05 16:22:39 |
      +---------------------+
      1 row in set (0.00 sec)
       
      MariaDB [tmp]> SELECT * From datetime_table where modifiedon > '2015-02-05 16:22:39';
      +----+---------------------+
      | id | modifiedon          |
      +----+---------------------+
      |  2 | 2016-01-01 00:00:00 |
      +----+---------------------+
      1 row in set (0.45 sec)

      The ODBC trace log shows:

      [ODBC][14801][1423171100.511886][SQLExecDirect.c][240]
                      Entry:
                              Statement = 0x7f8aa868d600
                              SQL = [SELECT id, modifiedon FROM dbo.datetime_table WHERE modifiedon > 2015-02-05 16:18:20][length = 84 (SQL_NTS)]

      There should be quotes around the DATETIME value in the query sent to the remote server.

        Attachments

          Activity

            People

            Assignee:
            bertrandop Olivier Bertrand
            Reporter:
            GeoffMontee Geoff Montee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: