summaryrefslogtreecommitdiff
path: root/src/c/urweb.c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-07-12 15:05:40 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-07-12 15:05:40 -0400
commite22b77776db9f846f5d0fae77dab5a57dfe7e0e8 (patch)
treec1a396c05b3c698202cfc482584b8d221ff51b47 /src/c/urweb.c
parent20b1f5880b6553c42f2a71fd5ad38b865faed6b6 (diff)
MySQL demo/sql succeeds in reading no rows
Diffstat (limited to 'src/c/urweb.c')
-rw-r--r--src/c/urweb.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index f088e74d..4b92c2b4 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -2742,3 +2742,38 @@ __attribute__((noreturn)) void uw_return_blob(uw_context ctx, uw_Basis_blob b, u
longjmp(ctx->jmp_buf, RETURN_BLOB);
}
+
+uw_Basis_string uw_Basis_unAs(uw_context ctx, uw_Basis_string s) {
+ uw_Basis_string r = uw_malloc(ctx, strlen(s) + 1);
+
+ for (; *s; ++s) {
+ if (s[0] == '\'') {
+ *r++ = '\'';
+ for (++s; *s; ++s) {
+ if (s[0] == '\'') {
+ *r++ = '\'';
+ break;
+ } else if (s[0] == '\\') {
+ if (s[1] == '\\') {
+ *r++ = '\\';
+ *r++ = '\\';
+ ++s;
+ } else if (s[1] == '\'') {
+ *r++ = '\\';
+ *r++ = '\'';
+ ++s;
+ } else
+ *r++ = '\'';
+ } else
+ *r++ = s[0];
+ }
+ if (*s == 0) break;
+ } else if (s[0] == 'T' && s[1] == '.')
+ ++s;
+ else
+ *r++ = s[0];
+ }
+
+ return r;
+}
+