Closed
Description
const { format, escape } = require('sqlstring')
const searchWord = 'word%' // Only want to search end of like "abcword%".
const sql = format(
`
SELECT * FROM ?? WHERE ?? LIKE ?
`,
['table', 'content', `%${escape(searchWord)}`]
)
console.log(sql)
// SELECT * FROM `table` WHERE `content` LIKE '%\'word%\''
Expected output
// SELECT * FROM
tableWHERE
contentLIKE '%word\%'
Actual output
// SELECT * FROM
tableWHERE
contentLIKE '%\'word%\''
Any idea?