projects
/
gnucomo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bugfix: Use '' instead of \' to escape single quotes in SQL
[gnucomo.git]
/
src
/
gcm_input
/
string_utils.cpp
diff --git
a/src/gcm_input/string_utils.cpp
b/src/gcm_input/string_utils.cpp
index
10696ad
..
90a4efd
100644
(file)
--- a/
src/gcm_input/string_utils.cpp
+++ b/
src/gcm_input/string_utils.cpp
@@
-20,7
+20,7
@@
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Jul 31, 2003
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Jul 31, 2003
-** LAST UPDATE :
Jul 31, 2003
+** LAST UPDATE :
Mar 14, 2015
** MODIFICATIONS :
**************************************************************************/
** MODIFICATIONS :
**************************************************************************/
@@
-49,13
+49,13
@@
static const char *RCSID = "$Id: string_utils.cpp,v 1.3 2003-12-04 09:57:35 arje
** PARAMETERS :
** RETURN VALUE :
**
** PARAMETERS :
** RETURN VALUE :
**
-** DESCRIPTION :
Insert backslashes before single quotes
.
+** DESCRIPTION :
Double backslashes and single quotes as per SQL syntax
.
**
** VARS USED :
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
**
** VARS USED :
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
-** LAST MODIFIED :
+** LAST MODIFIED :
Mar 14, 2015
**=========================================================================
*/
**=========================================================================
*/
@@
-65,11
+65,16
@@
String SQL_Escape(String s)
for (i = 0; i < ~s; i++)
{
for (i = 0; i < ~s; i++)
{
- if (s[i] == '\
'' || s[i] == '\
\')
+ if (s[i] == '\\')
{
s(i,0) = "\\";
i++;
}
{
s(i,0) = "\\";
i++;
}
+ if (s[i] == '\'')
+ {
+ s(i,0) = "'";
+ i++;
+ }
}
return s;
}
return s;