I made a SQL database using this statement
final String SQL_CREATE_PRIMARY_TABLE = "CREATE TABLE " +
TABLE_NAME + " (" +
P_K + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
SET_NAME + " TEXT, " +
MARKS_O1 + " INTEGER, " +
MARKS_O2 + " INTEGER, " +
MARKS_O3 + " INTEGER, " +
MARKS_O4 + " INTEGER, " +
ATTEMPTS + " INTEGER " +
")";
As you can see that column MARKS_01 to MARKS_04 has INTEGER data type, but accidentally I provided a float type to it which have getter and setter like this:-
public float getMO1() {
return MO1;
}
public void setMO1(float MO1) {
this.MO1 = MO1;
}
public float getMO2() {
return MO2;
}
public void setMO2(float MO2) {
this.MO2 = MO2;
}
public float getMO3() {
return MO3;
}
public void setMO3(float MO3) {
this.MO3 = MO3;
}
public float getMO4() {
return MO4;
}
public void setMO4(float MO4) {
this.MO4 = MO4;
}
public int getAttempts() {
return Attempts;
}
public void setAttempts(int attempts) {
Attempts = attempts;
}
And, end results are surprising for me even with a integer data type it is working perfectly for float values
I want to know the reason behind it, either it is a property of SQL database or any bug
And, can I use this property/bug as a plus point for my other databases