1

I wanna update my model by sequlize with below code:

                    let playUrl = 'http://example.com/test-23';
                     modelClass.update({play_url: playUrl}
                        ,{
                            
                            where :{
                                id:{
                                    [Op.eq]:800
                                }
        
                        }});

But finally Sequlize generate this for me:

  UPDATE `md_song` SET `play_url`=? WHERE `id` = 800

Do you know why it don't pass as parameter ??

Shayan
  • 402
  • 1
  • 4
  • 18
  • The thing is that it prepare the values that comes from "outside" just so it wont have any bad code that can for instance delete all you db. – Talg123 Aug 16 '20 at 15:40
  • @Talg123 what do you mean from outside? You mean I can't pass paramter as value ? – Shayan Aug 16 '20 at 15:43
  • It's a parameterised query. Nothing special about it. – Bergi Aug 16 '20 at 17:38
  • @Bergi ok, but why sequelize don;t pass nothing? – Shayan Aug 16 '20 at 21:44
  • 1
    What makes you think that no value was passed for the parameter? How did you even find the generated SQL query? How is your `modelClass` configured, how does your database connection look? (I had to assume it's MySQL, there might be others using the same syntax) – Bergi Aug 16 '20 at 21:51

0 Answers0