ecshop中自定义mysql函数处理
2014-07-28 12:54 来源:www.chinab4c.com 作者:ecshop专家
ecshop中自定义mysql函数处理
首先开启自定义函数开关
SET GLOBAL log_bin_trust_function_creators = 1
SET GLOBAL log_bin_trust_function_creators = 1
CREATE FUNCTION `concat_ic`(goods_name varchar(64)) RETURNS varchar(64) CHARSET utf8
BEGIN
DECLARE temp varchar(64);
set temp = replace(goods_name,"#","");
set temp = replace(temp,".","");
set temp = replace(temp,"/","");
set temp = replace(temp,"-","");
set temp = replace(temp,"=","");
set temp = replace(temp,"_","");
set temp = replace(temp," ","");
set temp = replace(temp,"+","");
set temp = replace(temp,"(","");
set temp = replace(temp,")","");
set temp = replace(temp,"!","");
set temp = replace(temp,"\"","");
set temp = replace(temp,"$","");
set temp = replace(temp,"%","");
set temp = replace(temp,"&","");
set temp = replace(temp,"'","");
set temp = replace(temp,"*","");
set temp = replace(temp,",","");
set temp = replace(temp,":","");
set temp = replace(temp,";","");
set temp = replace(temp,"<","");
set temp = replace(temp,"\|","");
set temp = concat("€€",temp);
set temp = concat(goods_name,temp);
return temp;
end
我们在检索ecshop商品的时候,select goods_id,concat_ic(goods_name) from ecs_goods就可以直接调用mysql自定义函数了。
来源:http://www.chinab4c.com
最近更新
常用插件
- ecshop降价通知登记插件
ecshop降价通知登记插件,主要是为了方便某些客户,对商品价格要求比...
- ecshop通用红包编码
很多时候,为了结合促销,必须扩展一下ecshop的红包功能。ecshop的红包...
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...
- ecshop分类树中统计商品数
最近忙于开发其他项目,在不少朋友不断要求和催促的情况下,做出了该小...
- ecshop购物车功能改进[插件
ecshop购物车功能改进[插件套餐]主要是我们最近开发工作和开发项目中。...