oci_statement_type

(PHP 5)

oci_statement_type -- 返回 OCI 語句的類型

說明

string oci_statement_type ( resource statement )

oci_statement_type() 返回語句 statement 的查詢類型,其值為下列之一:

  1. SELECT

  2. UPDATE

  3. DELETE

  4. INSERT

  5. CREATE

  6. DROP

  7. ALTER

  8. BEGIN

  9. DECLARE

  10. UNKNOWN

statement 參數是一個由 oci_parse() 所返回的有效的 OCI 語句標識符。

例子 1. oci_statement_type() 例子

<?php
    $conn 
oci_connect("scott""tiger");
    
$sql  "delete from emp where deptno = 10";

    
$stmt oci_parse($conn$sql);
    if (
oci_statement_type($stmt) == "DELETE") {
        die(
"You are not allowed to delete from this table<br />");
    }

    
oci_close($conn);
?>

oci_statement_type() 在出錯時返回 FALSE

注: 在 PHP 5.0.0 之前的版本必須使用 ocistatementtype() 替代本函數。該函數名仍然可用,為向下相容作為 oci_statement_type() 的別名。不過其已被廢棄,不推薦使用。