Commit fe80e459 authored by Xunfei's avatar Xunfei
Browse files

Change the name c_value to C_VALUE

parent 6f2099b4
...@@ -63,6 +63,7 @@ public class ReadingsDatabase extends SQLiteOpenHelper { ...@@ -63,6 +63,7 @@ public class ReadingsDatabase extends SQLiteOpenHelper {
public static final String C_PLATFORMNAME = "platformName"; public static final String C_PLATFORMNAME = "platformName";
public static final String C_PLATFORMTYPE = "platformType"; public static final String C_PLATFORMTYPE = "platformType";
public static final String C_RECORDTIME = "recordTime"; public static final String C_RECORDTIME = "recordTime";
public static final String C_VALUE = "value_";
//public static final String C_VALUE_ONE = "value_1"; //public static final String C_VALUE_ONE = "value_1";
//public static final String C_VALUE_TWO = "value_2"; //public static final String C_VALUE_TWO = "value_2";
//public static final String C_VALUE_THREE = "value_3"; //public static final String C_VALUE_THREE = "value_3";
...@@ -81,7 +82,6 @@ public class ReadingsDatabase extends SQLiteOpenHelper { ...@@ -81,7 +82,6 @@ public class ReadingsDatabase extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1; private static final int DATABASE_VERSION = 1;
public static File dbPath; public static File dbPath;
public static String[] tables = {T_HOST, T_TRIP, T_SITE, T_SECTOR, T_SPOT, T_PLATFORM, T_SENSOR}; public static String[] tables = {T_HOST, T_TRIP, T_SITE, T_SECTOR, T_SPOT, T_PLATFORM, T_SENSOR};
public static final String c_value = "value_";
public static final String FLOAT = "float"; public static final String FLOAT = "float";
public static final String INT = "integer"; public static final String INT = "integer";
public static final String TEXT = "text"; public static final String TEXT = "text";
...@@ -244,11 +244,11 @@ public class ReadingsDatabase extends SQLiteOpenHelper { ...@@ -244,11 +244,11 @@ public class ReadingsDatabase extends SQLiteOpenHelper {
SQLiteDatabase dbRead = this.getReadableDatabase(); SQLiteDatabase dbRead = this.getReadableDatabase();
ContentValues cv = new ContentValues(); ContentValues cv = new ContentValues();
Cursor c; Cursor c;
int i = 0; int i = 0;
int numberValues = 0; int numberValues = 0;
String c_value_i =null; String c_value_i =null;
c = dbRead.query(T_TRIP, new String[]{C_TRIPID}, "tripName = ?", c = dbRead.query(T_TRIP, new String[]{C_TRIPID}, "tripName = ?",
new String[]{trip}, null, null, null); new String[]{trip}, null, null, null);
c.moveToFirst(); c.moveToFirst();
...@@ -291,7 +291,7 @@ public class ReadingsDatabase extends SQLiteOpenHelper { ...@@ -291,7 +291,7 @@ public class ReadingsDatabase extends SQLiteOpenHelper {
{ {
Log.d("ReadingsDatabase", " sensorValues ["+ i+ "] = " + sensorValues[i]); Log.d("ReadingsDatabase", " sensorValues ["+ i+ "] = " + sensorValues[i]);
if(sensorValues[i] != 0.0f){ if(sensorValues[i] != 0.0f){
c_value_i = c_value + Integer.toString(i+1); c_value_i = C_VALUE + Integer.toString(i+1);
Log.d("ReadingsDatabase", "c_value_i = " + c_value_i); Log.d("ReadingsDatabase", "c_value_i = " + c_value_i);
cv.put(c_value_i, Double.valueOf(d.format(sensorValues[i]))); cv.put(c_value_i, Double.valueOf(d.format(sensorValues[i])));
} }
...@@ -434,7 +434,7 @@ public class ReadingsDatabase extends SQLiteOpenHelper { ...@@ -434,7 +434,7 @@ public class ReadingsDatabase extends SQLiteOpenHelper {
} }
public String getColumnType(String column){ public String getColumnType(String column){
if (column.contains(c_value))//check if it is sensor value if (column.contains(C_VALUE))//check if it is sensor value
{ {
return (FLOAT); return (FLOAT);
}else if (Arrays.asList(ReadingsDatabase.float_columns).contains(column)) { }else if (Arrays.asList(ReadingsDatabase.float_columns).contains(column)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment