|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttribble.util.SQLStrings
public abstract class SQLStrings
Utility methods for SQL string and token processing.
| Method Summary | |
|---|---|
static int |
getSQLToken(java.lang.String line,
int pos,
java.lang.StringBuffer tok)
Extract the next word token from an SQL-like expression. |
static java.lang.String[] |
splitSQL(java.lang.String line)
Split an SQL-like expression into separate word tokens. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int getSQLToken(java.lang.String line,
int pos,
java.lang.StringBuffer tok)
Words may be quoted by surrounding them with single quote (') or double quote (") characters. If a word contains either of these characters, it must be quoted, and the embedded quote characters must be preceded by a backslash character (\). (Embedded backslash characters should not be preceded by another backslash, however.)
Example
Consider the following input text line:
'Date 2' = "2001-10-01" & ID like '%\'s' & Rec.Size >= 100
0123456789_123456789_123456789_123456789_123456789_123456789_1
The line above contains the following word tokens at the string offsets
shown:
0: "'Date 2'"
9: "="
11: ""2001-10-01""
24: "&"
26: "ID"
29: "like"
34: "'%'s'"
41: "&"
46: "Rec"
49: "."
50: "Size"
55: ">="
58: "100"
line - A string containing one or more SQL expression word tokens separated by
whitespace.pos - Position within line where token parsing is to begin.tok - The text of the extracted word token is returned in this object.
splitSQL(java.lang.String)public static java.lang.String[] splitSQL(java.lang.String line)
Words may be quoted by surrounding them with single quote (') or double quote (") characters. If a word contains either of these characters, it must be quoted, and the embedded quote characters must be preceded by a backslash character (\). (Embedded backslash characters should not be preceded by another backslash, however.)
Example
Consider the following input text line:
'Date 2' = "2001-10-01" & ID like '%\'s' & Rec.Size >= 100
The line above is split into the following word tokens:
[0]: "'Date 2'"
[1]: "="
[2]: ""2001-10-01""
[3]: "&"
[4]: "ID"
[5]: "like"
[5]: "'%'s'"
[6]: "&"
[7]: "Rec"
[8]: "."
[9]: "Size"
[10]: ">="
[11]: "100"
line - A string containing one or more text tokens separated by whitespace.
getSQLToken(java.lang.String, int, java.lang.StringBuffer)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||