comparison src/com/five_ten_sg/connectbot/util/HostDatabase.java @ 61:ce8f13242339 tn5250

add 5250 config entries
author Carl Byington <carl@five-ten-sg.com>
date Fri, 13 Jun 2014 15:27:08 -0700
parents 0ce5cc452d02
children aac8e0496ef9
comparison
equal deleted inserted replaced
60:d9b27288a9d2 61:ce8f13242339
71 public final static String FIELD_HOST_STAYCONNECTED = "stayconnected"; 71 public final static String FIELD_HOST_STAYCONNECTED = "stayconnected";
72 public final static String FIELD_HOST_WANTX11FORWARD = "wantx11forward"; 72 public final static String FIELD_HOST_WANTX11FORWARD = "wantx11forward";
73 public final static String FIELD_HOST_X11HOST = "x11host"; 73 public final static String FIELD_HOST_X11HOST = "x11host";
74 public final static String FIELD_HOST_X11PORT = "x11port"; 74 public final static String FIELD_HOST_X11PORT = "x11port";
75 public final static String FIELD_HOST_MONITOR = "monitor"; 75 public final static String FIELD_HOST_MONITOR = "monitor";
76 public final static String FIELD_HOST_EMULATION = "emulation";
77 public final static String FIELD_HOST_ENCRYPTION5250 = "encryption5250";
76 78
77 public final static String TABLE_PORTFORWARDS = "portforwards"; 79 public final static String TABLE_PORTFORWARDS = "portforwards";
78 public final static String FIELD_PORTFORWARD_HOSTID = "hostid"; 80 public final static String FIELD_PORTFORWARD_HOSTID = "hostid";
79 public final static String FIELD_PORTFORWARD_NICKNAME = "nickname"; 81 public final static String FIELD_PORTFORWARD_NICKNAME = "nickname";
80 public final static String FIELD_PORTFORWARD_TYPE = "type"; 82 public final static String FIELD_PORTFORWARD_TYPE = "type";
177 + FIELD_HOST_ENCODING + " TEXT DEFAULT '" + ENCODING_DEFAULT + "', " 179 + FIELD_HOST_ENCODING + " TEXT DEFAULT '" + ENCODING_DEFAULT + "', "
178 + FIELD_HOST_STAYCONNECTED + " TEXT, " 180 + FIELD_HOST_STAYCONNECTED + " TEXT, "
179 + FIELD_HOST_WANTX11FORWARD + " TEXT DEFAULT '" + Boolean.toString(false) + "', " 181 + FIELD_HOST_WANTX11FORWARD + " TEXT DEFAULT '" + Boolean.toString(false) + "', "
180 + FIELD_HOST_X11HOST + " TEXT DEFAULT '" + X11HOST_DEFAULT + "', " 182 + FIELD_HOST_X11HOST + " TEXT DEFAULT '" + X11HOST_DEFAULT + "', "
181 + FIELD_HOST_X11PORT + " INTEGER DEFAULT " + X11PORT_DEFAULT + ", " 183 + FIELD_HOST_X11PORT + " INTEGER DEFAULT " + X11PORT_DEFAULT + ", "
182 + FIELD_HOST_MONITOR + " TEXT)"); 184 + FIELD_HOST_MONITOR + " TEXT, "
185 + FIELD_HOST_EMULATION + " TEXT, "
186 + FIELD_HOST_ENCRYPTION5250 + " TEXT)");
183 db.execSQL("CREATE TABLE " + TABLE_PORTFORWARDS 187 db.execSQL("CREATE TABLE " + TABLE_PORTFORWARDS
184 + " (_id INTEGER PRIMARY KEY, " 188 + " (_id INTEGER PRIMARY KEY, "
185 + FIELD_PORTFORWARD_HOSTID + " INTEGER, " 189 + FIELD_PORTFORWARD_HOSTID + " INTEGER, "
186 + FIELD_PORTFORWARD_NICKNAME + " TEXT, " 190 + FIELD_PORTFORWARD_NICKNAME + " TEXT, "
187 + FIELD_PORTFORWARD_TYPE + " TEXT NOT NULL DEFAULT " + PORTFORWARD_LOCAL + ", " 191 + FIELD_PORTFORWARD_TYPE + " TEXT NOT NULL DEFAULT " + PORTFORWARD_LOCAL + ", "
288 + " ADD COLUMN " + FIELD_HOST_HTTPPROXY + " TEXT"); 292 + " ADD COLUMN " + FIELD_HOST_HTTPPROXY + " TEXT");
289 293
290 case 24: 294 case 24:
291 db.execSQL("ALTER TABLE " + TABLE_HOSTS 295 db.execSQL("ALTER TABLE " + TABLE_HOSTS
292 + " ADD COLUMN " + FIELD_HOST_MONITOR + " TEXT"); 296 + " ADD COLUMN " + FIELD_HOST_MONITOR + " TEXT");
297
298 case 25:
299 db.execSQL("ALTER TABLE " + TABLE_HOSTS
300 + " ADD COLUMN " + FIELD_HOST_EMULATION + " TEXT");
301 db.execSQL("ALTER TABLE " + TABLE_HOSTS
302 + " ADD COLUMN " + FIELD_HOST_ENCRYPTION5250 + " TEXT");
293 } 303 }
294 } 304 }
295 305
296 /** 306 /**
297 * Touch a specific host to update its "last connected" field. 307 * Touch a specific host to update its "last connected" field.
401 COL_ENCODING = c.getColumnIndexOrThrow(FIELD_HOST_ENCODING), 411 COL_ENCODING = c.getColumnIndexOrThrow(FIELD_HOST_ENCODING),
402 COL_STAYCONNECTED = c.getColumnIndexOrThrow(FIELD_HOST_STAYCONNECTED), 412 COL_STAYCONNECTED = c.getColumnIndexOrThrow(FIELD_HOST_STAYCONNECTED),
403 COL_WANTX11FORWARD = c.getColumnIndexOrThrow(FIELD_HOST_WANTX11FORWARD), 413 COL_WANTX11FORWARD = c.getColumnIndexOrThrow(FIELD_HOST_WANTX11FORWARD),
404 COL_X11HOST = c.getColumnIndexOrThrow(FIELD_HOST_X11HOST), 414 COL_X11HOST = c.getColumnIndexOrThrow(FIELD_HOST_X11HOST),
405 COL_X11PORT = c.getColumnIndexOrThrow(FIELD_HOST_X11PORT), 415 COL_X11PORT = c.getColumnIndexOrThrow(FIELD_HOST_X11PORT),
406 COL_MONITOR = c.getColumnIndexOrThrow(FIELD_HOST_MONITOR); 416 COL_MONITOR = c.getColumnIndexOrThrow(FIELD_HOST_MONITOR),
417 COL_EMULATION = c.getColumnIndexOrThrow(FIELD_HOST_EMULATION),
418 COL_ENCRYPTION5250 = c.getColumnIndexOrThrow(FIELD_HOST_ENCRYPTION5250);
407 419
408 while (c.moveToNext()) { 420 while (c.moveToNext()) {
409 HostBean host = new HostBean(); 421 HostBean host = new HostBean();
410 host.setId(c.getLong(COL_ID)); 422 host.setId(c.getLong(COL_ID));
411 host.setNickname(c.getString(COL_NICKNAME)); 423 host.setNickname(c.getString(COL_NICKNAME));
428 host.setStayConnected(Boolean.valueOf(c.getString(COL_STAYCONNECTED))); 440 host.setStayConnected(Boolean.valueOf(c.getString(COL_STAYCONNECTED)));
429 host.setWantX11Forward(Boolean.valueOf(c.getString(COL_WANTX11FORWARD))); 441 host.setWantX11Forward(Boolean.valueOf(c.getString(COL_WANTX11FORWARD)));
430 host.setX11Host(c.getString(COL_X11HOST)); 442 host.setX11Host(c.getString(COL_X11HOST));
431 host.setX11Port(c.getInt(COL_X11PORT)); 443 host.setX11Port(c.getInt(COL_X11PORT));
432 host.setMonitor(c.getString(COL_MONITOR)); 444 host.setMonitor(c.getString(COL_MONITOR));
445 host.setEmulation(c.getString(COL_EMULATION));
446 host.setEncryption5250(c.getString(COL_ENCRYPTION5250));
433 hosts.add(host); 447 hosts.add(host);
434 } 448 }
435 449
436 return hosts; 450 return hosts;
437 } 451 }