示例#1
0
function WRCustomGetFieldType($table, $field)
{
    global $conn;
    if (is_wr_project()) {
        $pSet = new ProjectSettings($_SESSION['webreports']['tables'][0]);
        $type = $pSet->getFieldType($field);
        if ($type) {
            return $type;
        }
    }
    if (is_wr_db()) {
        global $wr_is_standalone;
        if (!$wr_is_standalone) {
            global $dal;
            if ($dal->Table($table)) {
                return $dal->GetFieldType($table, $field);
            }
        }
        return dbinfoFieldsType($table, $field);
    }
    if (is_wr_custom()) {
        $res = "";
        $sql = $_SESSION["object_sql"];
        if ($sql) {
            //The default connection is temporary used #9875
            $connection = getDefaultConnection();
            $arr = $connection->getFieldsList($sql);
            foreach ($arr as $val) {
                if ($val["fieldname"] == $field) {
                    $res = $val["type"];
                }
            }
        }
        return $res;
    }
}
function WRCustomGetFieldType($table,$field)
{
	global $conn;
	if(is_wr_project())
	{
		$pSet = new ProjectSettings($_SESSION['webreports']['tables'][0]);
		$type = $pSet->getFieldType($field);
		if($type)
			return $type;
	}
	if(is_wr_db())
	{
		global $wr_is_standalone;
		if(!$wr_is_standalone)
		{
			global $dal;
			if($dal->Table($table))
				return $dal->GetFieldType($table,$field);
		}
		return dbinfoFieldsType($table,$field);
	}
	if(is_wr_custom())
	{
		$res="";
		$sql=$_SESSION["object_sql"];
		if($sql)
		{
			$arr=db_getfieldslist($sql);
			foreach($arr as $val)
				if($val["fieldname"]==$field)
					$res=$val["type"];
		}
		return $res;
	}
}