PageRenderTime 119ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/doctrine/orm/lib/Doctrine/ORM/Query/TreeWalker.php

https://bitbucket.org/iiic/iszp
PHP | 409 lines | 53 code | 49 blank | 307 comment | 0 complexity | c9fd2dda7a4fa2c0667fac319307bf5b MD5 | raw file
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\ORM\Query;
  20. /**
  21. * Interface for walkers of DQL ASTs (abstract syntax trees).
  22. *
  23. * @author Roman Borschel <roman@code-factory.org>
  24. * @since 2.0
  25. */
  26. interface TreeWalker
  27. {
  28. /**
  29. * Initializes TreeWalker with important information about the ASTs to be walked
  30. *
  31. * @param Query $query The parsed Query.
  32. * @param ParserResult $parserResult The result of the parsing process.
  33. * @param array $queryComponents Query components (symbol table)
  34. */
  35. public function __construct($query, $parserResult, array $queryComponents);
  36. /**
  37. * Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
  38. *
  39. * @return string The SQL.
  40. */
  41. function walkSelectStatement(AST\SelectStatement $AST);
  42. /**
  43. * Walks down a SelectClause AST node, thereby generating the appropriate SQL.
  44. *
  45. * @return string The SQL.
  46. */
  47. function walkSelectClause($selectClause);
  48. /**
  49. * Walks down a FromClause AST node, thereby generating the appropriate SQL.
  50. *
  51. * @return string The SQL.
  52. */
  53. function walkFromClause($fromClause);
  54. /**
  55. * Walks down a FunctionNode AST node, thereby generating the appropriate SQL.
  56. *
  57. * @return string The SQL.
  58. */
  59. function walkFunction($function);
  60. /**
  61. * Walks down an OrderByClause AST node, thereby generating the appropriate SQL.
  62. *
  63. * @param OrderByClause
  64. * @return string The SQL.
  65. */
  66. function walkOrderByClause($orderByClause);
  67. /**
  68. * Walks down an OrderByItem AST node, thereby generating the appropriate SQL.
  69. *
  70. * @param OrderByItem
  71. * @return string The SQL.
  72. */
  73. function walkOrderByItem($orderByItem);
  74. /**
  75. * Walks down a HavingClause AST node, thereby generating the appropriate SQL.
  76. *
  77. * @param HavingClause
  78. * @return string The SQL.
  79. */
  80. function walkHavingClause($havingClause);
  81. /**
  82. * Walks down a Join AST node and creates the corresponding SQL.
  83. *
  84. * @param Join $joinVarDecl
  85. * @return string The SQL.
  86. */
  87. function walkJoin($join);
  88. /**
  89. * Walks down a SelectExpression AST node and generates the corresponding SQL.
  90. *
  91. * @param SelectExpression $selectExpression
  92. * @return string The SQL.
  93. */
  94. function walkSelectExpression($selectExpression);
  95. /**
  96. * Walks down a QuantifiedExpression AST node, thereby generating the appropriate SQL.
  97. *
  98. * @param QuantifiedExpression
  99. * @return string The SQL.
  100. */
  101. function walkQuantifiedExpression($qExpr);
  102. /**
  103. * Walks down a Subselect AST node, thereby generating the appropriate SQL.
  104. *
  105. * @param Subselect
  106. * @return string The SQL.
  107. */
  108. function walkSubselect($subselect);
  109. /**
  110. * Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.
  111. *
  112. * @param SubselectFromClause
  113. * @return string The SQL.
  114. */
  115. function walkSubselectFromClause($subselectFromClause);
  116. /**
  117. * Walks down a SimpleSelectClause AST node, thereby generating the appropriate SQL.
  118. *
  119. * @param SimpleSelectClause
  120. * @return string The SQL.
  121. */
  122. function walkSimpleSelectClause($simpleSelectClause);
  123. /**
  124. * Walks down a SimpleSelectExpression AST node, thereby generating the appropriate SQL.
  125. *
  126. * @param SimpleSelectExpression
  127. * @return string The SQL.
  128. */
  129. function walkSimpleSelectExpression($simpleSelectExpression);
  130. /**
  131. * Walks down an AggregateExpression AST node, thereby generating the appropriate SQL.
  132. *
  133. * @param AggregateExpression
  134. * @return string The SQL.
  135. */
  136. function walkAggregateExpression($aggExpression);
  137. /**
  138. * Walks down a GroupByClause AST node, thereby generating the appropriate SQL.
  139. *
  140. * @param GroupByClause
  141. * @return string The SQL.
  142. */
  143. function walkGroupByClause($groupByClause);
  144. /**
  145. * Walks down a GroupByItem AST node, thereby generating the appropriate SQL.
  146. *
  147. * @param GroupByItem
  148. * @return string The SQL.
  149. */
  150. function walkGroupByItem($groupByItem);
  151. /**
  152. * Walks down an UpdateStatement AST node, thereby generating the appropriate SQL.
  153. *
  154. * @param UpdateStatement
  155. * @return string The SQL.
  156. */
  157. function walkUpdateStatement(AST\UpdateStatement $AST);
  158. /**
  159. * Walks down a DeleteStatement AST node, thereby generating the appropriate SQL.
  160. *
  161. * @param DeleteStatement
  162. * @return string The SQL.
  163. */
  164. function walkDeleteStatement(AST\DeleteStatement $AST);
  165. /**
  166. * Walks down a DeleteClause AST node, thereby generating the appropriate SQL.
  167. *
  168. * @param DeleteClause
  169. * @return string The SQL.
  170. */
  171. function walkDeleteClause(AST\DeleteClause $deleteClause);
  172. /**
  173. * Walks down an UpdateClause AST node, thereby generating the appropriate SQL.
  174. *
  175. * @param UpdateClause
  176. * @return string The SQL.
  177. */
  178. function walkUpdateClause($updateClause);
  179. /**
  180. * Walks down an UpdateItem AST node, thereby generating the appropriate SQL.
  181. *
  182. * @param UpdateItem
  183. * @return string The SQL.
  184. */
  185. function walkUpdateItem($updateItem);
  186. /**
  187. * Walks down a WhereClause AST node, thereby generating the appropriate SQL.
  188. *
  189. * @param WhereClause
  190. * @return string The SQL.
  191. */
  192. function walkWhereClause($whereClause);
  193. /**
  194. * Walks down a ConditionalExpression AST node, thereby generating the appropriate SQL.
  195. *
  196. * @param ConditionalExpression
  197. * @return string The SQL.
  198. */
  199. function walkConditionalExpression($condExpr);
  200. /**
  201. * Walks down a ConditionalTerm AST node, thereby generating the appropriate SQL.
  202. *
  203. * @param ConditionalTerm
  204. * @return string The SQL.
  205. */
  206. function walkConditionalTerm($condTerm);
  207. /**
  208. * Walks down a ConditionalFactor AST node, thereby generating the appropriate SQL.
  209. *
  210. * @param ConditionalFactor
  211. * @return string The SQL.
  212. */
  213. function walkConditionalFactor($factor);
  214. /**
  215. * Walks down a ConditionalPrimary AST node, thereby generating the appropriate SQL.
  216. *
  217. * @param ConditionalPrimary
  218. * @return string The SQL.
  219. */
  220. function walkConditionalPrimary($primary);
  221. /**
  222. * Walks down an ExistsExpression AST node, thereby generating the appropriate SQL.
  223. *
  224. * @param ExistsExpression
  225. * @return string The SQL.
  226. */
  227. function walkExistsExpression($existsExpr);
  228. /**
  229. * Walks down a CollectionMemberExpression AST node, thereby generating the appropriate SQL.
  230. *
  231. * @param CollectionMemberExpression
  232. * @return string The SQL.
  233. */
  234. function walkCollectionMemberExpression($collMemberExpr);
  235. /**
  236. * Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.
  237. *
  238. * @param EmptyCollectionComparisonExpression
  239. * @return string The SQL.
  240. */
  241. function walkEmptyCollectionComparisonExpression($emptyCollCompExpr);
  242. /**
  243. * Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.
  244. *
  245. * @param NullComparisonExpression
  246. * @return string The SQL.
  247. */
  248. function walkNullComparisonExpression($nullCompExpr);
  249. /**
  250. * Walks down an InExpression AST node, thereby generating the appropriate SQL.
  251. *
  252. * @param InExpression
  253. * @return string The SQL.
  254. */
  255. function walkInExpression($inExpr);
  256. /**
  257. * Walks down an InstanceOfExpression AST node, thereby generating the appropriate SQL.
  258. *
  259. * @param InstanceOfExpression
  260. * @return string The SQL.
  261. */
  262. function walkInstanceOfExpression($instanceOfExpr);
  263. /**
  264. * Walks down a literal that represents an AST node, thereby generating the appropriate SQL.
  265. *
  266. * @param mixed
  267. * @return string The SQL.
  268. */
  269. function walkLiteral($literal);
  270. /**
  271. * Walks down a BetweenExpression AST node, thereby generating the appropriate SQL.
  272. *
  273. * @param BetweenExpression
  274. * @return string The SQL.
  275. */
  276. function walkBetweenExpression($betweenExpr);
  277. /**
  278. * Walks down a LikeExpression AST node, thereby generating the appropriate SQL.
  279. *
  280. * @param LikeExpression
  281. * @return string The SQL.
  282. */
  283. function walkLikeExpression($likeExpr);
  284. /**
  285. * Walks down a StateFieldPathExpression AST node, thereby generating the appropriate SQL.
  286. *
  287. * @param StateFieldPathExpression
  288. * @return string The SQL.
  289. */
  290. function walkStateFieldPathExpression($stateFieldPathExpression);
  291. /**
  292. * Walks down a ComparisonExpression AST node, thereby generating the appropriate SQL.
  293. *
  294. * @param ComparisonExpression
  295. * @return string The SQL.
  296. */
  297. function walkComparisonExpression($compExpr);
  298. /**
  299. * Walks down an InputParameter AST node, thereby generating the appropriate SQL.
  300. *
  301. * @param InputParameter
  302. * @return string The SQL.
  303. */
  304. function walkInputParameter($inputParam);
  305. /**
  306. * Walks down an ArithmeticExpression AST node, thereby generating the appropriate SQL.
  307. *
  308. * @param ArithmeticExpression
  309. * @return string The SQL.
  310. */
  311. function walkArithmeticExpression($arithmeticExpr);
  312. /**
  313. * Walks down an ArithmeticTerm AST node, thereby generating the appropriate SQL.
  314. *
  315. * @param mixed
  316. * @return string The SQL.
  317. */
  318. function walkArithmeticTerm($term);
  319. /**
  320. * Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL.
  321. *
  322. * @param mixed
  323. * @return string The SQL.
  324. */
  325. function walkStringPrimary($stringPrimary);
  326. /**
  327. * Walks down an ArithmeticFactor that represents an AST node, thereby generating the appropriate SQL.
  328. *
  329. * @param mixed
  330. * @return string The SQL.
  331. */
  332. function walkArithmeticFactor($factor);
  333. /**
  334. * Walks down an SimpleArithmeticExpression AST node, thereby generating the appropriate SQL.
  335. *
  336. * @param SimpleArithmeticExpression
  337. * @return string The SQL.
  338. */
  339. function walkSimpleArithmeticExpression($simpleArithmeticExpr);
  340. /**
  341. * Walks down an PathExpression AST node, thereby generating the appropriate SQL.
  342. *
  343. * @param mixed
  344. * @return string The SQL.
  345. */
  346. function walkPathExpression($pathExpr);
  347. /**
  348. * Walks down an ResultVariable AST node, thereby generating the appropriate SQL.
  349. *
  350. * @param string $resultVariable
  351. * @return string The SQL.
  352. */
  353. function walkResultVariable($resultVariable);
  354. /**
  355. * Gets an executor that can be used to execute the result of this walker.
  356. *
  357. * @return AbstractExecutor
  358. */
  359. function getExecutor($AST);
  360. }