[teiid-commits] teiid SVN: r1752 - in trunk/adminshell/src/main: resources/commands and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Jan 19 15:21:16 EST 2010


Author: shawkins
Date: 2010-01-19 15:21:16 -0500 (Tue, 19 Jan 2010)
New Revision: 1752

Modified:
   trunk/adminshell/src/main/java/com/metamatrix/script/shell/ReaderInterceptor.java
   trunk/adminshell/src/main/resources/commands/mparse.bsh
Log:
TEIID-932 fix for adminshell parse handling of double quote characters.

Modified: trunk/adminshell/src/main/java/com/metamatrix/script/shell/ReaderInterceptor.java
===================================================================
--- trunk/adminshell/src/main/java/com/metamatrix/script/shell/ReaderInterceptor.java	2010-01-19 19:43:23 UTC (rev 1751)
+++ trunk/adminshell/src/main/java/com/metamatrix/script/shell/ReaderInterceptor.java	2010-01-19 20:21:16 UTC (rev 1752)
@@ -21,18 +21,13 @@
  */
 
 package com.metamatrix.script.shell;
-/*
- * Copyright � 2000-2005 MetaMatrix, Inc.
- * All rights reserved.
- */
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.Writer;
 
-import bsh.Interpreter;
-
 /** 
  * This class used in conjunction with BeanShell, to hijack the System.in
  * and write a wrapper on top it,so that any commands entered in its console
@@ -131,33 +126,5 @@
             }
         }
     }
-        
      
-    public static void main(String[] args) {
-        final String ls = System.getProperty("line.separator"); //$NON-NLS-1$
-        CustomParser p = new CustomParser() {
-            public String convert(String str) {
-                System.out.println(str);
-                if (str.matches("select .+|insert into.+|delete .+|update table .*|exec .+")){ //$NON-NLS-1$
-                    return "execute(\""+str.substring(0,str.length()-1)+"\");"+ls; //$NON-NLS-1$ //$NON-NLS-2$
-                }
-                return "foo:"+str+ls; //$NON-NLS-1$
-            }
-
-            public void setInterpreter(Interpreter i) {
-            }            
-        };
-        
-        BufferedReader i = new BufferedReader(new ReaderInterceptor(p, null));
-        
-        try {
-            String line = i.readLine();            
-            while(line != null) {
-                System.out.println(line); 
-                line = i.readLine();
-            }
-        } catch (IOException err) {
-            err.printStackTrace();
-        }
-    }
 }

Modified: trunk/adminshell/src/main/resources/commands/mparse.bsh
===================================================================
--- trunk/adminshell/src/main/resources/commands/mparse.bsh	2010-01-19 19:43:23 UTC (rev 1751)
+++ trunk/adminshell/src/main/resources/commands/mparse.bsh	2010-01-19 20:21:16 UTC (rev 1752)
@@ -1,5 +1,5 @@
 /**
- * A simple parser for MetaMatrix specific commands.
+ * A simple parser for specific commands.
  */
 String mparse() {    
     // mmstr is special variable set by the Input Interceptor. Just update
@@ -9,7 +9,7 @@
     boolean record = false;
     
     if (str.endsWith(";") && str.matches("(select|insert|delete|update|exec|create|drop)\\W.+")){ 
-        mmstr="execute(\""+orig_str.substring(0,orig_str.length()-1)+"\");";
+        mmstr="execute(\""+orig_str.substring(0,orig_str.length()-1).replaceAll("\"", "\\\\\"") +"\");";
         record = true;
     }
     else if (str.matches("(help|exit|quit|dir|pwd)\\(?\\)?")) {



More information about the teiid-commits mailing list