Tedious or Sequelize uses the wrong syntax for `findOne()`

前端 未结 6 1024
青春惊慌失措
青春惊慌失措 2021-02-06 08:51

I am using Sequelize with Tedious to access SQL Server 2008.

When I do a sequelizeModel.findOne() I get this exception -

Unhandled

6条回答
  •  广开言路
    2021-02-06 09:25

    If you can change the sequelize library in node modules. Please follow the steps: Goto Node_modules -> sequelize ->lib -> mssql -> query-generator.js

    You will find this line :

        fragment += ` OFFSET ${this.escape(offset)} ROWS`;
    

    Add a line above it :

        fragment += ` ORDER BY ${this.quoteTable(options.tableAs || model.name)}.${this.quoteIdentifier(model.primaryKeyField)}`;
    

    This should look like :

        fragment += ` ORDER BY ${this.quoteTable(options.tableAs || model.name)}.${this.quoteIdentifier(model.primaryKeyField)}`;
    
        fragment += ` OFFSET ${this.escape(offset)} ROWS`;
    

提交回复
热议问题