數據庫沒法建立函數

在數據庫建立函數時報錯:you might want to use the less safe log_bin_trust_function_creators variable 須要執行下面的語句: SET GLOBAL log_bin_trust_function_creators = 1; 附:根據當前座標計算距離排序的函數和sql語句:git

BEGIN DECLARE num FLOAT DEFAULT 0;
SET num=2 1000 * 6378.137ASIN(SQRT(POW(SIN(PI()*(lat1-(lat2))/360),2)+ COS(PI()*lat1/180)COS(lat2PI()/180)POW(SIN(PI()(lng1-(lng2))/360),2))); RETURN ROUND(num,0); ENDsql

lat1 DOUBLE,lng1 DOUBLE,lat2 DOUBLE,lng2 DOUBLE數據庫

floatless

輸入圖片說明

<isGreaterThan property="foodStoreInfo.shopLatitude" compareValue="0"> <isGreaterThan property="foodStoreInfo.shopLongitude" compareValue="0"> ORDER by IFNULL(fun_getDistance(#foodStoreInfo.shopLatitude#,#foodStoreInfo.shopLongitude#,ifnull(shop_latitude,0),ifnull(shop_longitude,0)),0) ASC </isGreaterThan> </isGreaterThan>函數

輸入圖片說明

相關文章
相關標籤/搜索