[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/Webservices/ -> QueryParser.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  
  11      require_once ("include/Webservices/VTQL_Lexer.php");
  12      require_once ("include/Webservices/VTQL_Parser.php");
  13      
  14      class Parser{
  15          
  16          private $query = "";
  17          private $out;
  18          private $meta;
  19          private $hasError ;
  20          private $error ;
  21          private $user; 
  22  		function Parser($user, $q){
  23              $this->query = $q;
  24              $this->out = array();
  25              $this->hasError = false;
  26              $this->user = $user; 
  27          }
  28          
  29  		function parse(){
  30              
  31              $lex = new VTQL_Lexer($this->query);
  32              $parser = new VTQL_Parser($this->user, $lex,$this->out);
  33              while ($lex->yylex()) {
  34                  $parser->doParse($lex->token, $lex->value);
  35              }
  36              $parser->doParse(0, 0);
  37              
  38              if($parser->isSuccess()){
  39                  $this->hasError = false;
  40                  $this->query = $parser->getQuery();
  41                  $this->meta = $parser->getObjectMetaData();
  42              }else{
  43                  $this->hasError = true;
  44                  $this->error = $parser->getErrorMsg();
  45              }
  46              
  47              return $this->hasError;
  48              
  49          }
  50          
  51  		function getSql(){
  52              return $this->query;
  53          }
  54          
  55  		function getObjectMetaData(){
  56              return $this->meta;
  57          }
  58          
  59  		function getError(){
  60              return $this->error;
  61          }
  62          
  63      }
  64  ?>


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1