tursodatabase / libsql-shell-go

7 stars 7 forks source link

fix(dump): escape single quotes #141

Closed douglasmdev closed 12 months ago

douglasmdev commented 12 months ago

Description

The SQL standard specifies that single-quotes in strings are escaped by putting two single quotes in a row. Prior to this PR we were not doing that.

Related Issues

Visual reference

→  create table t (t text);
→  insert into t values ("x'x");
→  insert into t values ("I've been there");
→  .dump
PRAGMA foreign_keys=OFF;
CREATE TABLE t (t text);
INSERT INTO t VALUES ('x''x');
INSERT INTO t VALUES ('I''ve been there');