libgda r3064 - in branches/release-3-0-branch: . libgda



Author: vivien
Date: Wed Feb 27 17:09:56 2008
New Revision: 3064
URL: http://svn.gnome.org/viewvc/libgda?rev=3064&view=rev

Log:
2008-02-27  Vivien Malerba <malerba gnome-db org>

        * libgda/gda-util.c: applied patch to change the default string escape for a
        single-quote char from backslash single-quote (\') to single-quote
        single-quote ('') so that SQLite will accept it (thanks to Phil
        Longstaff)


Modified:
   branches/release-3-0-branch/ChangeLog
   branches/release-3-0-branch/libgda/gda-util.c

Modified: branches/release-3-0-branch/libgda/gda-util.c
==============================================================================
--- branches/release-3-0-branch/libgda/gda-util.c	(original)
+++ branches/release-3-0-branch/libgda/gda-util.c	Wed Feb 27 17:09:56 2008
@@ -85,7 +85,7 @@
  * @string: string to escape
  *
  * Escapes @string to make it understandable by a DBMS. The escape method is very common and replaces any
- * occurence of "'" with "\'" and "\" with "\\".
+ * occurence of "'" with "''" and "\" with "\\"
  */
 gchar *
 gda_default_escape_string (const gchar *string)
@@ -111,7 +111,12 @@
 	ret = g_new0 (gchar, size);
 	retptr = ret;
 	while (*ptr) {
-		if ((*ptr == '\'') || (*ptr == '\\')) {
+		if (*ptr == '\'') {
+			*retptr = '\'';
+			*(retptr+1) = *ptr;
+			retptr += 2;
+		}
+		else if (*ptr == '\\') {
 			*retptr = '\\';
 			*(retptr+1) = *ptr;
 			retptr += 2;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]