test.php
- <?php
- //----------------------------------------------------------------------------- 기본 설정 START
- $con = ocilogon($common_oracle_id,$common_oracle_passwd,$common_oracle_sid) or error("DB_CONNECT_ERROR");
- //----------------------------------------------------------------------------- 기본 설정 END
<?php //----------------------------------------------------------------------------- 기본 설정 START $con = ocilogon($common_oracle_id,$common_oracle_passwd,$common_oracle_sid) or error("DB_CONNECT_ERROR"); //----------------------------------------------------------------------------- 기본 설정 END
test.php
- // select
- //---------------------------------------------------------------------------- S
- $sql = "select * from table where a = b";
- //echo "<pre>$sql</pre>";
- $stmt = ociparse($con,$sql);
- $result = ociexecute($stmt,OCI_DEFAULT);
- for( $i=0 ; ocifetchinto($stmt,&$row) ; $i++ )
- {
- $aaaaaaaaa = $row[0];
- }
- ocifreestatement($stmt);
- //---------------------------------------------------------------------------- E
// select //---------------------------------------------------------------------------- S $sql = "select * from table where a = b"; //echo "<pre>$sql</pre>"; $stmt = ociparse($con,$sql); $result = ociexecute($stmt,OCI_DEFAULT); for( $i=0 ; ocifetchinto($stmt,&$row) ; $i++ ) { $aaaaaaaaa = $row[0]; } ocifreestatement($stmt); //---------------------------------------------------------------------------- E
test.php
- // insert, update
- //---------------------------------------------------------------------------- S
- $sql = "insert into table ...";
- //echo "<pre>$sql</pre>"; exit;
- $stmt = ociparse($con, $sql);
- $result = ociexecute($stmt,OCI_DEFAULT);
// insert, update //---------------------------------------------------------------------------- S $sql = "insert into table ..."; //echo "<pre>$sql</pre>"; exit; $stmt = ociparse($con, $sql); $result = ociexecute($stmt,OCI_DEFAULT);
test.php
- if(!$result)
- {
- $ocierror = ocierror($stmt);
- $error_code = $ocierror["code"];
- $error_message = trim($ocierror["message"]);
- // 에러 발생 시, rollback
- ocirollback($con);
if(!$result) { $ocierror = ocierror($stmt); $error_code = $ocierror["code"]; $error_message = trim($ocierror["message"]); // 에러 발생 시, rollback ocirollback($con);
test.php
- $tg_error = "1"; //★error구분 1,2,3,4 SQL,File,보안위배,입력위배
- $tx_message = " ERROR"; // error message
- seterror($con, $REQUEST_URI, $tg_error, $tx_message, $sql);
$tg_error = "1"; //★error구분 1,2,3,4 SQL,File,보안위배,입력위배 $tx_message = " ERROR"; // error message seterror($con, $REQUEST_URI, $tg_error, $tx_message, $sql);
test.php
- ocifreestatement($stmt);
ocifreestatement($stmt);
test.php
- ocilogoff($con);
- exit;
- }
- ocifreestatement($stmt);
ocilogoff($con); exit; } ocifreestatement($stmt);
test.php
- // 성공시 commit 해줘야 실제 데이터 처리가 이뤄짐.
- ocicommit($con);
// 성공시 commit 해줘야 실제 데이터 처리가 이뤄짐. ocicommit($con);
test.php
- ocilogoff($con);
- exit;
- ?>