Uploaded image for project: 'MariaDB Connector/node.js'
  1. MariaDB Connector/node.js
  2. CONJS-120

Permit values in SQL object to permits compatibility with mysql/mysql2

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: API
    • Labels:
      None

      Description

      Permits passing values in sql object to permit compatibility with mysql/mysql2, permitting compatibility with sql-template-strings at the same time.

      standard API is using :

      connection.query('SELECT ? as a', ['myValue'])
         .then(rows => {
            console.log(rows); //[ { 'a': myValue' }, meta: [ ... ] ]
        })
        .catch(...)
      

      or sql object:

      connection.query({sql:'SELECT ? as a'}, ['myValue'])
         .then(rows => {
            console.log(rows); //[ { 'a': myValue' }, meta: [ ... ] ]
        })
        .catch(...)
      

      Using sql object, value can be given as 'values' entry:

      connection.query({sql:'SELECT ? as a', value: ['myValue']})
         .then(rows => {
            console.log(rows); //[ { 'a': myValue' }, meta: [ ... ] ]
        })
        .catch(...)
      

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: