//定义表开始
$t_data="ZL_T_DATA";
$t_data_class=$t_data."_CLASS";
$t_data_keyword=$t_data."_KEYWORD";
//定义表结束
class odbc_oracle
{
var $host="php_oracle";//定义odbc数据源
var $user="soohuo";//定义用户名
var $passwd="soohuo";//定义密码
//库连接
function connect()
{
$con=odbc_connect($this-host,$this-user,$this-passwd);
if(!$con)
{
echo "odbc is not connect!
";
exit();
}
//odbc_autocommit($con);
return $con;
}
//sql语句执行
function query($con,$sql)
{
if(empty($con))
{
echo "odbc connect success value is not null!
";
exit();
}
if(empty($sql))
{
echo "odbc sql value is not null!
";
exit();
}
$result=odbc_do($con,$sql);
return $result;
}
//执行成功的句柄,参数为sql语句执行完毕后的句柄
function fetch_row($result)
{
if(empty($result))
{
echo "odbc query success is null!
";
exit();
}
$row=odbc_fetch_row($result);
//if(!$row)
//{
//echo "odbc query error!
";
//exit();
//}
return $row;
}
//关闭库,参数为,连接句柄
function close($con)
{
if(empty($con))
{
echo "odbc connect is not null!
";
exit();
}
odbc_close($con);
}
}
?