function xoops_module_update_ugm_market(&$module, $old_version) {
GLOBAL $xoopsDB;
if(!chk_ugm1()) go_ugm1(); # ---- 更改結構為 `e_last` -> DECIMAL( 10, 2 )
if(!chk_ugm2()) go_ugm2(); # ---- 更改結構為 `e_now` -> DECIMAL( 10, 2 )
return true;
}
# -------------------- ugm --------------------------------------------------*/
# ---- 更改結構 ugm_market_utility_main `e_last` 120->130----
function chk_ugm1(){
global $xoopsDB;
$sql="select `e_last` from ".$xoopsDB->prefix("ugm_market_utility_main")."";
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
if(mysql_field_type($result,0)=='int')return false ;
return true;
}
function go_ugm1(){
global $xoopsDB;
$sql="ALTER TABLE ".$xoopsDB->prefix("ugm_market_utility_main")." CHANGE `e_last` `e_last` DECIMAL( 10, 2 ) UNSIGNED NOT NULL COMMENT '上期用電度數'";
$xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
return true;
}
# -----------------------------------------
# ---- 更改結構 ugm_market_utility_main `e_now` 120->130-----
function chk_ugm2(){
global $xoopsDB;
$sql="select `e_now` from ".$xoopsDB->prefix("ugm_market_utility_main")."";
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
if(mysql_field_type($result,0)=='int')return false ;
return true;
}
function go_ugm2(){
global $xoopsDB;
$sql="ALTER TABLE ".$xoopsDB->prefix("ugm_market_utility_main")." CHANGE `e_now` `e_now` DECIMAL( 10, 2 ) UNSIGNED NOT NULL COMMENT '本期用電度數'";
$xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
return true;
}
# -----------------------------------------
2013年10月19日 星期六
更新資料結構 (模組更新)
市場攤販管理,更改資料表結構
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言