Methods Summary |
---|
public boolean | acceptsURL(java.lang.String url)
if (traceOn()) {
trace("@acceptsURL (url=" + url + ")");
}
boolean rc = false;
// Get the subname from the url. If the url is not valid for
// this driver, a null will be returned.
if (getSubname(url) != null) {
rc = true;
}
if (traceOn()) {
trace(" " + rc);
}
return rc;
|
public java.sql.Connection | connect(java.lang.String url, java.util.Properties info)
if (traceOn()) {
trace("@connect (url=" + url + ")");
}
// Ensure that we can understand the given url
if (!acceptsURL(url)) {
return null;
}
// Set the url for the driver
driverURL = url;
// For typical JDBC drivers, it would be appropriate to check
// for a secure environment before connecting, and deny access
// to the driver if it is deemed to be unsecure. For the
// SimpleText driver, if the environment is not secure we will
// turn into a read-only driver.
// Create a new SimpleTextConnection object
SimpleTextConnection con = new SimpleTextConnection();
// Initialize the new object
con.initialize (this, info);
return con;
|
public int | getMajorVersion()
return SimpleTextDefine.MAJOR_VERSION;
|
public int | getMinorVersion()
return SimpleTextDefine.MINOR_VERSION;
|
public java.sql.DriverPropertyInfo[] | getPropertyInfo(java.lang.String url, java.util.Properties info)
DriverPropertyInfo prop[];
// Only one property required for the SimpleText driver; the
// directory. Check the property list coming in. If the
// directory is specified, return an empty list.
if (info.getProperty("Directory") == null) {
// Setup the DriverPropertyInfo entry
prop = new DriverPropertyInfo[1];
prop[0] = new DriverPropertyInfo("Directory", null);
prop[0].description = "Initial text file directory";
prop[0].required = false;
}
else {
// Create an empty list
prop = new DriverPropertyInfo[0];
}
return prop;
|
public java.lang.String | getSubname()
return getSubname(driverURL);
|
public java.lang.String | getSubname(java.lang.String url)
String subname = null;
String protocol = "JDBC";
String subProtocol = "SIMPLETEXT";
// Convert to upper case and trim all leading and trailing
// blanks
url = (url.toUpperCase()).trim();
// Make sure the protocol is jdbc:
if (url.startsWith(protocol)) {
// Strip off the protocol
url = url.substring (protocol.length());
// Look for the colon
if (url.startsWith(":")) {
url = url.substring(1);
// Check the subprotocol
if (url.startsWith (subProtocol)) {
// Strip off the subprotocol, leaving the subname
url = url.substring(subProtocol.length());
// Look for the colon that separates the subname
// from the subprotocol (or the fact that there
// is no subprotocol at all)
if (url.startsWith(":")) {
subname = url.substring(1);
}
else if (url.length() == 0) {
subname = "";
}
}
}
}
return subname;
|
public java.lang.String | getURL()
return driverURL;
|
public boolean | jdbcCompliant()
// The SimpleText driver is not JDBC compliant
return false;
|