• R/O
  • SSH
  • HTTPS

wolf-desktop: コミット


コミットメタ情報

リビジョン379 (tree)
日時2015-05-08 19:21:53
作者l_v_yonsama

ログメッセージ

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

変更サマリ

差分

--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/cassandra/CassandraSQL.java (nonexistent)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/cassandra/CassandraSQL.java (revision 379)
@@ -0,0 +1,393 @@
1+package hiro.yoshioka.sql.cassandra;
2+
3+import hiro.yoshioka.sdh.DatabaseType;
4+import hiro.yoshioka.sdh2.ResultSetDataHolder2;
5+import hiro.yoshioka.sql.AbsNoSQL;
6+import hiro.yoshioka.sql.SQLExecutionStatus;
7+import hiro.yoshioka.sql.SqlBasicListener;
8+import hiro.yoshioka.sql.engine.GettingResourceRequest;
9+import hiro.yoshioka.sql.engine.MirroringRequest;
10+import hiro.yoshioka.sql.engine.Request;
11+import hiro.yoshioka.sql.engine.SQLOperationType;
12+import hiro.yoshioka.sql.engine.TransactionRequest;
13+import hiro.yoshioka.sql.params.ConnectionProperties;
14+import hiro.yoshioka.sql.resource.DBColumn;
15+import hiro.yoshioka.sql.resource.DBRoot;
16+import hiro.yoshioka.sql.resource.DBSchema;
17+import hiro.yoshioka.sql.resource.DBTable;
18+import hiro.yoshioka.sql.resource.IDBSchema;
19+import hiro.yoshioka.sql.resource.IDBTable;
20+import hiro.yoshioka.util.SQLDataType;
21+import hiro.yoshioka.util.StringUtil;
22+
23+import java.lang.reflect.InvocationTargetException;
24+import java.sql.SQLException;
25+import java.util.List;
26+import java.util.concurrent.ExecutionException;
27+import java.util.regex.Matcher;
28+import java.util.regex.Pattern;
29+
30+import com.datastax.driver.core.Cluster;
31+import com.datastax.driver.core.ColumnDefinitions.Definition;
32+import com.datastax.driver.core.ColumnMetadata;
33+import com.datastax.driver.core.KeyspaceMetadata;
34+import com.datastax.driver.core.Metadata;
35+import com.datastax.driver.core.ResultSet;
36+import com.datastax.driver.core.Row;
37+import com.datastax.driver.core.Session;
38+import com.datastax.driver.core.TableMetadata;
39+
40+public class CassandraSQL extends AbsNoSQL {
41+ Cluster cluster;
42+ String host;
43+ int port = 9042;
44+ String keyspace_nm;
45+
46+ public CassandraSQL() {
47+ }
48+
49+ public DatabaseType getDatabaseType() {
50+ return DatabaseType.CASSANDRA;
51+ }
52+
53+ public boolean connect(ConnectionProperties properties) throws SQLException {
54+ this._info = properties;
55+ boolean ret = false;
56+
57+ host = properties.getURLString();
58+ keyspace_nm = null;
59+ Pattern P = Pattern.compile("([a-zA-Z0-9\\._-]+):([a-zA-Z0-9\\._-]+):([0-9]+)");
60+ Matcher m = P.matcher(host);
61+ port = 9042;
62+ if (m.matches()) {
63+ host = m.group(1);
64+ keyspace_nm = m.group(2);
65+ port = Integer.parseInt(m.group(3), 10);
66+ }
67+
68+ cluster = Cluster.builder().withPort(port).addContactPoints(host)
69+ .build();
70+ ret = true;
71+
72+ if (ret && fConnectionListenerList != null) {
73+ for (SqlBasicListener listener : fConnectionListenerList) {
74+ listener.connected();
75+ }
76+ }
77+ properties.setConnected(ret);
78+ return ret;
79+ }
80+
81+ @Override
82+ public boolean close() throws SQLException {
83+ boolean ret = true;
84+ cluster.close();
85+
86+ if (fConnectionListenerList != null) {
87+ for (SqlBasicListener listener : fConnectionListenerList) {
88+ listener.disconnected();
89+ }
90+ }
91+ this._info.setConnected(ret);
92+ return ret;
93+ }
94+
95+ @Override
96+ public boolean doOperation(SQLOperationType operation, Request request)
97+ throws SQLException {
98+
99+ TransactionRequest treq = null;
100+ setMakeBlobData(request.makeBlob);
101+ if (request instanceof TransactionRequest) {
102+ treq = (TransactionRequest) request;
103+ setMaxRowNum(treq.getMaxRownum());
104+ }
105+ ConnectionProperties prop = request.getConnectionProperties();
106+ long time = System.currentTimeMillis();
107+
108+ boolean retCode = true;
109+ try {
110+ switch (operation) {
111+ case CONNECT:
112+ return connect(prop);
113+ case CLOSE:
114+ return close();
115+ case RESOURCE_MIRRORING:
116+ MirroringRequest mirroring_request = (MirroringRequest) request;
117+ retCode = createMirroredTableTo(mirroring_request);
118+ break;
119+ // case DATA_GENERATE:
120+ // DataGenerateRequest dreq = (DataGenerateRequest) request;
121+ // Table accessTbl = getAccessTable(dreq.getTableName(), false);
122+ // InsertCursorWorker worker = new InsertCursorWorker(accessTbl,
123+ // dreq.getInsertValuesMap());
124+ // ResultSetDataHolder2 r2 = worker.execute();
125+ // retCode = (r2.getIntData(0, "InsertCount") > 0);
126+ // break;
127+ case COUNT:
128+ int retCount = 0;
129+ treq.setResultCount(count(treq.getIDBTable()));
130+ break;
131+ case RESOURCE_CAPTION:
132+ getMetaData((GettingResourceRequest) request);
133+ break;
134+ case EXPLAIN_PLAN:
135+ break;
136+ case SELECT_SESSION:
137+ break;
138+ case SELECT_LOCK:
139+ break;
140+ case UNID_EXECUTE_QUERY:
141+
142+ case SELECT_ALL:
143+ notifyExecute(SQLExecutionStatus.BEFORE_EXECUTE);
144+ treq.setRDH(getAllData2(treq.getIDBTable(), treq));
145+ break;
146+ case CREATE_TRIG_FNC_PROC:
147+ break;
148+ case WORST_SQL:
149+ break;
150+ case CHECK_VALIDATION:
151+ break;
152+
153+ case PREPARED_EXECUTE_QUERY:
154+ notifyExecute(SQLExecutionStatus.BEFORE_EXECUTE);
155+ treq.setRDH(getAllData2(treq.getIDBTable(), treq));
156+
157+ break;
158+
159+ case PREPARED_EXECUTE:
160+ break;
161+ default:
162+ System.out.println("what's this operation ? " + operation);
163+ break;
164+ }
165+ } catch (Exception e) {
166+ notifyExecute(SQLExecutionStatus.EXCEPTION, e.getMessage());
167+ throw cnvSQLException(e);
168+ }
169+
170+ return retCode;
171+
172+ }
173+
174+ static SQLException cnvSQLException(Throwable e) {
175+ if (e instanceof ExecutionException) {
176+ Throwable c = e.getCause();
177+ if (c instanceof InvocationTargetException) {
178+ InvocationTargetException iv = (InvocationTargetException) c;
179+ e = iv.getTargetException();
180+ }
181+ }
182+ SQLException se = new SQLException("CassandraSQLException["
183+ + e.getLocalizedMessage() + "]", "", e);
184+ return se;
185+ }
186+
187+ protected DBRoot getMetaData(GettingResourceRequest request) {
188+ IDBSchema schema = null;
189+ DBRoot root = getRoot();
190+ try {
191+ this.capturing = true;
192+
193+ if (request.canceld()) {
194+ return null;
195+ }
196+ if (!request.targetType.isOnlyTable()) {
197+ root = new DBRoot("Cassandra");
198+ setRoot(root);
199+ root.setPropertyValue("DatabaseProductName", "Cassandra");
200+ fLogger.info("new DBRoot");
201+
202+ root.setPropertyValue("ClusterName", cluster.getClusterName());
203+ root.setPropertyValue("DriverVersion",
204+ cluster.getDriverVersion());
205+
206+ Metadata clu_meta = cluster.getMetadata();
207+ for (KeyspaceMetadata key_meta : clu_meta.getKeyspaces()) {
208+ schema = new DBSchema(root);
209+ schema.setName(key_meta.getName());
210+ schema.setComment(key_meta.getClass().getSimpleName());
211+ root.putResource(schema.getName(), schema);
212+ root.setDefaultSchema(schema);
213+ root.setCurrentSchema(schema);
214+
215+ System.out
216+ .println("------------------------------------------------");
217+ System.out.println("Replication : ["
218+ + key_meta.getReplication() + "]");
219+ System.out.println("DurableWrites : ["
220+ + key_meta.isDurableWrites() + "]");
221+ System.out.println("CQL : [" + key_meta.asCQLQuery() + "]");
222+
223+ for (TableMetadata tbl_meta : key_meta.getTables()) {
224+ DBTable table = new DBTable(schema);
225+ table.setName(tbl_meta.getName());
226+ table.setComment(tbl_meta.getClass().getSimpleName());
227+ table.setTableType("TABLE");
228+ schema.putTable(table);
229+
230+ System.out.println(" Tbl-Id : [" + tbl_meta.getId()
231+ + "] " + table.getName());
232+
233+ if (doCaptureColumn(root, table, request)) {
234+ System.out.println("cap");
235+ setTableColumns(schema.getName(), table);
236+ }
237+
238+ }
239+
240+ }
241+
242+ }
243+ } catch (Throwable e) {
244+ fLogger.error(StringUtil.EMPTY_STRING, e);
245+ return null;
246+ } finally {
247+ this.capturing = false;
248+ }
249+ return root;
250+ }
251+
252+ boolean doCaptureColumn(DBRoot root, IDBTable dbTable, Request request) {
253+ if (this._info == null) {
254+ return false;
255+ }
256+ if (this._info.isCaptureWithColumnInfo()) {
257+ return true;
258+ }
259+ DBRoot old = request.getConnectionProperties().getDBRootResource();
260+ if (old != null && old.isRecentryUsed(dbTable)) {
261+ return true;
262+ }
263+ if (root != null && root.isRecentryUsed(dbTable)) {
264+ return true;
265+ }
266+ return false;
267+ }
268+
269+ private KeyspaceMetadata findKeyspaceMetadata(String keyspace) {
270+ for (KeyspaceMetadata meta : cluster.getMetadata().getKeyspaces()) {
271+ if (meta.getName().equals(keyspace)) {
272+ return meta;
273+ }
274+ }
275+ return null;
276+ }
277+
278+ private TableMetadata findTableMetadata(KeyspaceMetadata key_meta,
279+ String table) {
280+ for (TableMetadata tbl_meta : key_meta.getTables()) {
281+ if (tbl_meta.getName().equals(table)) {
282+ return tbl_meta;
283+ }
284+ }
285+ return null;
286+ }
287+
288+ @Override
289+ public void setTableColumns(String schema, IDBTable table)
290+ throws SQLException {
291+
292+ KeyspaceMetadata key_meta = findKeyspaceMetadata(schema);
293+
294+ TableMetadata tbl_meta = findTableMetadata(key_meta, table.getName());
295+ for (ColumnMetadata col_meta : tbl_meta.getColumns()) {
296+
297+ DBColumn column = new DBColumn(table);
298+ column.setName(col_meta.getName());
299+ column.setComment(col_meta.getClass().getSimpleName());
300+
301+ // column.setPKey(true);
302+ SQLDataType data_type = SQLDataType.parse(col_meta.getType()
303+ .getName().name());
304+ column.setDataType(data_type);
305+ column.setDataTypeString(col_meta.getType().getName().name());
306+ column.setSize(0);
307+
308+ table.putResource(column.getName(), column);
309+ }
310+
311+ }
312+
313+ @Override
314+ public ResultSetDataHolder2 getAllData2(IDBTable table,
315+ Request request) throws SQLException {
316+ String sql_statement = null;
317+
318+ sql_statement = String.format("SELECT * FROM %s", table.getName());
319+
320+ fLogger.info(sql_statement);
321+ ResultSetDataHolder2 rdh2 = query(sql_statement);
322+ if (rdh2 != null) {
323+// rdh2.setTableNameE(table);
324+ }
325+ return rdh2;
326+ }
327+
328+ private ResultSetDataHolder2 query(String select_query){
329+ ResultSetDataHolder2 rdh2 = null;
330+ Session session = null;
331+ try {
332+ session = cluster.connect(String.format("\"%s\"", keyspace_nm));
333+ ResultSet rs = session.execute(select_query);
334+ List<Definition> def_list = rs.getColumnDefinitions().asList();
335+
336+
337+ int colsize = def_list.size();
338+ String[] columns = new String[colsize];
339+ int[] colSize = new int[colsize];
340+ int i=0;
341+ for(Definition def: def_list){
342+ columns[i] = def.getName();
343+ i++;
344+ }
345+ rdh2 = new ResultSetDataHolder2(columns, null, DatabaseType.CASSANDRA);
346+ for(Row rrow : rs.all()){
347+ String[] row = new String[colsize];
348+ for (i = 0; i < colsize; i++) {
349+ row[i] = rrow.getString(i);
350+ }
351+ rdh2.addRow(row);
352+ }
353+
354+ rdh2.setSqlStatement(select_query);
355+ // rdh2.setBinds(binds);
356+ rdh2.setConnectionDisplayString(_info.getDisplayString());
357+
358+ } catch (Exception e) {
359+ e.printStackTrace();
360+ } finally {
361+ if (session != null) {
362+ session.close();
363+ }
364+ }
365+ return rdh2;
366+ }
367+
368+ public long count(IDBTable table) throws SQLException {
369+ if (table == null) {
370+ return 0L;
371+ }
372+ long sum = 0;
373+ KeyspaceMetadata key_meta = findKeyspaceMetadata(table.getParent()
374+ .getName());
375+ TableMetadata tbl_meta = findTableMetadata(key_meta, table.getName());
376+
377+ Session session = null;
378+ try {
379+ session = cluster.connect(String.format("\"%s\"", keyspace_nm));
380+ ResultSet rs = session.execute(String.format("SELECT COUNT(*) FROM %s ",
381+ table.getName()));
382+ sum = rs.one().getLong(0);
383+ } catch (Exception e) {
384+ e.printStackTrace();
385+ } finally {
386+ if (session != null) {
387+ session.close();
388+ }
389+ }
390+
391+ return sum;
392+ }
393+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/SQLiteSQL.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/SQLiteSQL.java (revision 379)
@@ -382,7 +382,7 @@
382382
383383 @Override
384384 protected boolean dropTable(String schemaName, IDBTable table,
385- boolean cascade) throws SQLException {
385+ boolean cascade, boolean quoteTableName) throws SQLException {
386386 StringBuilder st = new StringBuilder();
387387 // drop table [if exists] [databasename.]tableName
388388 if (StringUtil.isEmpty(schemaName)) {
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/OracleSQL.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/OracleSQL.java (revision 379)
@@ -1400,7 +1400,7 @@
14001400
14011401 @Override
14021402 protected boolean dropTable(String schemaName, IDBTable table,
1403- boolean cascade) throws SQLException {
1403+ boolean cascade, boolean quoteTableName) throws SQLException {
14041404 StringBuilder st = new StringBuilder();
14051405 if (StringUtil.isEmpty(schemaName)) {
14061406 st.append(String.format("DROP TABLE %s", table.getName()));
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/engine/TwoDatabasesRequest.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/engine/TwoDatabasesRequest.java (revision 379)
@@ -69,8 +69,13 @@
6969 }
7070 if (this.columnNameSubstitutionMap.containsKey(sourceColumnName
7171 .toUpperCase())) {
72- return this.columnNameSubstitutionMap.get(sourceColumnName
73- .toUpperCase());
72+ if (getMirroringFromDatabaseType().isFileMaker()) {
73+ return String.format("\"%s\"", this.columnNameSubstitutionMap
74+ .get(sourceColumnName.toUpperCase()));
75+ } else {
76+ return this.columnNameSubstitutionMap.get(sourceColumnName
77+ .toUpperCase());
78+ }
7479 }
7580 return null;
7681 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/engine/SQLServerThread.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/engine/SQLServerThread.java (revision 379)
@@ -603,7 +603,8 @@
603603 public String test() {
604604 StringBuilder buf = new StringBuilder();
605605 /* Create a connection instance */
606- this.conn = new ch.ethz.ssh2.Connection(sshProperties.hostname);
606+ this.conn = new ch.ethz.ssh2.Connection(sshProperties.hostname,
607+ sshProperties.ssh_port);
607608
608609 boolean stop = false;
609610 /* Now connect */
@@ -646,13 +647,11 @@
646647 try {
647648 buf.append(String.format("[ Local port forwarder ].%n"));
648649 fLogger.info(String.format(
649- "conn.createLocalPortForwarder(%d,%s,%s)",
650+ "conn.createLocalPortForwarder(%d, %s)",
650651 sshProperties.local_port,
651- sshProperties.host_to_connect,
652652 sshProperties.port_to_connect));
653653 lpf = conn.createLocalPortForwarder(
654- sshProperties.local_port,
655- sshProperties.host_to_connect,
654+ sshProperties.local_port, "127.0.0.1",
656655 sshProperties.port_to_connect);
657656 buf.append(String
658657 .format(" createLocalPortForwarder success %n"));
@@ -663,33 +662,33 @@
663662 e.getMessage()));
664663 fLogger.error(StringUtil.EMPTY_STRING, e);
665664 }
666- try {
667- buf.append(String
668- .format("[ Request remote port forwarder ].%n"));
669- this.conn.requestRemotePortForwarding(
670- sshProperties.bindAddress, sshProperties.bindPort,
671- sshProperties.targetAddress,
672- sshProperties.targetPort);
673- buf.append(String
674- .format(" requestRemotePortForwarding success %n"));
675- try {
676- conn.cancelRemotePortForwarding(this.sshProperties.bindPort);
677- buf.append(String
678- .format(" cancelRemotePortForwarding success %n"));
679- } catch (IOException e) {
680- buf.append(String.format(
681- " cancelRemotePortForwarding fail[%s] %n",
682- e.getMessage()));
683- fLogger.error(e.getMessage());
684- }
685-
686- } catch (IOException e) {
687- stop = true;
688- buf.append(String.format(
689- " requestRemotePortForwarding fail[%s] %n",
690- e.getMessage()));
691- fLogger.error(e.getMessage());
692- }
665+ // try {
666+ // buf.append(String
667+ // .format("[ Request remote port forwarder ].%n"));
668+ // this.conn.requestRemotePortForwarding(
669+ // sshProperties.bindAddress, sshProperties.bindPort,
670+ // sshProperties.targetAddress,
671+ // sshProperties.targetPort);
672+ // buf.append(String
673+ // .format(" requestRemotePortForwarding success %n"));
674+ // try {
675+ // conn.cancelRemotePortForwarding(this.sshProperties.bindPort);
676+ // buf.append(String
677+ // .format(" cancelRemotePortForwarding success %n"));
678+ // } catch (IOException e) {
679+ // buf.append(String.format(
680+ // " cancelRemotePortForwarding fail[%s] %n",
681+ // e.getMessage()));
682+ // fLogger.error(e.getMessage());
683+ // }
684+ //
685+ // } catch (IOException e) {
686+ // stop = true;
687+ // buf.append(String.format(
688+ // " requestRemotePortForwarding fail[%s] %n",
689+ // e.getMessage()));
690+ // fLogger.error(e.getMessage());
691+ // }
693692 if (lpf != null) {
694693 try {
695694 lpf.close();
@@ -711,7 +710,8 @@
711710
712711 public void makeTunnel() throws IOException {
713712 /* Create a connection instance */
714- this.conn = new ch.ethz.ssh2.Connection(sshProperties.hostname);
713+ this.conn = new ch.ethz.ssh2.Connection(sshProperties.hostname,
714+ sshProperties.ssh_port);
715715
716716 /* Now connect */
717717 this.conn.connect();
@@ -726,23 +726,12 @@
726726 // host_to_connect
727727 // port_to_connect
728728 this.lpf1 = conn.createLocalPortForwarder(sshProperties.local_port,
729- sshProperties.host_to_connect,
730- sshProperties.port_to_connect);
731-
732- this.conn.requestRemotePortForwarding(sshProperties.bindAddress,
733- sshProperties.bindPort, sshProperties.targetAddress,
734- sshProperties.targetPort);
729+ "127.0.0.1", sshProperties.port_to_connect);
735730 }
736731
737732 public boolean closeTunnel() throws IOException {
738733 fLogger.info(String.format("cancelRemotePortForwarding[%d]",
739734 this.sshProperties.bindPort));
740- this.conn.cancelRemotePortForwarding(this.sshProperties.bindPort);
741-
742- /*
743- * Stop accepting connections on 127.0.0.1:8080 that are being
744- * forwarded to www.ethz.ch:80
745- */
746735 lpf1.close();
747736
748737 /* Close the connection */
@@ -785,12 +774,15 @@
785774 boolean ret = false;
786775 try {
787776 SSHConnectionInfo info = sshConnectionMap.get(sshProperties);
788- ret = info.closeTunnel();
777+ if (info != null) {
778+ ret = info.closeTunnel();
779+ }
789780 } catch (Exception e) {
790781 fLogger.warn("SSH-Tunneling close fault.", e);
791782 }
792783 fLogger.info(String.format("[closed SSH-Tunnel][%s] [%b]",
793784 sshProperties.getShortInformation(), ret));
785+ this.sshConnectionMap.remove(sshProperties);
794786 return ret;
795787 }
796788 }
\ No newline at end of file
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/AbsTransactionSQL.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/AbsTransactionSQL.java (revision 379)
@@ -520,7 +520,7 @@
520520
521521 /**
522522 * setBinds.
523- *
523+ *
524524 * @param statement
525525 * @param args
526526 * @throws SQLException
@@ -620,7 +620,7 @@
620620
621621 /*
622622 * (non-Javadoc)
623- *
623+ *
624624 * @see hiro.yoshioka.sql.ITransactionSQL#count(java.lang.String)
625625 */
626626 public int count(String sql_statement) throws SQLException {
@@ -653,7 +653,7 @@
653653
654654 /*
655655 * (non-Javadoc)
656- *
656+ *
657657 * @see hiro.yoshioka.sql.ITransactionSQL#counts(java.lang.String[])
658658 */
659659 public ResultSetDataHolder2 counts(String[] sql_statements)
@@ -798,7 +798,7 @@
798798
799799 /*
800800 * (non-Javadoc)
801- *
801+ *
802802 * @see hiro.yoshioka.sql.ITransactionSQL#execute(java.lang.String,
803803 * java.lang.String[])
804804 */
@@ -811,7 +811,7 @@
811811 // --
812812 /**
813813 * 引数のSQL文を実行して結果を返す。 <BR>
814- *
814+ *
815815 * @param connection
816816 * コネクション
817817 * @param sql_statement
@@ -890,7 +890,7 @@
890890
891891 /*
892892 * (non-Javadoc)
893- *
893+ *
894894 * @see hiro.yoshioka.sql.ITransactionSQL#executePrepare(java.lang.String,
895895 * java.lang.Object[])
896896 */
@@ -948,7 +948,7 @@
948948 // --
949949 /**
950950 * 引数のSQL文を実行して結果を返す。 <BR>
951- *
951+ *
952952 * @param connection
953953 * コネクション
954954 * @param sql_statement
@@ -993,7 +993,7 @@
993993
994994 /*
995995 * (non-Javadoc)
996- *
996+ *
997997 * @see hiro.yoshioka.sql.ITransactionSQL#saveCsv(java.lang.String,
998998 * jp.sf.orangesignal.csv.handlers.ResultSetHandler,
999999 * jp.sf.orangesignal.csv.CsvWriter)
@@ -1083,7 +1083,7 @@
10831083 // --
10841084 /*
10851085 * (non-Javadoc)
1086- *
1086+ *
10871087 * @see hiro.yoshioka.sql.ITransactionSQL#cansel()
10881088 */
10891089 // --------------------------------------------------------------------------
@@ -1109,7 +1109,7 @@
11091109
11101110 /*
11111111 * (non-Javadoc)
1112- *
1112+ *
11131113 * @see hiro.yoshioka.sql.ITransactionSQL#commit()
11141114 */
11151115 public boolean commit() {
@@ -1132,7 +1132,7 @@
11321132
11331133 /*
11341134 * (non-Javadoc)
1135- *
1135+ *
11361136 * @see hiro.yoshioka.sql.ITransactionSQL#rollback()
11371137 */
11381138 public boolean rollback() {
@@ -1173,7 +1173,7 @@
11731173
11741174 /*
11751175 * (non-Javadoc)
1176- *
1176+ *
11771177 * @see hiro.yoshioka.sql.ITransactionSQL#trunsactionTime()
11781178 */
11791179 public boolean trunsactionTime() {
@@ -1182,7 +1182,7 @@
11821182
11831183 /*
11841184 * (non-Javadoc)
1185- *
1185+ *
11861186 * @see hiro.yoshioka.sql.ITransactionSQL#getTableMetaCopy(java.lang.String)
11871187 */
11881188 public ResultSetMetaCopy getTableMetaCopy(String name) {
@@ -1191,7 +1191,7 @@
11911191
11921192 /*
11931193 * (non-Javadoc)
1194- *
1194+ *
11951195 * @see hiro.yoshioka.sql.ITransactionSQL#getTableMetaCopy(java.lang.String,
11961196 * java.lang.String[])
11971197 */
@@ -1462,7 +1462,9 @@
14621462 mappingToSchemaName, tableInfo.name, existsTable));
14631463 if (existsTable && mirroring_request.dropTable) {
14641464 dropTable(mappingToSchemaName, mappingFromTable,
1465- mirroring_request.cascade);
1465+ mirroring_request.cascade, mirroring_request
1466+ .getMirroringFromDatabaseType()
1467+ .isFileMaker());
14661468 }
14671469
14681470 ITransactionSQL mirroringFromSql = mirroring_request
@@ -1651,13 +1653,16 @@
16511653 }
16521654
16531655 protected boolean dropTable(String schemaName, IDBTable table,
1654- boolean cascade) throws SQLException {
1656+ boolean cascade, boolean quoteTableName) throws SQLException {
16551657 StringBuilder st = new StringBuilder();
1658+ String tn = table.getName();
1659+ if (quoteTableName) {
1660+ tn = String.format("\"%s\"", tn);
1661+ }
16561662 if (StringUtil.isEmpty(schemaName)) {
1657- st.append(String.format("DROP TABLE %s", table.getName()));
1663+ st.append(String.format("DROP TABLE %s", tn));
16581664 } else {
1659- st.append(String.format("DROP TABLE %s.%s", schemaName,
1660- table.getName()));
1665+ st.append(String.format("DROP TABLE %s.%s", schemaName, tn));
16611666 }
16621667 if (cascade) {
16631668 st.append(" CASCADE ");
@@ -1700,7 +1705,11 @@
17001705 if (!StringUtil.isEmpty(mappingToSchemaName)) {
17011706 buf.append(mappingToSchemaName).append(".");
17021707 }
1703- buf.append(tableInfo.name).append(" ");
1708+ if (request.getMirroringFromDatabaseType().isFileMaker()) {
1709+ buf.append(String.format("\"%s\" ", tableInfo.name));
1710+ } else {
1711+ buf.append(tableInfo.name).append(" ");
1712+ }
17041713 buf.append("(");
17051714 for (int i = 1; i <= rs_meta.getColumnCount(); i++) {
17061715 if (i > 1) {
@@ -1714,7 +1723,8 @@
17141723 }
17151724
17161725 columnName = request.getMirroringToDatabaseType()
1717- .getQuotedColumnName(columnName);
1726+ .getQuotedColumnName(columnName,
1727+ request.getMirroringFromDatabaseType());
17181728 buf.append(columnName);
17191729 value_buf.append("?");
17201730 }
@@ -1746,7 +1756,9 @@
17461756 } finally {
17471757 sum++;
17481758 if (sum % 100 == 0) {
1749- request.subTask(String.format("Insert into %s . total insert records[%d]",tableInfo.name, sum));
1759+ request.subTask(String.format(
1760+ "Insert into %s . total insert records[%d]",
1761+ tableInfo.name, sum));
17501762 fLogger.info("total insert records " + sum);
17511763 }
17521764 if (st != null) {
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/DBConfigDialog.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/DBConfigDialog.java (revision 379)
@@ -239,7 +239,7 @@
239239 fUrlOrHostText.setVisible(true);
240240 fUserText.setEditable(true);
241241 fPasswordText.setEditable(true);
242- fUrlOrHostLabel.setText("URL: "); //$NON-NLS-1$
242+ fUrlOrHostLabel.setText("URL: "); //$NON-NLS-1$
243243 switch (this.databaseType) {
244244 case MONGO:
245245 fUrlOrHostLabel.setText(Messages
@@ -442,7 +442,7 @@
442442 fDatabaseText = new Text(baseGroup, SWT.SINGLE | SWT.BORDER); //$NON-NLS-1$
443443 fDatabaseText.setLayoutData(createTextGridData());
444444
445- fUrlOrHostLabel = createLabel(baseGroup, "Host: "); //$NON-NLS-1$
445+ fUrlOrHostLabel = createLabel(baseGroup, "Host: "); //$NON-NLS-1$
446446 fUrlOrHostText = new Text(baseGroup, SWT.SINGLE | SWT.BORDER);
447447 fUrlOrHostText.addKeyListener(new KeyAdapter() {
448448 @Override
@@ -588,7 +588,7 @@
588588 radioComposite.setLayout(new FillLayout());
589589
590590 fCategoriesPatternLabel = createLabel(optionalGroup,
591- "Catalog Pattern: "); //$NON-NLS-1$
591+ "Catalog Pattern: "); //$NON-NLS-1$
592592 fCategoriesRegexText = new Text(optionalGroup, SWT.SINGLE | SWT.BORDER); //$NON-NLS-1$
593593 fCategoriesRegexText.setLayoutData(createTextGridData());
594594
@@ -1014,7 +1014,7 @@
10141014 fCombo.add(DatabaseType.DOMINO.getDriverName());
10151015 fCombo.setData(DatabaseType.DOMINO.getDriverName(), f);
10161016
1017- }
1017+ }
10181018 }
10191019 }
10201020
@@ -1029,7 +1029,8 @@
10291029
10301030 resetSysCombo();
10311031 resetTab();
1032- if (this.databaseType.isMsAccessJackess()) {
1032+ switch (this.databaseType) {
1033+ case MS_ACCESS_JACKCESS:
10331034 // User has selected to open multiple files
10341035 FileDialog dlg = new FileDialog(getShell(), SWT.SINGLE);
10351036 dlg.setFilterNames(MDB_FILTER_NAMES);
@@ -1038,14 +1039,20 @@
10381039 if (fn != null) {
10391040 File mdb_file = new File(dlg.getFilterPath(), dlg.getFileName());
10401041 fUrlOrHostText.setText(mdb_file.getAbsolutePath());
1041- if(fDisplayNameText.getText().length()==0){
1042+ if (fDisplayNameText.getText().length() == 0) {
10421043 fDisplayNameText.setText(dlg.getFileName());
10431044 }
1044- if(fUserText.getText().length()==0){
1045+ if (fUserText.getText().length() == 0) {
10451046 fUserText.setText("guest");
10461047 }
10471048 validate();
10481049 }
1050+ break;
1051+ case FILE_MAKER:
1052+ if (fUserText.getText().length() == 0) {
1053+ fUserText.setText("Admin");
1054+ }
1055+ break;
10491056 }
10501057
10511058 fUrlOrHostText.traverse(SWT.TRAVERSE_TAB_PREVIOUS);
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SSHTunnelingDefineEditor.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SSHTunnelingDefineEditor.java (revision 379)
@@ -41,7 +41,9 @@
4141
4242 ConnectionSettingDialog dialog;
4343 private static String[] HEADER = { StringUtil.HALF_SPACE__STRING,
44- Messages.getString("SSHTunnelingDefineEditor.definition"), Messages.getString("SSHTunnelingDefineEditor.hostname"), Messages.getString("SSHTunnelingDefineEditor.user"), "local port", "host to connect", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
44+ Messages.getString("SSHTunnelingDefineEditor.definition"),
45+ Messages.getString("SSHTunnelingDefineEditor.hostname"), "Port",
46+ Messages.getString("SSHTunnelingDefineEditor.user"), "local port",
4547 "port to connect", "bind addr", "bind port" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
4648 private static int[] HEADER_WIDTH = { 25, 100, 90, 70, 50, 70, 50, 70, 50 };
4749
@@ -259,13 +261,13 @@
259261 result = item.hostname;
260262 break;
261263 case 3:
262- result = item.username;
264+ result = String.valueOf(item.ssh_port);
263265 break;
264266 case 4:
265- result = String.valueOf(item.local_port);
267+ result = item.username;
266268 break;
267269 case 5:
268- result = item.host_to_connect;
270+ result = String.valueOf(item.local_port);
269271 break;
270272 case 6:
271273 result = String.valueOf(item.port_to_connect);
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SelectTableDialog.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SelectTableDialog.java (revision 379)
@@ -2,6 +2,7 @@
22
33 import hiro.yoshioka.sdh.BindObject;
44 import hiro.yoshioka.sdh.ConditionOperatorType;
5+import hiro.yoshioka.sdh.DatabaseType;
56 import hiro.yoshioka.sql.IRequestListener;
67 import hiro.yoshioka.sql.engine.DominoTransactionRequest;
78 import hiro.yoshioka.sql.engine.MongoTransactionRequest;
@@ -21,8 +22,6 @@
2122 import hiro.yoshioka.util.SQLDataType;
2223 import hiro.yoshioka.util.StringUtil;
2324
24-import java.math.BigDecimal;
25-import java.math.BigInteger;
2625 import java.nio.charset.Charset;
2726 import java.util.ArrayList;
2827 import java.util.Collection;
@@ -53,9 +52,7 @@
5352 import org.eclipse.jface.viewers.Viewer;
5453 import org.eclipse.swt.SWT;
5554 import org.eclipse.swt.custom.CCombo;
56-import org.eclipse.swt.events.MouseAdapter;
5755 import org.eclipse.swt.events.MouseEvent;
58-import org.eclipse.swt.events.MouseMoveListener;
5956 import org.eclipse.swt.events.MouseTrackListener;
6057 import org.eclipse.swt.events.SelectionAdapter;
6158 import org.eclipse.swt.events.SelectionEvent;
@@ -62,7 +59,6 @@
6259 import org.eclipse.swt.events.SelectionListener;
6360 import org.eclipse.swt.graphics.Color;
6461 import org.eclipse.swt.graphics.Image;
65-import org.eclipse.swt.graphics.Point;
6662 import org.eclipse.swt.layout.FillLayout;
6763 import org.eclipse.swt.layout.GridData;
6864 import org.eclipse.swt.layout.GridLayout;
@@ -523,11 +519,12 @@
523519 }
524520
525521 private String getColumnName(IDBColumn column, boolean withAlias,
526- boolean doQuote) {
522+ boolean doQuote, DatabaseType db_type) {
527523 String columnName = column.getName();
528- if (this.root != null
529- && this.root.getDatabaseProductName()
530- .equalsIgnoreCase("ACCESS")) {
524+ if (db_type.isFileMaker()) {
525+ return String.format("\"%s\"", columnName);
526+ }
527+ if (db_type.isMsAccessJackess()) {
531528 if (columnName.startsWith("_")) {
532529 return String.format("\"%s\"", columnName);
533530 }
@@ -558,8 +555,16 @@
558555 }
559556 }
560557
558+ private DatabaseType getDatabaseType() {
559+ if (this.root == null) {
560+ return DatabaseType.UNKNOWN;
561+ }
562+ return DatabaseType.parse(this.root.getDatabaseProductName());
563+ }
564+
561565 private void refreshSqlStatement() {
562566 try {
567+ DatabaseType db_type = getDatabaseType();
563568 StringBuffer buf = new StringBuffer();
564569 buf.append(getSpecialRendition());
565570 buf.append("SELECT ").append(StringUtil.LINE_SEPARATOR); //$NON-NLS-1$
@@ -583,7 +588,7 @@
583588 buf.append(","); //$NON-NLS-1$
584589 }
585590 buf.append(getColumnName(columns[i],
586- fLogicalBtn.getSelection(), doQuote));
591+ fLogicalBtn.getSelection(), doQuote, db_type));
587592 j++;
588593 }
589594 if (i > 0 && i % 5 == 0 && (i + 1 < columns.length)) {
@@ -593,9 +598,18 @@
593598
594599 }
595600 buf.append(StringUtil.LINE_SEPARATOR).append("FROM "); //$NON-NLS-1$
596-
597- buf.append(String
598- .format("%s %n", fIDBTable.getNameWithParentName())); //$NON-NLS-1$
601+ switch (db_type) {
602+ case FILE_MAKER:
603+ buf.append(String.format("\"%s\" %n", fIDBTable.getName())); //$NON-NLS-1$
604+ break;
605+ case CASSANDRA:
606+ buf.append(String.format("%s %n", fIDBTable.getName())); //$NON-NLS-1$
607+ break;
608+ default:
609+ buf.append(String.format(
610+ "%s %n", fIDBTable.getNameWithParentName())); //$NON-NLS-1$
611+ break;
612+ }
599613 boolean doWhere = false;
600614 for (int i = 0; i < myModel.length; i++) {
601615 if (myModel[i].validAppendCondition()) {
@@ -609,12 +623,16 @@
609623 for (int i = 0; i < myModel.length; i++) {
610624 if (myModel[i].validAppendCondition()) {
611625 if (myModel[i].compareOperator >= 6) {
612- buf.append(String.format("%s %s ",
613- getColumnName(columns[i], false, false),
626+ buf.append(String.format(
627+ "%s %s ",
628+ getColumnName(columns[i], false, false,
629+ db_type),
614630 COMP[myModel[i].compareOperator]));
615631 } else {
616- buf.append(String.format("%s %s ? ",
617- getColumnName(columns[i], false, false),
632+ buf.append(String.format(
633+ "%s %s ? ",
634+ getColumnName(columns[i], false, false,
635+ db_type),
618636 COMP[myModel[i].compareOperator]));
619637 BindObject bi = new BindObject(
620638 myModel[i].condition, myModel[i].dataType);
@@ -640,8 +658,8 @@
640658 buf.append("ORDER BY " + StringUtil.LINE_SEPARATOR); //$NON-NLS-1$
641659 for (int i = 0; i < myModel.length; i++) {
642660 if (myModel[i].sort > 0) {
643- buf.append(getColumnName(columns[i], false, false)
644- + " " //$NON-NLS-1$
661+ buf.append(getColumnName(columns[i], false, false,
662+ db_type) + " " //$NON-NLS-1$
645663 + SORT[myModel[i].sort] + ","); //$NON-NLS-1$
646664 }
647665 }
@@ -999,7 +1017,11 @@
9991017 if (connectionProperties.isConnected()) {
10001018 Button bt = getButton(BTN_ID_UPDATE);
10011019 if (bt != null) {
1002- bt.setEnabled(newErrorMessage == null);
1020+ if (getDatabaseType().isFileMaker()) {
1021+ bt.setEnabled(false);
1022+ } else {
1023+ bt.setEnabled(newErrorMessage == null);
1024+ }
10031025 }
10041026 bt = getButton(BTN_ID_SELECT);
10051027 if (bt != null) {
@@ -1018,13 +1040,17 @@
10181040 btUpd = createButton(parent, BTN_ID_UPDATE,
10191041 Messages.getString("SelectTableDialog.ExecuteForUpdate"), false); //$NON-NLS-1$
10201042 if (connectionProperties.isConnected()) {
1021- btUpd.addSelectionListener(new SelectionAdapter() {
1022- @Override
1023- public void widgetSelected(SelectionEvent e) {
1024- // mainConditionTable.a
1025- execute(true);
1026- }
1027- });
1043+ if (getDatabaseType().isFileMaker()) {
1044+ btUpd.setEnabled(false);
1045+ } else {
1046+ btUpd.addSelectionListener(new SelectionAdapter() {
1047+ @Override
1048+ public void widgetSelected(SelectionEvent e) {
1049+ // mainConditionTable.a
1050+ execute(true);
1051+ }
1052+ });
1053+ }
10281054 } else {
10291055 btUpd.setEnabled(false);
10301056 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SQLHistroyManager.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SQLHistroyManager.java (revision 379)
@@ -49,7 +49,7 @@
4949 }
5050
5151 /**
52- *
52+ *
5353 */
5454 public String go() {
5555 if (fHistoyList.size() == 0) {
@@ -160,6 +160,16 @@
160160 decoder = new XMLDecoder(new BufferedInputStream(
161161 new FileInputStream(getHistoryFile())));
162162 fHistoyList = (ArrayList<SQLHistoryData>) decoder.readObject();
163+ if (fHistoyList != null) {
164+ for (int i = 0; i < fHistoyList.size(); i++) {
165+ SQLHistoryData data = fHistoyList.get(i);
166+ if (data == null) {
167+ fHistoyList.remove(i);
168+ i--;
169+ continue;
170+ }
171+ }
172+ }
163173 return true;
164174 } catch (FileNotFoundException e) {
165175 fLogger.error(e);
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SQLUtil2.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SQLUtil2.java (revision 379)
@@ -95,12 +95,16 @@
9595 StringBuilder buf = new StringBuilder();
9696 String colName = null;
9797 if (StringUtil.isEmpty(substitutionColumnName)) {
98- colName = column.getName();
98+ if(mappingFrom.isFileMaker()){
99+ colName = String.format("\"%s\"", column.getName());
100+ } else {
101+ colName = column.getName();
102+ }
99103 } else {
100104 colName = substitutionColumnName;
101105 }
102106
103- buf.append(String.format("%s ", mappingTo.getQuotedColumnName(colName)));
107+ buf.append(String.format("%s ", mappingTo.getQuotedColumnName(colName, null)));
104108
105109 int size = column.getSize();
106110 if (size <= 0) {
@@ -578,10 +582,14 @@
578582 StringBuilder buf = new StringBuilder();
579583 if (mappingFromTable.isTable()) {
580584 buf.append("CREATE TABLE ");
581- if (schemaName.length() > 0) {
582- buf.append(schemaName).append(".");
585+ if( request.getMirroringFromDatabaseType().isFileMaker() ){
586+ buf.append(String.format("\"%s\"", mappingFromTable.getName()));
587+ } else {
588+ if (schemaName.length() > 0) {
589+ buf.append(schemaName).append(".");
590+ }
591+ buf.append(mappingFromTable.getName());
583592 }
584- buf.append(mappingFromTable.getName());
585593 buf.append(" ( ").append(StringUtil.LINE_SEPARATOR);
586594 IDBColumn[] columns = mappingFromTable.getColumns();
587595 fLogger.info("columns.length = " + columns.length);
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SSHTunnelingConfigDialog.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/util/SSHTunnelingConfigDialog.java (revision 379)
@@ -58,19 +58,12 @@
5858 Text fAuth_host;
5959 Text fAuth_user;
6060 Text fAuth_pass;
61+ Spinner fAuth_port;
6162
6263 // [ Local Port Forwarder ]
6364 Spinner fLpf_port;
64- Text fLpf_to_host;
6565 Spinner fLpf_to_port;
6666
67- // [ Request Remote Port Forwarder ]
68- Text fRpf_bind_address;
69- Spinner fRpf_bind_port;
70-
71- Text fRpf_target_address;
72- Spinner fRpf_target_port;
73-
7467 SSHProperties fSSHProperties;
7568
7669 String originalName;
@@ -145,18 +138,6 @@
145138 }
146139 testConnectButton.setEnabled(true);
147140
148- if (StringUtil.isEmpty(fLpf_to_host.getText())) {
149- setErrorMessage(DEF_MESSAGE_LPF_HOST);
150- return;
151- }
152- if (StringUtil.isEmpty(fRpf_bind_address.getText())) {
153- setErrorMessage(DEF_MESSAGE_RPF_BIND_ADDR);
154- return;
155- }
156- if (StringUtil.isEmpty(fRpf_target_address.getText())) {
157- setErrorMessage(DEF_MESSAGE_RPF_TARGET_ADDR);
158- return;
159- }
160141 bt.setEnabled(true);
161142
162143 }
@@ -195,6 +176,12 @@
195176 fAuth_host.addKeyListener(this);
196177 fAuth_host.setMessage(DEF_MESSAGE_AUTH_HOST);
197178
179+ createLabel(baseGroup,"Port");
180+ fAuth_port = new Spinner(baseGroup, SWT.NONE);
181+ fAuth_port.setValues(22, 22, 99999, 0, 1, 1);
182+ fAuth_port.setLayoutData(createTextGridData());
183+ fAuth_port.addKeyListener(this);
184+
198185 createLabel(baseGroup,
199186 Messages.getString("SSHTunnelingConfigDialog.userName")); //$NON-NLS-1$
200187 fAuth_user = new Text(baseGroup, SWT.SINGLE | SWT.BORDER); //$NON-NLS-1$
@@ -221,60 +208,23 @@
221208 fLpf_port.setLayoutData(createTextGridData());
222209
223210 createLabel(lpfGroup,
224- Messages.getString("SSHTunnelingConfigDialog.hostToConnect")); //$NON-NLS-1$
225- fLpf_to_host = new Text(lpfGroup, SWT.SINGLE | SWT.BORDER);
226- fLpf_to_host.setLayoutData(createTextGridData());
227- fLpf_to_host.addKeyListener(this);
228- fLpf_to_host.setMessage(DEF_MESSAGE_LPF_HOST);
229-
230- createLabel(lpfGroup,
231211 Messages.getString("SSHTunnelingConfigDialog.portToConnect")); //$NON-NLS-1$
232212 fLpf_to_port = new Spinner(lpfGroup, SWT.NONE);
233213 fLpf_to_port.setValues(5432, 0, 100000, 0, 1, 5);
234214 fLpf_to_port.setLayoutData(createTextGridData());
235215
236- // [ Request Remote Port Forwarder ]
237- Group rpfGroup = createGroup(
238- inner,
239- Messages.getString("SSHTunnelingConfigDialog.RequestRemotePortForwarder"), 2); //$NON-NLS-1$
240216
241- createLabel(rpfGroup, "bind address:"); //$NON-NLS-1$
242- fRpf_bind_address = new Text(rpfGroup, SWT.SINGLE | SWT.BORDER);
243- fRpf_bind_address.setLayoutData(createTextGridData());
244- fRpf_bind_address.addKeyListener(this);
245- fRpf_bind_address.setMessage(DEF_MESSAGE_RPF_BIND_ADDR);
246-
247- createLabel(rpfGroup, "bind port:"); //$NON-NLS-1$
248- fRpf_bind_port = new Spinner(rpfGroup, SWT.NONE);
249- fRpf_bind_port.setValues(15432, 0, 100000, 0, 1, 5);
250- fRpf_bind_port.setLayoutData(createTextGridData());
251-
252- createLabel(rpfGroup, "target address:"); //$NON-NLS-1$
253- fRpf_target_address = new Text(rpfGroup, SWT.SINGLE | SWT.BORDER);
254- fRpf_target_address.setLayoutData(createTextGridData());
255- fRpf_target_address.addKeyListener(this);
256- fRpf_target_address.setMessage(DEF_MESSAGE_RPF_TARGET_ADDR);
257-
258- createLabel(rpfGroup, "target port:"); //$NON-NLS-1$
259- fRpf_target_port = new Spinner(rpfGroup, SWT.NONE);
260- fRpf_target_port.setValues(5432, 0, 100000, 0, 1, 5);
261- fRpf_target_port.setLayoutData(createTextGridData());
262-
263217 switch (this.mode) {
264218 case EDIT:
265219 case CLONE:
266220 fDefinitionName.setText(this.fSSHProperties.getDefinition_name());
267221 fAuth_host.setText(this.fSSHProperties.hostname);
222+ fAuth_port.setSelection(this.fSSHProperties.ssh_port);
268223 fAuth_user.setText(this.fSSHProperties.username);
269224 fAuth_pass.setText(this.fSSHProperties.password);
270- fLpf_to_host.setText(this.fSSHProperties.host_to_connect);
271225 fLpf_port.setSelection(this.fSSHProperties.local_port);
272226 fLpf_to_port.setSelection(this.fSSHProperties.port_to_connect);
273227
274- fRpf_bind_address.setText(this.fSSHProperties.bindAddress);
275- fRpf_bind_port.setSelection(this.fSSHProperties.bindPort);
276- fRpf_target_address.setText(this.fSSHProperties.targetAddress);
277- fRpf_target_port.setSelection(this.fSSHProperties.targetPort);
278228 break;
279229 }
280230 if (this.mode == MODE.EDIT) {
@@ -368,17 +318,13 @@
368318 private void setOnProperties(SSHProperties p) {
369319 p.definition_name = fDefinitionName.getText();
370320 p.hostname = fAuth_host.getText();
321+ p.ssh_port = fAuth_port.getSelection();
371322 p.username = fAuth_user.getText();
372323 p.password = fAuth_pass.getText();
373324
374325 p.local_port = fLpf_port.getSelection();
375- p.host_to_connect = fLpf_to_host.getText();
376326 p.port_to_connect = fLpf_to_port.getSelection();
377327
378- p.bindAddress = fRpf_bind_address.getText();
379- p.bindPort = fRpf_bind_port.getSelection();
380- p.targetAddress = fRpf_target_address.getText();
381- p.targetPort = fRpf_target_port.getSelection();
382328 }
383329
384330 public SSHProperties getSSHProperties() {
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/resource/view/DBTreeLabelProvider.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/resource/view/DBTreeLabelProvider.java (revision 379)
@@ -232,8 +232,12 @@
232232 styledString.append(decoration, StyledString.COUNTER_STYLER);
233233 } else if (resource instanceof IDBColumn) {
234234 DBColumn obj = (DBColumn) resource;
235- styledString = new StyledString(
236- StringUtil.nvl(obj.getComment()));
235+ if (obj.isInsertDisabled()) {
236+ styledString = new StyledString("Insert Disabled");
237+ } else {
238+ styledString = new StyledString(StringUtil.nvl(obj
239+ .getComment()));
240+ }
237241 } else if (resource instanceof IDBTable) {
238242 IDBTable table = (IDBTable) resource;
239243 styledString = new StyledString(table.getComment());
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/FileMakerSQL.java (nonexistent)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/FileMakerSQL.java (revision 379)
@@ -0,0 +1,354 @@
1+package hiro.yoshioka.sql;
2+
3+import hiro.yoshioka.ast.sql.oracle.WolfSQLParserConstants;
4+import hiro.yoshioka.sdh.ResultSetDataHolder;
5+import hiro.yoshioka.sdh2.ResultSetDataHolder2;
6+import hiro.yoshioka.sql.engine.GettingResourceRequest;
7+import hiro.yoshioka.sql.engine.Request;
8+import hiro.yoshioka.sql.engine.SQLOperationType;
9+import hiro.yoshioka.sql.engine.TransactionRequest;
10+import hiro.yoshioka.sql.resource.DBColumn;
11+import hiro.yoshioka.sql.resource.DBResourceType;
12+import hiro.yoshioka.sql.resource.DBSequence;
13+import hiro.yoshioka.sql.resource.IDBColumn;
14+import hiro.yoshioka.sql.resource.IDBResource;
15+import hiro.yoshioka.sql.resource.IDBSchema;
16+import hiro.yoshioka.sql.resource.IDBTable;
17+import hiro.yoshioka.util.SQLDataType;
18+import hiro.yoshioka.util.SQLUtil;
19+import hiro.yoshioka.util.StringUtil;
20+
21+import java.sql.Connection;
22+import java.sql.DatabaseMetaData;
23+import java.sql.Driver;
24+import java.sql.ResultSet;
25+import java.sql.ResultSetMetaData;
26+import java.sql.SQLException;
27+import java.sql.Statement;
28+import java.util.HashSet;
29+import java.util.List;
30+import java.util.Map;
31+import java.util.Properties;
32+import java.util.Set;
33+import java.util.regex.Matcher;
34+import java.util.regex.Pattern;
35+
36+public class FileMakerSQL extends GeneralSQL {
37+ static final String DEFAULT_SCHEMA_NAME = "PUBLIC";
38+ static final String SQL_EXISTS_SCHEMA = "SELECT COUNT(*) CNT FROM INFORMATION_SCHEMA.SYSTEM_SCHEMAS WHERE UPPER(TABLE_SCHEM) = ?";
39+ static final String SQL_CREATE_SCHEMA_PRE = "CREATE SCHEMA ";
40+ static final String SQL_CREATE_SCHEMA_POST = " AUTHORIZATION DBA";
41+ static final String SQL_SELECT_TABLES = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.SYSTEM_TABLES "
42+ + " WHERE TABLE_TYPE='TABLE' AND upper(TABLE_SCHEM) = UPPER(?)";
43+ static final String SQL_EXISTS_TABLE = "SELECT COUNT(*) CNT FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE upper(TABLE_SCHEM) = ? AND UPPER(TABLE_NAME) =?";
44+ static final String SQL_DROP_TABLE = "DROP TABLE ";
45+
46+ static final String _SELECT_DIFF_TABLE = " SELECT "
47+ + " TABLE_NAME, NULL AS TABLE_COMMENT, "
48+ + " COLUMN_NAME, TYPE_NAME, "
49+ + " COLUMN_SIZE AS COLUMN_LENGTH, "
50+ + " NULL AS FLOATPART, "
51+ + " CASE NULLABLE WHEN 1 THEN NULL ELSE 'NN' END not_null, "
52+ + " NULL AS PRI_KEY, "
53+ + " NULL AS uniq_KEY, "
54+ + " ORDINAL_POSITION AS COLUMN_NUMBER, "
55+ + " REMARKS AS COLUMN_COMMENT "
56+ + " FROM "
57+ + " INFORMATION_SCHEMA.SYSTEM_COLUMNS "
58+ + " WHERE "
59+ + " UPPER(TABLE_SCHEM) = UPPER(?) ";
60+
61+ static final String _SQL_COLUMN_PK = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.SYSTEM_PRIMARYKEYS "
62+ + " WHERE TABLE_SCHEM = ? AND TABLE_NAME=?";
63+
64+ static final String _SELECT_ALL_SEQUENCE = "SELECT "
65+ + " SEQUENCE_SCHEMA, " + " SEQUENCE_NAME, "
66+ + " DTD_IDENTIFIER, " + " MAXIMUM_VALUE \"MAX\", "
67+ + " MINIMUM_VALUE \"MIN\", " + " INCREMENT, "
68+ + " CYCLE_OPTION CYCLE, " + " START_WITH "
69+ + " FROM INFORMATION_SCHEMA.SYSTEM_SEQUENCES "
70+ + " WHERE SEQUENCE_SCHEMA = ? ";
71+ static final String _SELECT_SEQUENCE_CNT = "SELECT COUNT(*) AS \"CNT\" FROM INFORMATION_SCHEMA.SYSTEM_SEQUENCES WHERE UPPER(SEQUENCE_SCHEMA) = UPPER(?) AND UPPER(SEQUENCE_NAME) =UPPER(?)";
72+
73+ public static String getSuggestURL() {
74+ return "jdbc:filemaker://localhost/<DB_NAME>";
75+ }
76+
77+ protected FileMakerSQL(Driver ds) {
78+ super(ds);
79+ }
80+
81+ @Override
82+ public boolean doOperation(SQLOperationType Operation, Request request)
83+ throws SQLException {
84+ boolean retCode = true;
85+ TransactionRequest treq = null;
86+ if (request instanceof TransactionRequest) {
87+ treq = (TransactionRequest) request;
88+ setMaxRowNum(treq.getMaxRownum());
89+ }
90+ switch (Operation) {
91+ case COUNT:
92+ String sql = null;
93+ if (StringUtil.isEmpty(treq.getSQLStatement())) {
94+ IDBTable table = treq.getIDBTable();
95+
96+ sql = String.format("SELECT COUNT(*) CNT FROM \"%s\"",
97+ table.getName());
98+ }
99+ treq.setResultCount(count(sql));
100+ break;
101+ default:
102+ return super.doOperation(Operation, request);
103+ }
104+
105+ return retCode;
106+ }
107+
108+ @Override
109+ protected boolean createSchema(String schemaName, Properties properties)
110+ throws SQLException {
111+ String st = String.format("CREATE SCHEMA %s AUTHORIZATION DBA",
112+ schemaName);
113+ executePrepare(st, EMPTY);
114+ return true;
115+ }
116+
117+ @Override
118+ public ResultSet getAllData(IDBTable table) throws SQLException {
119+ IDBResource schema = table.getParent();
120+
121+ getStatement(_con, ResultSet.TYPE_FORWARD_ONLY,
122+ ResultSet.CONCUR_READ_ONLY);
123+
124+ String sql = String.format("SELECT * FROM \"%s\"", table.getName());
125+ return fActiveStatement.executeQuery(sql);
126+ }
127+
128+ @Override
129+ public String getDefaultSchemaName() {
130+ return FileMakerSQL.DEFAULT_SCHEMA_NAME;
131+ }
132+
133+ @Override
134+ public boolean existsTable(String schemaName, String tableName)
135+ throws SQLException {
136+ ResultSetDataHolder rdh = executePrepareQuery(
137+ SQL_EXISTS_TABLE,
138+ new String[] { schemaName.toUpperCase(),
139+ tableName.toUpperCase() });
140+ return rdh.getIntDataDefaultZero(0, "CNT") > 0;
141+ }
142+
143+ protected boolean dropTable(String schemaName, IDBTable table,
144+ boolean cascade, boolean quoteTableName) throws SQLException {
145+ // if (StringUtil.isEmpty(schemaName)) {
146+ // schemaName = HSQL.DEFAULT_SCHEMA_NAME;
147+ // }
148+ return super.dropTable(schemaName, table, cascade, true);
149+ }
150+
151+ @Override
152+ public void setTableColumns(String schema, IDBTable table)
153+ throws SQLException {
154+ String quote_table_name = String.format("\"%s\"", table.getName());
155+
156+ Connection con = this.getOrCreateExtraConnection();
157+ DatabaseMetaData meta = con.getMetaData();
158+ ResultSet rs_m = meta.getColumnPrivileges(null, null, table.getName(),
159+ null);
160+ Set<String> insertableColSets = new HashSet<String>();
161+ while (rs_m.next()) {
162+ String col = rs_m.getString("COLUMN_NAME");
163+ String privilege = rs_m.getString("PRIVILEGE");
164+ if ("INSERT".equalsIgnoreCase(privilege)) {
165+ insertableColSets.add(col);
166+ }
167+ }
168+ rs_m.close();
169+
170+ ResultSet rs = null;
171+ Statement st = null;
172+ StringBuilder sql = new StringBuilder();
173+ try {
174+ st = this.getOrCreateExtraConnection().createStatement();
175+ st.setMaxRows(1);
176+
177+ rs = st.executeQuery(String.format("SELECT * FROM \"%s\"",
178+ table.getName()));
179+ ResultSetMetaData md = rs.getMetaData();
180+ for (int i = 1; i <= md.getColumnCount(); i++) {
181+ DBColumn col = new DBColumn(table);
182+ col.setName(md.getColumnName(i));
183+ col.setDataType(SQLDataType.parse(md.getColumnType(i)));
184+
185+ try {
186+ col.setSize(md.getPrecision(i));
187+ } catch (Exception e) {
188+ col.setSize(0);
189+ }
190+ try {
191+ col.setDecimalDigits(md.getScale(i));
192+ } catch (Exception e) {
193+ col.setDecimalDigits(0);
194+ }
195+
196+ col.setNullable((short) md.isNullable(i));
197+ if (!insertableColSets.contains(col.getName())) {
198+ col.setInsertDisabled(true);
199+ }
200+ col.setDataTypeString(md.getColumnTypeName(i));
201+ col.setMaxColumnNameLength(SQLUtil.getMaxColumnNameBytes(this
202+ .getOrCreateExtraConnection()));
203+
204+ table.putResource(col.getUName(), col);
205+ }
206+ } catch (SQLException e) {
207+ fLogger.info("sql=" + sql); //$NON-NLS-1$
208+ fLogger.info(StringUtil.EMPTY_STRING, e);
209+ return;
210+ } finally {
211+ if (rs != null) {
212+ rs.close();
213+ }
214+ if (st != null) {
215+ st.close();
216+ }
217+ }
218+ }
219+
220+ @Override
221+ protected void getSequence(GettingResourceRequest request)
222+ throws SQLException {
223+ ResultSetDataHolder rdh = null;
224+ IDBSchema[] schemas = getRoot().getSchemas();
225+ for (int i = 0; i < schemas.length; i++) {
226+ if (schemas[i].getName().length() == 0) {
227+ continue;
228+ }
229+ if (request.targetType.isOnlySchema()
230+ && !schemas[i].equals(request.selectionResource)) {
231+ continue;
232+ }
233+
234+ rdh = executePrepareQuery(_SELECT_ALL_SEQUENCE,
235+ new String[] { schemas[i].getName() });
236+ DBSequence sequence = null;
237+ for (int j = 0; j < rdh.getRowCount(); j++) {
238+ sequence = new DBSequence(schemas[i]);
239+ String name = rdh.getStringData(j, "SEQUENCE_NAME");
240+ sequence.setName(name);
241+ // String text = _SELECT_SEQUENCE_BODY + schemas[i].getName()
242+ // + "." + name;
243+ // rdh2 = executePrepareQuery(text, EMPTY);
244+ if (rdh.getRowCount() > 0) {
245+ setResourceProperties(sequence, 0, rdh);
246+ }
247+ schemas[i].putSequence(sequence);
248+ // setViewText(trigger);
249+ }
250+ if (request.canceld()) {
251+ return;
252+ }
253+ }
254+ }
255+
256+ protected String getSupportToken() {
257+ StringBuffer buf = new StringBuffer();
258+ Pattern p = Pattern.compile("\"(\\w+)\"");
259+ String[] str = WolfSQLParserConstants.tokenImage;
260+ for (int i = 0; i < str.length; i++) {
261+ Matcher m = p.matcher(str[i]);
262+ if (m.matches()) {
263+ buf.append(m.group(1)).append(",");
264+ }
265+ }
266+ if (buf.length() > 0) {
267+ buf.setLength(buf.length() - 1);
268+ }
269+ return buf.toString();
270+ }
271+
272+ public ResultSetDataHolder2 executeBatUpdate(String[] statements)
273+ throws SQLException {
274+ Statement statement = null;
275+ ResultSetDataHolder2 sdh = null;
276+ if (_con == null) {
277+ return sdh;
278+ }
279+ try {
280+ boolean[] ret = new boolean[statements.length];
281+ long time = System.currentTimeMillis();
282+ for (int i = 0; i < ret.length; i++) {
283+ ret[i] = execute(statements[i]);
284+ }
285+
286+ time = System.currentTimeMillis() - time;
287+
288+ sdh = createRdh2(new String[] { "Returns", "Statement" }, null);
289+ for (int i = 0; i < ret.length; i++) {
290+ sdh.addRow(new String[] { String.valueOf(ret[i]), statements[i] });
291+ }
292+
293+ sdh.setWrapTime(time);
294+ return sdh;
295+ } finally {
296+ setTransactionTime(true);
297+
298+ if (statement != null) {
299+ statement.close();
300+ }
301+ }
302+ }
303+
304+ // ----------------------------------------------------------------
305+ // [4] DIFF
306+ // ----------------------------------------------------------------
307+ @Override
308+ public ResultSetDataHolder2 getDiffInfoOf(DBResourceType resourceType,
309+ String schemaName, boolean withValue) {
310+ ResultSetDataHolder2 ret = null;
311+ try {
312+ switch (resourceType) {
313+ case TABLE:
314+ ret = executePrepareQuery(_SELECT_DIFF_TABLE,
315+ new String[] { schemaName });
316+ break;
317+ }
318+ } catch (SQLException e) {
319+ fLogger.error(StringUtil.EMPTY_STRING, e);
320+ }
321+ if (ret != null) {
322+ ret.setTableNameE(String.format("DEF_%s_%s", schemaName,
323+ resourceType.name()));
324+ }
325+ fLogger.debug("[" + _info.getDisplayString() + "] ret:[" + ret + "]");
326+ return ret;
327+ }
328+
329+ public void test() {
330+ try {
331+ DatabaseMetaData meta = getOrCreateExtraConnection().getMetaData();
332+
333+ ResultSet rs0 = meta.getTables(null, null, "%",
334+ new String[] { "TABLE" });
335+ ResultSetMetaData rmeta = rs0.getMetaData();
336+
337+ System.out.println("3.-----------------------------------");
338+ ResultSet rs = meta.getColumnPrivileges(null, null, "イベント", null);
339+ ResultSetDataHolder2 rdh = RS2RDH(rs, true);
340+ System.out.println(rdh);
341+
342+ rs = meta.getColumns(null, null, "イベント", null);
343+ System.out.println("4.-----------------------------------");
344+ rdh = RS2RDH(rs, true);
345+ System.out.println(rdh);
346+
347+ } catch (SQLException e) {
348+ // TODO 自動生成された catch ブロック
349+ e.printStackTrace();
350+ }
351+
352+ }
353+
354+}
\ No newline at end of file
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/twitter/TwitterResultSet.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/twitter/TwitterResultSet.java (revision 379)
@@ -1021,6 +1021,17 @@
10211021 }
10221022
10231023 @Override
1024+ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
1025+ // TODO 自動生成されたメソッド・スタブ
1026+ return null;
1027+ }
1028+
1029+ @Override
1030+ public <T> T getObject(String columnName, Class<T> type)
1031+ throws SQLException {
1032+ return (T) getObject(getTargetObjectIdx(columnName));
1033+ }
1034+ @Override
10241035 public Object getObject(int arg0, Map<String, Class<?>> arg1)
10251036 throws SQLException {
10261037 // TODO Auto-generated method stub
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/ResultSetUtil.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/ResultSetUtil.java (revision 379)
@@ -136,6 +136,7 @@
136136 throws SQLException {
137137
138138 try {
139+
139140 switch (meta.getColumnType(index)) {
140141 case Types.TIMESTAMP:
141142 Timestamp t = rs.getTimestamp(index);
@@ -241,6 +242,7 @@
241242 InputStream is = null;
242243 try {
243244 is = rs.getBinaryStream(index);
245+
244246 if (is == null) {
245247 return null;
246248 }
@@ -269,7 +271,8 @@
269271 }
270272 return decimal.toPlainString();
271273 default:
272- return rs.getString(index);
274+ String s = rs.getString(index);
275+ return s;
273276 }
274277 } catch (SQLException e) {
275278 fLogger.info(StringUtil.EMPTY_STRING, e);
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/DataBaseFactory.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/DataBaseFactory.java (revision 379)
@@ -3,6 +3,7 @@
33 import hiro.yoshioka.classmanager.ClassManager;
44 import hiro.yoshioka.sdh.DatabaseType;
55 import hiro.yoshioka.sql.access.MsAccessWithJackcessSQL;
6+import hiro.yoshioka.sql.cassandra.CassandraSQL;
67 import hiro.yoshioka.sql.evernote.EverNoteSQL;
78 import hiro.yoshioka.sql.mongo.MongoSQL;
89 import hiro.yoshioka.sql.params.ConnectionProperties;
@@ -66,6 +67,8 @@
6667 return new EverNoteSQL();
6768 case TWITTER:
6869 return new TwitterSQL();
70+ case CASSANDRA:
71+ return new CassandraSQL();
6972 case HSQL:
7073 return createHSQL();
7174 case MS_ACCESS_JACKCESS:
@@ -110,6 +113,8 @@
110113 case SQLITE:
111114 sql = new SQLiteSQL(driver);
112115 break;
116+ case FILE_MAKER:
117+ sql = new FileMakerSQL(driver);
113118 case UNKNOWN:
114119 sql = new GeneralSQL(driver);
115120 break;
@@ -182,6 +187,10 @@
182187 return SQLiteSQL.getSuggestURL();
183188 case EVERNOTE:
184189 return EverNoteSQL.getHostString();
190+ case FILE_MAKER:
191+ return FileMakerSQL.getSuggestURL();
192+ case CASSANDRA:
193+ return "127.0.0.1:9042";
185194 }
186195 return StringUtil.EMPTY_STRING;
187196 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/mongo/MongoResultSet.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/mongo/MongoResultSet.java (revision 379)
@@ -656,6 +656,18 @@
656656 return getCursorObjectByName(columnName);
657657 }
658658
659+ @Override
660+ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
661+ // TODO 自動生成されたメソッド・スタブ
662+ return null;
663+ }
664+
665+ @Override
666+ public <T> T getObject(String columnName, Class<T> type)
667+ throws SQLException {
668+ return (T) getCursorObjectByName(columnName);
669+ }
670+
659671 public Ref getRef(int columnIndex) {
660672 return (Ref) getCursorObjectByIndex(columnIndex);
661673 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/SSHProperties.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/SSHProperties.java (revision 379)
@@ -14,6 +14,7 @@
1414 public String hostname = StringUtil.EMPTY_STRING;
1515 public String username = StringUtil.EMPTY_STRING;
1616 public String password = StringUtil.EMPTY_STRING;
17+ public int ssh_port = 22;
1718 //
1819 // or "~/.ssh/id_dsa"
1920 public File keyfile;
@@ -24,7 +25,6 @@
2425 // LocalPortForwarder
2526 // -----------------------------------------------
2627 public int local_port;
27- public String host_to_connect = StringUtil.EMPTY_STRING;
2828 public int port_to_connect;
2929
3030 // -----------------------------------------------
@@ -61,10 +61,8 @@
6161 this.targetPort = targetPort;
6262 }
6363
64- public void createLocalPortForwarder(int local_port,
65- String host_to_connect, int port_to_connect) {
64+ public void createLocalPortForwarder(int local_port, int port_to_connect) {
6665 this.local_port = local_port;
67- this.host_to_connect = host_to_connect;
6866 this.port_to_connect = port_to_connect;
6967 }
7068
@@ -84,10 +82,8 @@
8482 StringBuilder buf = new StringBuilder();
8583 buf.append(String.format("SSH-Authenticate[%s/%s]%n", hostname,
8684 username));
87- buf.append(String.format("SSH-LocalportForwarder[%d/%s:%d]%n",
88- local_port, host_to_connect, port_to_connect));
89- buf.append(String.format("SSH-RemoteportForwarder[%s:%d/%s:%d]%n",
90- bindAddress, bindPort, targetAddress, targetPort));
85+ buf.append(String.format("SSH-LocalportForwarder[%d : %d]%n",
86+ local_port, port_to_connect));
9187
9288 return buf.toString();
9389 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/ConnectionProperties.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/params/ConnectionProperties.java (revision 379)
@@ -184,6 +184,14 @@
184184 return StringUtil.nvl(getProperty(HOST));
185185 }
186186
187+ public void setPort(Integer port) {
188+ put(PORT, port);
189+ }
190+
191+ public Integer getPort(){
192+ return (Integer) get(PORT);
193+ }
194+
187195 public void setMongoOptions(MongoOptions options) {
188196 put(MONGO_OPTIONS, options);
189197 }
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/SQLServerSQL.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/SQLServerSQL.java (revision 379)
@@ -66,7 +66,7 @@
6666
6767 @Override
6868 protected boolean dropTable(String schemaName, IDBTable table,
69- boolean cascade) throws SQLException {
69+ boolean cascade, boolean quoteTableName) throws SQLException {
7070 StringBuilder st = new StringBuilder();
7171 if (StringUtil.isEmpty(schemaName)) {
7272 st.append(String.format("DROP TABLE %s", table.getName()));
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/HSQL.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/HSQL.java (revision 379)
@@ -203,11 +203,11 @@
203203 }
204204
205205 protected boolean dropTable(String schemaName, IDBTable table,
206- boolean cascade) throws SQLException {
206+ boolean cascade, boolean quoteTableName) throws SQLException {
207207 // if (StringUtil.isEmpty(schemaName)) {
208208 // schemaName = HSQL.DEFAULT_SCHEMA_NAME;
209209 // }
210- return super.dropTable(schemaName, table, cascade);
210+ return super.dropTable(schemaName, table, cascade, quoteTableName);
211211 }
212212
213213 @Override
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/evernote/EvernoteResultSet.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sql/evernote/EvernoteResultSet.java (revision 379)
@@ -84,7 +84,7 @@
8484 private String authToken;
8585
8686 /**
87- *
87+ *
8888 * @param noteStore
8989 * @param schemaType
9090 * @param tableType
@@ -91,7 +91,7 @@
9191 * @param selectColumnList
9292 * @param params
9393 * @throws Exception
94- *
94+ *
9595 * params:
9696 */
9797 public EvernoteResultSet(NoteStore.Client noteStore, String authToken,
@@ -937,6 +937,18 @@
937937 }
938938
939939 @Override
940+ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
941+ // TODO 自動生成されたメソッド・スタブ
942+ return null;
943+ }
944+
945+ @Override
946+ public <T> T getObject(String columnName, Class<T> type)
947+ throws SQLException {
948+ return (T) getObject(getTargetObjectIdx(columnName));
949+ }
950+
951+ @Override
940952 public Object getObject(String arg0, Map<String, Class<?>> arg1)
941953 throws SQLException {
942954 // TODO Auto-generated method stub
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sdh2/ReflectionPreparedStatement.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sdh2/ReflectionPreparedStatement.java (revision 379)
@@ -117,7 +117,11 @@
117117 if (!newData[i].getString().equals(oldData[i].getString())) {
118118 if (buff.length() == 0) {
119119 buff.append("UPDATE ");
120- buff.append(getSchemaTableName(i));
120+ if (this.database_type.needsTableNameQuote()) {
121+ buff.append(String.format("\"%s\"", getTableName()));
122+ } else {
123+ buff.append(getSchemaTableName(i));
124+ }
121125 buff.append(" SET ");
122126 }
123127 buff.append(getSubstitutionColumnName(meta.getColumnName(i))
@@ -140,7 +144,11 @@
140144 }
141145 if (buff.length() == 0) {
142146 buff.append("INSERT INTO ");
143- buff.append(getSchemaTableName(i));
147+ if (this.database_type.needsTableNameQuote()) {
148+ buff.append(String.format("\"%s\"", getTableName()));
149+ } else {
150+ buff.append(getSchemaTableName(i));
151+ }
144152 buff.append(" ( ");
145153 }
146154 buff.append(getSubstitutionColumnName(meta.getColumnName(i))
@@ -154,7 +162,11 @@
154162 buff.append(") VALUES (").append(valueBuff).append(")");
155163 } else if (header.delete()) {
156164 buff.append("DELETE FROM ");
157- buff.append(getSchemaTableName(1));
165+ if (this.database_type.needsTableNameQuote()) {
166+ buff.append(String.format("\"%s\"", getTableName()));
167+ } else {
168+ buff.append(getSchemaTableName(1));
169+ }
158170 buff.append(" ");
159171 buff.append(createWhere(newData));
160172 }
@@ -204,7 +216,7 @@
204216 private String getSubstitutionColumnName(String sourceName) {
205217 if (this.database_type != null) {
206218 if (this.database_type.needsColumnNameQuote(sourceName)) {
207- return this.database_type.getQuotedColumnName(sourceName);
219+ return this.database_type.getQuotedColumnName(sourceName, null);
208220 }
209221 }
210222 if (this.columnNameSubstitutionMap == null) {
--- Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sdh2/ResultSetDataHolder2.java (revision 378)
+++ Libraries/WolfSQLParser/engine/src/hiro/yoshioka/sdh2/ResultSetDataHolder2.java (revision 379)
@@ -98,16 +98,18 @@
9898 }
9999
100100 private String getSubstitutionColumnName(String sourceName) {
101- System.out.println(" " + sourceName + "/"
102- + this.columnNameSubstitutionMap);
101+ String ret = null;
103102 if (this.columnNameSubstitutionMap == null) {
104- return sourceName;
103+ ret = sourceName;
104+ } else {
105+ String name = this.columnNameSubstitutionMap.get(sourceName);
106+ if (StringUtil.isEmpty(name)) {
107+ ret = sourceName;
108+ } else {
109+ ret = name;
110+ }
105111 }
106- String name = this.columnNameSubstitutionMap.get(sourceName);
107- if (StringUtil.isEmpty(name)) {
108- return sourceName;
109- }
110- return name;
112+ return getDatabaseType().getQuotedColumnName(ret, null);
111113 }
112114
113115 public String getTableNameE() {
@@ -149,10 +151,14 @@
149151 public String generateUpdateScript(int row) {
150152 StringBuilder buf = new StringBuilder();
151153 buf.append("UPDATE ");
152- if (!StringUtil.isEmpty(getSchemaNameE())) {
153- buf.append(getSchemaNameE()).append(".");
154+ if (getDatabaseType().needsTableNameQuote()) {
155+ buf.append(String.format("\"%s\"", getTableNameE()));
156+ } else {
157+ if (!StringUtil.isEmpty(getSchemaNameE())) {
158+ buf.append(getSchemaNameE()).append(".");
159+ }
160+ buf.append(getTableNameE());
154161 }
155- buf.append(getTableNameE());
156162 buf.append(" SET ");
157163 for (int i = 1; i < key.length; i++) {
158164 DifferenceStringData diff = (DifferenceStringData) getPair(row, i);
@@ -254,10 +260,14 @@
254260 public String generateInsertScript(int row) {
255261 StringBuilder buf = new StringBuilder();
256262 buf.append("INSERT INTO ");
257- if (!StringUtil.isEmpty(getSchemaNameE())) {
258- buf.append(getSchemaNameE()).append(".");
263+ if (getDatabaseType().needsTableNameQuote()) {
264+ buf.append(String.format("\"%s\"", getTableNameE()));
265+ } else {
266+ if (!StringUtil.isEmpty(getSchemaNameE())) {
267+ buf.append(getSchemaNameE()).append(".");
268+ }
269+ buf.append(getTableNameE());
259270 }
260- buf.append(getTableNameE());
261271 buf.append(" (");
262272 for (int i = 1; i < key.length; i++) {
263273 buf.append(getSubstitutionColumnName(key[i]));
--- Libraries/WolfSQLParser/base/hiro/yoshioka/sql/resource/IDBColumn.java (revision 378)
+++ Libraries/WolfSQLParser/base/hiro/yoshioka/sql/resource/IDBColumn.java (revision 379)
@@ -41,6 +41,10 @@
4141
4242 boolean isOnClickable();
4343
44+ boolean isInsertDisabled();
45+
46+ void setInsertDisabled(boolean insertDisabled);
47+
4448 void setPKey(Collection<String> pkeyCollection);
4549
4650 boolean isPkey();
--- Libraries/WolfSQLParser/base/hiro/yoshioka/sql/resource/DBColumn.java (revision 378)
+++ Libraries/WolfSQLParser/base/hiro/yoshioka/sql/resource/DBColumn.java (revision 379)
@@ -43,6 +43,8 @@
4343
4444 private boolean indexColumn;
4545
46+ private boolean insertDisabled;
47+
4648 // -1はプロシジャ以外
4749 private short columnType = -1;
4850
@@ -131,6 +133,16 @@
131133
132134 }
133135
136+ @Override
137+ public boolean isInsertDisabled() {
138+ return insertDisabled;
139+ }
140+
141+ @Override
142+ public void setInsertDisabled(boolean insertDisabled) {
143+ this.insertDisabled = insertDisabled;
144+ }
145+
134146 public boolean isPkey() {
135147 return pkey;
136148 }
@@ -144,7 +156,7 @@
144156 }
145157
146158 /*
147- *
159+ *
148160 */
149161 public static String cnvColumnType(short type) {
150162 switch (type) {
@@ -181,7 +193,7 @@
181193
182194 /**
183195 * コンテンツアシスト用文字列返却。 fASTExpr==null?getName():fASTExpr
184- *
196+ *
185197 * @return アシスト用文字列
186198 */
187199 public String getProposalString() {
@@ -260,7 +272,7 @@
260272
261273 /*
262274 * (non-Javadoc)
263- *
275+ *
264276 * @see
265277 * hiro.yoshioka.sql.resource.IAliasExtention#setAlias(java.lang.String)
266278 */
@@ -270,7 +282,7 @@
270282
271283 /*
272284 * (non-Javadoc)
273- *
285+ *
274286 * @see hiro.yoshioka.sql.resource.IDBTable#hasAlias()
275287 */
276288 public boolean hasAlias() {
--- Libraries/WolfSQLParser/test/sql/cassandra/CassandraTest.java (nonexistent)
+++ Libraries/WolfSQLParser/test/sql/cassandra/CassandraTest.java (revision 379)
@@ -0,0 +1,46 @@
1+package sql.cassandra;
2+
3+import hiro.yoshioka.sdh.BindObject;
4+import hiro.yoshioka.sdh2.ResultSetDataHolder2;
5+import hiro.yoshioka.sql.cassandra.CassandraSQL;
6+import hiro.yoshioka.sql.engine.GettingResourceRequest;
7+import hiro.yoshioka.sql.engine.SQLOperationType;
8+import hiro.yoshioka.sql.params.ConnectionProperties;
9+import hiro.yoshioka.sql.resource.twitter.TwitterColumnType;
10+import hiro.yoshioka.sql.resource.twitter.TwitterSchemaType;
11+import hiro.yoshioka.sql.resource.twitter.TwitterTableType;
12+import hiro.yoshioka.util.SQLDataType;
13+
14+import java.sql.SQLException;
15+import java.util.HashMap;
16+import java.util.Map;
17+
18+import junit.framework.TestCase;
19+import twitter4j.TwitterException;
20+
21+public class CassandraTest extends TestCase {
22+ /**
23+ * name='Arnold', screenName='Schwarzenegger', location='Los Angeles,
24+ * California' id=12044602
25+ *
26+ * @throws SQLException
27+ * @throws TwitterException
28+ */
29+ public void testRetweetedByUser() throws TwitterException, SQLException {
30+ CassandraSQL sql = new CassandraSQL();
31+ ConnectionProperties properties = new ConnectionProperties();
32+ properties.setURLString("172.16.100.46:9042");
33+ properties.setCaptureWithColumnInfo(true);
34+ //properties.setPort(9160);
35+ sql.connect(properties);
36+
37+ GettingResourceRequest request = new GettingResourceRequest(properties);
38+ sql.doOperation(SQLOperationType.RESOURCE_CAPTION, request);
39+ sql.close();
40+
41+
42+
43+
44+ }
45+
46+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- Libraries/WolfSQLParser/test/sql/notes/NotesDataInsertsTester.java (revision 378)
+++ Libraries/WolfSQLParser/test/sql/notes/NotesDataInsertsTester.java (revision 379)
@@ -65,13 +65,13 @@
6565 System.out.println(" --[SUB_TASK]" + subTaskName);
6666 }
6767 });
68- for (int i = 0; i < 1000; i++) {
69- Map<String, Object> map = new HashMap<String, Object>();
70- map.put("float_value", 10.4f);
71- map.put("richtext1", "あいうろ\nかきくけこ");
72- map.put("colors", "00FFFF00");
73- request.addParams(map);
74- }
68+// for (int i = 0; i < 1000; i++) {
69+// Map<String, Object> map = new HashMap<String, Object>();
70+// map.put("float_value", 10.4f);
71+// map.put("richtext1", "あいうろ\nかきくけこ");
72+// map.put("colors", "00FFFF00");
73+// request.addParams(map);
74+// }
7575 future = ex.submit(new NotesRunnerUpdate(cm, request));
7676
7777 try {
--- Libraries/WolfSQLParser/test/FileMakerMetaTest.java (nonexistent)
+++ Libraries/WolfSQLParser/test/FileMakerMetaTest.java (revision 379)
@@ -0,0 +1,63 @@
1+import hiro.yoshioka.classmanager.ClassManager;
2+import hiro.yoshioka.sql.FileMakerSQL;
3+import hiro.yoshioka.sql.ITransactionSQL;
4+import hiro.yoshioka.sql.engine.GettingResourceRequest;
5+import hiro.yoshioka.sql.engine.Request;
6+import hiro.yoshioka.sql.engine.SQLOperationType;
7+import hiro.yoshioka.sql.engine.SQLServerThread;
8+import hiro.yoshioka.sql.params.ConnectionProperties;
9+import hiro.yoshioka.sql.params.ConnectionSettingBean;
10+import hiro.yoshioka.sql.params.DBResourceCapturingFilter;
11+import hiro.yoshioka.sql.params.DBUserPass;
12+
13+import java.io.File;
14+
15+import org.omg.IOP.TransactionService;
16+
17+public class FileMakerMetaTest {
18+ static File winConnections = new File(
19+ "D:/tools/pleiades-e3.7_wolf/eclipse/w_config");
20+
21+ public static void main(java.lang.String[] args) {
22+ ConnectionProperties p = new ConnectionProperties();
23+
24+ // dom
25+ p.setHost("localhost");
26+ p.setAuthenticate(new DBUserPass("yuko admin", "password"));
27+
28+ p.setCaptureWithDDL(false);
29+ p.setCaptureWithColumnInfo(false);
30+ p.setCaptureWithViewInfo(false);
31+
32+ p.setCapturingFilter(DBResourceCapturingFilter.MATCHES);
33+ // p.addFilePathRegrex(".*hoge.*");
34+ ClassManager cm = new ClassManager();
35+ try {
36+ cm.add_lib(new File("D:/tools/jdbc/fmjdbc.jar"));
37+
38+ SQLServerThread.getSQLServer().init(winConnections);
39+
40+ ConnectionSettingBean bean = SQLServerThread.getSQLServer()
41+ .getConnectionSettingBean();
42+ p = bean.getConnectionPropertiesByDisplay("ファイルメーカ");
43+
44+ Request request = new Request(SQLOperationType.CONNECT, p);
45+ SQLServerThread.runNowThisRequest(request);
46+
47+ ITransactionSQL sql = SQLServerThread.getSQLServer().getTransactionSQL(p);
48+
49+ FileMakerSQL fsql = ((FileMakerSQL)sql);
50+
51+ fsql.test();
52+
53+ request = new Request(SQLOperationType.CLOSE, p);
54+ SQLServerThread.runNowThisRequest(request);
55+
56+ } catch (Exception e1) {
57+ // TODO Auto-generated catch block
58+ e1.printStackTrace();
59+ } finally {
60+ SQLServerThread.getSQLServer().dispose();
61+ }
62+ }
63+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
旧リポジトリブラウザで表示