|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.util14.ConnectStringParser
public class ConnectStringParser
ConnectStringParser is a utility class that parses or creates a JDBC connect string according to the OLE DB connect string syntax described at OLE DB Connection String Syntax.
This code adapted from Mondrian code at Util.java.
The primary differences between this and its Mondrian progenitor are:
Properties
for compatibility with the JDBC API
(replaces Mondrian's use of its own order-preserving and case-insensitive
PropertyList, found in Util.java at link above)parse(java.lang.String)
a pre-existing Properties object into
which properties are to be parsed, possibly overriding prior valuesSQLException
s rather than unchecked RuntimeException
sConnectStringParser has a private constructor. Callers use the static members:
parse(String)
parse(String, Properties)
getParamString(Properties)
Field Summary | |
---|---|
private int |
i
|
private int |
n
|
private StringBuffer |
nameBuf
|
private String |
s
|
private StringBuffer |
valueBuf
|
Constructor Summary | |
---|---|
private |
ConnectStringParser(String s)
Creates a new connect string parser. |
Method Summary | |
---|---|
static String |
getParamString(Properties props)
Returns a param string, quoted and escaped as needed, to represent the supplied name-value pairs. |
(package private) Properties |
parse(Properties props)
Parses the connect string into a Properties object. |
static Properties |
parse(String s)
Parses the connect string into a new Properties object. |
static Properties |
parse(String s,
Properties props)
Parses the connect string into an existing Properties object. |
(package private) String |
parseName()
Reads "name=". |
(package private) void |
parsePair(Properties props)
Reads "name=value;" or "name=value |
(package private) String |
parseQuoted(char q)
Reads a string quoted by a given character. |
(package private) String |
parseValue()
Reads "value;" or "value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final String s
private final int n
private int i
private final StringBuffer nameBuf
private final StringBuffer valueBuf
Constructor Detail |
---|
private ConnectStringParser(String s)
s
- connect string to parseparse(String)
,
parse(String, Properties)
Method Detail |
---|
public static Properties parse(String s) throws SQLException
s
- connect string to parse
SQLException
- error parsing name-value pairspublic static Properties parse(String s, Properties props) throws SQLException
s
- connect string to parseprops
- optional properties object, may be null
props
was supplied, any duplicate properties will have been
replaced by those from the connect string.
SQLException
- error parsing name-value pairsProperties parse(Properties props) throws SQLException
props
- optional properties object, may be null
props
was supplied, any duplicate properties will have been
replaced by those from the connect string.
SQLException
- error parsing name-value pairsvoid parsePair(Properties props) throws SQLException
SQLException
- error parsing valueString parseName()
String parseValue() throws SQLException
SQLException
- if find an unterminated quoted valueString parseQuoted(char q) throws SQLException
parseQuoted('"')
reads "a ""new"" string"
and returns a "new"
string
.
SQLException
- if find an unterminated quoted valuepublic static String getParamString(Properties props)
props
- name-value pairs
null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |