Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
DALDropParser.inc
1 <?php
13 require_once dirname(__FILE__).'/DALQueryParser.inc';
14 
23 {
24 
25 
34  private function __construct()
35  {
36 
37  }//end __construct()
38 
39 
48  public static function parse(DomElement $xmlQuery)
49  {
50  $query = array();
51  $dropTag = $xmlQuery->getElementsByTagName('drop')->item(0);
52  if ($dropTag !== NULL) {
53  if ($dropTag->getAttribute('table') !== '') {
54  $query['DROP']['TABLE'] = $dropTag->getAttribute('table');
55  } else if ($dropTag->getAttribute('sequence') !== '') {
56  $query['DROP']['SEQUENCE'] = $dropTag->getAttribute('sequence');
57  }
58  }
59 
60  return $query;
61 
62  }//end parse()
63 
64 
76  public static function validate(DomElement $query)
77  {
78  $dropTag = $query->getElementsByTagName('drop')->item(0);
79  if ($dropTag === NULL) {
80  throw new DALParserException('DROP tag not found.');
81  }
82 
83  if (($dropTag->getAttribute('table') === '') && ($dropTag->getAttribute('sequence') === '')) {
84  throw new DALParserException('No DROP query type specified.');
85  }
86 
87  }//end validate()
88 
89 
90 }//end class
91 
92 ?>