2

老静姑娘_2705

老静姑娘_2705

2016-06-21

1226人浏览

原创

LiblibAI高清放大
LiblibAI高清放大

LiblibAI高清放大是一款AI图片处理工具,LiblibAI 推出的 AI 高清放大工作流。

下载

    {
        $this->doxmlstring2xml($string,$xpath);
    }

    /**
    * adds an additional pear::db_result resultset to $this->xmldoc
    *
    * @param    object db_result result from a db-query
    * @see      dosql2xml()
    * @access   public
    */
    function addresult($result)
    {
        $this->dosql2xml($result);
    }

    /**
    * adds an aditional resultset generated from an sql-statement
    *  to $this->xmldoc
    *
    * @param    string sql a string containing an sql-statement.
    * @access   public
    * @see      dosql2xml()
    */
    function addsql($sql)
    {
        /* if there are {} expressions in the sql query, we assume it's an xpath expression to
        *   be evaluated.
        */

        if (preg_match_all ("/\{([^\}]+)\}/i",$sql,$matches))
        {
            foreach ($matches[1] as $match)
            {
                $sql = preg_replace("#\{".preg_quote($match)."\}#  ", $this->getxpathvalue($match),$sql);
            }
        }
        $result = $this->db->query($sql);

        //very strange
        if (pear::iserror($result->result)) {
                 print "you have an sql-error:
".$result->result->userinfo;
                 print "
";
                new db_error($result->result->code,pear_error_die);
        }

        $this->dosql2xml($result);
    }

    /**
    * adds an aditional resultset generated from an array
    *  to $this->xmldoc
    * todo: more explanation, how arrays are transferred
    *
    * @param    array multidimensional array.
    * @access   public
    * @see      doarray2xml()
    */
    function addarray ($array)
    {
        $parent_row = $this->insertnewresult(&$metadata);
        $this->doarray2xml($array,$parent_row);
    }

    /**
    * returns an xml-string with a xml-representation of the resultsets.
    *
    * the resultset can be directly provided here, or if you need more than one
    * in your xml, then you have to provide each of them with add() before you
    * call getxml, but the last one can also be provided here.
    *
    * @param    mixed  $result result object from a db-query
    * @return   string  xml
    * @access   public
    */
    function getxml($result = null)
    {
        $xmldoc = $this->getxmlobject($result);
        return $xmldoc->dumpmem();
    }

    /**
    * returns an xml domdocument object with a xml-representation of the resultsets.
    *
    * the resultset can be directly provided here, or if you need more than one
    * in your xml, then you have to provide each of them with add() before you
    * call getxmlobject, but the last one can also be provided here.
    *
    * @param    mixed $result result object from a db-query
    * @return   object domdocument
    * @access   public
    */
    function getxmlobject($result = null)
    {
        if ($result) {
            $this->add ($result);
        }
        return $this->xmldoc;
    }

    /**
    * for adding db_result-"trees" to $this->xmldoc
    * @param    object db_result
    * @access   private
    * @see      addresult(),addsql()
    */
    function dosql2xml($result)
    {

        if (db::iserror($result)) {
            print "error in file ".__file__." at line ".__line__."
\n";
            print $result->userinfo."
\n";
            new db_error($result->code,pear_error_die);
        }

        // the method_exists is here, cause tableinfo is only in the cvs at the moment
        // be careful: if you have fields with the same name in different tables, you will get errors
        // later, since db_fetchmode_assoc doesn't differentiate that stuff.
        $this->lastresult = &$result;

        if (!method_exists($result,"tableinfo") || ! ($tableinfo = $result->tableinfo(false)))
        {
            //emulate tableinfo. this can go away, if every db supports tableinfo
            $fetchmode = db_fetchmode_assoc;
            $res = $result->fetchrow($fetchmode);
            $this->nested = false;
            $i = 0;

            while (list($key, $val) = each($res))
            {
                $tableinfo[$i]["table"]= $this->tagnameresult;
                $tableinfo[$i]["name"] = $key;
                $resfirstrow[$i] = $val;
                $i++;
            }
            $res  = $resfirstrow;
            $firstfetchdone = true;
            $fetchmode = db_fetchmode_ordered;
        }
        else
        {
            $firstfetchdone = false;
            $fetchmode = db_fetchmode_ordered;
        }

        // initialize db hierarchy...
        $parenttable = "root";
        $tableinfo["parent_key"]["root"] = 0;

        foreach ($tableinfo as $key => $value)
        {
            if (is_int($key))
            {
                // if the sql-query had a function the table starts with a # (only in mysql i think....), then give the field the name of the table before...
                if (preg_match ("/^#/",$value["table"]) || strlen($value["table"]) == 0) {
                     $value["table"] = $tableinfo[($key - 1)]["table"] ;
                    $tableinfo[$key]["table"] = $value["table"];
                }


                if (!isset($tableinfo["parent_table"]) || is_null($tableinfo["parent_table"][$value]["table"]]))
                {
                    $tableinfo["parent_key"][$value]["table"]] = $key;
                    $tableinfo["parent_table"][$value]["table"]] = $parenttable;
                    $parenttable = $value["table"] ;
                }

            }
            //if you need more tableinfo for later use you can write a function addtableinfo..
            $this->addtableinfo($key, $value, &$tableinfo);
        }

        // end initialize

        // if user made some own tableinfo data, merge them here.
        if ($this->user_tableinfo)
        {
            $tableinfo = $this->array_merge_clobber($tableinfo,$this->user_tableinfo);
        }
        $parent['root'] = $this->insertnewresult(&$tableinfo);

        //initialize $resold to get rid of warning messages;
        $resold[0] = "thisvalueisimpossibleforthefirstfieldinthefirstrow";

        while ($firstfetchdone == true || $res = $result->fetchrow($fetchmode))
        {

            //firstfetchdone is only for emulating tableinfo, as long as not all dbs support tableinfo. can go away later
            $firstfetchdone = false;

            while (list($key, $val) = each($res))
            {

                if ($resold[$tableinfo]["parent_key"][$tableinfo][$key]["table"]]] != $res[$tableinfo]["parent_key"][$tableinfo][$key]["table"]]] || !$this->nested)
                {
                    if ($tableinfo["parent_key"][$tableinfo][$key]["table"]] == $key )
                    {
                        if ($this->nested || $key == 0)
                        {

                            $parent[$tableinfo][$key]["table"]] =  $this->insertnewrow($parent[$tableinfo]["parent_table"][$tableinfo][$key]["table"]]], $res, $key, &$tableinfo);
                        }
                        else
                        {
                            $parent[$tableinfo][$key]["table"]]= $parent[$tableinfo]["parent_table"][$tableinfo][$key]["table"]]];
                        }

                        //set all children entries to somethin stupid
                        foreach($tableinfo["parent_table"] as $pkey => $pvalue)
                        {
                            if ($pvalue == $tableinfo[$key]["table"])
                            {
                                $resold[$tableinfo]["parent_key"][$pkey]]= "thisisjustaplaceholder";
                            }
                        }

                    }
                    if ( $parent[$tableinfo][$key]["table"]] != null)
                    {
                        $this->insertnewelement($parent[$tableinfo][$key]["table"]], $res, $key, &$tableinfo, &$subrow);
                    }

                }
            }

            $resold = $res;
            unset ($subrow);
        }
        return $this->xmldoc;
    }



    /**
    * for adding whole arrays to $this->xmldoc
    *
    * @param    array
    * @param    object domnode
    * @access   private
    * @see      addarray()
    */

    function doarray2xml ($array, $parent) {

        while (list($key, $val) = each($array))
            {
                $tableinfo[$key]["table"]= $this->tagnameresult;
                $tableinfo[$key]["name"] = $key;
            }

        if ($this->user_tableinfo)
        {
            $tableinfo = $this->array_merge_clobber($tableinfo,$this->user_tableinfo);
        }
        foreach ($array as $key=>$value)
        {
            if (is_array($value) ) {
                if (is_int($key) )
                {
                    $valuenew = array_slice($value,0,1);
                    $keynew = array_keys($valuenew);
                    $keynew = $keynew[0];
                }
                else
                {

                    $valuenew = $value;
                    $keynew = $key;
                }

                $rec2 = $this->insertnewrow($parent, $valuenew, $keynew, &$tableinfo);
                $this->doarray2xml($value,$rec2);
            }
            else {
                $this->insertnewelement($parent, $array, $key, &$tableinfo,&$subrow);
            }
        }

    }



    /**
    * this method sets the options for the class
    *  one can only set variables, which are defined at the top of
    *  of this class.
    *
    * @param    array   options to be passed to the class
    * @param    boolean   if the old suboptions should be deleted
    * @access   public
    * @see      $nested,$user_options,$user_tableinfo
    */

    function setoptions($options,$delete = false) {
    //set options
        if (is_array($options))
        {
            foreach ($options as $option => $value)
            {
               if (isset($this->{$option}))



相关文章

PHP速学视频免费教程(入门到精通)
PHP速学视频免费教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载

相关标签:

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

相关专题

更多
Go-Zero API开发使用教程
Go-Zero API开发使用教程

本专题聚焦Go-Zero的API开发,拆解.api描述文件的语法结构、路由与分组定义、参数绑定与校验规则,说明统一响应体、JWT鉴权、跨域与接口文档生成的落地方式,并给出网关聚合与接口测试的实践建议。

2026.11.12

140

15

Go-Zero安装与goctl环境配置教程
Go-Zero安装与goctl环境配置教程

本专题围绕Go-Zero的安装与工具链配置展开,讲清Go版本要求、goctl安装方式、代理镜像、protoc依赖与环境变量设置,说明多版本共存、升级回退与CI流水线安装的做法,并整理安装阶段的常见报错与验证步骤。

2026.11.12

100

15

Go-Zero零基础入门教程
Go-Zero零基础入门教程

本专题整理Go-Zero的入门知识,从框架定位、环境准备到跑通第一个API服务,讲清目录分层、配置加载、日志与中间件的基本用法,并对比Gin、Kratos的差异,帮助Go开发者建立整体认知,判断它是否适合当前项目。

2026.11.12

80

15

Postman身份认证怎么配置
Postman身份认证怎么配置

本专题从实际API接口调试场景出发,讲解Postman身份认证的完整配置流程,包括常见认证协议介绍、授权参数设置、访问令牌填写、OAuth 2.0授权及认证失败排查,帮助用户正确完成接口授权与访问验证。

2026.11.06

160

12

Postman请求头Headers怎么设置
Postman请求头Headers怎么设置

围绕Postman HTTP请求头配置展开,讲解Headers选项的具体使用方式,包括Key和Value参数填写、请求头信息添加、常见Header字段设置及请求头修改方法,帮助用户解决接口调试过程中遇到的请求头配置问题。

2026.11.06

140

13

Postman接口请求发送教程
Postman接口请求发送教程

详细介绍Postman接口请求的创建与发送方法,涵盖GET和POST请求、URL配置、请求参数、Headers请求头、Body请求体设置以及响应结果查看,帮助用户掌握Postman接口请求的完整操作流程。

2026.11.06

120

10

DBeaver怎么导入数据
DBeaver怎么导入数据

DBeaver数据导入专题,整理Excel、CSV、SQL、TXT等常见文件的数据导入方法,涵盖目标数据库选择、数据表创建、字段映射、数据类型设置及导入参数配置等操作,帮助用户将本地文件中的数据写入数据库,并了解批量导入、重复数据处理和导入失败等常见问题的解决方法。

2026.11.05

120

12

DBeaver安全防护教程大全
DBeaver安全防护教程大全

DBeaver安全防护专题,围绕数据库连接安全、账号密码保护和访问权限管理展开,整理SSL/TLS加密连接、SSH隧道、数据库凭据保存及证书验证等配置方法,同时介绍敏感信息保护、远程连接风险和高权限账号使用等注意事项,帮助用户提高数据库日常管理的安全性。

2026.11.05

100

12

DBeaver连接创建与配置教程
DBeaver连接创建与配置教程

本专题聚焦DBeaver数据库连接配置与管理,覆盖从新建连接、选择数据库类型到填写连接参数和验证连接的完整流程。针对MySQL、PostgreSQL、SQL Server等常见数据库,整理相应的连接设置方法,并提供驱动缺失、认证失败和连接异常等问题的排查方向。

2026.11.04

120

16

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Excel 教程
Excel 教程

共162课时 | 45.8万人学习

Pandas 教程
Pandas 教程

共15课时 | 2万人学习

C# 教程
C# 教程

共94课时 | 23万人学习