-
CI3 트랜잭션 (transaction)CI3 2022. 9. 30. 18:42728x90반응형
# 트랜잭션 시작
$this->db->trans_start();
# 트랜잭션 완료$this->db->trans_complete();
#트랜잭션 엄격모드 비활성화
$this->db->trans_strict(false);
#트랜잭션 수동처리
$this->db->trans_begin();
$this->db->query("YOUR QUERY");
if ($this->db->trans_status() === FALSE){
$this->db->trans_rollback();
} else {
$this->db->trans_commit();
}# CI3 & CI4 Transaction
처리 CI3 CI4 트랜잭션 시작 trans_start() transStart() 트랜잭션 완료 trans_complete() transComplete() 트랜잭션 엄격모드 비활성화 trans_strict(false) transStrict(false) 결과 상태 trans_status() transStatus() 롤백 trans_rollback() transRollback() 커밋 trans_commit() transCommit() 비활성화 trans_off() transOff() <?php defined('BASEPATH') OR exit('No direct script access allowed'); class BoardModel extends CI_Model { function test() { $this->db->trans_start(); $this->db->query(""); $this->db->trans_complete(); } function test2() { $this->db->trans_begin(); $this->db->query(""); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); } else { $this->db->trans_commit(); } } }
728x90반응형'CI3' 카테고리의 다른 글
ci3 가상환경 index.php 없애기 (0) 2022.10.29 CI3 라이브러리 (0) 2022.09.23 CI3 query 결과 가져오기 (0) 2022.09.21 ci3 model (0) 2022.09.15