Просмотр исходного кода

160914
Modify: optimise func model_category_img speed up.

Ray Zhang 9 лет назад
Родитель
Сommit
ae36ef7fdb
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

+ 6 - 3
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -1290,11 +1290,14 @@
     
     NSString *sqlQuery = nil;
     //select url,type from model_image where product_id=%d and type=1 order by default_img desc , _id asc limit 1;",product_id
-    
+    // sqlQuery = [NSString stringWithFormat:@"select i.url from product m LEFT join model_image i on m.product_id = i.product_id  where m.name=%@ order by i.default_img desc, i._id asc limit 1;",model_name];// select i.url from model m LEFT join model_image i on m.product_id = i.product_id  where m.name=%@ order by i.default_img desc, i._id asc limit 1;
+    //   sqlQuery = [NSString stringWithFormat:@"select i.url from product m LEFT join model_image i on m.product_id = i.product_id  where m.product_id=%@ order by i.default_img desc, i._id asc limit 1;",product_id];// select i.url from model m
+
+
     if(product_id==nil && model_name)
-        sqlQuery = [NSString stringWithFormat:@"select i.url from (select name,product_id from product where name=%@) m LEFT join model_image i on m.product_id = i.product_id   order by i.default_img desc, i._id asc limit 1;",model_name];// select i.url from model m LEFT join model_image i on m.product_id = i.product_id  where m.name=%@ order by i.default_img desc, i._id asc limit 1;
+        sqlQuery = [NSString stringWithFormat:@"select i.url from (select name,product_id from product where name='%@') m LEFT join model_image i on m.product_id = i.product_id  order by i.default_img desc, i._id asc limit 1;",model_name];// select i.url from model m LEFT join model_image i on m.product_id = i.product_id  where m.name=%@ order by i.default_img desc, i._id asc limit 1;
     else if (product_id)
-        sqlQuery = [NSString stringWithFormat:@"select i.url from (select name,product_id from product where name=%@) m LEFT join model_image i on m.product_id = i.product_id   order by i.default_img desc, i._id asc limit 1;",product_id];// select i.url from model m
+        sqlQuery = [NSString stringWithFormat:@"select i.url from (select name,product_id from product where product_id=%@) m LEFT join model_image i on m.product_id = i.product_id   order by i.default_img desc, i._id asc limit 1;",product_id];// select i.url from model m
     
     sqlite3_stmt * statement;