import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
-import java.io.PrintWriter;
import java.io.Reader;
-import java.io.StringWriter;
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Hashtable;
+import java.util.List;
import java.util.Properties;
+import java.util.StringTokenizer;
import java.util.Vector;
-import net.sourceforge.phpdt.sql.adapters.AdapterFactory;
-import net.sourceforge.phpdt.sql.adapters.DatabaseAdapter;
-import net.sourceforge.phpdt.sql.adapters.NoSuchAdapterException;
+import org.apache.xml.utils.IntVector;
+
import net.sourceforge.phpdt.sql.bookmarks.Bookmark;
+import net.sourceforge.phpdt.sql.sql.metadata.MetaDataJDBCInterface;
+import net.sourceforge.phpdt.sql.sql.metadata.ObjectMetaData;
import net.sourceforge.phpdt.sql.view.LogProxy;
+import net.sourceforge.phpdt.sql.view.bookmark.TableNode;
+import net.sourceforge.phpdt.sql.view.bookmark.TreeNode;
-public class MultiSQLServer extends Thread {
+/**
+ *
+ * MultiSQLServer is a Singleton, used as a interface with the sql drivers
+ * Use MultiSQLServer.getInstance() to get the object
+ */
+public class MultiSQLServer implements ConnectionEstablisher {
private static final int STREAM = 1024 * 2;
- public static final String USERNAME = "user";
- public static final String PASSWORD = "password";
+ public static final String USERNAME = "user"; //$NON-NLS-1$
+ public static final String PASSWORD = "password"; //$NON-NLS-1$
private static MultiSQLServer instance = null;
private Hashtable classLoaderCache = new Hashtable();
- private Connection con = null;
boolean running = true;
- private Bookmark current = null;
- private MultiSQLServer() {
+
+ public MultiSQLServer() {
//start();
}
public synchronized static MultiSQLServer getInstance() {
}
return instance;
}
- public Bookmark getConnected() {
- return current;
- }
- public void commit() {
+ public void commit(Connection con) {
LogProxy log = LogProxy.getInstance();
try {
con.commit();
} catch (SQLException e) {
- log.addText(log.ERROR, "Error commiting: " + e);
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
+ log.addText(LogProxy.ERROR, "Error commiting: " + e, e); //$NON-NLS-1$
}
}
- public void rollback() {
+ public void rollback(Connection con) {
LogProxy log = LogProxy.getInstance();
try {
con.rollback();
} catch (SQLException e) {
- log.addText(log.ERROR, "Error rolling back: " + e);
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
+ log.addText(LogProxy.ERROR, "Error rolling back: " + e, e); //$NON-NLS-1$
}
}
- public void setAutoCommit(boolean enabled) {
+ public void setAutoCommit(Connection con, boolean enabled) {
LogProxy log = LogProxy.getInstance();
try {
if (con != null) {
con.setAutoCommit(enabled);
} else {
- log.addText(log.ERROR, "Please connect before setting autocommit");
+ log.addText(LogProxy.ERROR, "Please connect before setting autocommit"); //$NON-NLS-1$
}
} catch (SQLException e) {
- log.addText(log.ERROR, "Error setting autocommit: " + e);
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
+ log.addText(LogProxy.ERROR, "Error setting autocommit: " + e, e); //$NON-NLS-1$
}
}
- public DatabaseAdapter getCurrentAdapter() {
+ public void disconnect(Bookmark b, Connection con) {
LogProxy log = LogProxy.getInstance();
try {
- AdapterFactory factory = AdapterFactory.getInstance();
- return factory.getAdapter(current.getType());
- } catch (NoSuchAdapterException e) {
- log.addText(log.ERROR, "Invalid database type: ->" + current.getType() + "<-");
- }
- return null;
- }
- public void disconnect(Bookmark b) {
- current = null;
- LogProxy log = LogProxy.getInstance();
-
- try {
con.close();
- con = null;
- log.addText(log.RESULTS, "Disconnected from: " + b.getName());
+ b.setConnection(null);
+ log.addText(LogProxy.RESULTS, "Disconnected from: " + b.getName()); //$NON-NLS-1$
} catch (Exception e) {
log.addText(
- log.ERROR,
- "Error Disonnecting to: " + b.getName() + ":" + e.toString());
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
-
- }
- }
- public void shutdown() {
- LogProxy log = LogProxy.getInstance();
- try {
- if (con != null) {
- con.close();
- }
- con = null;
- } catch (SQLException e) {
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
+ LogProxy.ERROR,
+ "Error Disonnecting to: " + b.getName() + ":" + e.toString(), e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
- public void dumpDatabaseData() {
+ public void dumpDatabaseData(Connection con) {
LogProxy log = LogProxy.getInstance();
try {
- DatabaseMetaData metadata = con.getMetaData();
- log.addText(log.WARNING, "[METADATA] Database type: " + metadata.getDatabaseProductName());
- if (metadata.supportsCatalogsInDataManipulation()) {
- log.addText(log.WARNING, "[METADATA] Database does support catalog in data manipulation");
+ DatabaseMetaData meta = con.getMetaData();
+ log.addText(LogProxy.WARNING, "[METADATA] Database type: " + meta.getDatabaseProductName()); //$NON-NLS-1$
+ if (meta.supportsCatalogsInDataManipulation()) {
+ log.addText(LogProxy.WARNING, "[METADATA] Database does support catalog in data manipulation"); //$NON-NLS-1$
} else {
- log.addText(log.WARNING, "[METADATA] Database does not support catalog in data manipulation");
+ log.addText(LogProxy.WARNING, "[METADATA] Database does not support catalog in data manipulation"); //$NON-NLS-1$
}
- if (metadata.supportsSchemasInDataManipulation()) {
- log.addText(log.WARNING, "[METADATA] Database does support schema in data manipulation");
+ if (meta.supportsSchemasInDataManipulation()) {
+ log.addText(LogProxy.WARNING, "[METADATA] Database does support schema in data manipulation"); //$NON-NLS-1$
} else {
- log.addText(log.WARNING, "[METADATA] Database does not support schema in data manipulation");
+ log.addText(LogProxy.WARNING, "[METADATA] Database does not support schema in data manipulation"); //$NON-NLS-1$
}
- if (metadata.supportsCatalogsInTableDefinitions()) {
- log.addText(log.WARNING, "[METADATA] Database does support catalogs in table definitions");
+ if (meta.supportsCatalogsInTableDefinitions()) {
+ log.addText(LogProxy.WARNING, "[METADATA] Database does support catalogs in table definitions"); //$NON-NLS-1$
} else {
- log.addText(log.WARNING, "[METADATA] Database does not support catalogs in table definitions");
+ log.addText(LogProxy.WARNING, "[METADATA] Database does not support catalogs in table definitions"); //$NON-NLS-1$
}
- log.addText(log.WARNING, "[METADATA] Catalog Separator: " + metadata.getCatalogSeparator());
- log.addText(log.WARNING, "[METADATA] Catalog Term: " + metadata.getCatalogTerm());
- ResultSet set = metadata.getCatalogs();
+ log.addText(LogProxy.WARNING, "[METADATA] Catalog Separator: " + meta.getCatalogSeparator()); //$NON-NLS-1$
+ log.addText(LogProxy.WARNING, "[METADATA] Catalog Term: " + meta.getCatalogTerm()); //$NON-NLS-1$
+ ResultSet set = meta.getCatalogs();
ArrayList catalogList = new ArrayList();
catalogList.add(null);
while (set.next()) {
}
set.close();
StringBuffer catalogOutput = new StringBuffer();
- catalogOutput.append("[CATALOG LIST] [");
+ catalogOutput.append("[CATALOG LIST] ["); //$NON-NLS-1$
for (int i = 0; i < catalogList.size(); i++) {
String name = (String) catalogList.get(i);
- catalogOutput.append(name + ", ");
+ catalogOutput.append(name + ", "); //$NON-NLS-1$
}
- catalogOutput.append("]");
- log.addText(log.WARNING, catalogOutput.toString());
+ catalogOutput.append("]"); //$NON-NLS-1$
+ log.addText(LogProxy.WARNING, catalogOutput.toString());
- set = metadata.getSchemas();
+ set = meta.getSchemas();
ArrayList schemaList = new ArrayList();
- schemaList.add("");
+ schemaList.add(""); //$NON-NLS-1$
while (set.next()) {
schemaList.add(set.getString(1));
}
set.close();
StringBuffer schemaOutput = new StringBuffer();
- schemaOutput.append("[SCHEMA LIST] [");
+ schemaOutput.append("[SCHEMA LIST] ["); //$NON-NLS-1$
for (int i = 0; i < schemaList.size(); i++) {
String name = (String) schemaList.get(i);
- schemaOutput.append(name + ", ");
+ schemaOutput.append(name + ", "); //$NON-NLS-1$
}
- schemaOutput.append("]");
- log.addText(log.WARNING, schemaOutput.toString());
+ schemaOutput.append("]"); //$NON-NLS-1$
+ log.addText(LogProxy.WARNING, schemaOutput.toString());
- ArrayList tableTypes = new ArrayList();
- set = metadata.getTableTypes();
- while (set.next()) {
- tableTypes.add(set.getString(1));
- }
- set.close();
+ List tableTypes = getTableTypes(meta);
StringBuffer tableListOutput = new StringBuffer();
- tableListOutput.append("[TABLE LIST] [");
+ tableListOutput.append("[TABLE LIST] ["); //$NON-NLS-1$
for (int i = 0; i < tableTypes.size(); i++) {
String name = (String) tableTypes.get(i);
- tableListOutput.append(name + ", ");
+ tableListOutput.append(name + ", "); //$NON-NLS-1$
}
- tableListOutput.append("]");
- log.addText(log.WARNING, tableListOutput.toString());
+ tableListOutput.append("]"); //$NON-NLS-1$
+ log.addText(LogProxy.WARNING, tableListOutput.toString());
} catch (Exception e) {
- log.addText(log.ERROR, "Error occured: " + e);
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
+ log.addText(LogProxy.ERROR, e);
}
}
+ private List getTableTypes(DatabaseMetaData meta) throws SQLException {
+ ArrayList tableTypes = new ArrayList();
+ ResultSet set = meta.getTableTypes();
+ while (set.next()) {
+ String type = set.getString(1);
+ if (type != null) {
+ tableTypes.add(type.trim());
+ }
+ }
+ set.close();
+ return tableTypes;
+ }
+// /**
+// * @param con
+// * @param schema
+// * @param type of the element "TABLE", "VIEW", "SEQUENCE"
+// * @return
+// */
+// public Vector listElements(Connection con, String schema, String type) {
+// LogProxy log = LogProxy.getInstance();
+// Vector retVal = new Vector(50,5);
+// log.addText(LogProxy.QUERY, "Retrieving list [" + type + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+// try {
+// DatabaseMetaData meta = con.getMetaData();
+// List types = getTableTypes(meta);
+// if (types.contains(type)) {
+// ResultSet set = meta.getTables(
+// null, null, "%", new String[] {type}); //$NON-NLS-1$
+// while (set.next()) {
+// String tableSchema = set.getString("TABLE_SCHEM");
+// tableSchema = (tableSchema == null) ? "" : tableSchema.trim();
+// String tableName = set.getString("TABLE_NAME").trim(); //$NON-NLS-1$
+// if (tableName.length() > 0)
+// retVal.addElement(((tableSchema.length() > 0) ? tableSchema + "." : "") + tableName);
+// }
+// set.close();
+// }
+// log.addText(LogProxy.RESULTS, "Success"); //$NON-NLS-1$
+//
+// } catch (SQLException e) {
+// log.addText(LogProxy.ERROR, e);
+// }
+// return retVal;
+// }
+
/**
- * type = "TABLE" "VIEW" "SEQUENCE"
+ * Makes a connection to a JDBC driver based on the data from a bookmark
+ * @param b The Bookmark with the data needed to make the connection
+ * @return The Connection object if everything went OK
*/
- public Vector listTables(String schema, String type) {
+ public Connection connect(Bookmark b) {
+ Connection con;
LogProxy log = LogProxy.getInstance();
- Vector retVal = new Vector();
- log.addText(log.QUERY, "Retrieving list [" + type + "]");
- try {
- DatabaseMetaData meta = con.getMetaData();
- ResultSet set = meta.getTableTypes();
- int columnCount = set.getMetaData().getColumnCount();
- for (int i = 1; i <= columnCount; i++) {
- System.out.print(set.getMetaData().getColumnName(i) + "\t");
- }
- System.out.println();
- while (set.next()) {
- for (int i = 1; i <= columnCount; i++) {
- System.out.print(set.getString(i) + "\t");
- }
- System.out.println();
- }
- Vector types = new Vector();
- set = meta.getTableTypes();
- while (set.next()) {
- types.add(set.getString(1));
- }
- set.close();
- if (types.contains(type)) {
- set = meta.getTables(null, schema, "%", new String[] {type});
- while (set.next()) {
- String name = set.getString("TABLE_NAME");
- String tableType = set.getString("TABLE_TYPE");
- //System.out.println(name + ":" + tableType);
- retVal.addElement(name);
- }
- set.close();
- }
- log.addText(log.RESULTS, "Success");
- } catch (SQLException e) {
- log.addText(log.ERROR, "Error occured: " + e);
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
- }
- return retVal;
- }
- public boolean connect(Bookmark b) {
- LogProxy log = LogProxy.getInstance();
- log.addText(log.QUERY, "Connecting to: " + b.getName());
+ log.addText(LogProxy.QUERY, "Connecting to: " + b.getName()); //$NON-NLS-1$
URL urls[] = new URL[1];
try {
String driverFile = b.getDriverFile();
urls[0] = new File(driverFile).toURL();
loader = new URLClassLoader(urls);
classLoaderCache.put(driverFile, loader);
- System.out.println("Creating new classloader");
+ System.out.println("Creating new classloader"); //$NON-NLS-1$
} else {
- System.out.println("Using classloader in cache");
+ System.out.println("Using classloader in cache"); //$NON-NLS-1$
}
Class driverClass = loader.loadClass(b.getDriver());
Driver driver = (Driver) driverClass.newInstance();
props.put(PASSWORD, b.getPassword());
con = driver.connect(b.getConnect(), props);
if (con == null) {
- throw new Exception("Error: Driver returned a null connection: " + b.toString());
+ throw new Exception("Error: Driver returned a null connection: " + b.toString()); //$NON-NLS-1$
}
- current = b;
- log.addText(log.RESULTS, "Connected to: " + b.getName());
- System.out.println("Connected");
- return true;
+ log.addText(LogProxy.RESULTS, "Connected to: " + b.getName()); //$NON-NLS-1$
+ System.out.println("Connected"); //$NON-NLS-1$
+ return con;
} catch (Exception e) {
- log.addText(
- log.ERROR,
- "Error Connecting to: " + b.getName() + ":" + e.toString());
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
+ //log.addText(
+ // LogProxy.ERROR,
+ // "Error Connecting to: " + b.getName() + ":" + e.toString(), e); //$NON-NLS-1$ //$NON-NLS-2$
}
- return false;
+ return null;
}
- public SQLResults execute(String s) {
- return execute(s, -1, -1);
+ public SQLResults execute(Connection con, String s) {
+ return execute(con, s, -1, -1);
}
- public SQLResults execute(String s, int startRow, int endRow) {
- return execute(s, -1, -1, Integer.MAX_VALUE);
+ public SQLResults execute(Connection con, String s, int startRow, int endRow) {
+ return execute(con, s, -1, -1, Integer.MAX_VALUE);
}
- public SQLResults execute(String s, int startRow, int endRow, int maxLength) {
- return execute(s, startRow, endRow, maxLength, "");
+ public SQLResults execute(Connection con, String s, int startRow, int endRow, int maxLength) {
+ return execute(con, s, startRow, endRow, maxLength, ""); //$NON-NLS-1$
}
- public SQLResults execute(String s, int startRow, int endRow, int maxLength, String encoding) {
+ public SQLResults execute(Connection con, String s, int startRow, int endRow, int maxLength, String encoding) {
SQLResults results = new SQLResults();
- System.out.println("Executing");
+ System.out.println("Executing"); //$NON-NLS-1$
LogProxy log = LogProxy.getInstance();
- log.addText(log.QUERY, "Executing Request [" + s + "]");
+ log.addText(LogProxy.QUERY, "Executing Request [" + s + "]"); //$NON-NLS-1$ //$NON-NLS-2$
boolean metadata = false;
- if (s.startsWith("METADATA")) {
+ if (s.startsWith("METADATA")) { //$NON-NLS-1$
metadata = true;
}
if (metadata) {
results.setQuery(s);
String table = s.substring(s.indexOf(':') + 1);
- String schema = current.getSchema();
- String query = "SELECT * FROM " + schema + "." + table;
- if (schema.equals("")) {
- query = "SELECT * FROM " + table;
- }
+ String query = "SELECT * FROM " + table + " WHERE (1 = 0)"; //$NON-NLS-1$ //$NON-NLS-2$
s = query;
- log.addText(log.QUERY, "Metadata Request [" + s + "]");
+ log.addText(LogProxy.QUERY, "Metadata Request [" + s + "]"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
results.setQuery(s);
}
int updates = stmt.getUpdateCount();
results.setUpdateCount(updates);
log.addText(
- log.RESULTS,
- "Success: " + updates + " records updated");
+ LogProxy.RESULTS,
+ "Success: " + updates + " records updated"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
if (metadata) {
ResultSetMetaData metaData = set.getMetaData();
int columnCount = metaData.getColumnCount();
Vector columnNames = new Vector();
- columnNames.addElement("ColumnName");
- columnNames.addElement("Type");
- columnNames.addElement("Size");
- columnNames.addElement("Nullable");
- columnNames.addElement("AutoIncrement");
+ columnNames.addElement("ColumnName"); //$NON-NLS-1$
+ columnNames.addElement("Type"); //$NON-NLS-1$
+ columnNames.addElement("Size"); //$NON-NLS-1$
+ columnNames.addElement("Nullable"); //$NON-NLS-1$
+ columnNames.addElement("AutoIncrement"); //$NON-NLS-1$
results.setColumnNames(columnNames);
for (int i = 1; i <= columnCount; i++) {
Vector row = new Vector();
if (scale == 0 && precision == 0) {
row.addElement(Integer.toString(precision));
} else {
- row.addElement(textSize + ", " + precision + ", " + scale);
+ row.addElement(textSize + ", " + precision + ", " + scale); //$NON-NLS-1$ //$NON-NLS-2$
}
int nullable = metaData.isNullable(i);
- if (nullable == metaData.columnNoNulls) {
- row.addElement("Not Null");
- } else if (nullable == metaData.columnNullable) {
- row.addElement("Nullable");
- } else if (nullable == metaData.columnNullableUnknown) {
- row.addElement("Nullable");
+ if (nullable == ResultSetMetaData.columnNoNulls) {
+ row.addElement("Not Null"); //$NON-NLS-1$
+ } else if (nullable == ResultSetMetaData.columnNullable) {
+ row.addElement("Nullable"); //$NON-NLS-1$
+ } else if (nullable == ResultSetMetaData.columnNullableUnknown) {
+ row.addElement("Nullable"); //$NON-NLS-1$
} else {
- row.addElement("<Error>");
+ row.addElement("<Error>"); //$NON-NLS-1$
}
- row.addElement(new Boolean(metaData.isAutoIncrement(i)).toString());
+ row.addElement(Boolean.toString(metaData.isAutoIncrement(i)));
results.addRow(row);
}
results.setHasMore(false);
+ set.close();
} else {
ResultSet set = stmt.getResultSet();
ResultSetMetaData metaData = set.getMetaData();
for (int i = 1; i <= columnCount; i++) {
columnTypes.addElement(metaData.getColumnTypeName(i));
}
- results.setColumnsTypes(columnTypes);
- int columnSizes[] = new int[columnCount];
+ results.setColumnTypes(columnTypes);
+ IntVector columnSizes = new IntVector();
for (int i = 1; i <= columnCount; i++) {
- columnSizes[i - 1] = metaData.getColumnDisplaySize(i);
+ columnSizes.addElement(metaData.getColumnDisplaySize(i));
}
+ results.setColumnSizes(columnSizes);
+// int columnSizes[] = new int[columnCount];
+// for (int i = 1; i <= columnCount; i++) {
+// columnSizes[i - 1] = metaData.getColumnDisplaySize(i);
+// }
int rowCount = 1;
boolean exitEarly = false;
while (set.next()) {
Vector row = new Vector();
for (int i = 1; i <= columnCount; i++) {
String value;
- if (columnSizes[i - 1] < STREAM && columnSizes[i - 1] < maxLength) {
- if (encoding.equals("")) {
+ if (columnSizes.elementAt(i - 1) < STREAM && columnSizes.elementAt(i - 1) < maxLength) {
+ if (encoding.equals("")) { //$NON-NLS-1$
value = set.getString(i);
} else {
value = new String(set.getBytes(i), encoding);
}
} else {
try {
- if (encoding.equals("")) {
+ if (encoding.equals("")) { //$NON-NLS-1$
Reader reader = set.getCharacterStream(i);
StringBuffer buffer = new StringBuffer();
if (reader != null) {
retVal = reader.read();
count++;
if (count > maxLength) {
- buffer.append("...>>>");
+ buffer.append("...>>>"); //$NON-NLS-1$
break;
}
}
}
}
if (set.wasNull()) {
- row.addElement("<NULL>");
+ row.addElement("<NULL>"); //$NON-NLS-1$
} else {
row.addElement(value);
}
results.setMaxSize(rowCount);
results.setHasMore(false);
}
+ set.close();
}
- log.addText(log.RESULTS, "Success: result set displayed");
+ log.addText(LogProxy.RESULTS, "Success: result set displayed"); //$NON-NLS-1$
}
stmt.close();
- System.out.println("Executed");
+ System.out.println("Executed"); //$NON-NLS-1$
System.out.println();
} catch (Exception e) {
results.setIsError(true);
- log.addText(log.ERROR, "Error occured: " + e);
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.addText(
- log.ERROR,
- writer.toString());
+ log.addText(LogProxy.ERROR, e); //$NON-NLS-1$
}
return results;
}
-}
+
+ public ObjectMetaData getObjectMetadata(Connection con, TreeNode node) throws SQLException {
+ ObjectMetaData metadata = new ObjectMetaData();
+ String table = node.getName();
+ metadata.setColumns(MetaDataJDBCInterface.getColumns(con, getSchemaName(table), getTableName(table)));
+ if (node instanceof TableNode) {
+ String schema = getSchemaName(table);
+ String tableName = getTableName(table);
+ metadata.setPrimaryKeys(MetaDataJDBCInterface.getPrimaryKeys(con, schema, tableName));
+ metadata.setForeignKeys(MetaDataJDBCInterface.getForeignKeys(con, schema, tableName, true));
+ metadata.setIndexInfo(MetaDataJDBCInterface.getIndexInfo(con, schema, tableName));
+ }
+ return metadata;
+ }
+
+ public String getTableName(String table) {
+ StringTokenizer st = new StringTokenizer(table, "."); //$NON-NLS-1$
+ if (st.countTokens() == 2) {
+ st.nextToken();
+ return st.nextToken();
+ } else if (st.countTokens() == 1){
+ return st.nextToken();
+ } else
+ return null;
+ }
+ public String getSchemaName(String table) {
+ StringTokenizer st = new StringTokenizer(table, "."); //$NON-NLS-1$
+ if (st.countTokens() == 2) {
+ return st.nextToken();
+ } else
+ return null;
+ }
+
+}
\ No newline at end of file