ccgus / fmdb

A Cocoa / Objective-C wrapper around SQLite
Other
13.84k stars 2.77k forks source link

executeUpdate stop #491

Open nelsonnan opened 8 years ago

nelsonnan commented 8 years ago

I run follow codes with System version 8.1.2 is stopped working if I could add codes with

CGFloat version=[[[UIDevice currentDevice].systemVersion]doubleValue];
if ((version-8.3)<0.01) {
    return ;
}

Can you do with this issues?

NSString *sql = @"update MaxTable set gender=6 where gender=1;";
BOOL ret = [dbX executeUpdate:sql];
sql=@"update MaxTable set gender=5 where gender=2;";
ret = [dbX executeUpdate:sql];
CGFloat version=[[[UIDevice currentDevice].systemVersion]doubleValue];
if ((version-8.3)<0.01) {
    return ;
}
sql=@"delete from Drug where dataId in (select A.dataId from Drug A,Drug B where A.dataId<B.dataId and A.drugName=B.drugName and A.pharmacyDrugName=B.pharmacyDrugName and A.orgCode=B.orgCode);";
ret = [dbX executeUpdate:sql];
sql=@"delete from HitData where dataId in (select A.dataId from HitData A,HitData B where A.dataId<B.dataId and A.hintClassName=B.hintClassName and A.orgCode=B.orgCode and A.type=B.type);";
ret = [dbX executeUpdate:sql];
sql=@"delete from EfficacyClassfity where dataId in (select A.dataId from EfficacyClassfity A,EfficacyClassfity B where A.dataId<B.dataId and A.hintClassName=B.hintClassName and A.hintClass=B.hintClass);";
ret = [dbX executeUpdate:sql];
sql=@"delete from TabooClassfity where dataId in (select A.dataId  from TabooClassfity A,TabooClassfity B where A.dataId<B.dataId and A.hintClassName=B.hintClassName and A.hintClass=B.hintClass);";
ret = [dbX executeUpdate:sql];

sql=@"delete from MaxTable where dataId in (select A.dataId from MaxTable A,MaxTable B where A.dataId<B.dataId and A.name=B.name);";
ret = [dbX executeUpdate:sql];

sql=@"delete from DiseaseClassfity where dataId in (select A.dataId  from DiseaseClassfity A,DiseaseClassfity B where A.dataId<B.dataId and A.hintClassName=B.hintClassName and A.hintClass=B.hintClass and A.className=B.className);";
ret = [dbX executeUpdate:sql];

sql=@"delete from SymptomClassfity where dataId in (select A.dataId  from SymptomClassfity A,SymptomClassfity B where A.dataId<B.dataId and A.hintClassName=B.hintClassName and A.hintClass=B.hintClass and A.className=B.className);";
ret = [dbX executeUpdate:sql];
nelsonnan commented 8 years ago

If iphone system version is 8.3 or 8.4 or other 9+ ,FMDB can run these sql .But other system it will stop working!

robertmryan commented 8 years ago

I'm not understanding the question. When you say "stopped working", what precisely is happening. And you have code here that explicitly performs return if the OS is less than 8.3. Why is that there? If you removed it, what would happen?