zoukankan      html  css  js  c++  java
  • 初学Phreeze 6,reporter文件

    Phreezer.php里面的函数,
    public function IncludeModel($objectclass) { Includer::RequireClass($objectclass, array("Model/","Reporter/") ); }
    Query()方法里面有这句话
    1 $custom = $this->GetCustomQuery($objectclass, $criteria);

    调用了Phreezer.php里面的自身的方法GetCustomQuery();

    public function GetCustomQuery($objectclass, $criteria)
        {
            $this->IncludeModel($objectclass);
            $sql = call_user_func( array($objectclass,"GetCustomQuery"),$criteria );
    //上面这句话调用了用户自定义的GetCustomQuery方法,在Reporter.php里面
    return $sql; }
     
    PTestReporter.php的内容如下:

    require_once("verysimple/Phreeze/Reporter.php"); class PTestReporter extends Reporter{ public $Id; public $Name; public $Time; static function GetCustomQuery($criteria) { $sql = "select `ptest`.`id` as Id ,`ptest`.`name` as Name ,`ptest`.`time` as Time from `ptest`"; // the criteria can be used or you can write your own custom logic. // be sure to escape any user input with $criteria->Escape() $sql .= $criteria->GetWhere(); $sql .= $criteria->GetOrder();      //echo $sql; return $sql; } }
     */
        public static function RequireClass($classname, $classpath = "")
        {
            if (class_exists($classname)) return true;
            
            // normalize this as an array
            $classpaths = is_array($classpath) ? $classpath : array($classpath);
            $attempts = "";
    
            foreach ($classpaths as $path)
            {
                if (class_exists($classname)) break;
    //$classname='PTest';
    //$classpaths=array('Model/','Reporter/');
    try { // append a directory separater if necessary if ($path && substr($path,-1) != "/") $path .= "/"; Includer::IncludeFile($path . $classname . ".php"); //这里表示加载的页面,可是也没有说明可以加载Reporter.php的文件啊, } catch (IncludeException $ex) {$attempts .= " " . $ex->getMessage();} } if (!class_exists($classname)) { // the class still isn't defined so there was a problem including the model throw new IncludeException("Unable to locate class '$classname': " . $attempts); } }

    Query语句这么写:

    $ds=$this->Phreezer->Query('PTestReporter',$criteria);

    未完待续。。。。。。

  • 相关阅读:
    4.0中的并行计算和多线程详解(一)
    Dojo工具包简介
    javascript中event.keyCode
    iText简介(转)
    ServletContext
    java文件加解密算法
    ResultSet 的相关介绍
    spring的AOP的四种实现方式
    java实现文件zip压缩或者解压缩
    Hibernate查询数据的几种方式以及HQL用法及参数的几种使用方法
  • 原文地址:https://www.cnblogs.com/zhangjun516/p/2934975.html
Copyright © 2011-2022 走看看