SQL语句在字符串中添加双引号

时间:2019-03-19 20:38:14

标签: sql postgresql

我有这个PostgreSQL语句:

db.any(`INSERT INTO promotions (event_name, event_location, event_date, event_time, phone_number, email, website, description, event_exp_date, event_sms_message, restaurant_group_id, segment, drink_preference, add_button, restaurant_location, schedule_date ${imageSql1}) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)RETURNING id`,[eventName, eventLocation, eventDate, eventTime, phoneNumber, email, website, description, eventExpDate, event_sms_message, masterLocationId, segment, drinkPreference, addButt, locationSegment2, eventScheduleDate, imageSql2])

信息来自表单,当他们提交时,我在数据库中获得了信息,但是每当人们用撇号写一个单词时,这个信息就会重复出现。

示例:you're-会变成-you''re

我如何转义双引号?

0 个答案:

没有答案