spring mvc4.x怎么返回json格式
1个回答
2017-02-06 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
public void onCreateA(SQLiteDatabase db) { System.out.println("On create works"); try { db.execSQL("DROP TABLE IF EXISTS actuator;"); db.execSQL("CREATE TABLE IF NOT EXISTS actuator ("+ "ACTUATOR_ID INT(11) NOT NULL,"+ "ACTUATOR_HW_ID int(11) DEFAULT NULL,"+ "DEVICE_NAME TEXT(45) DEFAULT NULL,"+ "DEVICE_TYPE TEXT(45) DEFAULT NULL,"+ "DEVICE_SUB_TYPE TEXT(45) DEFAULT NULL,"+ "LOCATION_ID INT(11) DEFAULT NULL,"+ "STATUES_VALUE REAL DEFAULT NULL,"+ "MAX_STATUES_VALUE REAL DEFAULT NULL,"+ "MIN_STATUES_VALUE REAL DEFAULT NULL,"+ "PRIMARY KEY (`ACTUATOR_ID`))"); System.out.println("table created now values will be added"); System.out.print("DONE!"); } catch (SQLException e) { System.out.println("table is not created"); } try { db.execSQL("INSERT INTO actuator (ACTUATOR_ID, ACTUATOR_HW_ID, DEVICE_NAME, DEVICE_TYPE, DEVICE_SUB_TYPE, LOCATION_ID, STATUES_VALUE, MAX_STATUES_VALUE, MIN_STATUES_VALUE) " + "VALUES (1, 2, 'Heat Sensor FX615','Heat Sensor', 'Optic ... public void onCreateA(SQLiteDatabase db) {
System.out.println("On create works");
try {
db.execSQL("DROP TABLE IF EXISTS actuator;");
db.execSQL("CREATE TABLE IF NOT EXISTS actuator ("+
"ACTUATOR_ID INT(11) NOT NULL,"+
"ACTUATOR_HW_ID int(11) DEFAULT NULL,"+
"DEVICE_NAME TEXT(45) DEFAULT NULL,"+
"DEVICE_TYPE TEXT(45) DEFAULT NULL,"+
"DEVICE_SUB_TYPE TEXT(45) DEFAULT NULL,"+
"LOCATION_ID INT(11) DEFAULT NULL,"+
"STATUES_VALUE REAL DEFAULT NULL,"+
"MAX_STATUES_VALUE REAL DEFAULT NULL,"+
"MIN_STATUES_VALUE REAL DEFAULT NULL,"+
"PRIMARY KEY (`ACTUATOR_ID`))");
System.out.println("table created now values will be added");
System.out.print("DONE!");
} catch (SQLException e) {
System.out.println("table is not created");
}
try {
db.execSQL("INSERT INTO actuator (ACTUATOR_ID, ACTUATOR_HW_ID, DEVICE_NAME, DEVICE_TYPE, DEVICE_SUB_TYPE, LOCATION_ID, STATUES_VALUE, MAX_STATUES_VALUE, MIN_STATUES_VALUE) " +
"VALUES (1, 2, 'Heat Sensor FX615','Heat Sensor', 'Optic Heat Sensor', 4, 6, 7, 8) " );
System.out.println("values are added");
} catch (Exception e) {
e.printStackTrace();
System.out.println("values are not added");
}
try {
db.execSQL("SELECT * FROM actuator");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("not selected");
}
System.out.println("On create works");
try {
db.execSQL("DROP TABLE IF EXISTS actuator;");
db.execSQL("CREATE TABLE IF NOT EXISTS actuator ("+
"ACTUATOR_ID INT(11) NOT NULL,"+
"ACTUATOR_HW_ID int(11) DEFAULT NULL,"+
"DEVICE_NAME TEXT(45) DEFAULT NULL,"+
"DEVICE_TYPE TEXT(45) DEFAULT NULL,"+
"DEVICE_SUB_TYPE TEXT(45) DEFAULT NULL,"+
"LOCATION_ID INT(11) DEFAULT NULL,"+
"STATUES_VALUE REAL DEFAULT NULL,"+
"MAX_STATUES_VALUE REAL DEFAULT NULL,"+
"MIN_STATUES_VALUE REAL DEFAULT NULL,"+
"PRIMARY KEY (`ACTUATOR_ID`))");
System.out.println("table created now values will be added");
System.out.print("DONE!");
} catch (SQLException e) {
System.out.println("table is not created");
}
try {
db.execSQL("INSERT INTO actuator (ACTUATOR_ID, ACTUATOR_HW_ID, DEVICE_NAME, DEVICE_TYPE, DEVICE_SUB_TYPE, LOCATION_ID, STATUES_VALUE, MAX_STATUES_VALUE, MIN_STATUES_VALUE) " +
"VALUES (1, 2, 'Heat Sensor FX615','Heat Sensor', 'Optic Heat Sensor', 4, 6, 7, 8) " );
System.out.println("values are added");
} catch (Exception e) {
e.printStackTrace();
System.out.println("values are not added");
}
try {
db.execSQL("SELECT * FROM actuator");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("not selected");
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询