|
|
@@ -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;
|
|
|
|