Changeset 14919


Ignore:
Timestamp:
2007/06/26 12:00:09 (13 years ago)
Author:
uehara
Message:

CSVアップロード改修
MySQLのauto_incrementバグに対応

Location:
branches/beta
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/beta/data/class/SC_Query.php

    r14676 r14919  
    590590    } 
    591591     
    592     // auto_increment¤ò¼èÆÀ¤¹¤ë 
    593     function get_auto_increment($table_name){ 
    594         // ¥í¥Ã¥¯¤¹¤ë 
    595         $this->BEGIN(); 
    596          
    597         // ¼¡¤ÎIncrement¤ò¼èÆÀ 
    598         $arrRet = $this->getAll("SHOW TABLE STATUS LIKE ?", array($table_name)); 
    599         $auto_inc_no = $arrRet[0]["Auto_increment"]; 
    600          
    601         // Ãͤò¥«¥¦¥ó¥È¥¢¥Ã¥×¤·¤Æ¤ª¤¯ 
    602         $this->conn->query("ALTER TABLE $table_name AUTO_INCREMENT=?" , $auto_inc_no + 1); 
    603          
    604         // ²ò½ü¤¹¤ë 
    605         $this->COMMIT(); 
    606          
    607         return $auto_inc_no; 
    608     } 
     592    // auto_increment¤ò¼èÆÀ¤¹¤ë 
     593    function get_auto_increment($table_name){ 
     594        // ¥í¥Ã¥¯¤¹¤ë 
     595        $this->query("LOCK TABLES $table_name WRITE"); 
     596         
     597        // ¼¡¤ÎIncrement¤ò¼èÆÀ 
     598        $arrRet = $this->getAll("SHOW TABLE STATUS LIKE ?", array($table_name)); 
     599        $auto_inc_no = $arrRet[0]["Auto_increment"]; 
     600         
     601        // Ãͤò¥«¥¦¥ó¥È¥¢¥Ã¥×¤·¤Æ¤ª¤¯ 
     602        $this->conn->query("ALTER TABLE $table_name AUTO_INCREMENT=?" , $auto_inc_no + 1); 
     603         
     604        // ²ò½ü¤¹¤ë 
     605        $this->query('UNLOCK TABLES'); 
     606         
     607        return $auto_inc_no; 
     608    } 
    609609} 
    610610?> 
  • branches/beta/html/admin/products/upload_csv.php

    r14676 r14919  
    255255        case 'recommend_product_id2': 
    256256        case 'recommend_product_id3': 
    257         case 'recommend_product_id4': 
     257        case 'recommend_product_id4': 
     258        case 'recommend_product_id5': 
     259        case 'recommend_product_id6': 
    258260        case 'recommend_comment1': 
    259261        case 'recommend_comment2': 
    260262        case 'recommend_comment3': 
    261263        case 'recommend_comment4': 
     264        case 'recommend_comment5': 
     265        case 'recommend_comment6': 
    262266            break; 
    263267        default: 
  • branches/beta/html/install/sql/insert_data.sql

    r14676 r14919  
    9797insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(1,'(SELECT recommend_product_id FROM dtb_recommend_products WHERE prdcls.product_id = dtb_recommend_products.product_id ORDER BY update_date DESC limit 1 offset 3) AS recommend_product_id4','¤ª¤¹¤¹¤á¾¦ÉÊ(4)',51,now(),now()); 
    9898insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(1,'(SELECT comment FROM dtb_recommend_products WHERE prdcls.product_id = dtb_recommend_products.product_id ORDER BY update_date DESC limit 1 offset 3) AS recommend_comment4','¤ª¤¹¤¹¤á¥³¥á¥ó¥È(4)',52,now(),now()); 
    99 insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(1,'category_id','¥«¥Æ¥´¥êID',53,now(),now()); 
     99insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(1,'(SELECT recommend_product_id FROM dtb_recommend_products WHERE prdcls.product_id = dtb_recommend_products.product_id ORDER BY update_date DESC limit 1 offset 4) AS recommend_product_id5','¤ª¤¹¤¹¤á¾¦ÉÊ(5)',53,now(),now()); 
     100insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(1,'(SELECT comment FROM dtb_recommend_products WHERE prdcls.product_id = dtb_recommend_products.product_id ORDER BY update_date DESC limit 1 offset 4) AS recommend_comment5','¤ª¤¹¤¹¤á¥³¥á¥ó¥È(5)',54,now(),now()); 
     101insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(1,'(SELECT recommend_product_id FROM dtb_recommend_products WHERE prdcls.product_id = dtb_recommend_products.product_id ORDER BY update_date DESC limit 1 offset 5) AS recommend_product_id6','¤ª¤¹¤¹¤á¾¦ÉÊ(6)',55,now(),now()); 
     102insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(1,'(SELECT comment FROM dtb_recommend_products WHERE prdcls.product_id = dtb_recommend_products.product_id ORDER BY update_date DESC limit 1 offset 5) AS recommend_comment6','¤ª¤¹¤¹¤á¥³¥á¥ó¥È(6)',56,now(),now()); 
     103insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(1,'category_id','¥«¥Æ¥´¥êID',57,now(),now()); 
    100104insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(2,'customer_id','¸ÜµÒID',1,now(),now()); 
    101105insert into dtb_csv(csv_id,col,disp_name,rank,create_date,update_date)values(2,'name01','̾Á°1',2,now(),now()); 
Note: See TracChangeset for help on using the changeset viewer.