Java Doc for ScriptParser.java in  » Database-Client » SQL-Workbench » workbench » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » SQL Workbench » workbench.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   workbench.sql.ScriptParser

ScriptParser
public class ScriptParser implements Iterator(Code)
A class to parse a SQL script and return the individual commands in the script. The actual parsing is done by using an instance of IteratingScriptParser
author:
   support@sql-workbench.net



Constructor Summary
public  ScriptParser()
    
public  ScriptParser(String aScript)
     Create a ScriptParser for the given Script.
public  ScriptParser(int fileSize)
    
public  ScriptParser(File f)
     Initialize a ScriptParser from a file.
public  ScriptParser(File f, String encoding)
     Initialize a ScriptParser from a file.

Method Summary
public  voidallowEmptyLineAsSeparator(boolean flag)
    
public  voiddone()
    
public  intfindNextLineStart(int pos)
    
public  StringgetCommand(int index)
     Return the command at the given index position.
public  StringgetCommand(int index, boolean rightTrimCommand)
     Return the command at the given index position.
public  intgetCommandIndexAtCursorPos(int cursorPos)
     Return the command index for the command which is located at the given index of the current script.
public  StringgetDelimiterString()
    
public  intgetEndPosForCommand(int index)
    
public  intgetIndexInCommand(int commandIndex, int cursorPos)
     Return the index from the overall script mapped to the index inside the specified command.
public  IteratorgetIterator()
     Return an Iterator which allows to iterate over the commands from the script.
public  StringgetNextCommand()
     Return the next ScriptCommandDefinition from the script.
public  intgetSize()
    
public  intgetStartPosForCommand(int index)
    
public  booleanhasNext()
     Check if more commands are present.
public  Objectnext()
     Return the next SQL command from the script.
public  voidreadScriptFromFile(File f)
    
public  voidreadScriptFromFile(File f, String encoding)
    
public  voidremove()
     Not implemented, as removing commands is not possible.
public  voidsetAlternateDelimiter(DelimiterDefinition alt)
     Sets the alternate delimiter.
public  voidsetAlternateLineComment(String comment)
    
public  voidsetCheckEscapedQuotes(boolean flag)
     Check for quote characters that are escaped using a backslash.
public  voidsetCheckForSingleLineCommands(boolean flag)
    
public  voidsetDelimiter(DelimiterDefinition delim)
    
public  voidsetDelimiters(DelimiterDefinition defaultDelim, DelimiterDefinition alternateDelim)
     Define the delimiters to be used.
public  voidsetFile(File f)
    
public  voidsetFile(File f, String encoding)
     Define the source file for this ScriptParser.
public  voidsetReturnStartingWhitespace(boolean flag)
    
public  voidsetScript(String aScript)
     Define the script to be parsed.
public  voidsetSupportOracleInclude(boolean flag)
    
public  voidstartIterator()
    


Constructor Detail
ScriptParser
public ScriptParser()(Code)



ScriptParser
public ScriptParser(String aScript)(Code)
Create a ScriptParser for the given Script. The delimiter to be used will be evaluated dynamically



ScriptParser
public ScriptParser(int fileSize)(Code)
Create a ScriptParser The actual script needs to be specified with setScript() The delimiter will be evaluated dynamically



ScriptParser
public ScriptParser(File f) throws IOException(Code)
Initialize a ScriptParser from a file. The delimiter will be evaluated dynamically



ScriptParser
public ScriptParser(File f, String encoding) throws IOException(Code)
Initialize a ScriptParser from a file. The delimiter will be evaluated dynamically




Method Detail
allowEmptyLineAsSeparator
public void allowEmptyLineAsSeparator(boolean flag)(Code)



done
public void done()(Code)



findNextLineStart
public int findNextLineStart(int pos)(Code)
Find the position in the original script for the next start of line



getCommand
public String getCommand(int index)(Code)
Return the command at the given index position.



getCommand
public String getCommand(int index, boolean rightTrimCommand)(Code)
Return the command at the given index position.



getCommandIndexAtCursorPos
public int getCommandIndexAtCursorPos(int cursorPos)(Code)
Return the command index for the command which is located at the given index of the current script.



getDelimiterString
public String getDelimiterString()(Code)



getEndPosForCommand
public int getEndPosForCommand(int index)(Code)
Get the starting offset in the original script for the command indicated by index



getIndexInCommand
public int getIndexInCommand(int commandIndex, int cursorPos)(Code)
Return the index from the overall script mapped to the index inside the specified command. For a single command script scriptCursorLocation will be the same as the location inside the dedicated command.
Parameters:
  commandIndex - the index for the command to check
Parameters:
  cursorPos - the index in the overall script the relative index inside the command



getIterator
public Iterator getIterator()(Code)
Return an Iterator which allows to iterate over the commands from the script. The Iterator will return objects of type ScriptCommandDefinition



getNextCommand
public String getNextCommand() throws NoSuchElementException(Code)
Return the next ScriptCommandDefinition from the script.
throws:
  IllegalStateException - if the Iterator has not been initialized using ScriptParser.getIterator()
See Also:   IteratingScriptParser.getNextCommand
See Also:   ScriptParser.next()



getSize
public int getSize()(Code)



getStartPosForCommand
public int getStartPosForCommand(int index)(Code)
Get the starting offset in the original script for the command indicated by index



hasNext
public boolean hasNext()(Code)
Check if more commands are present.



next
public Object next() throws NoSuchElementException(Code)
Return the next SQL command from the script. This is delegated to ScriptParser.getNextCommand() a String object representing the SQL command
throws:
  IllegalStateException - if the Iterator has not been initialized using ScriptParser.getIterator()
See Also:   IteratingScriptParser.getNextCommand
See Also:   ScriptParser.getNextCommand()



readScriptFromFile
public void readScriptFromFile(File f) throws IOException(Code)



readScriptFromFile
public void readScriptFromFile(File f, String encoding) throws IOException(Code)



remove
public void remove()(Code)
Not implemented, as removing commands is not possible. A call to this method simply does nothing.



setAlternateDelimiter
public void setAlternateDelimiter(DelimiterDefinition alt)(Code)
Sets the alternate delimiter. This implies that by default the semicolon is used, and only if the alternate delimiter is detected, that will be used. If only one delimiter should be used (and no automatic checking for an alternate delimiter), use ScriptParser.setDelimiter(DelimiterDefinition)



setAlternateLineComment
public void setAlternateLineComment(String comment)(Code)



setCheckEscapedQuotes
public void setCheckEscapedQuotes(boolean flag)(Code)
Check for quote characters that are escaped using a backslash. If turned on (flag == true) the following SQL statement would be valid (different to the SQL standard):
INSERT INTO myTable (column1) VALUES ('Arthurs\'s house');
but the following Script would generate an error:
INSERT INTO myTable (file_path) VALUES ('c:\');
because the last quote would not bee seen as a closing quote



setCheckForSingleLineCommands
public void setCheckForSingleLineCommands(boolean flag)(Code)



setDelimiter
public void setDelimiter(DelimiterDefinition delim)(Code)



setDelimiters
public void setDelimiters(DelimiterDefinition defaultDelim, DelimiterDefinition alternateDelim)(Code)
Define the delimiters to be used. If the (in-memory) script ends with the defined alternate delimiter, then the alternate is used, otherwise the default



setFile
public void setFile(File f) throws IOException(Code)



setFile
public void setFile(File f, String encoding) throws IOException(Code)
Define the source file for this ScriptParser. Depending on the size the file might be read into memory or not



setReturnStartingWhitespace
public void setReturnStartingWhitespace(boolean flag)(Code)



setScript
public void setScript(String aScript)(Code)
Define the script to be parsed. The delimiter to be used will be checked automatically First the it will check if the script ends with the alternate delimiter if this is not the case, the script will be checked if it ends with GO If so, GO will be used (MS SQL Server script style) If none of the above is true, ; (semicolon) will be used



setSupportOracleInclude
public void setSupportOracleInclude(boolean flag)(Code)



startIterator
public void startIterator()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.