You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In SQL to escape a single quote, a solution is to double the quote.
Currently in OrientDB we must use \'
Here are different cases where orientdb sql parser fails :
final OSchema schema = db.getMetadata().getSchema();
final OClass clazz = schema.createClass("test");
clazz.createProperty("strAtt", OType.STRING);
db.command(new OCommandSQL("INSERT INTO test(numericAtt) VALUES ('some escaped '' cote')")).execute();
// double single quote in the middle = fail -> will store the two quotes in the field value
db.command(new OCommandSQL("INSERT INTO test(numericAtt) VALUES ('some escaped cote''')")).execute();
// double single quote at the beginning = fail -> parsing error
db.command(new OCommandSQL("INSERT INTO test(numericAtt) VALUES ('''some escaped cote')")).execute();
// double single quote at the end =fail -> parsing error
I know orientdb sql is not a true sql, but preserving well knowned writings would be appreciated by users.
The text was updated successfully, but these errors were encountered:
In SQL to escape a single quote, a solution is to double the quote.
Currently in OrientDB we must use \'
Here are different cases where orientdb sql parser fails :
final OSchema schema = db.getMetadata().getSchema();
final OClass clazz = schema.createClass("test");
clazz.createProperty("strAtt", OType.STRING);
db.command(new OCommandSQL("INSERT INTO test(numericAtt) VALUES ('some escaped '' cote')")).execute();
// double single quote in the middle = fail -> will store the two quotes in the field value
db.command(new OCommandSQL("INSERT INTO test(numericAtt) VALUES ('some escaped cote''')")).execute();
// double single quote at the beginning = fail -> parsing error
db.command(new OCommandSQL("INSERT INTO test(numericAtt) VALUES ('''some escaped cote')")).execute();
// double single quote at the end =fail -> parsing error
I know orientdb sql is not a true sql, but preserving well knowned writings would be appreciated by users.
The text was updated successfully, but these errors were encountered: