本文整理匯總了PHP中Dao::execute方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dao::execute方法的具體用法?PHP Dao::execute怎麽用?PHP Dao::execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dao
的用法示例。
在下文中一共展示了Dao::execute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exec
public function exec($sql, $dbconfig, $unicode = 'gb2312')
{
$dao = new Dao('', 'jk_dnb_hgk_send', '', false, $dbconfig);
$sql = $this->auto_charset($sql, 'utf8', $unicode);
if (strpos($sql, 'select') !== false) {
$result = $dao->query($sql)->toArray();
if ($result) {
$result = $this->auto_charset($result, $unicode, 'utf8');
for ($i = 0; $i < count($result); $i++) {
for ($j = count($result[$i]); $j >= 0; $j--) {
unset($result[$i][$j]);
}
}
$rtn["result"] = true;
$rtn["value"] = $result;
} else {
$rtn["result"] = false;
}
} else {
$result = $dao->execute($sql);
if ($result) {
$rtn["result"] = true;
$rtn["value"] = $result;
} else {
$rtn["result"] = false;
}
}
return $rtn;
}
示例2: outPut
/**
* 輸出出倉數據
*
* @param $data
*/
public function outPut($data, $dbconfig)
{
//無條碼不用做
if (!$data["code"]) {
return true;
}
$unicode = $dbconfig['unicode'];
if (!$unicode) {
$unicode = 'gb2312';
}
$billtypedao = new BilltypeDao();
$billtype = $data["billType"];
$result = $billtypedao->find("billtypeDesc='{$billtype}'");
$result = $result->toArray();
if ($result["stype"] != 'OUT') {
return true;
}
$dao = new Dao('', 'jk_dnb_hgk_send', '', false, $dbconfig);
$dao->startTrans();
try {
if ($data["memo"] == '電能表') {
$sql = "insert into jk_dnb_hgk_recieve (fc_tm) values('" . $data["code"] . "')";
} else {
$sql = "insert into jk_hgq_hgk_recieve (fc_tm) values('" . $data["code"] . "')";
}
$sql = $this->auto_charset($sql, 'utf8', $unicode);
$result = $dao->execute($sql);
} catch (Exception $e) {
$dao->rollback();
throw new Exception($e);
}
$dao->commit();
return true;
}