[libgda/LIBGDA_4.2] Correction for bug #663608
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_4.2] Correction for bug #663608
- Date: Sat, 19 Nov 2011 17:12:07 +0000 (UTC)
commit 28b1814302c0246a0f48c5efeecc416d84d3411e
Author: Vivien Malerba <malerba gnome-db org>
Date: Sat Nov 19 18:03:57 2011 +0100
Correction for bug #663608
libgda/sql-parser/gda-statement-struct-util.c | 15 ++++++++++++---
providers/postgres/gda-postgres-provider.c | 15 ++++++++++++---
2 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/libgda/sql-parser/gda-statement-struct-util.c b/libgda/sql-parser/gda-statement-struct-util.c
index 28458fa..8b4bb7d 100644
--- a/libgda/sql-parser/gda-statement-struct-util.c
+++ b/libgda/sql-parser/gda-statement-struct-util.c
@@ -86,7 +86,6 @@ _remove_quotes (gchar *str)
if ((delim != '\'') && (delim != '"'))
return str;
-
total = strlen (str);
if (str[total-1] == delim) {
/* string is correctly terminated by a double quote */
@@ -113,7 +112,17 @@ _remove_quotes (gchar *str)
return str;
}
}
- if (*ptr == '\\') {
+ else if (*ptr == '"') {
+ if (*(ptr+1) == '"') {
+ g_memmove (ptr+1, ptr+2, total - offset);
+ offset += 2;
+ }
+ else {
+ *str = 0;
+ return str;
+ }
+ }
+ else if (*ptr == '\\') {
if (*(ptr+1) == '\\') {
g_memmove (ptr+1, ptr+2, total - offset);
offset += 2;
@@ -165,7 +174,7 @@ gda_sql_identifier_add_quotes (const gchar *str)
*retval = '"';
for (rptr = retval+1, sptr = str; *sptr; sptr++, rptr++) {
if (*sptr == '"') {
- *rptr = '\\';
+ *rptr = '"';
rptr++;
*rptr = *sptr;
}
diff --git a/providers/postgres/gda-postgres-provider.c b/providers/postgres/gda-postgres-provider.c
index f8d01ca..36058ad 100644
--- a/providers/postgres/gda-postgres-provider.c
+++ b/providers/postgres/gda-postgres-provider.c
@@ -2417,7 +2417,7 @@ identifier_add_quotes (const gchar *str)
*retval = '"';
for (rptr = retval+1, sptr = str; *sptr; sptr++, rptr++) {
if (*sptr == '"') {
- *rptr = '\\';
+ *rptr = '"';
rptr++;
*rptr = *sptr;
}
@@ -2468,7 +2468,6 @@ pg_remove_quotes (gchar *str)
if ((delim != '\'') && (delim != '"'))
return str;
-
total = strlen (str);
if (str[total-1] == delim) {
/* string is correctly terminated */
@@ -2495,7 +2494,17 @@ pg_remove_quotes (gchar *str)
return str;
}
}
- if (*ptr == '\\') {
+ else if (*ptr == '"') {
+ if (*(ptr+1) == '"') {
+ g_memmove (ptr+1, ptr+2, total - offset);
+ offset += 2;
+ }
+ else {
+ *str = 0;
+ return str;
+ }
+ }
+ else if (*ptr == '\\') {
if (*(ptr+1) == '\\') {
g_memmove (ptr+1, ptr+2, total - offset);
offset += 2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]