Java Doc for SqlUtil.java in  » Database-Client » SQL-Workbench » workbench » util » 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.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   workbench.util.SqlUtil

SqlUtil
public class SqlUtil (Code)
Methods for manipulating and analyzing SQL statements.


Field Summary
final public static  Set<String>JOIN_KEYWORDS
    


Method Summary
public static  StringbuildExpression(WbConnection conn, String catalog, String schema, String name)
    
public static  voidcloseAll(ResultSet rs, Statement stmt)
    
public static  voidcloseResult(ResultSet rs)
    
public static  voidcloseStatement(Statement stmt)
    
public static  StringgetCreateType(CharSequence sql)
     Returns the type that is beeing created e.g.
public static  StringgetDeleteTable(CharSequence sql)
    
public static  StringgetFromPart(String sql)
     Extract the FROM part of a SQL statement.
public static  intgetFromPosition(String sql)
    
public static  StringgetInsertTable(CharSequence sql)
     If the given SQL is an INSERT INTO...
public static  intgetKeywordPosition(String keyword, CharSequence sql)
    
public static  intgetKeywordPosition(Set<String> keywords, CharSequence sql)
    
public static  ResultInfogetResultInfoFromQuery(String sql, WbConnection conn)
    
public static  List<ColumnIdentifier>getResultSetColumns(String sql, WbConnection conn)
     Returns the columns for the result set defined by the passed query.
public static  List<String>getSelectColumns(String select, boolean includeAlias)
     Parse the given SQL SELECT query and return the columns defined in the column list.
public static  StringgetSqlTypeDisplay(String aTypeName, int sqlType, int size, int digits)
     Construct the SQL display name for the given SQL datatype.
public static  StringgetSqlVerb(CharSequence sql)
     Returns the SQL Verb for the given SQL string.
public static  ListgetTables(String aSql)
    
public static  List<String>getTables(String sql, boolean includeAlias)
     Returns a List of tables defined in the SQL query.
final public static  StringgetTypeName(int aSqlType)
    
public static  StringgetUpdateTable(CharSequence sql)
    
public static  CharSequencegetWarnings(WbConnection con, Statement stmt)
    
public static  intgetWherePosition(String sql)
    
final public static  booleanisBlobType(int aSqlType)
    
final public static  booleanisCharacterType(int aSqlType)
    
final public static  booleanisClobType(int aSqlType)
    
final public static  booleanisClobType(int aSqlType, DbSettings dbInfo)
    
final public static  booleanisDateType(int aSqlType)
    
final public static  booleanisDecimalType(int aSqlType, int aScale, int aPrecision)
    
final public static  booleanisIntegerType(int aSqlType)
    
final public static  booleanisNumberType(int aSqlType)
    
final public static  booleanisStringType(int aSqlType)
     Returns true if the given JDBC type maps to the String class.
public static  StringmakeCleanSql(String aSql, boolean keepNewlines)
    
public static  StringmakeCleanSql(String aSql, boolean keepNewlines, char quote)
    
public static  StringmakeCleanSql(String aSql, boolean keepNewlines, boolean keepComments, char quote)
    
public static  StringquoteObjectname(String object)
    
public static  StringquoteObjectname(String aColname, boolean quoteAlways)
    
public static  StringstripVerb(String sql)
     Removes the SQL verb of this command.
public static  StringstriptColumnAlias(String expression)
    

Field Detail
JOIN_KEYWORDS
final public static Set<String> JOIN_KEYWORDS(Code)





Method Detail
buildExpression
public static String buildExpression(WbConnection conn, String catalog, String schema, String name)(Code)



closeAll
public static void closeAll(ResultSet rs, Statement stmt)(Code)
Convenience method to close a ResultSet and a Statement without a possible SQLException



closeResult
public static void closeResult(ResultSet rs)(Code)
Convenience method to close a ResultSet without a possible SQLException



closeStatement
public static void closeStatement(Statement stmt)(Code)
Convenience method to close a Statement without a possible SQLException



getCreateType
public static String getCreateType(CharSequence sql)(Code)
Returns the type that is beeing created e.g. TABLE, VIEW, PROCEDURE



getDeleteTable
public static String getDeleteTable(CharSequence sql)(Code)
If the given SQL is a DELETE [FROM] returns the table from which rows will be deleted



getFromPart
public static String getFromPart(String sql)(Code)
Extract the FROM part of a SQL statement. That is anything after the FROM up to (but not including) the WHERE, GROUP BY, ORDER BY, whichever comes first



getFromPosition
public static int getFromPosition(String sql)(Code)
Return the position of the FROM keyword in the given SQL



getInsertTable
public static String getInsertTable(CharSequence sql)(Code)
If the given SQL is an INSERT INTO... returns the target table, otherwise null



getKeywordPosition
public static int getKeywordPosition(String keyword, CharSequence sql)(Code)



getKeywordPosition
public static int getKeywordPosition(Set<String> keywords, CharSequence sql)(Code)



getResultInfoFromQuery
public static ResultInfo getResultInfoFromQuery(String sql, WbConnection conn) throws SQLException(Code)



getResultSetColumns
public static List<ColumnIdentifier> getResultSetColumns(String sql, WbConnection conn) throws SQLException(Code)
Returns the columns for the result set defined by the passed query. This method will actually execute the given SQL query, but will not retrieve any rows (using setMaxRows(1).



getSelectColumns
public static List<String> getSelectColumns(String select, boolean includeAlias)(Code)
Parse the given SQL SELECT query and return the columns defined in the column list. If the SQL string does not start with SELECT returns an empty List
Parameters:
  select - the SQL String to parse
Parameters:
  includeAlias - if false, the "raw" column names will be returned, otherwisethe column name including the alias (e.g. "p.name AS person_name" a List of String objecs.



getSqlTypeDisplay
public static String getSqlTypeDisplay(String aTypeName, int sqlType, int size, int digits)(Code)
Construct the SQL display name for the given SQL datatype. This is used when re-recreating the source for a table



getSqlVerb
public static String getSqlVerb(CharSequence sql)(Code)
Returns the SQL Verb for the given SQL string.



getTables
public static List getTables(String aSql)(Code)



getTables
public static List<String> getTables(String sql, boolean includeAlias)(Code)
Returns a List of tables defined in the SQL query. If the query is not a SELECT query the result is undefined



getTypeName
final public static String getTypeName(int aSqlType)(Code)



getUpdateTable
public static String getUpdateTable(CharSequence sql)(Code)
If the given SQL command is an UPDATE command, return the table that is updated, otherwise return null;



getWarnings
public static CharSequence getWarnings(WbConnection con, Statement stmt)(Code)



getWherePosition
public static int getWherePosition(String sql)(Code)



isBlobType
final public static boolean isBlobType(int aSqlType)(Code)



isCharacterType
final public static boolean isCharacterType(int aSqlType)(Code)
Returns true if the given JDBC type indicates some kind of character data (including CLOBs)



isClobType
final public static boolean isClobType(int aSqlType)(Code)



isClobType
final public static boolean isClobType(int aSqlType, DbSettings dbInfo)(Code)



isDateType
final public static boolean isDateType(int aSqlType)(Code)



isDecimalType
final public static boolean isDecimalType(int aSqlType, int aScale, int aPrecision)(Code)
returns true if the passed data type (from java.sql.Types) indicates a data type which can hold numeric values with decimals



isIntegerType
final public static boolean isIntegerType(int aSqlType)(Code)
returns true if the passed JDBC data type (from java.sql.Types) indicates a data type which maps to a integer type



isNumberType
final public static boolean isNumberType(int aSqlType)(Code)
Returns true if the passed datatype (from java.sql.Types) can hold a numeric value (either with or without decimals)



isStringType
final public static boolean isStringType(int aSqlType)(Code)
Returns true if the given JDBC type maps to the String class. This returns fals for CLOB data.



makeCleanSql
public static String makeCleanSql(String aSql, boolean keepNewlines)(Code)



makeCleanSql
public static String makeCleanSql(String aSql, boolean keepNewlines, char quote)(Code)



makeCleanSql
public static String makeCleanSql(String aSql, boolean keepNewlines, boolean keepComments, char quote)(Code)
Replaces all white space characters with ' ' (But not inside string literals) and removes -- style and Java style comments
Parameters:
  aSql - The sql script to "clean out"
Parameters:
  keepNewlines - if true, newline characters (\n) are kept
Parameters:
  keepComments - if true, comments (single line, block comments) are kept
Parameters:
  quote - The quote character String



quoteObjectname
public static String quoteObjectname(String object)(Code)



quoteObjectname
public static String quoteObjectname(String aColname, boolean quoteAlways)(Code)



stripVerb
public static String stripVerb(String sql)(Code)
Removes the SQL verb of this command. The verb is defined as the first "word" in the SQL string that is not a comment.
See Also:   SqlUtil.getSqlVerb(CharSequence)



striptColumnAlias
public static String striptColumnAlias(String expression)(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.