1: <?php
2: 3: 4: 5: 6: 7: 8:
9: class QQueryExpansion extends QBaseClass {
10: protected $strSelectArray;
11: protected $strFromArray;
12: protected $strWhereArray;
13:
14: public function __construct($strClassName = null, $strParentAlias = null, $objExpansionMap = null) {
15: $this->strSelectArray = array();
16: $this->strFromArray = array();
17: $this->strWhereArray = array();
18:
19: if ($strClassName) {
20: try {
21: call_user_func(array($strClassName, 'ExpandQuery'), $strParentAlias, null, $objExpansionMap, $this);
22: } catch (QCallerException $objExc) {
23: $objExc->IncrementOffset();
24: $objExc->IncrementOffset();
25: $objExc->IncrementOffset();
26: throw $objExc;
27: }
28: }
29: }
30:
31: public function AddSelectItem($strItem) {
32: array_push($this->strSelectArray, $strItem);
33: }
34:
35: public function AddFromItem($strItem) {
36: array_push($this->strFromArray, $strItem);
37: }
38:
39: public function AddWhereItem($strItem) {
40: array_push($this->strWhereArray, $strItem);
41: }
42:
43: public function GetSelectSql($strPrefix = ",\n ", $strGlue = ",\n ") {
44: if (count($this->strSelectArray) > 0) {
45: return $strPrefix . implode($strGlue, $this->strSelectArray);
46: } else {
47: return '';
48: }
49: }
50:
51: public function GetFromSql($strPrefix = '', $strGlue = "\n ") {
52: if (count($this->strFromArray) > 0) {
53: return $strPrefix . implode($strGlue, $this->strFromArray);
54: } else {
55: return '';
56: }
57: }
58:
59: public function GetWhereSql($strPrefix, $strGlue) {
60: if (count($this->strWhereArray) > 0) {
61: return $strPrefix . implode($strGlue, $this->strWhereArray);
62: } else {
63: return '';
64: }
65: }
66: }