Log Message:
-----------
qtIdent checks keywords

Modified Files:
--------------
    pgadmin3/src/utils:
        misc.cpp (r1.54 -> r1.55)

Index: misc.cpp
===================================================================
RCS file: /projects/pgadmin3/src/utils/misc.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -Lsrc/utils/misc.cpp -Lsrc/utils/misc.cpp -u -w -r1.54 -r1.55
--- src/utils/misc.cpp
+++ src/utils/misc.cpp
@@ -249,41 +249,40 @@
 wxString qtIdent(const wxString& value)
 {
     wxString result = value;
+    bool needQuoting=false;
     
     if (result.Length() == 0)
         return result;
 
     int pos = 0;
 
-#if 0
-    if (ScanKeywordLookup(value.ToAscii()))
-    {
-        result.Append(wxT("\""));
-        result.Prepend(wxT("\""));
-        return result;
-    }
-#endif
     // Replace Double Quotes
     result.Replace(wxT("\""), wxT("\"\""));
        
     // Is it a number?
-    if (result.IsNumber()) {
-        result.Append(wxT("\""));
-        result.Prepend(wxT("\""));
-        return result;
-    } else {
-        while (pos < (int)result.length()) {
+    if (result.IsNumber()) 
+        needQuoting = true;
+    else
+    {
+        while (pos < (int)result.length())
+        {
             if (!((result.GetChar(pos) >= '0') && (result.GetChar(pos) <= '9')) && 
                 !((result.GetChar(pos)  >= 'a') && (result.GetChar(pos)  <= 'z')) && 
-                !(result.GetChar(pos)  == '_')){
-            
-                result.Append(wxT("\""));
-                result.Prepend(wxT("\""));
-                return result; 
+                !(result.GetChar(pos)  == '_'))
+            {
+                needQuoting = true;
+                break;
             }
             pos++;
         }
     }  
+
+    if (!needQuoting && ScanKeywordLookup(value.ToAscii()))
+        needQuoting = true;
+
+    if (needQuoting)
+        return wxT("\"") + result + wxT("\"");
+    else
     return result;
 }
 
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to