org.eclipse.datatools.modelbase.sql.query.util
Class SQLQuerySourceBuffer

java.lang.Object
  extended byorg.eclipse.datatools.modelbase.sql.query.util.SQLQuerySourceBuffer

public class SQLQuerySourceBuffer
extends java.lang.Object

Author:
ckadner TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Method Summary
 SQLQuerySourceBuffer append(char c)
           
 SQLQuerySourceBuffer append(int i)
           
 SQLQuerySourceBuffer append(java.lang.String sql)
           
 SQLQuerySourceBuffer appendIdentifier(java.lang.String ident)
           
 SQLQuerySourceBuffer appendKeyword(java.lang.String keyword, boolean optional)
           
 SQLQuerySourceBuffer appendOptional(char c)
           
 SQLQuerySourceBuffer appendWord(java.lang.String word, boolean optional, boolean ignoreCase)
           
 char charAt(int i)
           
 void insertConditionalLineBreak(SQLQueryObject context)
           
 int lastIndexOf(java.lang.String string)
           
 int length()
           
 SQLQuerySourceBuffer replace(int start, int end, java.lang.String str)
           
 void setIndent(SQLQueryObject context)
           
 void stripOriginalSourceCommentsAndBlanks_makeUpperCase_createIndexMapping()
          strips out the comments of a SQL statement that are identified by two dashes in line "--" and that are not part of a delimited character string (single quotes), or SQL delimited object name (double quotes).
 java.lang.String toString()
          returns a rather expensive snapshot of this SourceBuffer's content (non-Javadoc)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

append

public SQLQuerySourceBuffer append(java.lang.String sql)
Parameters:
sql -
Returns:

appendKeyword

public SQLQuerySourceBuffer appendKeyword(java.lang.String keyword,
                                          boolean optional)
Parameters:
keyword -
optional -
Returns:

appendIdentifier

public SQLQuerySourceBuffer appendIdentifier(java.lang.String ident)
Parameters:
ident -
Returns:

appendWord

public SQLQuerySourceBuffer appendWord(java.lang.String word,
                                       boolean optional,
                                       boolean ignoreCase)
Parameters:
word -
optional -
ignoreCase -
Returns:

append

public SQLQuerySourceBuffer append(char c)
Parameters:
c -
Returns:

appendOptional

public SQLQuerySourceBuffer appendOptional(char c)
Parameters:
c -
Returns:

length

public int length()
Returns:

replace

public SQLQuerySourceBuffer replace(int start,
                                    int end,
                                    java.lang.String str)
Parameters:
start -
end -
str -
Returns:

toString

public java.lang.String toString()
returns a rather expensive snapshot of this SourceBuffer's content (non-Javadoc)

See Also:
Object.toString()

stripOriginalSourceCommentsAndBlanks_makeUpperCase_createIndexMapping

public void stripOriginalSourceCommentsAndBlanks_makeUpperCase_createIndexMapping()
strips out the comments of a SQL statement that are identified by two dashes in line "--" and that are not part of a delimited character string (single quotes), or SQL delimited object name (double quotes).
NOTE: The given SQL statement string must contain the line-break characters to delimit the "--" comments, otherwise all of the SQL-Statement that comes after the first occurence of a "--" comment be treated as part of the comment and rather be ignored, moreover the resulting statement is likely to fail!

SELECT EMP_NUM FROM DEPARTEMENT -- pre-accumulated number of employees
WHERE LOCATION = 'C-Tower--01' OR LOCATION = 'C-Tower-02'

In this statement the first occurence of "--" would indicate a comment that would be stripped of and the second occurence would be retained, as it is part of a String delimited by the enclosing single quotes.

Returns:
The a SQL statement without "--" comments.

lastIndexOf

public int lastIndexOf(java.lang.String string)
Parameters:
string -
Returns:

charAt

public char charAt(int i)
Parameters:
i -
Returns:

append

public SQLQuerySourceBuffer append(int i)
Parameters:
i -

insertConditionalLineBreak

public void insertConditionalLineBreak(SQLQueryObject context)

setIndent

public void setIndent(SQLQueryObject context)


Copyright © 2006 Actuate, IBM Corporation, Sybase, Inc. and others. All rights reserved.