@@ -136,6 +136,39 @@ public function buildDeleteQuery()
136136 }
137137
138138
139+ /**
140+ * Returns select query hash for caching.
141+ * @return string
142+ */
143+ public function getSelectQueryHash ($ columns = NULL )
144+ {
145+ $ parts = [
146+ 'delimitedTable ' => $ this ->delimitedTable ,
147+ 'queryCondition ' => $ this ->buildConditions (),
148+ 'queryEnd ' => $ this ->buildQueryEnd (),
149+ $ this ->aliases ,
150+ $ this ->limit , $ this ->offset ,
151+ ];
152+ if ($ this ->select ) {
153+ $ parts [] = $ this ->select ;
154+ } elseif ($ columns ) {
155+ $ parts [] = [$ this ->delimitedTable , $ columns ];
156+ } elseif ($ this ->group && !$ this ->driver ->isSupported (ISupplementalDriver::SUPPORT_SELECT_UNGROUPED_COLUMNS )) {
157+ $ parts [] = [$ this ->group ];
158+ } else {
159+ $ parts [] = "{$ this ->delimitedTable }.* " ;
160+ }
161+ return $ this ->getConditionHash (json_encode ($ parts ), array_merge (
162+ $ this ->parameters ['select ' ],
163+ $ this ->parameters ['joinCondition ' ] ? call_user_func_array ('array_merge ' , $ this ->parameters ['joinCondition ' ]) : [],
164+ $ this ->parameters ['where ' ],
165+ $ this ->parameters ['group ' ],
166+ $ this ->parameters ['having ' ],
167+ $ this ->parameters ['order ' ]
168+ ));
169+ }
170+
171+
139172 /**
140173 * Returns SQL query.
141174 * @param string list of columns
0 commit comments