Mercurial > urweb
diff src/c/urweb.c @ 874:3c7b48040dcf
MySQL demo/sql succeeds in reading no rows
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 12 Jul 2009 15:05:40 -0400 |
parents | 03e7f111fe99 |
children | b2a175a0f2ef |
line wrap: on
line diff
--- a/src/c/urweb.c Sun Jul 12 13:16:05 2009 -0400 +++ b/src/c/urweb.c Sun Jul 12 15:05:40 2009 -0400 @@ -2742,3 +2742,38 @@ 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; +} +