InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

InstantDB: Embedded Quotes


I have an application that uses PreparedStatements, which 99% of the time
works great with embedded quote (") and single-quote (') characters without
doing any explicit escape sequences.

The 1% is where I have a problem.  If the setString() call on my prepared
statement starts with a quote (") or single-quote (') character, InstantDB
skips it and goes to the next character.  Obviously, this starting quote
character is very important to my application.  I have tried prepending a
slash to the string, but InstantDB then complains with:
Unknown escape character: \

My code (snippet of):

PreparedStatement stmt = conn.prepareStatement(
"INSERT INTO MY_TABLE (aString) VALUES (?)");
s = //someString;
// if it starts with a quote or single-quote, prepend the slash
c = s.charAt(0);
if (c == '"')
{
s = "\\" + s;
// I even tried
// s = "\\\"" + s.substring(1);
}
else if (c == '\'')
{
s = "\\" + s;
}
stmt.setString(1, s);

Any help or suggestions?

Thanks.
Gary Myers



-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.