Skip to content

Bugfix invalid query log not bind parameters in [email protected] #11151

Closed

Description

@ryuki0628

version: [email protected]

Invalid query log not bind parameters in [email protected]

What are you doing?

use query logging.
execute update method.

What do you expect to happen?

output sql log

Executing (default): UPDATE users SET email = '[email protected]', updated_at = '2019-01-01 10:00:00' WHERE id = 1;

What is actually happening?

query log not bind parameters

output sql log

Executing (default): UPDATE users SET email = ?, updated_at = ? WHERE id = ?;

Environment

Dialect:

  • mysql
  • postgres
  • sqlite
  • mssql
  • any
    Database version: 5.7
    Sequelize version: 5.9.0

If TypeScript related: TypeScript version: XXX
Tested with latest release:

  • No
  • Yes, specify that version:

How to modify

target file path: lib/dialects/mysql/query.js
line: 37

    const complete = this._logQuery(parameters ? connection.format(sql, parameters) : sql, debug);

Activity

  1. changed the title [-]Invalid query log not bind parameters in [email protected][/-] [+]Bugfix invalid query log not bind parameters in [email protected][/+] on Jul 5, 2019
  2. added
    status: wip
    type: other
    on Jul 24, 2019
  3. sushantdhiman commented on Sep 19, 2019

    @sushantdhiman
    Contributor

    Fixed by #11267

  4. soufian044 commented on Sep 19, 2019

    @soufian044

    I'm still seeing the same issue with the "?" in the logs for the UPDATE
    using the latest version 5.19.0

    image

  5. sushantdhiman commented on Sep 19, 2019

    @sushantdhiman
    Contributor

    @soufian044 You will need to pass logQueryParameters: true to your Sequelize constructor options to enable parameter logging

  6. soufian044 commented on Sep 19, 2019

    @soufian044

    @sushantdhiman thank you, i would suggest to update the API Reference for the Sequelize constructor.

  7. sushantdhiman commented on Sep 19, 2019

    @sushantdhiman
    Contributor

    @soufian044 It will automatically update in 24 hours

  8. terrynguyen255 commented on Jul 29, 2020

    @terrynguyen255

    Hi @sushantdhiman ,

    Can we somehow have it

    UPDATE `users` SET `age`=10;

    instead of

    UPDATE `users` SET `name`=?; 10

    I've having trailing params while using MySQL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: wiptype: other

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions