(sql, values, timeZone, dialect)
| 94 | exports.escape = escape; |
| 95 | |
| 96 | function format(sql, values, timeZone, dialect) { |
| 97 | values = [].concat(values); |
| 98 | |
| 99 | if (typeof sql !== 'string') { |
| 100 | throw new Error(`Invalid SQL string provided: ${sql}`); |
| 101 | } |
| 102 | |
| 103 | return sql.replace(/\?/g, match => { |
| 104 | if (!values.length) { |
| 105 | return match; |
| 106 | } |
| 107 | |
| 108 | return escape(values.shift(), timeZone, dialect, true); |
| 109 | }); |
| 110 | } |
| 111 | exports.format = format; |
| 112 | |
| 113 | function formatNamedParameters(sql, values, timeZone, dialect) { |