本文整理汇总了PHP中SC_Query::get_auto_increment方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Query::get_auto_increment方法的具体用法?PHP SC_Query::get_auto_increment怎么用?PHP SC_Query::get_auto_increment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Query
的用法示例。
在下文中一共展示了SC_Query::get_auto_increment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: lfRegistProduct
/**
* 商品登録を行う.
*
* @param SC_Query $objQuery SC_Queryインスタンス
* @param string|integer $line 処理中の行数
* @return void
*/
function lfRegistProduct($objQuery, $line = "")
{
$objDb = new SC_Helper_DB_Ex();
$arrRet = $this->objFormParam->getHashArray();
// dtb_products以外に登録される値を除外する。
foreach ($arrRet as $key => $val) {
switch ($key) {
case 'product_code':
case 'price01':
case 'price02':
case 'stock':
case 'product_class_id':
case 'recommend_product_id1':
case 'recommend_product_id2':
case 'recommend_product_id3':
case 'recommend_product_id4':
case 'recommend_product_id5':
case 'recommend_product_id6':
case 'recommend_comment1':
case 'recommend_comment2':
case 'recommend_comment3':
case 'recommend_comment4':
case 'recommend_comment5':
case 'recommend_comment6':
case 'category_id':
break;
default:
if (!ereg("^dummy", $key)) {
$sqlval[$key] = $val;
}
break;
}
}
// 登録時間を生成(DBのnow()だとcommitした際、すべて同一の時間になってしまう)
$time = date("Y-m-d H:i:s");
// 秒以下を生成
if ($line != "") {
$microtime = sprintf("%06d", $line);
$time .= ".{$microtime}";
}
$sqlval['update_date'] = $time;
$sqlval['creator_id'] = $_SESSION['member_id'];
if ($sqlval['sale_limit'] == "") {
$sqlval['sale_unlimited'] = '1';
} else {
$sqlval['sale_unlimited'] = '0';
}
if ($sqlval['status'] == "") {
$sqlval['status'] = 2;
}
if ($arrRet['product_id'] != "" && $arrRet['product_class_id'] != "") {
// UPDATEの実行
$where = "product_id = ?";
$objQuery->update("dtb_products", $sqlval, $where, array($sqlval['product_id']));
} else {
// 新規登録
// postgresqlとmysqlとで処理を分ける
if (DB_TYPE == "pgsql") {
$product_id = $objQuery->nextval("dtb_products", "product_id");
} elseif (DB_TYPE == "mysql") {
$product_id = $objQuery->get_auto_increment("dtb_products");
}
$sqlval['product_id'] = $product_id;
$sqlval['create_date'] = $time;
// INSERTの実行
$objQuery->insert("dtb_products", $sqlval);
}
// カテゴリ登録
$arrCategory_id = explode("|", $arrRet["category_id"]);
$objDb->updateProductCategories($arrCategory_id, $sqlval['product_id']);
// 規格登録
$this->lfRegistProductClass($objQuery, $arrRet, $sqlval['product_id'], $arrRet['product_class_id']);
// おすすめ商品登録
$objQuery->delete("dtb_recommend_products", "product_id = ?", array($sqlval['product_id']));
for ($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
$keyname = "recommend_product_id" . $i;
$comment_key = "recommend_comment" . $i;
if ($arrRet[$keyname] != "") {
$arrProduct = $objQuery->select("product_id", "dtb_products", "product_id = ?", array($arrRet[$keyname]));
if ($arrProduct[0]['product_id'] != "") {
$arrval['product_id'] = $sqlval['product_id'];
$arrval['recommend_product_id'] = $arrProduct[0]['product_id'];
$arrval['comment'] = $arrRet[$comment_key];
$arrval['update_date'] = "Now()";
$arrval['create_date'] = "Now()";
$arrval['creator_id'] = $_SESSION['member_id'];
$arrval['rank'] = RECOMMEND_PRODUCT_MAX - $i + 1;
$objQuery->insert("dtb_recommend_products", $arrval);
}
}
}
}
示例3: mobileProcess
/**
* Page のプロセス(モバイル).
*
* @return void
*/
function mobileProcess()
{
$objView = new SC_MobileView();
$objCartSess = new SC_CartSession();
$objSiteInfo = $objView->objSiteInfo;
$objSiteSess = new SC_SiteSession();
$objCustomer = new SC_Customer();
$arrInfo = $objSiteInfo->data;
$objQuery = new SC_Query();
$objDb = new SC_Helper_DB_Ex();
// 前のページで正しく登録手続きが行われた記録があるか判定
SC_Utils_Ex::sfIsPrePage($objSiteSess, true);
// ユーザユニークIDの取得と購入状態の正当性をチェック
$uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
$this->tpl_uniqid = $uniqid;
// カート集計処理
$objDb->sfTotalCart($this, $objCartSess, $arrInfo);
// 一時受注テーブルの読込
$arrData = $objDb->sfGetOrderTemp($uniqid);
// カート集計を元に最終計算
$arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo, $objCustomer);
// カート内の商品の売り切れチェック
$objCartSess->chkSoldOut($objCartSess->getCartList());
// 会員ログインチェック
if ($objCustomer->isLoginSuccess(true)) {
$this->tpl_login = '1';
$this->tpl_user_point = $objCustomer->getValue('point');
}
// 決済区分を取得する
$payment_type = "";
if ($objDb->sfColumnExists("dtb_payment", "memo01")) {
// MEMO03に値が入っている場合には、モジュール追加されたものとみなす
$sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
$arrPayment = $objQuery->getall($sql, array($arrData['payment_id']));
$payment_type = $arrPayment[0]["memo03"];
}
$this->payment_type = $payment_type;
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
switch ($_POST['mode']) {
// 前のページに戻る
case 'return':
// 正常な推移であることを記録しておく
$objSiteSess->setRegistFlag();
$this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true);
exit;
break;
case 'confirm':
// この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため)
// 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");
}
$arrData["order_id"] = $order_id;
// セッション情報を保持
$arrData['session'] = serialize($_SESSION);
// 集計結果を受注一時テーブルに反映
$objDb->sfRegistTempOrder($uniqid, $arrData);
// 正常に登録されたことを記録しておく
$objSiteSess->setRegistFlag();
// 決済方法により画面切替
if ($payment_type != "") {
$_SESSION["payment_id"] = $arrData['payment_id'];
$this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_MODULE), true);
} else {
$this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_COMPLETE), true);
}
exit;
break;
default:
break;
}
$this->arrData = $arrData;
$this->arrInfo = $arrInfo;
$objView->assignobj($this);
$objView->display(SITE_FRAME);
}