• R/O
  • SSH
  • HTTPS

wolf-desktop: コミット


コミットメタ情報

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

ログメッセージ

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

変更サマリ

差分

--- Libraries/Common/src/hiro/yoshioka/util/SQLDataType.java (revision 376)
+++ Libraries/Common/src/hiro/yoshioka/util/SQLDataType.java (revision 377)
@@ -95,6 +95,16 @@
9595 BINARY_FLOAT("BINARY_FLOAT", 100),
9696 /** BINARY_DOUBLE */
9797 BINARY_DOUBLE("BINARY_DOUBLE", 101),
98+ /** MAP */
99+ MAP("MAP", -1),
100+ /** UUID */
101+ UUID("UUID", -1),
102+ /** TIMEUUID */
103+ TIMEUUID("TIMEUUID", -1),
104+ /** INET */
105+ INET("INET", -1),
106+ /** SET */
107+ SET("SET", -1),
98108 /** UNKNOWN */
99109 UNKNOWN("UNKNOWN", Integer.MAX_VALUE);
100110
@@ -170,6 +180,9 @@
170180 if (message.equals("TEXT")) {
171181 return SQLDataType.LONGVARCHAR;
172182 }
183+ if (message.equals("INT")) {
184+ return SQLDataType.INTEGER;
185+ }
173186 if (message.equals("TIMESTAMP WITHOUT TIME ZONE")) {
174187 return SQLDataType.TIMESTAMP;
175188 }
--- Libraries/Common/src/hiro/yoshioka/sdh/DatabaseType.java (revision 376)
+++ Libraries/Common/src/hiro/yoshioka/sdh/DatabaseType.java (revision 377)
@@ -1,10 +1,10 @@
11 package hiro.yoshioka.sdh;
22
3+import hiro.yoshioka.util.StringUtil;
4+
35 import java.util.regex.Matcher;
46 import java.util.regex.Pattern;
57
6-import hiro.yoshioka.util.StringUtil;
7-
88 public enum DatabaseType {
99 // -------------------------------------------------------------------------
1010 // NO SQL
@@ -13,6 +13,8 @@
1313 EVERNOTE("evernote", "evernote"),
1414 /** mongodb */
1515 MONGO(".*mongodb.Mongo", "com.mongodb.Mongo"),
16+ /** cassandra */
17+ CASSANDRA("cassandra", "cassandra"),
1618 // -------------------------------------------------------------------------
1719 // LOTSU NOTES DOMINO SERVER
1820 // -------------------------------------------------------------------------
@@ -44,6 +46,8 @@
4446 SQLITE(".*sqlite.*", StringUtil.EMPTY_STRING),
4547 /** ms-acccess */
4648 MS_ACCESS_JACKCESS("MS Access with Jackcess", "MS Access with Jackcess"),
49+ /** File Maker */
50+ FILE_MAKER("com.filemaker.jdbc.Driver", StringUtil.EMPTY_STRING),
4751 /** odbc */
4852 ODBC(".*.jdbc.odbc.*", "sun.jdbc.odbc.JdbcOdbcDriver"),
4953 /** unkown */
@@ -50,7 +54,7 @@
5054 UNKNOWN("unkown", StringUtil.EMPTY_STRING);
5155
5256 public static DatabaseType[] INTERNAL_JARS = { HSQL, ODBC, MONGO, TWITTER,
53- EVERNOTE, MS_ACCESS_JACKCESS };
57+ EVERNOTE, MS_ACCESS_JACKCESS, CASSANDRA };
5458
5559 static Pattern sql_server_needs_quotes_pattern = Pattern.compile("[(())]");
5660
@@ -62,11 +66,26 @@
6266 this.driverName = driverName;
6367 }
6468
65- public static DatabaseType parse(String driver) {
66- for (DatabaseType types : values()) {
67- if (driver.matches(types.driverPattern)) {
68- return types;
69+ public static DatabaseType parse(String str) {
70+ if (StringUtil.isEmpty(str)) {
71+ return UNKNOWN;
72+ }
73+ if ("ACCESS".equalsIgnoreCase(str)) {
74+ return MS_ACCESS_JACKCESS;
75+ }
76+ if ("FileMaker".equals(str)) {
77+ return FILE_MAKER;
78+ }
79+ for (DatabaseType type : values()) {
80+ if (type.name().equalsIgnoreCase(str)) {
81+ return type;
6982 }
83+ if (type.getDriverName().equalsIgnoreCase(str)) {
84+ return type;
85+ }
86+ if (str.matches(type.driverPattern)) {
87+ return type;
88+ }
7089 }
7190 System.out.println("DatabaseType#parse retunKnown");
7291 return UNKNOWN;
@@ -77,6 +96,7 @@
7796 case SQLITE:
7897 case MS_SQLSERVER:
7998 case MS_ACCESS_JACKCESS:
99+ case FILE_MAKER:
80100 return true;
81101 }
82102 return false;
@@ -88,6 +108,7 @@
88108 case MS_SQLSERVER:
89109 case POSTGRES:
90110 case MS_ACCESS_JACKCESS:
111+ case FILE_MAKER:
91112 return true;
92113 }
93114 return false;
@@ -109,6 +130,14 @@
109130 return MONGO.equals(this);
110131 }
111132
133+ public boolean isFileMaker() {
134+ return FILE_MAKER.equals(this);
135+ }
136+
137+ public boolean isCassandra() {
138+ return CASSANDRA.equals(this);
139+ }
140+
112141 public boolean isDomino() {
113142 return DOMINO.equals(this);
114143 }
@@ -214,6 +243,14 @@
214243 return null;
215244 }
216245
246+ public boolean needsTableNameQuote() {
247+ switch (this) {
248+ case FILE_MAKER:
249+ return true;
250+ }
251+ return false;
252+ }
253+
217254 public boolean needsColumnNameQuote(String col_name) {
218255 switch (this) {
219256 case MS_SQLSERVER:
@@ -221,19 +258,31 @@
221258 if (m.find()) {
222259 return true;
223260 }
261+ break;
262+ case FILE_MAKER:
263+ return true;
224264 }
225265 return false;
226266 }
227267
228- public String getQuotedColumnName(String col_name) {
229- switch (this) {
230- case MS_SQLSERVER:
231- Matcher m = sql_server_needs_quotes_pattern.matcher(col_name);
232- if(m.find()){
268+ public String getQuotedColumnName(String col_name, DatabaseType from_db_type) {
269+ if(from_db_type == null || !from_db_type.isFileMaker()){
270+ switch (this) {
271+ case MS_SQLSERVER:
272+ Matcher m = sql_server_needs_quotes_pattern.matcher(col_name);
273+ if (m.find()) {
274+ col_name = String.format("\"%s\"", col_name);
275+ }
276+ break;
277+ case FILE_MAKER:
233278 col_name = String.format("\"%s\"", col_name);
279+ break;
234280 }
281+ } else {
282+ col_name = String.format("\"%s\"", col_name);
235283 }
236284 return col_name;
237285 }
238286
287+
239288 }
--- Libraries/Common/src/hiro/yoshioka/sdh/DefaultHyperLinkAction.java (revision 376)
+++ Libraries/Common/src/hiro/yoshioka/sdh/DefaultHyperLinkAction.java (revision 377)
@@ -316,6 +316,8 @@
316316 return c;
317317 }
318318
319+
320+
319321 @Override
320322 public void widgetDefaultSelected(SelectionEvent ev) {
321323 }
--- Libraries/Common/src/hiro/yoshioka/sdh/ResultSetDataHolder.java (revision 376)
+++ Libraries/Common/src/hiro/yoshioka/sdh/ResultSetDataHolder.java (revision 377)
@@ -17,6 +17,8 @@
1717 import java.util.List;
1818 import java.util.Set;
1919
20+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
21+
2022 public class ResultSetDataHolder extends CSVRecordDataHolder {
2123 private static final long serialVersionUID = -4781540870053874050L;
2224 public static final DecimalFormat f = new DecimalFormat("#,##0.0#####");
@@ -179,7 +181,13 @@
179181 if (j > 1) {
180182 temp.append(",");
181183 }
182- temp.append(meta.getColumnName(j));
184+ if (this.databaseType != null
185+ && this.databaseType.isFileMaker()) {
186+ temp.append(String.format("\"%s\"",
187+ meta.getColumnName(j)));
188+ } else {
189+ temp.append(meta.getColumnName(j));
190+ }
183191 }
184192 insert.append(String.format("INSERT INTO %s (%s) %s VALUES (",
185193 meta.getTableName(1), temp.toString(),
@@ -193,8 +201,15 @@
193201 String value = getStringData(i, meta.getColumnName(j));
194202 if (value.length() > 0) {
195203 if (isString(j) || isTimesType(j)) {
196- temp.append("'" + StringUtil.cnv2SQLEscape(value)
197- + "'");
204+ if (this.databaseType != null
205+ && this.databaseType.isFileMaker()
206+ && isTimesType(j)) {
207+ temp.append("DATE'"
208+ + StringUtil.cnv2SQLEscape(value) + "'");
209+ } else {
210+ temp.append("'"
211+ + StringUtil.cnv2SQLEscape(value) + "'");
212+ }
198213 } else {
199214 temp.append(value);
200215 }
--- Libraries/Common/src/hiro/yoshioka/sdh/ResultSetDataHolderTransfer.java (revision 376)
+++ Libraries/Common/src/hiro/yoshioka/sdh/ResultSetDataHolderTransfer.java (revision 377)
@@ -24,7 +24,7 @@
2424 return instance;
2525 }
2626
27- // シリアライズ
27+ // ?スV?ス?ス?スA?ス?ス?スC?スY
2828 public void javaToNative(Object object, TransferData transferData) {
2929 if (object == null || !(object instanceof ResultSetDataHolder)) {
3030 return;
@@ -45,7 +45,6 @@
4545 }
4646 }
4747
48- // デシリアライズ
4948 public Object nativeToJava(TransferData transferData) {
5049 if (isSupportedType(transferData)) {
5150 byte[] buffer = (byte[]) super.nativeToJava(transferData);
旧リポジトリブラウザで表示