@@ 78-126 (lines=49) @@ | ||
75 | $this->used_tables[$table]=$table; |
|
76 | $result=" $table.$field "; |
|
77 | break; |
|
78 | case 'custom': |
|
79 | $table = $this->tbl_prefix."prop_custom"; |
|
80 | $field = $node["field"]; |
|
81 | $nls = $node["nls"]; |
|
82 | $record_id = $node["record_id"]; |
|
83 | /* |
|
84 | when we are compiling orderby properties we always want |
|
85 | to assign it to a new table alias |
|
86 | */ |
|
87 | if ($this->in_orderby) { |
|
88 | $this->custom_id++; |
|
89 | } |
|
90 | $this->custom_ref++; |
|
91 | if (!$record_id) { |
|
92 | $this->used_tables[$table." as $table".$this->custom_id] = $table.$this->custom_id; |
|
93 | $this->select_tables[$table." as $table".$this->custom_id] = 1; |
|
94 | ||
95 | $this->used_custom_fields[$field] = true; |
|
96 | $result = " $table".$this->custom_id.".AR_name = '$field' "; |
|
97 | if ($nls) { |
|
98 | $result = " $result and $table".$this->custom_id.".AR_nls = '$nls' "; |
|
99 | } |
|
100 | ||
101 | if (!$this->in_orderby) { |
|
102 | $result = " $result and $table".$this->custom_id.".AR_value "; |
|
103 | } else { |
|
104 | $this->where_s_ext = $result; |
|
105 | $result = " $table".$this->custom_id.".AR_value "; |
|
106 | } |
|
107 | } else { |
|
108 | $this->used_tables["$table as $table$record_id"] = $table.$record_id; |
|
109 | //$this->select_tables[$table." as $table$record_id"] = 1; |
|
110 | ||
111 | $result = " $table$record_id.AR_name = '$field' "; |
|
112 | if (!$this->in_orderby && !$no_context_join) { |
|
113 | if ($this->join_target_properties["prop_my"][":$record_id"]) { |
|
114 | $result=" $result and $table$record_id.object = target.object and $table$record_id.AR_value "; |
|
115 | } else { |
|
116 | $result=" $table$record_id.object = ".$this->tbl_prefix."objects.id and $table$record_id.AR_value "; |
|
117 | } |
|
118 | } else { |
|
119 | if ($this->join_target_properties[$node["table"]]) { |
|
120 | $this->join_target_properties["$table as $table$record_id"] = $table.$record_id; |
|
121 | } |
|
122 | $this->select_tables["$table as $table$record_id"] = $table.$record_id; |
|
123 | $result=" $table$record_id.AR_value "; |
|
124 | } |
|
125 | } |
|
126 | break; |
|
127 | case 'string': |
|
128 | $result = "'".addSlashes($node["value"])."'"; |
|
129 | if ($escape_chars) { |
@@ 87-135 (lines=49) @@ | ||
84 | $this->used_tables[$table]=$table; |
|
85 | $result=" $table.$field "; |
|
86 | break; |
|
87 | case 'custom': |
|
88 | $table = $this->tbl_prefix."prop_custom"; |
|
89 | $field = $node["field"]; |
|
90 | $nls = $node["nls"]; |
|
91 | $record_id = $node["record_id"]; |
|
92 | /* |
|
93 | when we are compiling orderby properties we always want |
|
94 | to assign it to a new table alias |
|
95 | */ |
|
96 | if ($this->in_orderby) { |
|
97 | $this->custom_id++; |
|
98 | } |
|
99 | $this->custom_ref++; |
|
100 | if (!$record_id) { |
|
101 | $this->used_tables[$table." as $table".$this->custom_id] = $table.$this->custom_id; |
|
102 | $this->select_tables[$table." as $table".$this->custom_id] = 1; |
|
103 | ||
104 | $this->used_custom_fields[$field] = true; |
|
105 | $result = " $table".$this->custom_id.".AR_name = '$field' "; |
|
106 | if ($nls) { |
|
107 | $result = " $result and $table".$this->custom_id.".AR_nls = '$nls' "; |
|
108 | } |
|
109 | ||
110 | if (!$this->in_orderby) { |
|
111 | $result = " $result and $table".$this->custom_id.".AR_value "; |
|
112 | } else { |
|
113 | $this->where_s_ext = $result; |
|
114 | $result = " $table".$this->custom_id.".AR_value "; |
|
115 | } |
|
116 | } else { |
|
117 | $this->used_tables["$table as $table$record_id"] = $table.$record_id; |
|
118 | // $this->select_tables[$table." as $table$record_id"] = 1; |
|
119 | ||
120 | $result = " $table$record_id.AR_name = '$field' "; |
|
121 | if (!$this->in_orderby ) { |
|
122 | if ($this->join_target_properties["prop_my"][":$record_id"]) { |
|
123 | $result=" $result and $table$record_id.object = target.object and $table$record_id.AR_value "; |
|
124 | } else { |
|
125 | $result=" $table$record_id.object = ".$this->tbl_prefix."objects.id and $table$record_id.AR_value "; |
|
126 | } |
|
127 | } else { |
|
128 | if ($this->join_target_properties[$node["table"]]) { |
|
129 | $this->join_target_properties["$table as $table$record_id"] = $table.$record_id; |
|
130 | } |
|
131 | $this->select_tables["$table as $table$record_id"] = $table.$record_id; |
|
132 | $result=" $table$record_id.AR_value "; |
|
133 | } |
|
134 | } |
|
135 | break; |
|
136 | case 'string': |
|
137 | $result=" '".pg_escape_string($node["value"])."' "; |
|
138 | break; |