• R/O
  • SSH
  • HTTPS

wolf-desktop: コミット


コミットメタ情報

リビジョン381 (tree)
日時2016-06-14 18:10:52
作者l_v_yonsama

ログメッセージ

(メッセージはありません)

変更サマリ

差分

--- Libraries/WolfSQLParser/test/MongoTest.java (revision 380)
+++ Libraries/WolfSQLParser/test/MongoTest.java (revision 381)
@@ -118,7 +118,7 @@
118118
119119 Button delBtn = new Button(btnPanel, SWT.BORDER);
120120 delBtn.setText("1. connect");
121- treeViewer.setInput(server.getConnectionSet());
121+ treeViewer.setInput(server.getConnectionList());
122122 // delBtn.addSelectionListener(new SelectionAdapter() {
123123 // @Override
124124 // public void widgetSelected(SelectionEvent e) {
--- Libraries/WolfSQLParser/test/sql/twitter/TwitterTest.java (revision 380)
+++ Libraries/WolfSQLParser/test/sql/twitter/TwitterTest.java (revision 381)
@@ -32,7 +32,7 @@
3232 super.setUp();
3333 ConnectionSettingBean bean = (ConnectionSettingBean) SQLUtil2
3434 .readObject(macConnections);
35- for (ConnectionProperties p : bean.getConnectionSet()) {
35+ for (ConnectionProperties p : bean.getConnectionList()) {
3636 if (p.getDatabaseType().isTwitter()) {
3737 properties = p;
3838 break;
--- Libraries/WolfSQLParser/test/sql/mirroring/MsSQLServerTest.java (revision 380)
+++ Libraries/WolfSQLParser/test/sql/mirroring/MsSQLServerTest.java (revision 381)
@@ -33,7 +33,7 @@
3333 SQLServerThread.getSQLServer().init(macConnections);
3434 }
3535 this.bean = SQLServerThread.getSQLServer().getConnectionSettingBean();
36- for (ConnectionProperties p : bean.getConnectionSet()) {
36+ for (ConnectionProperties p : bean.getConnectionList()) {
3737 if (p.getDatabaseType().equals(DatabaseType.MS_SQLSERVER)) {
3838 con_prop = p;
3939 break;
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/AbsTransactionSQL.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/AbsTransactionSQL.java (revision 381)
@@ -42,6 +42,7 @@
4242 import java.sql.SQLException;
4343 import java.sql.Statement;
4444 import java.sql.Types;
45+import java.util.Arrays;
4546 import java.util.Collection;
4647 import java.util.Date;
4748 import java.util.Properties;
@@ -90,7 +91,6 @@
9091 Connection con = null;
9192 try {
9293 _url = properties.getProperty("url"); //$NON-NLS-1$
93- fLogger.info("Driver=" + _driver + " THIS[" + this + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
9494 if (this._driver == null) {
9595 File f = new File(properties.getDriverFilePath());
9696 String s = null;
@@ -106,8 +106,6 @@
106106 }
107107 throw new IllegalStateException(s);
108108 }
109- fLogger.info("URL ACCEPT=" + (_driver.acceptsURL(_url)) //$NON-NLS-1$
110- + "ConnectionInfo:" + properties); //$NON-NLS-1$
111109
112110 con = _driver.connect(_url,
113111 properties.getRelationalDBConnectionProperties());
@@ -262,7 +260,8 @@
262260 break;
263261 }
264262 } catch (SQLException e) {
265- notifyExecute(_con, SQLExecutionStatus.EXCEPTION, e.getMessage());
263+ String es = getNonCorruptedMessage(e);
264+ notifyExecute(_con, SQLExecutionStatus.EXCEPTION, es);
266265 throw e;
267266 } finally {
268267 queryTimeOut = 0;
@@ -272,6 +271,21 @@
272271 return retCode;
273272 }
274273
274+ private String getNonCorruptedMessage(SQLException e) {
275+ String s = e.getMessage();
276+// System.out.println("s=" + s);
277+// try {
278+// if (s.indexOf("�") >= 0) {
279+// String sjis_string3 = new String(s.getBytes("8859_1"));
280+// System.out.println("source3=" + sjis_string3);
281+// String sjis_string4 = new String(s.getBytes("EUC_JP"));
282+// System.out.println("source4=" + sjis_string4);
283+// }
284+// } catch (Exception ue) {
285+// }
286+ return s;
287+ }
288+
275289 @Override
276290 public ResultSet getAllData(IDBTable table) throws SQLException {
277291 IDBResource schema = table.getParent();
@@ -520,7 +534,7 @@
520534
521535 /**
522536 * setBinds.
523- *
537+ *
524538 * @param statement
525539 * @param args
526540 * @throws SQLException
@@ -618,11 +632,6 @@
618632 return queryTimeOut;
619633 }
620634
621- /*
622- * (non-Javadoc)
623- *
624- * @see hiro.yoshioka.sql.ITransactionSQL#count(java.lang.String)
625- */
626635 public int count(String sql_statement) throws SQLException {
627636 PreparedStatement statement = null;
628637 ResultSet rs = null;
@@ -651,11 +660,33 @@
651660 }
652661 }
653662
654- /*
655- * (non-Javadoc)
656- *
657- * @see hiro.yoshioka.sql.ITransactionSQL#counts(java.lang.String[])
658- */
663+ public int countAndReturnFirstColumn(String sql_statement, String[] args)
664+ throws SQLException {
665+ PreparedStatement statement = null;
666+ ResultSet rs = null;
667+ try {
668+ statement = getPrepareStatement(_con, sql_statement);
669+ fLogger.trace(sql_statement);
670+ for (int i = 0; i < args.length; i++) {
671+ statement.setString(i + 1, args[i]);
672+ }
673+ notifyExecute(_con, SQLExecutionStatus.BEFORE_EXECUTE);
674+ rs = statement.executeQuery();
675+ rs.next();
676+ int ret = rs.getInt(1);
677+ notifyExecute(_con, SQLExecutionStatus.AFTER_EXECUTE,
678+ StringUtil.EMPTY_STRING + ret, "0");
679+ return ret;
680+ } finally {
681+ if (rs != null) {
682+ rs.close();
683+ }
684+ if (statement != null) {
685+ statement.close();
686+ }
687+ }
688+ }
689+
659690 public ResultSetDataHolder2 counts(String[] sql_statements)
660691 throws SQLException {
661692 ResultSetDataHolder2 ret = createRdh2(new String[] { "CNT" }, null);
@@ -688,6 +719,10 @@
688719 return ret;
689720 }
690721
722+ public int count(String sql_statement, String[] args) throws SQLException {
723+ return this.count(_con, sql_statement, args);
724+ }
725+
691726 public int count(Connection con, String sql_statement, String[] args)
692727 throws SQLException {
693728 PreparedStatement statement = null;
@@ -798,7 +833,7 @@
798833
799834 /*
800835 * (non-Javadoc)
801- *
836+ *
802837 * @see hiro.yoshioka.sql.ITransactionSQL#execute(java.lang.String,
803838 * java.lang.String[])
804839 */
@@ -811,7 +846,7 @@
811846 // --
812847 /**
813848 * 引数のSQL文を実行して結果を返す。 <BR>
814- *
849+ *
815850 * @param connection
816851 * コネクション
817852 * @param sql_statement
@@ -890,7 +925,7 @@
890925
891926 /*
892927 * (non-Javadoc)
893- *
928+ *
894929 * @see hiro.yoshioka.sql.ITransactionSQL#executePrepare(java.lang.String,
895930 * java.lang.Object[])
896931 */
@@ -948,7 +983,7 @@
948983 // --
949984 /**
950985 * 引数のSQL文を実行して結果を返す。 <BR>
951- *
986+ *
952987 * @param connection
953988 * コネクション
954989 * @param sql_statement
@@ -993,7 +1028,7 @@
9931028
9941029 /*
9951030 * (non-Javadoc)
996- *
1031+ *
9971032 * @see hiro.yoshioka.sql.ITransactionSQL#saveCsv(java.lang.String,
9981033 * jp.sf.orangesignal.csv.handlers.ResultSetHandler,
9991034 * jp.sf.orangesignal.csv.CsvWriter)
@@ -1083,7 +1118,7 @@
10831118 // --
10841119 /*
10851120 * (non-Javadoc)
1086- *
1121+ *
10871122 * @see hiro.yoshioka.sql.ITransactionSQL#cansel()
10881123 */
10891124 // --------------------------------------------------------------------------
@@ -1109,7 +1144,7 @@
11091144
11101145 /*
11111146 * (non-Javadoc)
1112- *
1147+ *
11131148 * @see hiro.yoshioka.sql.ITransactionSQL#commit()
11141149 */
11151150 public boolean commit() {
@@ -1132,7 +1167,7 @@
11321167
11331168 /*
11341169 * (non-Javadoc)
1135- *
1170+ *
11361171 * @see hiro.yoshioka.sql.ITransactionSQL#rollback()
11371172 */
11381173 public boolean rollback() {
@@ -1173,7 +1208,7 @@
11731208
11741209 /*
11751210 * (non-Javadoc)
1176- *
1211+ *
11771212 * @see hiro.yoshioka.sql.ITransactionSQL#trunsactionTime()
11781213 */
11791214 public boolean trunsactionTime() {
@@ -1182,7 +1217,7 @@
11821217
11831218 /*
11841219 * (non-Javadoc)
1185- *
1220+ *
11861221 * @see hiro.yoshioka.sql.ITransactionSQL#getTableMetaCopy(java.lang.String)
11871222 */
11881223 public ResultSetMetaCopy getTableMetaCopy(String name) {
@@ -1191,7 +1226,7 @@
11911226
11921227 /*
11931228 * (non-Javadoc)
1194- *
1229+ *
11951230 * @see hiro.yoshioka.sql.ITransactionSQL#getTableMetaCopy(java.lang.String,
11961231 * java.lang.String[])
11971232 */
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/ConnectionSettingDialog.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/ConnectionSettingDialog.java (revision 381)
@@ -10,6 +10,7 @@
1010 import java.io.File;
1111 import java.util.Collection;
1212 import java.util.LinkedHashSet;
13+import java.util.List;
1314 import java.util.Set;
1415
1516 import org.eclipse.jface.dialogs.Dialog;
@@ -43,7 +44,7 @@
4344 public class ConnectionSettingDialog extends Dialog {
4445 Label messageLabel;
4546 ConnectionSettingBean fConnectionSettingBean;
46- Collection<ConnectionProperties> connectionSet;
47+ List<ConnectionProperties> connectionSet;
4748 Collection<SSHProperties> sshSet;
4849 PropetiesChangeType changedType;
4950 ConnectionProperties selectedConnectionProperties;
@@ -77,7 +78,7 @@
7778 this.mode = mode;
7879 this.fConnectionSettingBean = connectionSetBean;
7980 this.selectedConnectionProperties = defaultConnection;
80- this.connectionSet = connectionSetBean.getCloneConnectionSet();
81+ this.connectionSet = connectionSetBean.getCloneConnectionList();
8182 try {
8283 this.sshSet = connectionSetBean.getCloneSSHSet();
8384 } catch (CloneNotSupportedException e) {
@@ -88,7 +89,7 @@
8889 }
8990
9091 public ConnectionSettingDialog(Shell shell,
91- Collection<ConnectionProperties> connectionSet,
92+ List<ConnectionProperties> connectionSet,
9293 ConnectionProperties defaultConnection, int mode) {
9394 super(shell);
9495 this.mode = mode;
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/DBDefineTableEditor.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/DBDefineTableEditor.java (revision 381)
@@ -67,7 +67,14 @@
6767 DBConfigDialog dialog2 = new DBConfigDialog(shell, dialog.listFiles(),
6868 p, dialog.sshSet, MODE.EDIT);
6969 if (dialog2.open() == dialog2.OK) {
70- dialog.connectionSet.add(dialog2.getConnectionProperties());
70+ for(int i=0;i<dialog.connectionSet.size();i++){
71+ ConnectionProperties cp = (ConnectionProperties) dialog.connectionSet.get(i);
72+ if(cp.getDisplayString().equals(dialog2.getConnectionProperties().getDisplayString())){
73+ dialog.connectionSet.remove(i);
74+ dialog.connectionSet.add(i, dialog2.getConnectionProperties());
75+ break;
76+ }
77+ }
7178 dialog.changedType = PropetiesChangeType.CHANGE;
7279 refreshTable();
7380 }
@@ -201,9 +208,16 @@
201208 int index = tableViewer.getTable().getSelectionIndex();
202209 int size = tableViewer.getTable().getItemCount();
203210 boolean en = index >= 0 && size > 0;
211+ ConnectionProperties p = (ConnectionProperties) ((IStructuredSelection) tableViewer
212+ .getSelection()).getFirstElement();
213+
204214 editButton.setEnabled(en);
205215 cloneButton.setEnabled(en);
206216 delButton.setEnabled(en);
217+ if (p != null && p.isConnected()) {
218+ editButton.setEnabled(false);
219+ delButton.setEnabled(false);
220+ }
207221 }
208222 }
209223
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SSHTunnelingDefineEditor.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SSHTunnelingDefineEditor.java (revision 381)
@@ -41,11 +41,11 @@
4141
4242 ConnectionSettingDialog dialog;
4343 private static String[] HEADER = { StringUtil.HALF_SPACE__STRING,
44- Messages.getString("SSHTunnelingDefineEditor.definition"),
45- Messages.getString("SSHTunnelingDefineEditor.hostname"), "Port",
46- Messages.getString("SSHTunnelingDefineEditor.user"), "local port",
47- "port to connect", "bind addr", "bind port" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
48- private static int[] HEADER_WIDTH = { 25, 100, 90, 70, 50, 70, 50, 70, 50 };
44+ Messages.getString("SSHTunnelingDefineEditor.definition"), //$NON-NLS-1$
45+ Messages.getString("SSHTunnelingDefineEditor.hostname"), Messages.getString("SSHTunnelingDefineEditor.ssh_port"), //$NON-NLS-1$ //$NON-NLS-2$
46+ Messages.getString("SSHTunnelingDefineEditor.user"), Messages.getString("SSHTunnelingDefineEditor.local_port"), //$NON-NLS-1$ //$NON-NLS-2$
47+ Messages.getString("SSHTunnelingDefineEditor.remote_db_port") }; //$NON-NLS-1$
48+ private static int[] HEADER_WIDTH = { 25, 125, 90, 68, 80, 78, 105 };
4949
5050 private Button createButton(Composite parent, String text, int style) {
5151 Button ret = new Button(parent, style);
@@ -272,12 +272,6 @@
272272 case 6:
273273 result = String.valueOf(item.port_to_connect);
274274 break;
275- case 7:
276- result = item.bindAddress;
277- break;
278- case 8:
279- result = String.valueOf(item.bindPort);
280- break;
281275
282276 default:
283277 break;
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/mongo/MongoResultSet.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/mongo/MongoResultSet.java (revision 381)
@@ -656,13 +656,11 @@
656656 return getCursorObjectByName(columnName);
657657 }
658658
659- @Override
660659 public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
661660 // TODO 自動生成されたメソッド・スタブ
662661 return null;
663662 }
664663
665- @Override
666664 public <T> T getObject(String columnName, Class<T> type)
667665 throws SQLException {
668666 return (T) getCursorObjectByName(columnName);
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/AbsBasicSQL.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/AbsBasicSQL.java (revision 381)
@@ -1113,8 +1113,6 @@
11131113 field = rdh.getStringData(i, "COLUMN_NAME"); //$NON-NLS-1$
11141114 }
11151115 }
1116- fLogger.info(String.format("catalog:%s schema:%s table:%s ret:%s",
1117- catalog, schema, table, items));
11181116
11191117 return items;
11201118 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/IPostgresDBConst.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/IPostgresDBConst.java (revision 381)
@@ -70,7 +70,9 @@
7070 + "WHERE table_schema ILIKE ? AND table_name ILIKE ? ";
7171 String _SELECT_VIEW_TEXT = "SELECT view_definition AS \"TEXT\" FROM information_schema.views "
7272 + "WHERE table_schema ILIKE ? AND table_name ILIKE ? ";
73- String _SELECT_SESSION = "select * from pg_stat_activity ";
73+
74+ String _SELECT_SESSION = "select *, (current_timestamp - xact_start)::interval(3) AS duration from pg_stat_activity WHERE procpid <> pg_backend_pid() ORDER BY duration DESC NULLS LAST, query_start DESC ";
75+
7476 String _SELECT_INDEX_CNT = "SELECT COUNT(*) AS \"CNT\" "
7577 + "FROM information_schema.referential_constraints "
7678 + "WHERE constraint_schema ILIKE ? AND constraint_name ILIKE ? ";
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/SSHProperties.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/SSHProperties.java (revision 381)
@@ -30,8 +30,6 @@
3030 // -----------------------------------------------
3131 // RemotePortForwarding
3232 // -----------------------------------------------
33- public String bindAddress = StringUtil.EMPTY_STRING;
34- public int bindPort;
3533 public String targetAddress = StringUtil.EMPTY_STRING;
3634 public int targetPort;
3735
@@ -53,10 +51,8 @@
5351 this.password = password;
5452 }
5553
56- public void createRemotePortForwarding(String bindAddress, int bindPort,
54+ public void createRemotePortForwarding(int bindPort,
5755 String targetAddress, int targetPort) {
58- this.bindAddress = bindAddress;
59- this.bindPort = bindPort;
6056 this.targetAddress = targetAddress;
6157 this.targetPort = targetPort;
6258 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/ConnectionProperties.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/ConnectionProperties.java (revision 381)
@@ -21,6 +21,7 @@
2121
2222 public class ConnectionProperties extends Properties implements Serializable,
2323 Cloneable {
24+ private static final long serialVersionUID = -2498287675102652414L;
2425 public static final String ADMIN_AUTHENTICATE = "admin";
2526 public static final String MONGO_OPTIONS = "MONGO_OPTIONS";
2627 public static final String HOST = "HOST";
@@ -65,6 +66,7 @@
6566 private transient int endOfRequestCount;
6667
6768 public ConnectionProperties() {
69+ created = System.currentTimeMillis();
6870 }
6971
7072 public boolean isCaptureWithColumnInfo() {
@@ -335,11 +337,6 @@
335337 return clone;
336338 }
337339
338- @Override
339- public synchronized int hashCode() {
340- return (int) created;
341- }
342-
343340 public boolean isConnected() {
344341 return connected;
345342 }
@@ -394,6 +391,7 @@
394391 ClassNotFoundException {
395392 in.defaultReadObject();
396393 connected = false;
394+ created = System.currentTimeMillis();
397395 }
398396
399397 private void writeObject(ObjectOutputStream stream) throws IOException {
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/ConnectionSettingBean.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/ConnectionSettingBean.java (revision 381)
@@ -23,7 +23,7 @@
2323 public class ConnectionSettingBean implements Serializable {
2424 private static final long serialVersionUID = 5792695663300493365L;
2525 private Set<String> jdbcDriverFilePathSet = new LinkedHashSet<String>();
26- private Map<Long, ConnectionProperties> connectionMap = new LinkedHashMap<Long, ConnectionProperties>();
26+ private List<ConnectionProperties> connectionList = new ArrayList<ConnectionProperties>();
2727 private Map<String, SSHProperties> sshMap = new LinkedHashMap<String, SSHProperties>();
2828 private static final String LOCAL_HSQL_SERVER_DISP = "LocalHsqlServer";
2929 protected transient Log log = LogFactory.getLog(getClass());
@@ -56,44 +56,50 @@
5656 hsql.setDriverName(DatabaseType.HSQL.getDriverName());
5757 hsql.setCaptureResourceAfterTheConnectProcess(true);
5858 System.err.println("createLocalHsqlServerConnetionDefinition " + hsql);
59- connectionMap.put(hsql.getCreated(), hsql);
59+ if (this.connectionList == null) {
60+ this.connectionList = new ArrayList<ConnectionProperties>();
61+ }
62+ connectionList.add(hsql);
6063 }
6164
6265 private void removeLocalHsqlServerConnectionDefinition() {
66+ if (this.connectionList == null) {
67+ this.connectionList = new ArrayList<ConnectionProperties>();
68+ return;
69+ }
6370 Long removeKey = null;
64- for (Entry<Long, ConnectionProperties> entry : connectionMap.entrySet()) {
65- ConnectionProperties p = entry.getValue();
71+ for (int i = 0; i < connectionList.size(); i++) {
72+ ConnectionProperties p = connectionList.get(i);
6673 if (p.getDisplayString().equals(LOCAL_HSQL_SERVER_DISP)) {
67- removeKey = entry.getKey();
74+ connectionList.remove(i);
75+ break;
6876 }
6977 }
70- if (removeKey != null) {
71- connectionMap.remove(removeKey);
72- }
7378 }
7479
7580 public ConnectionProperties getConnectionPropertiesByDisplay(
7681 String displayString) {
77- for (ConnectionProperties p : connectionMap.values()) {
82+ if (connectionList == null) {
83+ return null;
84+ }
85+ for (ConnectionProperties p : connectionList) {
7886 if (p.getDisplayString().equals(displayString)) {
7987 return p;
8088 }
8189 }
82- log.warn(String.format("mapSize[%d] DisplayString[%s] return null",
83- connectionMap.size(), displayString));
8490 return null;
8591 }
8692
87- public Map<Long, ConnectionProperties> getConnectionMap() {
88- return connectionMap;
93+ public List<ConnectionProperties> getConnectionList() {
94+ return connectionList;
8995 }
9096
91- public void setConnectionMap(Map<Long, ConnectionProperties> connectionMap) {
92- this.connectionMap = connectionMap;
97+ public void setConnectionMap(List<ConnectionProperties> connectionList) {
98+ this.connectionList = connectionList;
9399 }
94100
95101 public void addConnectionProperties(ConnectionProperties properties) {
96- connectionMap.put(properties.getCreated(), properties);
102+ connectionList.add(properties);
97103 }
98104
99105 public void addSSHProperties(SSHProperties ssh_properties) {
@@ -116,8 +122,11 @@
116122
117123 public boolean changeConnectionProperties(
118124 Collection<ConnectionProperties> newProperties) throws IOException {
125+ if (this.connectionList == null) {
126+ this.connectionList = new ArrayList<ConnectionProperties>();
127+ }
119128 boolean ret = false;
120- connectionMap.clear();
129+ connectionList.clear();
121130
122131 for (ConnectionProperties target : newProperties) {
123132 addConnectionProperties(target);
@@ -125,16 +134,15 @@
125134 return ret;
126135 }
127136
128- public Collection<ConnectionProperties> getConnectionSet() {
129- return connectionMap.values();
130- }
131-
132- public Collection<ConnectionProperties> getConnectedConnectionSet() {
133- if (connectionMap.size() == 0) {
134- return Collections.EMPTY_SET;
137+ public List<ConnectionProperties> getConnectedConnectionSet() {
138+ if (this.connectionList == null) {
139+ this.connectionList = new ArrayList<ConnectionProperties>();
135140 }
136- Set<ConnectionProperties> ret = new LinkedHashSet<ConnectionProperties>();
137- for (ConnectionProperties p : connectionMap.values()) {
141+ if (connectionList.size() == 0) {
142+ return Collections.EMPTY_LIST;
143+ }
144+ List<ConnectionProperties> ret = new ArrayList<ConnectionProperties>();
145+ for (ConnectionProperties p : connectionList) {
138146 if (p.isConnected()) {
139147 ret.add(p);
140148 }
@@ -142,12 +150,15 @@
142150 return ret;
143151 }
144152
145- public Collection<ConnectionProperties> getDisConnectedConnectionSet() {
146- if (connectionMap.size() == 0) {
147- return Collections.EMPTY_SET;
153+ public List<ConnectionProperties> getDisConnectedConnectionSet() {
154+ if (this.connectionList == null) {
155+ this.connectionList = new ArrayList<ConnectionProperties>();
148156 }
149- Set<ConnectionProperties> ret = new LinkedHashSet<ConnectionProperties>();
150- for (ConnectionProperties p : connectionMap.values()) {
157+ if (connectionList.size() == 0) {
158+ return Collections.EMPTY_LIST;
159+ }
160+ List<ConnectionProperties> ret = new ArrayList<ConnectionProperties>();
161+ for (ConnectionProperties p : connectionList) {
151162 if (!p.isConnected()) {
152163 ret.add(p);
153164 }
@@ -156,8 +167,11 @@
156167 }
157168
158169 public String[] getDisplayStrings() {
170+ if (this.connectionList == null) {
171+ this.connectionList = new ArrayList<ConnectionProperties>();
172+ }
159173 List<String> retList = new ArrayList<String>();
160- for (ConnectionProperties p : getConnectionSet()) {
174+ for (ConnectionProperties p : getConnectionList()) {
161175 retList.add(p.getDisplayString());
162176 }
163177 return retList.toArray(new String[retList.size()]);
@@ -184,7 +198,7 @@
184198 @Override
185199 public String toString() {
186200 StringBuilder buf = new StringBuilder();
187- if (connectionMap == null) {
201+ if (connectionList == null) {
188202 buf.append(String.format(
189203 "JAR_FILE[%s] ConnectionProperties is nothing...",
190204 jdbcDriverFilePathSet));
@@ -191,8 +205,8 @@
191205 } else {
192206 buf.append(String.format(
193207 "JAR_FILE[%s] ConnectionProperties size [%d]%n",
194- jdbcDriverFilePathSet, connectionMap.size()));
195- for (ConnectionProperties con : connectionMap.values()) {
208+ jdbcDriverFilePathSet, connectionList.size()));
209+ for (ConnectionProperties con : connectionList) {
196210 buf.append(String.format(" %s%n", con));
197211 }
198212 }
@@ -199,10 +213,13 @@
199213 return buf.toString();
200214 }
201215
202- public Set<ConnectionProperties> getCloneConnectionSet() {
203- log.debug("conMap=" + connectionMap);
204- Set<ConnectionProperties> ret = new LinkedHashSet<ConnectionProperties>();
205- for (ConnectionProperties set : connectionMap.values()) {
216+ public List<ConnectionProperties> getCloneConnectionList() {
217+ if (this.connectionList == null) {
218+ this.connectionList = new ArrayList<ConnectionProperties>();
219+ }
220+ log.debug("conMap=" + connectionList);
221+ List<ConnectionProperties> ret = new ArrayList<ConnectionProperties>();
222+ for (ConnectionProperties set : connectionList) {
206223 ConnectionProperties clone = (ConnectionProperties) set.clone();
207224 log.debug("add:" + clone + "/ " + clone.getCreated());
208225 ret.add(clone);
@@ -213,7 +230,7 @@
213230
214231 public Collection<SSHProperties> getCloneSSHSet()
215232 throws CloneNotSupportedException {
216- log.debug("conMap=" + connectionMap);
233+ log.debug("conMap=" + connectionList);
217234 Set<SSHProperties> ret = new LinkedHashSet<SSHProperties>();
218235 for (SSHProperties set : sshMap.values()) {
219236 SSHProperties clone = (SSHProperties) set.clone();
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/evernote/EvernoteResultSet.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/evernote/EvernoteResultSet.java (revision 381)
@@ -936,13 +936,11 @@
936936 return null;
937937 }
938938
939- @Override
940939 public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
941940 // TODO 自動生成されたメソッド・スタブ
942941 return null;
943942 }
944943
945- @Override
946944 public <T> T getObject(String columnName, Class<T> type)
947945 throws SQLException {
948946 return (T) getObject(getTargetObjectIdx(columnName));
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/twitter/TwitterResultSet.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/twitter/TwitterResultSet.java (revision 381)
@@ -1020,13 +1020,11 @@
10201020 return getObject(getTargetObjectIdx(columnName));
10211021 }
10221022
1023- @Override
10241023 public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
10251024 // TODO 自動生成されたメソッド・スタブ
10261025 return null;
10271026 }
10281027
1029- @Override
10301028 public <T> T getObject(String columnName, Class<T> type)
10311029 throws SQLException {
10321030 return (T) getObject(getTargetObjectIdx(columnName));
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/engine/SQLServerThread.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/engine/SQLServerThread.java (revision 381)
@@ -58,7 +58,7 @@
5858
5959 Thread fThread;
6060
61- private Map<ConnectionProperties, ITransactionSQL> sqlMap = new LinkedHashMap<ConnectionProperties, ITransactionSQL>();
61+ private Map<String, ITransactionSQL> sqlMap = new LinkedHashMap<String, ITransactionSQL>();
6262
6363 private Set<IConnectionPropertiesChangeListener> fConPropeteisUpdateList;
6464 private Set<SqlBasicListener> fConnectionList = new HashSet<SqlBasicListener>();
@@ -94,19 +94,19 @@
9494 @Override
9595 public void run() {
9696 boolean ret = false;
97- for (ConnectionProperties p : sqlMap.keySet()) {
98- if (p == null) {
97+ for (String def : sqlMap.keySet()) {
98+ if (def == null) {
9999 continue;
100100 }
101+ ConnectionProperties p = SQLServerThread.this.fConnectionSettingBean
102+ .getConnectionPropertiesByDisplay(def);
101103 if (checkAlive(p)) {
102- ITransactionSQL sql = sqlMap.get(p);
104+ ITransactionSQL sql = sqlMap.get(def);
103105 try {
104106 ret = sql.isAlive(p);
105- fLogger.trace("ret=" + ret);
106107 } catch (Throwable e) {
107108 fLogger.warn(StringUtil.EMPTY_STRING, e);
108109 }
109- fLogger.info("keep alive [" + ret + "]");
110110 }
111111 }
112112 }
@@ -118,7 +118,7 @@
118118 DatabaseType type = p.getDatabaseType();
119119 int interval = p.getKeepAliveInterval();
120120 if (p.isConnected() && type.enableKeepAlive() && interval > 0) {
121- ITransactionSQL sql = sqlMap.get(p);
121+ ITransactionSQL sql = sqlMap.get(p.getDisplayString());
122122 Date latestTime = sql.getLatestRequestTime();
123123 if (latestTime == null) {
124124 return true;
@@ -164,7 +164,9 @@
164164 }
165165
166166 public ITransactionSQL getTransactionSQL(DBRoot root) {
167- for (ConnectionProperties key : sqlMap.keySet()) {
167+ for (String def : sqlMap.keySet()) {
168+ ConnectionProperties key = SQLServerThread.this.fConnectionSettingBean
169+ .getConnectionPropertiesByDisplay(def);
168170 if (key.getDBRootResource() == root) {
169171 return getTransactionSQL(key);
170172 }
@@ -175,7 +177,7 @@
175177 public HSQL createHSQLLocalServerTransactionSQL() {
176178 ConnectionProperties hsqlProp = fConnectionSettingBean
177179 .getLocalHsqlServerConnection();
178- ITransactionSQL sql = sqlMap.get(hsqlProp);
180+ ITransactionSQL sql = sqlMap.get(hsqlProp.getDisplayString());
179181 if (sql == null || !hsqlProp.isConnected()) {
180182 sql = createTransactionSql(hsqlProp, null);
181183 }
@@ -196,7 +198,7 @@
196198 // + key.getDisplayString());
197199 }
198200 }
199- return sqlMap.get(properties);
201+ return sqlMap.get(properties.getDisplayString());
200202 }
201203
202204 public void addConnectionPropertiesChangedListener(
@@ -271,6 +273,7 @@
271273 }
272274
273275 public boolean copyConfigFrom(File copy_config_folder) {
276+ fLogger.info("start copy");
274277 if (!copy_config_folder.exists()) {
275278 return false;
276279 }
@@ -281,7 +284,9 @@
281284 ConnectionSettingBean load = (ConnectionSettingBean) SQLUtil2
282285 .readObject(def);
283286 try {
287+ fLogger.info("load= " + load);
284288 if (load == null) {
289+ fLogger.info("load is null ");
285290 if (xml != null) {
286291 load = (ConnectionSettingBean) SQLUtil2
287292 .readObjectXML(xml);
@@ -288,6 +293,13 @@
288293 }
289294 }
290295 if (load != null) {
296+ if (load.getConnectionList() == null) {
297+ fLogger.info("connection list is null ");
298+ if (xml != null) {
299+ load = (ConnectionSettingBean) SQLUtil2
300+ .readObjectXML(xml);
301+ }
302+ }
291303 this.fConnectionSettingBean = load;
292304
293305 saveConnectionProperties();
@@ -299,6 +311,7 @@
299311
300312 this.init(this.configFileDir);
301313 }
314+ fLogger.info("end copy");
302315 return true;
303316 }
304317
@@ -355,11 +368,11 @@
355368
356369 if (load == null) {
357370 fConnectionSettingBean = new ConnectionSettingBean();
358- fConnectionSettingBean.getLocalHsqlServerConnection();
359- sqlMap = new LinkedHashMap<ConnectionProperties, ITransactionSQL>();
371+ sqlMap = new LinkedHashMap<String, ITransactionSQL>();
360372 } else {
361373 fConnectionSettingBean = load;
362374 }
375+ fConnectionSettingBean.getLocalHsqlServerConnection();
363376 }
364377
365378 public boolean changeConnectionProperties(
@@ -480,10 +493,10 @@
480493
481494 private ITransactionSQL createTransactionSql(ConnectionProperties prop,
482495 Request request) {
483- ITransactionSQL sql = sqlMap.get(prop);
496+ ITransactionSQL sql = sqlMap.get(prop.getDisplayString());
484497 if (sql == null) {
485498 sql = DataBaseFactory.createSQL(prop);
486- sqlMap.put(prop, sql);
499+ sqlMap.put(prop.getDisplayString(), sql);
487500 for (SqlBasicListener basic : fConnectionList) {
488501 sql.addConnectionListner(basic);
489502 }
@@ -510,6 +523,25 @@
510523 return sql;
511524 }
512525
526+ public static ConnectionProperties getConnectionProperties(
527+ String display_string) {
528+ SQLServerThread obj = SQLServerThread.getSQLServer();
529+ ConnectionSettingBean bean = obj.getConnectionSettingBean();
530+ if (bean == null) {
531+ return null;
532+ }
533+ return bean.getConnectionPropertiesByDisplay(display_string);
534+ }
535+
536+ public static boolean isConnected(String display_string) {
537+ ConnectionProperties p = SQLServerThread
538+ .getConnectionProperties(display_string);
539+ if (p == null) {
540+ return false;
541+ }
542+ return p.isConnected();
543+ }
544+
513545 public void removeConnectionPropertiesChangedListener(
514546 IConnectionPropertiesChangeListener listener) {
515547 if (fConPropeteisUpdateList != null) {
@@ -549,7 +581,7 @@
549581 }
550582 if (request.operation.isClose()) {
551583 System.err.println("closeeeeeeeeeeeeeeeeeeeeeeeeee::" + propertis);
552- ITransactionSQL sql = sqlMap.remove(propertis);
584+ ITransactionSQL sql = sqlMap.remove(propertis.getDisplayString());
553585 fLogger.info(String.format("removed:%s, %s",
554586 propertis.getDisplayString(), sql));
555587
@@ -563,7 +595,9 @@
563595 }
564596
565597 public boolean hasSSHDefOf(String defineName) {
566- for (ConnectionProperties p : sqlMap.keySet()) {
598+ for (String def : sqlMap.keySet()) {
599+ ConnectionProperties p = SQLServerThread.this.fConnectionSettingBean
600+ .getConnectionPropertiesByDisplay(def);
567601 if (defineName.equals(p.getSSHTunnelingDefine())) {
568602 return true;
569603 }
@@ -584,8 +618,8 @@
584618 public void worked(int i) {
585619 }
586620
587- public Collection<ConnectionProperties> getConnectionSet() {
588- return fConnectionSettingBean.getConnectionSet();
621+ public Collection<ConnectionProperties> getConnectionList() {
622+ return fConnectionSettingBean.getConnectionList();
589623 }
590624
591625 // ---------------------------------------------------------
@@ -730,8 +764,7 @@
730764 }
731765
732766 public boolean closeTunnel() throws IOException {
733- fLogger.info(String.format("cancelRemotePortForwarding[%d]",
734- this.sshProperties.bindPort));
767+ fLogger.info(String.format("cancelRemotePortForwarding"));
735768 lpf1.close();
736769
737770 /* Close the connection */
@@ -766,7 +799,7 @@
766799
767800 /**
768801 * Close SSH-tunneling.
769- *
802+ *
770803 * @param sshProperties
771804 * @return true:success
772805 */
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/engine/RequestQueue.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/engine/RequestQueue.java (revision 381)
@@ -11,12 +11,9 @@
1111 private final LinkedList<Request> queue = new LinkedList<Request>();
1212
1313 public synchronized Request getRequest() {
14- fLogger.trace("lock queue.size()..." + queue.size());
1514 while (queue.size() <= 0) {
1615 try {
17- fLogger.fatal("before lock");
1816 wait();
19- fLogger.fatal("before after");
2017 } catch (InterruptedException e) {
2118 fLogger.fatal("lock interrupted...", e);
2219 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sdh2/ResultSetDataHolder2.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sdh2/ResultSetDataHolder2.java (revision 381)
@@ -12,6 +12,8 @@
1212 import hiro.yoshioka.sdh.ResultSetDataHolder;
1313 import hiro.yoshioka.sdh.ResultSetMetaCopy;
1414 import hiro.yoshioka.sdh.StringRecordData;
15+import hiro.yoshioka.sdh.StringRecordPairData;
16+import hiro.yoshioka.sdh.diff.DiffElementType;
1517 import hiro.yoshioka.sdh.pair.DifferenceStringData;
1618 import hiro.yoshioka.sql.resource.IDBSchema;
1719 import hiro.yoshioka.sql.resource.IDBTable;
@@ -21,6 +23,7 @@
2123 import hiro.yoshioka.util.LineSeparatorEnum;
2224 import hiro.yoshioka.util.SQLDataType;
2325 import hiro.yoshioka.util.StringUtil;
26+import hiro.yoshioka.util.Util;
2427
2528 import java.io.BufferedWriter;
2629 import java.io.PrintWriter;
@@ -42,6 +45,8 @@
4245 import java.util.TreeMap;
4346 import java.util.regex.Pattern;
4447
48+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
49+
4550 import net.arnx.jsonic.JSON;
4651
4752 public class ResultSetDataHolder2 extends ResultSetDataHolder {
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/application/chihuahua/ChihuahuaDBClient.java (revision 380)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/application/chihuahua/ChihuahuaDBClient.java (revision 381)
@@ -201,7 +201,7 @@
201201 }
202202 });
203203 treeViewer = maker.getTreeViewer();
204- treeViewer.setInput(server.getConnectionSet());
204+ treeViewer.setInput(server.getConnectionList());
205205 treeSearchText = maker.getSearchText();
206206 Composite bottomComposite = new Composite(sashMain, SWT.NONE);
207207 bottomComposite.setLayout(createGridLayout(1));
--- Libraries/WolfSQLParser/base/hiro/yoshioka/ast/sql/util/ParserUtil.java (revision 380)
+++ Libraries/WolfSQLParser/base/hiro/yoshioka/ast/sql/util/ParserUtil.java (revision 381)
@@ -388,10 +388,20 @@
388388 public boolean startsWithSelect() {
389389 String sel = StringUtil.cnvWithoutComment(fSQL_Statement).toUpperCase()
390390 .trim();
391- if (sel.startsWith("SELECT") || sel.startsWith("SHOW")) {
392- return true;
391+ Pattern p = Pattern.compile(
392+ "(SELECT|INSERT|UPDATE|DELETE|ALTER|CREATE|SHOW)[ \t\r\n]",
393+ Pattern.CASE_INSENSITIVE);
394+ Matcher m = p.matcher(sel);
395+ boolean ret = false;
396+ while (m.find()) {
397+ String g = m.group(1);
398+ if (g.equals("SELECT") || g.equals("SHOW")) {
399+ ret = true;
400+ } else {
401+ ret = false;
402+ }
393403 }
394- return false;
404+ return ret;
395405 }
396406
397407 /**
--- Libraries/WolfSQLParser/base/hiro/yoshioka/sql/resource/DBRoot.java (revision 380)
+++ Libraries/WolfSQLParser/base/hiro/yoshioka/sql/resource/DBRoot.java (revision 381)
@@ -1,5 +1,9 @@
11 package hiro.yoshioka.sql.resource;
22
3+import hiro.yoshioka.sdh.DatabaseType;
4+import hiro.yoshioka.sdh.ResultSetDataHolder;
5+import hiro.yoshioka.sdh.diff.DiffToResultSetDataHolder;
6+import hiro.yoshioka.sdh2.ResultSetDataHolder2;
37 import hiro.yoshioka.util.StringUtil;
48
59 import java.util.ArrayList;
旧リポジトリブラウザで表示