Back to the month index |
Back to the list index
|
David Sklar (sklar@student.net)
Tue, 1 Apr 1997 13:54:27 -0500 (EST)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: A. R. M.: "[mSQL] W3-Auth"
- Previous message: sbeer@ibm.net: "[mSQL] Updated fix for NOT NULL bug in Beta 5"
- Next in thread: thoth@purplefrog.com: "Re: [mSQL] answer: escaping chars in C"
- Reply: thoth@purplefrog.com: "Re: [mSQL] answer: escaping chars in C"
Date: Tue, 1 Apr 1997 13:54:27 -0500 (EST) From: David Sklar <sklar@student.net> Subject: [mSQL] answer: escaping chars in C Message-Id: <Pine.LNX.3.95.970401135337.5502E-100000@juan-epstein.student.net>ok, i answered my own question. here's the code I'm using...
-dave
http://www.student.net
--------
#define CHARS_TO_ESCAPE "'\\"
char *msqlEscape(char *pcOld) {
char *pcNew = NULL;
int iOld = 0, iNew = 0;
pcNew = (char *) malloc(2*strlen(pcOld));
while(iOld < strlen(pcOld)) {
if (strchr(CHARS_TO_ESCAPE, pcOld[iOld]))
pcNew[iNew++] = '\\';
pcNew[iNew++] = pcOld[iOld++];
}
pcNew[iNew] = '\0';
pcNew = realloc(pcNew,strlen(pcNew));
return(pcNew);
}
----------
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!
- Next message: A. R. M.: "[mSQL] W3-Auth"
- Previous message: sbeer@ibm.net: "[mSQL] Updated fix for NOT NULL bug in Beta 5"
- Next in thread: thoth@purplefrog.com: "Re: [mSQL] answer: escaping chars in C"
- Reply: thoth@purplefrog.com: "Re: [mSQL] answer: escaping chars in C"