本文整理汇总了PHP中SC_Query::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Query::delete方法的具体用法?PHP SC_Query::delete怎么用?PHP SC_Query::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Query
的用法示例。
在下文中一共展示了SC_Query::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$conn = new SC_DBConn();
$objView = new SC_AdminView();
$objSess = new SC_Session();
$objQuery = new SC_Query();
$objDb = new SC_Helper_DB_Ex();
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
// 要求判定
switch ($_POST['mode']) {
// 編集処理
case 'edit':
// POST値の引き継ぎ
$this->arrForm = $_POST;
// 入力文字の変換
$this->arrForm = $this->lfConvertParam($this->arrForm);
// エラーチェック
$this->arrErr = $this->lfErrorCheck();
if (count($this->arrErr) <= 0) {
if ($_POST['class_id'] == "") {
$this->lfInsertClass($this->arrForm);
// 新規作成
} else {
$this->lfUpdateClass($this->arrForm);
// 既存編集
}
// 再表示
$this->reload();
} else {
// POSTデータを引き継ぐ
$this->tpl_class_id = $_POST['class_id'];
}
break;
// 削除
// 削除
case 'delete':
$objDb->sfDeleteRankRecord("dtb_class", "class_id", $_POST['class_id'], "", true);
$objQuery = new SC_Query();
$objQuery->delete("dtb_classcategory", "class_id = ?", $_POST['class_id']);
// 再表示
$this->reload();
break;
// 編集前処理
// 編集前処理
case 'pre_edit':
// 編集項目をDBより取得する。
$where = "class_id = ?";
$class_name = $objQuery->get("dtb_class", "name", $where, array($_POST['class_id']));
// 入力項目にカテゴリ名を入力する。
$this->arrForm['name'] = $class_name;
// POSTデータを引き継ぐ
$this->tpl_class_id = $_POST['class_id'];
break;
case 'down':
$objDb->sfRankDown("dtb_class", "class_id", $_POST['class_id']);
// 再表示
$this->reload();
break;
case 'up':
$objDb->sfRankUp("dtb_class", "class_id", $_POST['class_id']);
// 再表示
$this->reload();
break;
default:
break;
}
// 規格の読込
$where = "del_flg <> 1";
$objQuery->setorder("rank DESC");
$this->arrClass = $objQuery->select("name, class_id", "dtb_class", $where);
$this->arrClassCatCount = SC_Utils_Ex::sfGetClassCatCount();
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例2: lfRegistReccomendProducts
/**
* 関連商品登録を行う.
*
* FIXME: 商品規格登録の実処理自体は、LC_Page_Admin_Products_Productと共通化して欲しい。
* DELETE/INSERT ではなく UPDATEへの変更も・・・
*
* @param SC_Query $objQuery SC_Queryインスタンス
* @param array $arrList 商品規格情報配列
* @param integer $product_id 商品ID
* @return void
*/
public function lfRegistReccomendProducts($objQuery, $arrList, $product_id)
{
$objQuery->delete('dtb_recommend_products', 'product_id = ?', array($product_id));
for ($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
$keyname = 'recommend_product_id' . $i;
$comment_key = 'recommend_comment' . $i;
if ($arrList[$keyname] != '') {
$arrProduct = $objQuery->select('product_id', 'dtb_products', 'product_id = ?', array($arrList[$keyname]));
if ($arrProduct[0]['product_id'] != '') {
$arrWhereVal = array();
$arrWhereVal['product_id'] = $product_id;
$arrWhereVal['recommend_product_id'] = $arrProduct[0]['product_id'];
$arrWhereVal['comment'] = $arrList[$comment_key];
$arrWhereVal['update_date'] = $arrList['update_date'];
$arrWhereVal['create_date'] = $arrList['update_date'];
$arrWhereVal['creator_id'] = $_SESSION['member_id'];
$arrWhereVal['rank'] = RECOMMEND_PRODUCT_MAX - $i + 1;
$objQuery->insert('dtb_recommend_products', $arrWhereVal);
}
}
}
}
示例3: doEdit
function doEdit(SC_Query $objQuery, SC_FormParam &$objFormParam)
{
if (is_array($this->arrErr)) {
$this->arrErr = array_filter($this->arrErr);
if (count($this->arrErr)) {
GC_Utils_Ex::gfPrintLog(print_r($this->arrErr, TRUE), ERROR_LOG_REALFILE);
return;
}
}
$this->arrErr = $objFormParam->checkError();
if (!SC_Utils_Ex::isBlank($this->arrErr)) {
return;
}
$device_id = $objFormParam->getValue("device_id");
$sqldata = $objFormParam->getDbArray();
$arrDateColumn = $this->ARR_DATE_COLUMN;
foreach ($arrDateColumn as $column) {
$date_keys = $this->date_keys($column);
$date = $objFormParam->getHashArray(array_values($date_keys));
$date = array_map("intval", $date);
if (checkdate($date[$date_keys["month"]], $date[$date_keys["day"]], $date[$date_keys["year"]])) {
$sqldata[$column] = SC_Utils_Ex::sfGetTimestamp($date[$date_keys["year"]], $date[$date_keys["month"]], $date[$date_keys["day"]], FALSE);
}
}
$has_insert = false;
$sqldata["update_date"] = "CURRENT_TIMESTAMP";
$device_id = intval($device_id);
if ($device_id == 0) {
$sqldata["device_id"] = $objQuery->nextVal("cp_dtb_device_device_id");
$sqldata["create_date"] = "CURRENT_TIMESTAMP";
$sqldata["del_flg"] = 0;
$objQuery->insert("cp_dtb_device", $sqldata);
$device_id = $sqldata["device_id"];
// 端末情報初期設定
$objFormParam->addParam("edit_device_id", "edit_device_id");
$objFormParam->setValue("edit_device_id", $device_id);
$has_insert = true;
} else {
$sqldata["update_date"] = "CURRENT_TIMESTAMP";
$objQuery->update("cp_dtb_device", $sqldata, "device_id=?", (array) $device_id);
$objQuery->delete("cp_dtb_device_categories", "device_id=?", (array) $device_id);
}
$form = $objFormParam->getHashArray(array("category_id"));
if (is_array($form["category_id"]) && count($form["category_id"])) {
foreach ($form["category_id"] as $category_id) {
$sqldata = compact("category_id", "device_id");
$objQuery->insert("cp_dtb_device_categories", $sqldata);
}
if ($has_insert) {
// 初回登録時のみ
$this->doProductSupportinitial($objQuery, $objFormParam);
}
}
$this->tpl_onload = "eccube.setValueAndSubmit('search_form', 'mode', 'return');";
return $device_id;
}
示例4: lfDeleteTemplate
/**
* テンプレートパッケージの削除
*/
function lfDeleteTemplate($template_code)
{
// DB更新
$objQuery = new SC_Query();
$objQuery->delete('dtb_templates', 'template_code = ?', array($template_code));
// テンプレート削除
$templates_dir = SMARTY_TEMPLATES_DIR . $template_code . "/";
SC_Utils_Ex::sfDelFile($templates_dir);
// コンパイル削除
$templates_c_dir = DATA_PATH . "Smarty/templates_c/" . $template_code . "/";
SC_Utils_Ex::sfDelFile($templates_c_dir);
// ユーザーデータ削除
$user_dir = USER_TEMPLATE_PATH . $template_code . "/";
SC_Utils_Ex::sfDelFile($user_dir);
}
示例5: productSupportinitial
static function productSupportinitial($device_id, SC_Query $objQuery)
{
$objQuery->delete("cp_dtb_device_products", "device_id=?", (array) $device_id);
$objQuery->insert("cp_dtb_device_products", array(), array("product_id" => "product_id", "device_id" => "device_id"), array(), "\n FROM dtb_product_categories\n INNER JOIN cp_dtb_device_categories USING(category_id)\n WHERE product_id IN (SELECT product_id FROM cp_dtb_device_products)\n AND device_id = ?", (array) $device_id);
$objQuery->commit();
}
示例6: sfSessGc
/**
* ガーベジコレクションを実行する.
*
* 引数 $maxlifetime の代りに 定数 MAX_LIFETIME を使用する.
*
* @param integer $maxlifetime セッションの有効期限(使用しない)
*/
function sfSessGc($maxlifetime)
{
// MAX_LIFETIME以上更新されていないセッションを削除する。
if (!$this->objDb->sfTabaleExists("dtb_session")) {
return false;
}
$objQuery = new SC_Query();
$where = "update_date < current_timestamp + '-" . MAX_LIFETIME . " secs'";
$objQuery->delete("dtb_session", $where);
return true;
}
示例7: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$objView = new SC_AdminView();
$objDb = new SC_Helper_DB_Ex();
$objDate = new SC_Date();
// 登録・更新検索開始年
$objDate->setStartYear(RELEASE_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrStartYear = $objDate->getYear();
$this->arrStartMonth = $objDate->getMonth();
$this->arrStartDay = $objDate->getDay();
// 登録・更新検索終了年
$objDate->setStartYear(RELEASE_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrEndYear = $objDate->getYear();
$this->arrEndMonth = $objDate->getMonth();
$this->arrEndDay = $objDate->getDay();
// 認証可否の判定
$objSess = new SC_Session();
SC_Utils_Ex::sfIsSuccess($objSess);
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
//キャンペーンの編集時
if (isset($_POST['campaign_id']) && SC_Utils_Ex::sfIsInt($_POST['campaign_id']) && $_POST['mode'] == "camp_search") {
$objQuery = new SC_Query();
$search_data = $objQuery->get("dtb_campaign", "search_condition", "campaign_id = ? ", array($_POST['campaign_id']));
$arrSearch = unserialize($search_data);
foreach ($arrSearch as $key => $val) {
$_POST[$key] = $val;
}
}
// POST値の引き継ぎ
$this->arrForm = $_POST;
// 検索ワードの引き継ぎ
foreach ($_POST as $key => $val) {
if (ereg("^search_", $key) || ereg("^campaign_", $key)) {
switch ($key) {
case 'search_product_flag':
case 'search_status':
$this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
if (!is_array($val)) {
$this->arrForm[$key] = split("-", $val);
}
break;
default:
$this->arrHidden[$key] = $val;
break;
}
}
}
// ページ送り用
$this->arrHidden['search_pageno'] = isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
// 商品削除
if ($_POST['mode'] == "delete") {
if ($_POST['category_id'] != "") {
// ランク付きレコードの削除
$where = "category_id = " . SC_Utils_Ex::sfQuoteSmart($_POST['category_id']);
$objDb->sfDeleteRankRecord("dtb_products", "product_id", $_POST['product_id'], $where);
} else {
$objDb->sfDeleteRankRecord("dtb_products", "product_id", $_POST['product_id']);
}
// 子テーブル(商品規格)の削除
$objQuery = new SC_Query();
$objQuery->delete("dtb_products_class", "product_id = ?", array($_POST['product_id']));
// 件数カウントバッチ実行
$objDb->sfCategory_Count($objQuery);
}
if ($_POST['mode'] == "search" || $_POST['mode'] == "csv" || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all" || $_POST['mode'] == "camp_search") {
// 入力文字の強制変換
$this->lfConvertParam();
// エラーチェック
$this->arrErr = $this->lfCheckError();
$where = "del_flg = 0";
$view_where = "del_flg = 0";
// 入力エラーなし
if (count($this->arrErr) == 0) {
$arrval = array();
foreach ($this->arrForm as $key => $val) {
$val = SC_Utils_Ex::sfManualEscape($val);
if ($val == "") {
continue;
}
switch ($key) {
case 'search_product_id':
// 商品ID
$where .= " AND product_id = ?";
$view_where .= " AND product_id = ?";
$arrval[] = $val;
break;
case 'search_product_class_name':
//規格名称
$where_in = " (SELECT classcategory_id FROM dtb_classcategory WHERE class_id IN (SELECT class_id FROM dtb_class WHERE name LIKE ?)) ";
$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE classcategory_id1 IN " . $where_in;
$where .= " OR classcategory_id2 IN" . $where_in . ")";
//.........这里部分代码省略.........
示例8: setExtSessionId
/**
* 外部サイト連携用にセッションIDとパラメーターの組み合わせを保存する。
*
* @param string $param_key パラメーター名
* @param string $param_value パラメーター値
* @param string $url URL
* @return void
*/
function setExtSessionId($param_key, $param_value, $url)
{
$objQuery = new SC_Query();
// GC
$lifetime = $this->state->getLifeTime();
$time = date('Y-m-d H:i:s', time() - $lifetime);
$objQuery->delete('dtb_mobile_ext_session_id', 'create_date < ?', array($time));
$arrValues = array('session_id' => session_id(), 'param_key' => $param_key, 'param_value' => $param_value, 'url' => $url);
$objQuery->insert('dtb_mobile_ext_session_id', $arrValues);
}
示例9: lfDeleteFavoriteProduct
function lfDeleteFavoriteProduct($customer_id, $product_id)
{
$objQuery = new SC_Query();
$objConn = new SC_DbConn();
$count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = ?", array($customer_id, $product_id));
if ($count > 0) {
$where = "customer_id = ? AND product_id = ?";
$sqlval['customer_id'] = $customer_id;
$sqlval['product_id'] = $product_id;
$objQuery->begin();
$objQuery->delete('dtb_customer_favorite_products', $where, $sqlval);
$objQuery->commit();
}
}
示例10: lfRegistNewData
function lfRegistNewData()
{
$objQuery = new SC_Query();
$objQuery->begin();
// 入力データを渡す。
$arrRet = $this->objFormParam->getHashArray();
foreach ($arrRet as $key => $val) {
// 配列は登録しない
if (!is_array($val)) {
$sqlval[$key] = $val;
}
}
// postgresqlとmysqlとで処理を分ける
if (DB_TYPE == "pgsql") {
$order_id = $objQuery->nextval("dtb_order", "order_id");
} elseif (DB_TYPE == "mysql") {
$order_id = $objQuery->get_auto_increment("dtb_order");
}
$sqlval['order_id'] = $order_id;
$sqlval['create_date'] = "Now()";
// 注文ステータス:指定が無ければ新規受付に設定
if ($sqlval["status"] == "") {
$sqlval['status'] = '1';
}
// customer_id
if ($sqlval["customer_id"] == "") {
$sqlval['customer_id'] = '0';
}
unset($sqlval['total_point']);
unset($sqlval['point']);
$where = "order_id = ?";
// 受注ステータスの判定
if ($sqlval['status'] == ODERSTATUS_COMMIT) {
// 受注テーブルの発送済み日を更新する
$sqlval['commit_date'] = "Now()";
}
// 受注テーブルの登録
$objQuery->insert("dtb_order", $sqlval);
$sql = "";
$sql .= " UPDATE";
$sql .= " dtb_order";
$sql .= " SET";
$sql .= " payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = ?)";
$sql .= " ,deliv_time = (SELECT deliv_time FROM dtb_delivtime WHERE time_id = ? AND deliv_id = (SELECT deliv_id FROM dtb_payment WHERE payment_id = ? ))";
$sql .= " WHERE order_id = ?";
if ($arrRet['deliv_time_id'] == "") {
$deliv_time_id = 0;
} else {
$deliv_time_id = $arrRet['deliv_time_id'];
}
$arrUpdData = array($arrRet['payment_id'], $deliv_time_id, $arrRet['payment_id'], $order_id);
$objQuery->query($sql, $arrUpdData);
// 受注詳細データの更新
$arrDetail = $this->objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2"));
$objQuery->delete("dtb_order_detail", $where, array($order_id));
$max = count($arrDetail);
for ($i = 0; $i < $max; $i++) {
$sqlval = array();
$sqlval['order_id'] = $order_id;
$sqlval['product_id'] = $arrDetail[$i]['product_id'];
$sqlval['product_code'] = $arrDetail[$i]['product_code'];
$sqlval['product_name'] = $arrDetail[$i]['product_name'];
$sqlval['price'] = $arrDetail[$i]['price'];
$sqlval['quantity'] = $arrDetail[$i]['quantity'];
$sqlval['point_rate'] = $arrDetail[$i]['point_rate'];
$sqlval['classcategory_id1'] = $arrDetail[$i]['classcategory_id1'];
$sqlval['classcategory_id2'] = $arrDetail[$i]['classcategory_id2'];
$sqlval['classcategory_name1'] = $arrDetail[$i]['classcategory_name1'];
$sqlval['classcategory_name2'] = $arrDetail[$i]['classcategory_name2'];
$objQuery->insert("dtb_order_detail", $sqlval);
}
$objQuery->commit();
return $order_id;
}
示例11: lfRegistReccomendProducts
/**
* 関連商品登録を行う.
*
* FIXME: 商品規格登録の実処理自体は、LC_Page_Admin_Products_Productと共通化して欲しい。
* DELETE/INSERT ではなく UPDATEへの変更も・・・
*
* @param SC_Query $objQuery SC_Queryインスタンス
* @param array $arrList 商品規格情報配列
* @param integer $product_id 商品ID
* @return void
*/
function lfRegistReccomendProducts($objQuery, $arrList, $product_id)
{
$objQuery->delete("dtb_recommend_products", "product_id = ?", array($product_id));
for ($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
$keyname = "recommend_product_id" . $i;
$comment_key = "recommend_comment" . $i;
if ($arrList[$keyname] != "") {
$arrProduct = $objQuery->select("product_id", "dtb_products", "product_id = ?", array($arrList[$keyname]));
if ($arrProduct[0]['product_id'] != "") {
$arrval['product_id'] = $product_id;
$arrval['recommend_product_id'] = $arrProduct[0]['product_id'];
$arrval['comment'] = $arrList[$comment_key];
$arrval['update_date'] = $arrList['update_date'];
$arrval['create_date'] = $arrList['update_date'];
$arrval['creator_id'] = $_SESSION['member_id'];
$arrval['rank'] = RECOMMEND_PRODUCT_MAX - $i + 1;
$objQuery->insert("dtb_recommend_products", $arrval);
}
}
}
}
示例12: deleteOtherDeliv
/**
* お届け先の削除
*
* @param integer $customerId
* @param integer $delivId
*/
function deleteOtherDeliv($customerId, $delivId)
{
$where = 'customer_id = ? AND other_deliv_id = ?';
$objQuery = new SC_Query();
$objQuery->delete("dtb_other_deliv", $where, array($customerId, $delivId));
}
示例13: sfMobileSetExtSessionId
/**
* 外部サイト連携用にセッションIDとパラメーターの組み合わせを保存する。
*
* @param string $param_key パラメーター名
* @param string $param_value パラメーター値
* @param string $url URL
* @return void
*/
function sfMobileSetExtSessionId($param_key, $param_value, $url)
{
$objQuery = new SC_Query();
// GC
$time = date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME);
$objQuery->delete('dtb_mobile_ext_session_id', 'create_date < ?', array($time));
$arrValues = array('session_id' => session_id(), 'param_key' => $param_key, 'param_value' => $param_value, 'url' => $url);
$objQuery->insert('dtb_mobile_ext_session_id', $arrValues);
}
示例14: lfRegistProductClass
/**
* 商品規格登録を行う.
*
* @param SC_Query $objQuery SC_Queryインスタンス
* @param array $arrList 商品規格情報配列
* @param integer $product_id 商品ID
* @param integer $product_class_id 商品規格ID
* @return void
*/
function lfRegistProductClass($objQuery, $arrList, $product_id, $product_class_id)
{
$sqlval['product_code'] = $arrList["product_code"];
$sqlval['stock'] = $arrList["stock"];
if ($sqlval['stock'] == "") {
$sqlval['stock_unlimited'] = '1';
} else {
$sqlval['stock_unlimited'] = '0';
}
$sqlval['price01'] = $arrList['price01'];
$sqlval['price02'] = $arrList['price02'];
$sqlval['creator_id'] = $_SESSION['member_id'];
// TODO $sqlval['member_id'] は何処から出てくる?
if ($sqlval['member_id'] == "") {
$sqlval['creator_id'] = '0';
}
if ($product_class_id == "") {
// 新規登録
$where = "product_id = ?";
// 念のために既存の規格を削除
$objQuery->delete("dtb_products_class", $where, array($product_id));
$sqlval['product_id'] = $product_id;
$sqlval['classcategory_id1'] = '0';
$sqlval['classcategory_id2'] = '0';
$sqlval['create_date'] = "now()";
$objQuery->insert("dtb_products_class", $sqlval);
} else {
// 既存編集
$where = "product_id = ? AND product_class_id = ?";
$objQuery->update("dtb_products_class", $sqlval, $where, array($product_id, $product_class_id));
}
}
示例15: lfDelPageData
/**
* ページ情報を削除する.
*
* @param integer|string $page_id ページID
* @return integer 削除数
*/
function lfDelPageData($page_id)
{
// DBへデータを更新する
$objQuery = new SC_Query();
// DB操作オブジェクト
$sql = "";
// データ更新SQL生成用
$ret = "";
// データ更新結果格納用
$arrDelData = array();
// 更新データ生成用
// page_id が空でない場合にはdeleteを実行
if ($page_id != '') {
$arrPageData = $this->lfgetPageData(" page_id = ? ", array($page_id));
// SQL実行
$ret = $objQuery->delete("dtb_pagelayout", "page_id = ?", array($page_id));
// ファイルの削除
$this->lfDelFile($arrPageData[0]);
}
return $ret;
}