introduced IConstant.DEBUG flag
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / sql / SQLParser.java
index 1f9a19b..fc31429 100644 (file)
@@ -2,42 +2,45 @@ package net.sourceforge.phpdt.sql.sql;
 
 import java.util.Vector;
 
+import net.sourceforge.phpdt.sql.IConstants;
 import net.sourceforge.phpdt.sql.parser.SQLLexx;
 import net.sourceforge.phpdt.sql.parser.Token;
 
-public class SQLParser {
-       public static final String COMMENT = "--";
-       public static final String ENDLINE = ";";
-       public static Vector parse(String query) {
-                       Vector commands = new Vector();
-               try {
-               //System.out.println("-------------------1");
-                       Vector tokens = SQLLexx.parse(query);
-               //System.out.println("-------------------2");
-                       StringBuffer buffer = new StringBuffer();
-                       for (int i = 0; i < tokens.size(); i++) {
-               //System.out.println("-------------------3");
-                               Token t = (Token) tokens.elementAt(i);
-                               if (t.getType() == t.COMMENT) {
-                                       // ignore comments
-                               } else if (t.getType() == t.SEPARATOR) {
-                                       String newCommand = buffer.toString().trim();
-                                       if (!newCommand.equals("")) {
-                                               commands.addElement(newCommand);
-                                       }
-                                       buffer = new StringBuffer();
-                               } else {
-                                       buffer.append(t.getValue());
-                               }
-                       }
-                       String newCommand = buffer.toString().trim();
-                       if (!newCommand.equals("")) {
-                               commands.addElement(newCommand);
-                       }
-               } catch (Throwable e) {
-                       e.printStackTrace();
-               }
-               System.out.println("Returning");
-                       return commands;
-       }
+public class SQLParser implements IConstants {
+  public static final String COMMENT = "--";
+  public static final String ENDLINE = ";";
+  public static Vector parse(String query) {
+    Vector commands = new Vector();
+    try {
+      //System.out.println("-------------------1");
+      Vector tokens = SQLLexx.parse(query);
+      //System.out.println("-------------------2");
+      StringBuffer buffer = new StringBuffer();
+      for (int i = 0; i < tokens.size(); i++) {
+        //System.out.println("-------------------3");
+        Token t = (Token) tokens.elementAt(i);
+        if (t.getType() == t.COMMENT) {
+          // ignore comments
+        } else if (t.getType() == t.SEPARATOR) {
+          String newCommand = buffer.toString().trim();
+          if (!newCommand.equals("")) {
+            commands.addElement(newCommand);
+          }
+          buffer = new StringBuffer();
+        } else {
+          buffer.append(t.getValue());
+        }
+      }
+      String newCommand = buffer.toString().trim();
+      if (!newCommand.equals("")) {
+        commands.addElement(newCommand);
+      }
+    } catch (Throwable e) {
+      e.printStackTrace();
+    }
+    if (DEBUG) {
+      System.out.println("Returning");
+    }
+    return commands;
+  }
 }
\ No newline at end of file