canonical / sqlair

Friendly type mapping for SQL databases
Apache License 2.0
17 stars 9 forks source link

Handle escaped quotes #17

Closed Aflynn50 closed 1 year ago

Aflynn50 commented 1 year ago

Modified parseStringLiteral to ignore escaped quotes and added testing for it.

manadart commented 1 year ago

Double quoted strings are not generally used in SQL.

One would prefer

SELECT 'something' FROM dual

over

SELECT "something" FROM dual

And apostrophes are repeated in order to escape. So "Onos T'oolan" would be retrieved thusly:

SELECT 'Onos T''oolan' FROM dual

In turn, selecting a single quote would be:

SELECT '''' FROM dual

Are we covering all of these?

Aflynn50 commented 1 year ago

Double quoted strings are not generally used in SQL.

One would prefer

SELECT 'something' FROM dual

over

SELECT "something" FROM dual

And apostrophes are repeated in order to escape. So "Onos T'oolan" would be retrieved thusly:

SELECT 'Onos T''oolan' FROM dual

In turn, selecting a single quote would be:

SELECT '''' FROM dual

Are we covering all of these?

Double quoted strings are not generally used in SQL.

One would prefer

SELECT 'something' FROM dual

over

SELECT "something" FROM dual

And apostrophes are repeated in order to escape. So "Onos T'oolan" would be retrieved thusly:

SELECT 'Onos T''oolan' FROM dual

In turn, selecting a single quote would be:

SELECT '''' FROM dual

Are we covering all of these?

PR changed to use repeated quote escaping rather than backslash escaping.