Re: SQL server application porting headache
От | Gregory Seidman |
---|---|
Тема | Re: SQL server application porting headache |
Дата | |
Msg-id | 20020624174911.GA15662@cs.brown.edu обсуждение исходный текст |
Ответ на | Re: SQL server application porting headache (Oskar Berggren <beo@sgs.o.se>) |
Список | pgsql-general |
Oskar Berggren sez: [...] } I'm getting ready to give up and recommend to my bosses that we hire } a consultant to run the darn thing on Windows and SQL Server. Which } I suppose means that Microsoft has succeeded with their little strange } case-sensitivity trick. Anyway, I will talk to the head developer } at the company that made the application tomorrow and we'll see what } happens. Hm. Perhaps you could mess with the ODBC driver (and install it under a different name, I expect) so that it lowercases everything not in single quotes, and strips double quotes. It's a hack, but it sounds like it would work plausibly at a small performance cost. An appropriate function: /* assumes inbuf is null-terminated and outbuf is allocated at least as * large as inbuf; inbuf *must* be the entire query else quotes might get * unbalanced; ignores all i18n considerations; outbuf will be filled with * the stripped and sanitized null-terminated string, no larger than inbuf */ void strip_and_sanitize(const char *inbuf, char *outbuf) { /* these are boolean flags */ int escmode = 0; int quotemode = 0; char *iptr = inbuf; char *optr = outbuf; while (*iptr) { char ochar = *iptr; if (escmode) { escmode = 0; } else { switch (ochar) { case '\\': escmode = 1; break; case '"'; if (!quotemode) ochar = 0; break; case '\'': quotemode ^= 1; /* toggle */ break; default: if (!quotemode) ochar = tolower(ochar); } } if (ochar) *(optr++) = ochar; ++iptr; } *optr = 0; } } regards, } Oskar --Greg
В списке pgsql-general по дате отправления: