background image

function Q($query){

$str=strtolower(substr($query,0,1));//可能值为:d i s u

$msg_fail=array("d"=>"数据删除失败!","i"=>"数据插入失败!","s"=>"数据选择失
败!","u"=>"数据修改失败!");

if(!$rs=$this->conn->Execute($query)){

echo $msg_fail[$str]."<br />".$query;

exit;

}

switch ($str){

case "d":

break;

case "i":

if($this->db_type=="oci8"){

$tablename = preg_replace("/insert into(?:\s)*(?:\")?([a-z0-9_-]+)(?:\")?(?:\s)*.*/is","\\1",
$query);

$tablename=substr($tablename,strlen($this->prefix));

$query="select "."\"seq_".$tablename."\".currval from dual";

$rs=$this->conn->Execute($query);

return $rs->fields['CURRVAL'];

}else{

return $this->conn->Insert_ID();

}