signalk-parquet
Version:
Vessel data Parquet file archive with automated value and geospatial triggers. History API compliant with cloud backups and queries.
22 lines • 908 B
JavaScript
;
/**
* Helpers for safely embedding string literals in the SQL we build by
* interpolation for DuckDB. The query builders in this plugin assemble SQL as
* strings rather than using bound parameters, so any externally-supplied value
* (context, source reference, timestamps) must be escaped before it is spliced
* into a quoted literal.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.escapeSqlString = escapeSqlString;
/**
* Escape a string for inclusion inside a single-quoted SQL literal by doubling
* embedded single quotes. This is the standard SQL escaping for string
* literals and prevents the value from terminating the literal early.
*
* Input: O'Brien Output: O''Brien
* Usage: `WHERE label = '${escapeSqlString(value)}'`
*/
function escapeSqlString(value) {
return value.replace(/'/g, "''");
}
//# sourceMappingURL=sql-escape.js.map