共享PHP操作oracle的操作类

oracle_db.class.php


< PHP
类oracle_db {
公共链接;
公共功能__construct(){
$这个链接;
如果(!$这个链接){
连接失败;
出口;
}
}
公共函数连接(){
返回oci_connect('demo ','demo ','localhost /氙,'al32utf8);
}
公共函数执行($ SQL){
$结果= false;
孤立度= oci_parse美元(美元->链接,为SQL);
如果($ interface){
结果= oci_execute美元(约合interface);
}
返回的数组(interface美元,美元的结果);
}
公共功能fetch_assoc($ interface){
返回oci_fetch_assoc($ interface);
}

公共功能fetch_one($ interface){
ARR =美元美元-> fetch_assoc($ interface);
美元->自由($ interface);
返回的数组;
}
公共功能fetch_all($ interface){
ARR =阵列(美元);
而($行=美元-> fetch_assoc($ interface)){
ARR { } = $行美元;
}
美元->自由($ interface);
返回的数组;
}
公共功能num_rows($ STMT){
返回oci_num_rows(美元支撑);
}
公共函数错误(){
返回oci_error(美元->链接);
}
公共功能($ interface){
返回oci_free_statement($ interface);
}
公共功能server_version(){
返回oci_server_version(美元->链接);
}
公共功能client_version(){
返回oci_client_version();
}
公共功能__destruct(){
返回oci_close(美元->链接);
}

}



这一切都是本文的全部内容。我希望你能喜欢它。