I created sqlite database in android as follows:
db.execSQL("CREATE TABLE ratecard (fat NUMERIC, lac NUMERIC, snf NUMERIC,
cow NUMERIC, buf NUMERIC)");
Then I Inserted records in it as follows
DecimalFormat degreeformat = new DecimalFormat("#.#");
DecimalFormat rateformat = new DecimalFormat("#.##");
Double csn = 0.20;
Double bsn = 0.00;
Double cft = 0.50;
Double bft = 0.00;
Double crt = 20.00 - cft - csn;
Double brt = 0.00 - bft - bsn;
for (Double ss = 7.0; ss <= 8.0); ss = ss + .1) {
ProcSnf.setText(degreeformat.format(ss));
crt = crt + csn;
brt = brt + bsn;
Double crrt = crt;
Double brrt = brt;
for (Double ff = Double.valueOf(fromfat); ff <= Double.valueOf(tofat);
ff = ff + .1) {
ProcFat.setText(degreeformat.format(ff));
Double l = (ss - 0.36 - (ff * .21)) * 4.0;
ll = Double.valueOf(degreeformat.format(l));
crrt = crrt + cft;
brrt = brrt + bft;
DB.DeleteSelectedRateCard(ff, ss);
DB.AddRateCard(ll, ff, ss, crrt, brrt);
}
}
Records created in database. Then I pulled this database from emulator to hard disk. Then I browse this data using sqlite browser. All records shown properly. Now filter records in browser for fat = 5.0. All records shown. Now going to Execute SQL tab in Sqlite Browser I tried following sql statement and getting following result.
- select * from ratecard where fat = 3.5 (12 rows returned)
- select * from ratecard where fat = 4.1 (12 rows returned)
- select * from ratecard where snf = 7.0 (18 rows returned including fat > 4.1)
- select * from ratecard where fat = 4.2 (0 rows returned "this result is upto fat = 5.0")
- select * from ratecard where fat > 4.1 (108 rows returned)
This problem also occurs when I fire query in android app. So my problem is Is there problem in creating table or problem is in query statement.