1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/tests_old/coverage/Doctrine_Query.html

5763 lines
282 KiB
HTML
Raw Normal View History

<html>
<head>
<title>Coverage for Doctrine_Query</title>
<style type="text/css">
.covered{ background: green;}
.normal{ background: white;}
.red{ background: red;}
.orange{ background: #f90;}
</style>
</head>
<body><h1>Coverage for Doctrine_Query</h1><p><a href="index.php">Back to coverage report</a></p><table>
<tr><td>1</td>
<td class="normal">&lt;?php
</td></tr>
<tr><td>2</td>
<td class="normal">/*
</td></tr>
<tr><td>3</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;$Id:&nbsp;Query.php&nbsp;3221&nbsp;2007-11-25&nbsp;15:57:08Z&nbsp;romanb&nbsp;$
</td></tr>
<tr><td>4</td>
<td class="normal">&nbsp;*
</td></tr>
<tr><td>5</td>
<td class="normal">&nbsp;*&nbsp;THIS&nbsp;SOFTWARE&nbsp;IS&nbsp;PROVIDED&nbsp;BY&nbsp;THE&nbsp;COPYRIGHT&nbsp;HOLDERS&nbsp;AND&nbsp;CONTRIBUTORS
</td></tr>
<tr><td>6</td>
<td class="normal">&nbsp;*&nbsp;&quot;AS&nbsp;IS&quot;&nbsp;AND&nbsp;ANY&nbsp;EXPRESS&nbsp;OR&nbsp;IMPLIED&nbsp;WARRANTIES,&nbsp;INCLUDING,&nbsp;BUT&nbsp;NOT
</td></tr>
<tr><td>7</td>
<td class="normal">&nbsp;*&nbsp;LIMITED&nbsp;TO,&nbsp;THE&nbsp;IMPLIED&nbsp;WARRANTIES&nbsp;OF&nbsp;MERCHANTABILITY&nbsp;AND&nbsp;FITNESS&nbsp;FOR
</td></tr>
<tr><td>8</td>
<td class="normal">&nbsp;*&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE&nbsp;ARE&nbsp;DISCLAIMED.&nbsp;IN&nbsp;NO&nbsp;EVENT&nbsp;SHALL&nbsp;THE&nbsp;COPYRIGHT
</td></tr>
<tr><td>9</td>
<td class="normal">&nbsp;*&nbsp;OWNER&nbsp;OR&nbsp;CONTRIBUTORS&nbsp;BE&nbsp;LIABLE&nbsp;FOR&nbsp;ANY&nbsp;DIRECT,&nbsp;INDIRECT,&nbsp;INCIDENTAL,
</td></tr>
<tr><td>10</td>
<td class="normal">&nbsp;*&nbsp;SPECIAL,&nbsp;EXEMPLARY,&nbsp;OR&nbsp;CONSEQUENTIAL&nbsp;DAMAGES&nbsp;(INCLUDING,&nbsp;BUT&nbsp;NOT
</td></tr>
<tr><td>11</td>
<td class="normal">&nbsp;*&nbsp;LIMITED&nbsp;TO,&nbsp;PROCUREMENT&nbsp;OF&nbsp;SUBSTITUTE&nbsp;GOODS&nbsp;OR&nbsp;SERVICES;&nbsp;LOSS&nbsp;OF&nbsp;USE,
</td></tr>
<tr><td>12</td>
<td class="normal">&nbsp;*&nbsp;DATA,&nbsp;OR&nbsp;PROFITS;&nbsp;OR&nbsp;BUSINESS&nbsp;INTERRUPTION)&nbsp;HOWEVER&nbsp;CAUSED&nbsp;AND&nbsp;ON&nbsp;ANY
</td></tr>
<tr><td>13</td>
<td class="normal">&nbsp;*&nbsp;THEORY&nbsp;OF&nbsp;LIABILITY,&nbsp;WHETHER&nbsp;IN&nbsp;CONTRACT,&nbsp;STRICT&nbsp;LIABILITY,&nbsp;OR&nbsp;TORT
</td></tr>
<tr><td>14</td>
<td class="normal">&nbsp;*&nbsp;(INCLUDING&nbsp;NEGLIGENCE&nbsp;OR&nbsp;OTHERWISE)&nbsp;ARISING&nbsp;IN&nbsp;ANY&nbsp;WAY&nbsp;OUT&nbsp;OF&nbsp;THE&nbsp;USE
</td></tr>
<tr><td>15</td>
<td class="normal">&nbsp;*&nbsp;OF&nbsp;THIS&nbsp;SOFTWARE,&nbsp;EVEN&nbsp;IF&nbsp;ADVISED&nbsp;OF&nbsp;THE&nbsp;POSSIBILITY&nbsp;OF&nbsp;SUCH&nbsp;DAMAGE.
</td></tr>
<tr><td>16</td>
<td class="normal">&nbsp;*
</td></tr>
<tr><td>17</td>
<td class="normal">&nbsp;*&nbsp;This&nbsp;software&nbsp;consists&nbsp;of&nbsp;voluntary&nbsp;contributions&nbsp;made&nbsp;by&nbsp;many&nbsp;individuals
</td></tr>
<tr><td>18</td>
<td class="normal">&nbsp;*&nbsp;and&nbsp;is&nbsp;licensed&nbsp;under&nbsp;the&nbsp;LGPL.&nbsp;For&nbsp;more&nbsp;information,&nbsp;see
</td></tr>
<tr><td>19</td>
<td class="normal">&nbsp;*&nbsp;&lt;http://www.phpdoctrine.org&gt;.
</td></tr>
<tr><td>20</td>
<td class="normal">&nbsp;*/
</td></tr>
<tr><td>21</td>
<td class="normal">Doctrine::autoload('Doctrine_Query_Abstract');
</td></tr>
<tr><td>22</td>
<td class="normal">/**
</td></tr>
<tr><td>23</td>
<td class="normal">&nbsp;*&nbsp;Doctrine_Query
</td></tr>
<tr><td>24</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;A&nbsp;Doctrine_Query&nbsp;object&nbsp;represents&nbsp;a&nbsp;DQL&nbsp;query.&nbsp;It&nbsp;is&nbsp;used&nbsp;to&nbsp;query&nbsp;databases&nbsp;for
</td></tr>
<tr><td>25</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;data&nbsp;in&nbsp;an&nbsp;object-oriented&nbsp;fashion.&nbsp;A&nbsp;DQL&nbsp;query&nbsp;understands&nbsp;relations&nbsp;and&nbsp;inheritance
</td></tr>
<tr><td>26</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;and&nbsp;is&nbsp;dbms&nbsp;independant.
</td></tr>
<tr><td>27</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*
</td></tr>
<tr><td>28</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;@package&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Doctrine
</td></tr>
<tr><td>29</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;@subpackage&nbsp;&nbsp;Query
</td></tr>
<tr><td>30</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;@license&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://www.opensource.org/licenses/lgpl-license.php&nbsp;LGPL
</td></tr>
<tr><td>31</td>
<td class="normal">&nbsp;*&nbsp;@link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;www.phpdoctrine.org
</td></tr>
<tr><td>32</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;@since&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.0
</td></tr>
<tr><td>33</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;@version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Revision:&nbsp;3221&nbsp;$
</td></tr>
<tr><td>34</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;@author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Konsta&nbsp;Vesterinen&nbsp;&lt;kvesteri@cc.hut.fi&gt;
</td></tr>
<tr><td>35</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;@todo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Proposal:&nbsp;This&nbsp;class&nbsp;does&nbsp;far&nbsp;too&nbsp;much.&nbsp;It&nbsp;should&nbsp;have&nbsp;only&nbsp;1&nbsp;task:&nbsp;Collecting
</td></tr>
<tr><td>36</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;DQL&nbsp;query&nbsp;parts&nbsp;and&nbsp;the&nbsp;query&nbsp;parameters&nbsp;(the&nbsp;query&nbsp;state&nbsp;and&nbsp;caching&nbsp;options/methods
</td></tr>
<tr><td>37</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;can&nbsp;remain&nbsp;here,&nbsp;too).
</td></tr>
<tr><td>38</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;actual&nbsp;SQL&nbsp;construction&nbsp;could&nbsp;be&nbsp;done&nbsp;by&nbsp;a&nbsp;separate&nbsp;object&nbsp;(Doctrine_Query_SqlBuilder?)
</td></tr>
<tr><td>39</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;whose&nbsp;task&nbsp;it&nbsp;is&nbsp;to&nbsp;convert&nbsp;DQL&nbsp;into&nbsp;SQL.
</td></tr>
<tr><td>40</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Furthermore&nbsp;the&nbsp;SqlBuilder?&nbsp;can&nbsp;then&nbsp;use&nbsp;other&nbsp;objects&nbsp;(Doctrine_Query_Tokenizer?),
</td></tr>
<tr><td>41</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Doctrine_Query_Parser(s)?)&nbsp;to&nbsp;accomplish&nbsp;his&nbsp;work.&nbsp;Doctrine_Query&nbsp;does&nbsp;not&nbsp;need
</td></tr>
<tr><td>42</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;know&nbsp;the&nbsp;tokenizer/parsers.&nbsp;There&nbsp;could&nbsp;be&nbsp;extending
</td></tr>
<tr><td>43</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;implementations&nbsp;of&nbsp;SqlBuilder?&nbsp;that&nbsp;cover&nbsp;the&nbsp;specific&nbsp;SQL&nbsp;dialects.
</td></tr>
<tr><td>44</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;would&nbsp;release&nbsp;Doctrine_Connection&nbsp;and&nbsp;the&nbsp;Doctrine_Connection_xxx&nbsp;classes
</td></tr>
<tr><td>45</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;this&nbsp;tedious&nbsp;task.
</td></tr>
<tr><td>46</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;would&nbsp;also&nbsp;largely&nbsp;reduce&nbsp;the&nbsp;currently&nbsp;huge&nbsp;interface&nbsp;of&nbsp;Doctrine_Query(_Abstract)
</td></tr>
<tr><td>47</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;better&nbsp;hide&nbsp;all&nbsp;these&nbsp;transformation&nbsp;internals&nbsp;from&nbsp;the&nbsp;public&nbsp;Query&nbsp;API.
</td></tr>
<tr><td>48</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*
</td></tr>
<tr><td>49</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;@internal&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;lifecycle&nbsp;of&nbsp;a&nbsp;Query&nbsp;object&nbsp;is&nbsp;the&nbsp;following:
</td></tr>
<tr><td>50</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;After&nbsp;construction&nbsp;the&nbsp;query&nbsp;object&nbsp;is&nbsp;empty.&nbsp;Through&nbsp;using&nbsp;the&nbsp;fluent
</td></tr>
<tr><td>51</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;interface&nbsp;the&nbsp;user&nbsp;fills&nbsp;the&nbsp;query&nbsp;object&nbsp;with&nbsp;DQL&nbsp;parts&nbsp;and&nbsp;query&nbsp;parameters.
</td></tr>
<tr><td>52</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;These&nbsp;get&nbsp;collected&nbsp;in&nbsp;{@link&nbsp;$_dqlParts}&nbsp;and&nbsp;{@link&nbsp;$_params},&nbsp;respectively.
</td></tr>
<tr><td>53</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When&nbsp;the&nbsp;query&nbsp;is&nbsp;executed&nbsp;the&nbsp;first&nbsp;time,&nbsp;or&nbsp;when&nbsp;{@link&nbsp;getSqlQuery()}
</td></tr>
<tr><td>54</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;called&nbsp;the&nbsp;first&nbsp;time,&nbsp;the&nbsp;collected&nbsp;DQL&nbsp;parts&nbsp;get&nbsp;parsed&nbsp;and&nbsp;the&nbsp;resulting
</td></tr>
<tr><td>55</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection-driver&nbsp;specific&nbsp;SQL&nbsp;is&nbsp;generated.&nbsp;The&nbsp;generated&nbsp;SQL&nbsp;parts&nbsp;are
</td></tr>
<tr><td>56</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stored&nbsp;in&nbsp;{@link&nbsp;$_sqlParts}&nbsp;and&nbsp;the&nbsp;final&nbsp;resulting&nbsp;SQL&nbsp;query&nbsp;is&nbsp;stored&nbsp;in
</td></tr>
<tr><td>57</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{@link&nbsp;$_sql}.
</td></tr>
<tr><td>58</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;*/
</td></tr>
<tr><td>59</td>
2007-11-25 23:32:49 +03:00
<td class="normal">class&nbsp;Doctrine_Query&nbsp;extends&nbsp;Doctrine_Query_Abstract&nbsp;implements&nbsp;Countable,&nbsp;Serializable
</td></tr>
<tr><td>60</td>
2007-11-25 23:32:49 +03:00
<td class="normal">{
</td></tr>
<tr><td>61</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>62</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array&nbsp;&nbsp;The&nbsp;DQL&nbsp;keywords.
</td></tr>
<tr><td>63</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>64</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;static&nbsp;$_keywords&nbsp;&nbsp;=&nbsp;array('ALL',&nbsp;
</td></tr>
<tr><td>65</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AND',&nbsp;
</td></tr>
<tr><td>66</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'ANY',&nbsp;
</td></tr>
<tr><td>67</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AS',&nbsp;
</td></tr>
<tr><td>68</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'ASC',&nbsp;
</td></tr>
<tr><td>69</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AVG',&nbsp;
</td></tr>
<tr><td>70</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'BETWEEN',&nbsp;
</td></tr>
<tr><td>71</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'BIT_LENGTH',&nbsp;
</td></tr>
<tr><td>72</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'BY',&nbsp;
</td></tr>
<tr><td>73</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'CHARACTER_LENGTH',&nbsp;
</td></tr>
<tr><td>74</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'CHAR_LENGTH',&nbsp;
</td></tr>
<tr><td>75</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'CURRENT_DATE',
</td></tr>
<tr><td>76</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'CURRENT_TIME',&nbsp;
</td></tr>
<tr><td>77</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'CURRENT_TIMESTAMP',&nbsp;
</td></tr>
<tr><td>78</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'DELETE',&nbsp;
</td></tr>
<tr><td>79</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'DESC',&nbsp;
</td></tr>
<tr><td>80</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'DISTINCT',&nbsp;
</td></tr>
<tr><td>81</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'EMPTY',&nbsp;
</td></tr>
<tr><td>82</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'EXISTS',&nbsp;
</td></tr>
<tr><td>83</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'FALSE',&nbsp;
</td></tr>
<tr><td>84</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'FETCH',&nbsp;
</td></tr>
<tr><td>85</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'FROM',&nbsp;
</td></tr>
<tr><td>86</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'GROUP',&nbsp;
</td></tr>
<tr><td>87</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'HAVING',&nbsp;
</td></tr>
<tr><td>88</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'IN',&nbsp;
</td></tr>
<tr><td>89</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'INDEXBY',&nbsp;
</td></tr>
<tr><td>90</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'INNER',&nbsp;
</td></tr>
<tr><td>91</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'IS',&nbsp;
</td></tr>
<tr><td>92</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'JOIN',
</td></tr>
<tr><td>93</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'LEFT',&nbsp;
</td></tr>
<tr><td>94</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'LIKE',&nbsp;
</td></tr>
<tr><td>95</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'LOWER',
</td></tr>
<tr><td>96</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'MEMBER',
</td></tr>
<tr><td>97</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'MOD',
</td></tr>
<tr><td>98</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'NEW',&nbsp;
</td></tr>
<tr><td>99</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'NOT',&nbsp;
</td></tr>
<tr><td>100</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'NULL',&nbsp;
</td></tr>
<tr><td>101</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'OBJECT',&nbsp;
</td></tr>
<tr><td>102</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'OF',&nbsp;
</td></tr>
<tr><td>103</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'OR',&nbsp;
</td></tr>
<tr><td>104</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'ORDER',&nbsp;
</td></tr>
<tr><td>105</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'OUTER',&nbsp;
</td></tr>
<tr><td>106</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'POSITION',&nbsp;
</td></tr>
<tr><td>107</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'SELECT',&nbsp;
</td></tr>
<tr><td>108</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'SOME',
</td></tr>
<tr><td>109</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'TRIM',&nbsp;
</td></tr>
<tr><td>110</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'TRUE',&nbsp;
</td></tr>
<tr><td>111</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'UNKNOWN',&nbsp;
</td></tr>
<tr><td>112</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'UPDATE',&nbsp;
</td></tr>
<tr><td>113</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'WHERE');
</td></tr>
<tr><td>114</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>115</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>116</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array
</td></tr>
<tr><td>117</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>118</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_subqueryAliases&nbsp;=&nbsp;array();
</td></tr>
<tr><td>119</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>120</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>121</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array&nbsp;$_aggregateAliasMap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;containing&nbsp;all&nbsp;aggregate&nbsp;aliases,&nbsp;keys&nbsp;as&nbsp;dql&nbsp;aliases
</td></tr>
<tr><td>122</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;values&nbsp;as&nbsp;sql&nbsp;aliases
</td></tr>
<tr><td>123</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>124</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_aggregateAliasMap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;array();
</td></tr>
<tr><td>125</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>126</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>127</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array
</td></tr>
<tr><td>128</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>129</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_pendingAggregates&nbsp;=&nbsp;array();
</td></tr>
<tr><td>130</td>
<td class="normal">
</td></tr>
<tr><td>131</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>132</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;boolean&nbsp;$needsSubquery
</td></tr>
<tr><td>133</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>134</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_needsSubquery&nbsp;=&nbsp;false;
</td></tr>
<tr><td>135</td>
<td class="normal">
</td></tr>
<tr><td>136</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>137</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;boolean&nbsp;$isSubquery&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;whether&nbsp;or&nbsp;not&nbsp;this&nbsp;query&nbsp;object&nbsp;is&nbsp;a&nbsp;subquery&nbsp;of&nbsp;another&nbsp;
</td></tr>
<tr><td>138</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;object
</td></tr>
<tr><td>139</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>140</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_isSubquery;
</td></tr>
<tr><td>141</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>142</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>143</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array&nbsp;$_neededTables&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;needed&nbsp;table&nbsp;aliases
</td></tr>
<tr><td>144</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>145</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_neededTables&nbsp;=&nbsp;array();
</td></tr>
<tr><td>146</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>147</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>148</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array&nbsp;$pendingSubqueries&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT&nbsp;part&nbsp;subqueries,&nbsp;these&nbsp;are&nbsp;called&nbsp;pending&nbsp;subqueries&nbsp;since
</td></tr>
<tr><td>149</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;they&nbsp;cannot&nbsp;be&nbsp;parsed&nbsp;directly&nbsp;(some&nbsp;queries&nbsp;might&nbsp;be&nbsp;correlated)
</td></tr>
<tr><td>150</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>151</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_pendingSubqueries&nbsp;=&nbsp;array();
</td></tr>
<tr><td>152</td>
<td class="normal">
</td></tr>
<tr><td>153</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>154</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array&nbsp;$_pendingFields&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;of&nbsp;pending&nbsp;fields&nbsp;(fields&nbsp;waiting&nbsp;to&nbsp;be&nbsp;parsed)
</td></tr>
<tr><td>155</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>156</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_pendingFields&nbsp;=&nbsp;array();
</td></tr>
<tr><td>157</td>
<td class="normal">
</td></tr>
<tr><td>158</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>159</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array&nbsp;$_parsers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;of&nbsp;parser&nbsp;objects,&nbsp;each&nbsp;DQL&nbsp;query&nbsp;part&nbsp;has&nbsp;its&nbsp;own&nbsp;parser
</td></tr>
<tr><td>160</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>161</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_parsers&nbsp;=&nbsp;array();
</td></tr>
<tr><td>162</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>163</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>164</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array&nbsp;$_pendingJoinConditions&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;containing&nbsp;pending&nbsp;joins
</td></tr>
<tr><td>165</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>166</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_pendingJoinConditions&nbsp;=&nbsp;array();
</td></tr>
<tr><td>167</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>168</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>169</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;array
</td></tr>
<tr><td>170</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>171</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_expressionMap&nbsp;=&nbsp;array();
</td></tr>
<tr><td>172</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>173</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>174</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@var&nbsp;string&nbsp;$_sql&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cached&nbsp;SQL&nbsp;query
</td></tr>
<tr><td>175</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>176</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;$_sql;
</td></tr>
<tr><td>177</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>178</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>179</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>180</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;create
</td></tr>
<tr><td>181</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;returns&nbsp;a&nbsp;new&nbsp;Doctrine_Query&nbsp;object
</td></tr>
<tr><td>182</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>183</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;Doctrine_Connection&nbsp;$conn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;optional&nbsp;connection&nbsp;parameter
</td></tr>
<tr><td>184</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Query
</td></tr>
<tr><td>185</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>186</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;static&nbsp;function&nbsp;create($conn&nbsp;=&nbsp;null)
</td></tr>
<tr><td>187</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>188</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;Doctrine_Query($conn);
</td></tr>
<tr><td>189</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>190</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>191</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>192</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Resets&nbsp;the&nbsp;query&nbsp;to&nbsp;the&nbsp;state&nbsp;just&nbsp;after&nbsp;it&nbsp;has&nbsp;been&nbsp;instantiated.
</td></tr>
<tr><td>193</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>194</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;reset()
</td></tr>
<tr><td>195</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>196</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingJoinConditions&nbsp;=&nbsp;array();
</td></tr>
<tr><td>197</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingSubqueries&nbsp;=&nbsp;array();
</td></tr>
<tr><td>198</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingFields&nbsp;=&nbsp;array();
</td></tr>
<tr><td>199</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_neededTables&nbsp;=&nbsp;array();
</td></tr>
<tr><td>200</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_expressionMap&nbsp;=&nbsp;array();
</td></tr>
<tr><td>201</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_subqueryAliases&nbsp;=&nbsp;array();
</td></tr>
<tr><td>202</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_needsSubquery&nbsp;=&nbsp;false;
</td></tr>
<tr><td>203</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_isLimitSubqueryUsed&nbsp;=&nbsp;false;
</td></tr>
<tr><td>204</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>205</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>206</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>207</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;createSubquery
</td></tr>
<tr><td>208</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;creates&nbsp;a&nbsp;subquery
</td></tr>
<tr><td>209</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>210</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Hydrate
</td></tr>
<tr><td>211</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>212</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;createSubquery()
</td></tr>
<tr><td>213</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>214</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$class&nbsp;=&nbsp;get_class($this);
</td></tr>
<tr><td>215</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$obj&nbsp;&nbsp;&nbsp;=&nbsp;new&nbsp;$class();
</td></tr>
<tr><td>216</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>217</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;copy&nbsp;the&nbsp;aliases&nbsp;to&nbsp;the&nbsp;subquery
</td></tr>
<tr><td>218</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$obj-&gt;copyAliases($this);
</td></tr>
<tr><td>219</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>220</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;this&nbsp;prevents&nbsp;the&nbsp;'id'&nbsp;being&nbsp;selected,&nbsp;re&nbsp;ticket&nbsp;#307
</td></tr>
<tr><td>221</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$obj-&gt;isSubquery(true);
</td></tr>
<tr><td>222</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>223</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$obj;
</td></tr>
<tr><td>224</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>225</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>226</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>227</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;_addPendingJoinCondition
</td></tr>
<tr><td>228</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>229</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$componentAlias&nbsp;&nbsp;&nbsp;&nbsp;component&nbsp;alias
</td></tr>
<tr><td>230</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$joinCondition&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dql&nbsp;join&nbsp;condition
</td></tr>
<tr><td>231</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Query&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this&nbsp;object
</td></tr>
<tr><td>232</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>233</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;function&nbsp;_addPendingJoinCondition($componentAlias,&nbsp;$joinCondition)
</td></tr>
<tr><td>234</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>235</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingJoins[$componentAlias]&nbsp;=&nbsp;$joinCondition;
</td></tr>
<tr><td>236</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>237</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>238</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>239</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;addEnumParam
</td></tr>
<tr><td>240</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;sets&nbsp;input&nbsp;parameter&nbsp;as&nbsp;an&nbsp;enumerated&nbsp;parameter
</td></tr>
<tr><td>241</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>242</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$key&nbsp;&nbsp;&nbsp;the&nbsp;key&nbsp;of&nbsp;the&nbsp;input&nbsp;parameter
</td></tr>
<tr><td>243</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Query
</td></tr>
<tr><td>244</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>245</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;addEnumParam($key,&nbsp;$table&nbsp;=&nbsp;null,&nbsp;$column&nbsp;=&nbsp;null)
</td></tr>
<tr><td>246</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>247</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$array&nbsp;=&nbsp;(isset($table)&nbsp;||&nbsp;isset($column))&nbsp;?&nbsp;array($table,&nbsp;$column)&nbsp;:&nbsp;array();
</td></tr>
<tr><td>248</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>249</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($key&nbsp;===&nbsp;'?')&nbsp;{
</td></tr>
<tr><td>250</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_enumParams[]&nbsp;=&nbsp;$array;
</td></tr>
<tr><td>251</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>252</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_enumParams[$key]&nbsp;=&nbsp;$array;
</td></tr>
<tr><td>253</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>254</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>255</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>256</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>257</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;getEnumParams
</td></tr>
<tr><td>258</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;get&nbsp;all&nbsp;enumerated&nbsp;parameters
</td></tr>
<tr><td>259</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>260</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;array&nbsp;&nbsp;&nbsp;&nbsp;all&nbsp;enumerated&nbsp;parameters
</td></tr>
<tr><td>261</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>262</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getEnumParams()
</td></tr>
<tr><td>263</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>264</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;_enumParams;
</td></tr>
<tr><td>265</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>266</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>267</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>268</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;getDql
</td></tr>
<tr><td>269</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;returns&nbsp;the&nbsp;DQL&nbsp;query&nbsp;that&nbsp;is&nbsp;represented&nbsp;by&nbsp;this&nbsp;query&nbsp;object.
</td></tr>
<tr><td>270</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>271</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;the&nbsp;query&nbsp;is&nbsp;built&nbsp;from&nbsp;$_dqlParts
</td></tr>
<tr><td>272</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>273</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string&nbsp;&nbsp;&nbsp;the&nbsp;DQL&nbsp;query
</td></tr>
<tr><td>274</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>275</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getDql()
</td></tr>
<tr><td>276</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>277</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;=&nbsp;'';
</td></tr>
<tr><td>278</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_dqlParts['select']))?&nbsp;&nbsp;'SELECT&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_dqlParts['select'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>279</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_dqlParts['from']))?&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;FROM&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;',&nbsp;$this-&gt;_dqlParts['from'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>280</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_dqlParts['where']))?&nbsp;&nbsp;&nbsp;'&nbsp;WHERE&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;AND&nbsp;',&nbsp;$this-&gt;_dqlParts['where'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>281</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_dqlParts['groupby']))?&nbsp;'&nbsp;GROUP&nbsp;BY&nbsp;'&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_dqlParts['groupby'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>282</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_dqlParts['having']))?&nbsp;&nbsp;'&nbsp;HAVING&nbsp;'&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;AND&nbsp;',&nbsp;$this-&gt;_dqlParts['having'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>283</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_dqlParts['orderby']))?&nbsp;'&nbsp;ORDER&nbsp;BY&nbsp;'&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_dqlParts['orderby'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>284</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_dqlParts['limit']))?&nbsp;&nbsp;&nbsp;'&nbsp;LIMIT&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;',&nbsp;$this-&gt;_dqlParts['limit'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>285</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_dqlParts['offset']))?&nbsp;&nbsp;'&nbsp;OFFSET&nbsp;'&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;',&nbsp;$this-&gt;_dqlParts['offset'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>286</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>287</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$q;
</td></tr>
<tr><td>288</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>289</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>290</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>291</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;getParams
</td></tr>
<tr><td>292</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>293</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;array
</td></tr>
<tr><td>294</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>295</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getParams()
</td></tr>
<tr><td>296</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>297</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;array_merge($this-&gt;_params['set'],&nbsp;$this-&gt;_params['where'],&nbsp;$this-&gt;_params['having']);
</td></tr>
<tr><td>298</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>299</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>300</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>301</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;setParams
</td></tr>
<tr><td>302</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>303</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;array&nbsp;$params
</td></tr>
<tr><td>304</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>305</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;setParams(array&nbsp;$params&nbsp;=&nbsp;array())&nbsp;{
</td></tr>
<tr><td>306</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_params&nbsp;=&nbsp;$params;
</td></tr>
<tr><td>307</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>308</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>309</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>310</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;fetchArray
</td></tr>
<tr><td>311</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Convenience&nbsp;method&nbsp;to&nbsp;execute&nbsp;using&nbsp;array&nbsp;fetching&nbsp;as&nbsp;hydration&nbsp;mode.
</td></tr>
<tr><td>312</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>313</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$params
</td></tr>
<tr><td>314</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;array
</td></tr>
<tr><td>315</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>316</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;fetchArray($params&nbsp;=&nbsp;array())&nbsp;{
</td></tr>
<tr><td>317</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;execute($params,&nbsp;Doctrine::HYDRATE_ARRAY);
</td></tr>
<tr><td>318</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>319</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>320</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>321</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;fetchOne
</td></tr>
<tr><td>322</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Convenience&nbsp;method&nbsp;to&nbsp;execute&nbsp;the&nbsp;query&nbsp;and&nbsp;return&nbsp;the&nbsp;first&nbsp;item
</td></tr>
<tr><td>323</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;of&nbsp;the&nbsp;collection.
</td></tr>
<tr><td>324</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>325</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$params&nbsp;Parameters
</td></tr>
<tr><td>326</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;int&nbsp;$hydrationMode&nbsp;Hydration&nbsp;mode
</td></tr>
<tr><td>327</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;mixed&nbsp;Array&nbsp;or&nbsp;Doctrine_Collection&nbsp;or&nbsp;false&nbsp;if&nbsp;no&nbsp;result.
</td></tr>
<tr><td>328</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>329</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;fetchOne($params&nbsp;=&nbsp;array(),&nbsp;$hydrationMode&nbsp;=&nbsp;null)
</td></tr>
<tr><td>330</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>331</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$collection&nbsp;=&nbsp;$this-&gt;execute($params,&nbsp;$hydrationMode);
</td></tr>
<tr><td>332</td>
2007-10-29 20:08:24 +03:00
<td class="normal">
</td></tr>
<tr><td>333</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count($collection)&nbsp;===&nbsp;0)&nbsp;{
</td></tr>
<tr><td>334</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;
</td></tr>
<tr><td>335</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>336</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>337</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($collection&nbsp;instanceof&nbsp;Doctrine_Collection)&nbsp;{
</td></tr>
<tr><td>338</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$collection-&gt;getFirst();
</td></tr>
<tr><td>339</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;if&nbsp;(is_array($collection))&nbsp;{
</td></tr>
<tr><td>340</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;array_shift($collection);
</td></tr>
<tr><td>341</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>342</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>343</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;
</td></tr>
<tr><td>344</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>345</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>346</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>347</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;isSubquery
</td></tr>
<tr><td>348</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;if&nbsp;$bool&nbsp;parameter&nbsp;is&nbsp;set&nbsp;this&nbsp;method&nbsp;sets&nbsp;the&nbsp;value&nbsp;of
</td></tr>
<tr><td>349</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Doctrine_Query::$isSubquery.&nbsp;If&nbsp;this&nbsp;value&nbsp;is&nbsp;set&nbsp;to&nbsp;true
</td></tr>
<tr><td>350</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;the&nbsp;query&nbsp;object&nbsp;will&nbsp;not&nbsp;load&nbsp;the&nbsp;primary&nbsp;key&nbsp;fields&nbsp;of&nbsp;the&nbsp;selected
</td></tr>
<tr><td>351</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;components.
</td></tr>
<tr><td>352</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>353</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;If&nbsp;null&nbsp;is&nbsp;given&nbsp;as&nbsp;the&nbsp;first&nbsp;parameter&nbsp;this&nbsp;method&nbsp;retrieves&nbsp;the&nbsp;current
</td></tr>
<tr><td>354</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;value&nbsp;of&nbsp;Doctrine_Query::$isSubquery.
</td></tr>
<tr><td>355</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>356</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;boolean&nbsp;$bool&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;whether&nbsp;or&nbsp;not&nbsp;this&nbsp;query&nbsp;acts&nbsp;as&nbsp;a&nbsp;subquery
</td></tr>
<tr><td>357</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Query|bool
</td></tr>
<tr><td>358</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>359</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;isSubquery($bool&nbsp;=&nbsp;null)
</td></tr>
<tr><td>360</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>361</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($bool&nbsp;===&nbsp;null)&nbsp;{
</td></tr>
<tr><td>362</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;_isSubquery;
</td></tr>
<tr><td>363</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>364</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>365</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_isSubquery&nbsp;=&nbsp;(bool)&nbsp;$bool;
</td></tr>
<tr><td>366</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this;
</td></tr>
<tr><td>367</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>368</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>369</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>370</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;getAggregateAlias
</td></tr>
<tr><td>371</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>372</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$dqlAlias&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;dql&nbsp;alias&nbsp;of&nbsp;an&nbsp;aggregate&nbsp;value
</td></tr>
<tr><td>373</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string
</td></tr>
<tr><td>374</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@deprecated
</td></tr>
<tr><td>375</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>376</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getAggregateAlias($dqlAlias)
</td></tr>
<tr><td>377</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>378</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;getSqlAggregateAlias($dqlAlias);
</td></tr>
<tr><td>379</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>380</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>381</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>382</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;getSqlAggregateAlias
</td></tr>
<tr><td>383</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>384</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$dqlAlias&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;dql&nbsp;alias&nbsp;of&nbsp;an&nbsp;aggregate&nbsp;value
</td></tr>
<tr><td>385</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string
</td></tr>
<tr><td>386</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>387</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getSqlAggregateAlias($dqlAlias)
</td></tr>
<tr><td>388</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>389</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($this-&gt;_aggregateAliasMap[$dqlAlias]))&nbsp;{
</td></tr>
<tr><td>390</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;mark&nbsp;the&nbsp;expression&nbsp;as&nbsp;used
</td></tr>
<tr><td>391</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_expressionMap[$dqlAlias][1]&nbsp;=&nbsp;true;
</td></tr>
<tr><td>392</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>393</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;_aggregateAliasMap[$dqlAlias];
</td></tr>
<tr><td>394</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_pendingAggregates))&nbsp;{
</td></tr>
<tr><td>395</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;processPendingAggregates();
</td></tr>
<tr><td>396</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>397</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;getSqlAggregateAlias($dqlAlias);
</td></tr>
<tr><td>398</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>399</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Unknown&nbsp;aggregate&nbsp;alias:&nbsp;'&nbsp;.&nbsp;$dqlAlias);
</td></tr>
<tr><td>400</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>401</td>
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>402</td>
<td class="normal">
</td></tr>
<tr><td>403</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>404</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parseQueryPart
</td></tr>
<tr><td>405</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parses&nbsp;given&nbsp;DQL&nbsp;query&nbsp;part
</td></tr>
<tr><td>406</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>407</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$queryPartName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;query&nbsp;part
</td></tr>
<tr><td>408</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$queryPart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;part&nbsp;to&nbsp;be&nbsp;parsed
</td></tr>
<tr><td>409</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;boolean&nbsp;$append&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;whether&nbsp;or&nbsp;not&nbsp;to&nbsp;append&nbsp;the&nbsp;query&nbsp;part&nbsp;to&nbsp;its&nbsp;stack
</td></tr>
<tr><td>410</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;false&nbsp;is&nbsp;given,&nbsp;this&nbsp;method&nbsp;will&nbsp;overwrite&nbsp;
</td></tr>
<tr><td>411</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;given&nbsp;query&nbsp;part&nbsp;stack&nbsp;with&nbsp;$queryPart
</td></tr>
<tr><td>412</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Query&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this&nbsp;object
</td></tr>
<tr><td>413</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>414</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/*protected&nbsp;function&nbsp;parseQueryPart($queryPartName,&nbsp;$queryPart,&nbsp;$append&nbsp;=&nbsp;false)&nbsp;
</td></tr>
<tr><td>415</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>416</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&gt;_state&nbsp;===&nbsp;self::STATE_LOCKED)&nbsp;{
</td></tr>
<tr><td>417</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('This&nbsp;query&nbsp;object&nbsp;is&nbsp;locked.&nbsp;No&nbsp;query&nbsp;parts&nbsp;can&nbsp;be&nbsp;manipulated.');
</td></tr>
<tr><td>418</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>419</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>420</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;sanity&nbsp;check
</td></tr>
<tr><td>421</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($queryPart&nbsp;===&nbsp;''&nbsp;||&nbsp;$queryPart&nbsp;===&nbsp;null)&nbsp;{
</td></tr>
<tr><td>422</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Empty&nbsp;'&nbsp;.&nbsp;$queryPartName&nbsp;.&nbsp;'&nbsp;part&nbsp;given.');
</td></tr>
<tr><td>423</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>424</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>425</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;add&nbsp;query&nbsp;part&nbsp;to&nbsp;the&nbsp;dql&nbsp;part&nbsp;array
</td></tr>
<tr><td>426</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($append)&nbsp;{
</td></tr>
<tr><td>427</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_dqlParts[$queryPartName][]&nbsp;=&nbsp;$queryPart;
</td></tr>
<tr><td>428</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>429</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_dqlParts[$queryPartName]&nbsp;=&nbsp;array($queryPart);
</td></tr>
<tr><td>430</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>431</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>432</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&gt;_state&nbsp;===&nbsp;self::STATE_DIRECT)&nbsp;{
</td></tr>
<tr><td>433</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parser&nbsp;=&nbsp;$this-&gt;_getParser($queryPartName);
</td></tr>
<tr><td>434</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>435</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;$parser-&gt;parse($queryPart);
</td></tr>
<tr><td>436</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>437</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($sql))&nbsp;{
</td></tr>
<tr><td>438</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($append)&nbsp;{
</td></tr>
<tr><td>439</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;addSqlQueryPart($queryPartName,&nbsp;$sql);
</td></tr>
<tr><td>440</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>441</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setSqlQueryPart($queryPartName,&nbsp;$sql);
</td></tr>
<tr><td>442</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>443</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>444</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>445</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>446</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_state&nbsp;=&nbsp;Doctrine_Query::STATE_DIRTY;
</td></tr>
<tr><td>447</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>448</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this;
</td></tr>
<tr><td>449</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;}*/
</td></tr>
<tr><td>450</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>451</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>452</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;getDqlPart
</td></tr>
<tr><td>453</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;returns&nbsp;a&nbsp;specific&nbsp;DQL&nbsp;query&nbsp;part.
</td></tr>
<tr><td>454</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>455</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$queryPart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;query&nbsp;part
</td></tr>
<tr><td>456</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string&nbsp;&nbsp;&nbsp;the&nbsp;DQL&nbsp;query&nbsp;part
</td></tr>
<tr><td>457</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Description:&nbsp;List&nbsp;which&nbsp;query&nbsp;parts&nbsp;exist&nbsp;or&nbsp;point&nbsp;to&nbsp;the&nbsp;method/property
</td></tr>
<tr><td>458</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;where&nbsp;they&nbsp;are&nbsp;listed.
</td></tr>
<tr><td>459</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>460</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getDqlPart($queryPart)
</td></tr>
<tr><td>461</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>462</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;isset($this-&gt;_dqlParts[$queryPart]))&nbsp;{
</td></tr>
<tr><td>463</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Unknown&nbsp;query&nbsp;part&nbsp;'&nbsp;.&nbsp;$queryPart);
</td></tr>
<tr><td>464</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>465</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>466</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;_dqlParts[$queryPart];
</td></tr>
<tr><td>467</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>468</td>
<td class="normal">
</td></tr>
<tr><td>469</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>470</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;processPendingFields
</td></tr>
<tr><td>471</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;the&nbsp;fields&nbsp;in&nbsp;SELECT&nbsp;clause&nbsp;cannot&nbsp;be&nbsp;parsed&nbsp;until&nbsp;the&nbsp;components
</td></tr>
<tr><td>472</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;in&nbsp;FROM&nbsp;clause&nbsp;are&nbsp;parsed,&nbsp;hence&nbsp;this&nbsp;method&nbsp;is&nbsp;called&nbsp;everytime&nbsp;a&nbsp;
</td></tr>
<tr><td>473</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;specific&nbsp;component&nbsp;is&nbsp;being&nbsp;parsed.
</td></tr>
<tr><td>474</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>475</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@throws&nbsp;Doctrine_Query_Exception&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;unknown&nbsp;component&nbsp;alias&nbsp;has&nbsp;been&nbsp;given
</td></tr>
<tr><td>476</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$componentAlias&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;alias&nbsp;of&nbsp;the&nbsp;component
</td></tr>
<tr><td>477</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;void
</td></tr>
<tr><td>478</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Description:&nbsp;What&nbsp;is&nbsp;a&nbsp;'pending&nbsp;field'&nbsp;(and&nbsp;are&nbsp;there&nbsp;non-pending&nbsp;fields,&nbsp;too)?
</td></tr>
<tr><td>479</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What&nbsp;is&nbsp;'processed'?&nbsp;(Meaning:&nbsp;What&nbsp;information&nbsp;is&nbsp;gathered&nbsp;&amp;&nbsp;stored&nbsp;away)
</td></tr>
<tr><td>480</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>481</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;processPendingFields($componentAlias)
</td></tr>
<tr><td>482</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>483</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias);
</td></tr>
<tr><td>484</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;_queryComponents[$componentAlias]['table'];
</td></tr>
<tr><td>485</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>486</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;isset($this-&gt;_pendingFields[$componentAlias]))&nbsp;{
</td></tr>
<tr><td>487</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
</td></tr>
<tr><td>488</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>489</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>490</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields&nbsp;=&nbsp;$this-&gt;_pendingFields[$componentAlias];
</td></tr>
<tr><td>491</td>
<td class="normal">
</td></tr>
<tr><td>492</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>493</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;for&nbsp;wildcards
</td></tr>
<tr><td>494</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(in_array('*',&nbsp;$fields))&nbsp;{
</td></tr>
<tr><td>495</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//echo&nbsp;&quot;&lt;br&nbsp;/&gt;&quot;;Doctrine::dump($table-&gt;getColumnNames());&nbsp;echo&nbsp;&quot;&lt;br&nbsp;/&gt;&quot;;
</td></tr>
<tr><td>496</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields&nbsp;=&nbsp;$table-&gt;getFieldNames();
</td></tr>
<tr><td>497</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>498</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;only&nbsp;auto-add&nbsp;the&nbsp;primary&nbsp;key&nbsp;fields&nbsp;if&nbsp;this&nbsp;query&nbsp;object&nbsp;is&nbsp;not
</td></tr>
<tr><td>499</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;a&nbsp;subquery&nbsp;of&nbsp;another&nbsp;query&nbsp;object
</td></tr>
<tr><td>500</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$this-&gt;_isSubquery)&nbsp;{
</td></tr>
<tr><td>501</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields&nbsp;=&nbsp;array_unique(array_merge((array)&nbsp;$table-&gt;getIdentifier(),&nbsp;$fields));
</td></tr>
<tr><td>502</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>503</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>504</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>505</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;array();
</td></tr>
<tr><td>506</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($fields&nbsp;as&nbsp;$fieldName)&nbsp;{
</td></tr>
<tr><td>507</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$columnName&nbsp;=&nbsp;$table-&gt;getColumnName($fieldName);
</td></tr>
<tr><td>508</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(($owner&nbsp;=&nbsp;$table-&gt;getColumnOwner($columnName))&nbsp;!==&nbsp;null&nbsp;&amp;&amp;&nbsp;
</td></tr>
<tr><td>509</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$owner&nbsp;!==&nbsp;$table-&gt;getComponentName())&nbsp;{
</td></tr>
<tr><td>510</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>511</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parent&nbsp;=&nbsp;$this-&gt;_conn-&gt;getTable($owner);
</td></tr>
<tr><td>512</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$columnName&nbsp;=&nbsp;$parent-&gt;getColumnName($fieldName);
</td></tr>
<tr><td>513</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parentAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$parent-&gt;getComponentName());
</td></tr>
<tr><td>514</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql[]&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($parentAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$columnName)
</td></tr>
<tr><td>515</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;AS&nbsp;'
</td></tr>
<tr><td>516</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias&nbsp;.&nbsp;'__'&nbsp;.&nbsp;$columnName);
</td></tr>
<tr><td>517</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>518</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$columnName&nbsp;=&nbsp;$table-&gt;getColumnName($fieldName);
</td></tr>
<tr><td>519</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql[]&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$columnName)
</td></tr>
<tr><td>520</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;AS&nbsp;'
</td></tr>
<tr><td>521</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias&nbsp;.&nbsp;'__'&nbsp;.&nbsp;$columnName);
</td></tr>
<tr><td>522</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>523</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>524</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>525</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_neededTables[]&nbsp;=&nbsp;$tableAlias;
</td></tr>
<tr><td>526</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Doctrine::dump(implode(',&nbsp;',&nbsp;$sql));
</td></tr>
<tr><td>527</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//echo&nbsp;&quot;&lt;br&nbsp;/&gt;&lt;br&nbsp;/&gt;&quot;;
</td></tr>
<tr><td>528</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;implode(',&nbsp;',&nbsp;$sql);
</td></tr>
<tr><td>529</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>530</td>
<td class="normal">
</td></tr>
<tr><td>531</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>532</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parseSelectField
</td></tr>
<tr><td>533</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>534</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@throws&nbsp;Doctrine_Query_Exception&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;unknown&nbsp;component&nbsp;alias&nbsp;has&nbsp;been&nbsp;given
</td></tr>
<tr><td>535</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;void
</td></tr>
<tr><td>536</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Description:&nbsp;Explain&nbsp;what&nbsp;this&nbsp;method&nbsp;does.&nbsp;Is&nbsp;there&nbsp;a&nbsp;relation&nbsp;to&nbsp;parseSelect()?
</td></tr>
<tr><td>537</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(It&nbsp;doesnt&nbsp;seem&nbsp;to&nbsp;get&nbsp;called&nbsp;from&nbsp;there...?).&nbsp;In&nbsp;what&nbsp;circumstances&nbsp;is&nbsp;this&nbsp;method
</td></tr>
<tr><td>538</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;used?
</td></tr>
<tr><td>539</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>540</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;parseSelectField($field)
</td></tr>
<tr><td>541</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>542</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$terms&nbsp;=&nbsp;explode('.',&nbsp;$field);
</td></tr>
<tr><td>543</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>544</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($terms[1]))&nbsp;{
</td></tr>
<tr><td>545</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$terms[0];
</td></tr>
<tr><td>546</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$field&nbsp;=&nbsp;$terms[1];
</td></tr>
<tr><td>547</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>548</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reset($this-&gt;_queryComponents);
</td></tr>
<tr><td>549</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;key($this-&gt;_queryComponents);
</td></tr>
<tr><td>550</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fields&nbsp;=&nbsp;$terms[0];
</td></tr>
<tr><td>551</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>552</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>553</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias);
</td></tr>
<tr><td>554</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;_queryComponents[$componentAlias]['table'];
</td></tr>
<tr><td>555</td>
<td class="normal">
</td></tr>
<tr><td>556</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>557</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;for&nbsp;wildcards
</td></tr>
<tr><td>558</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($field&nbsp;===&nbsp;'*')&nbsp;{
</td></tr>
<tr><td>559</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;array();
</td></tr>
<tr><td>560</td>
<td class="normal">
</td></tr>
<tr><td>561</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($table-&gt;getColumnNames()&nbsp;as&nbsp;$field)&nbsp;{
</td></tr>
<tr><td>562</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql[]&nbsp;=&nbsp;$this-&gt;parseSelectField($componentAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$field);
</td></tr>
<tr><td>563</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>564</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>565</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;implode(',&nbsp;',&nbsp;$sql);
</td></tr>
<tr><td>566</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>567</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$name&nbsp;=&nbsp;$table-&gt;getColumnName($field);
</td></tr>
<tr><td>568</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>569</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_neededTables[]&nbsp;=&nbsp;$tableAlias;
</td></tr>
<tr><td>570</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>571</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$name)
</td></tr>
<tr><td>572</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;AS&nbsp;'
</td></tr>
<tr><td>573</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias&nbsp;.&nbsp;'__'&nbsp;.&nbsp;$name);
</td></tr>
<tr><td>574</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>575</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>576</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>577</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>578</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;getExpressionOwner
</td></tr>
<tr><td>579</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;returns&nbsp;the&nbsp;component&nbsp;alias&nbsp;for&nbsp;owner&nbsp;of&nbsp;given&nbsp;expression
</td></tr>
<tr><td>580</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>581</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$expr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;expression&nbsp;from&nbsp;which&nbsp;to&nbsp;get&nbsp;to&nbsp;owner&nbsp;from
</td></tr>
<tr><td>582</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;component&nbsp;alias
</td></tr>
<tr><td>583</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Description:&nbsp;What&nbsp;does&nbsp;it&nbsp;mean&nbsp;if&nbsp;a&nbsp;component&nbsp;is&nbsp;an&nbsp;'owner'&nbsp;of&nbsp;an&nbsp;expression?
</td></tr>
<tr><td>584</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What&nbsp;kind&nbsp;of&nbsp;'expression'&nbsp;are&nbsp;we&nbsp;talking&nbsp;about&nbsp;here?
</td></tr>
<tr><td>585</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>586</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getExpressionOwner($expr)
</td></tr>
<tr><td>587</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>588</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strtoupper(substr(trim($expr,&nbsp;'(&nbsp;'),&nbsp;0,&nbsp;6))&nbsp;!==&nbsp;'SELECT')&nbsp;{
</td></tr>
<tr><td>589</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;preg_match_all(&quot;/[a-z0-9_]+\.[a-z0-9_]+[\.[a-z0-9]+]*/i&quot;,&nbsp;$expr,&nbsp;$matches);
</td></tr>
<tr><td>590</td>
<td class="normal">
</td></tr>
<tr><td>591</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$match&nbsp;=&nbsp;current($matches);
</td></tr>
<tr><td>592</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>593</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($match[0]))&nbsp;{
</td></tr>
<tr><td>594</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$terms&nbsp;=&nbsp;explode('.',&nbsp;$match[0]);
</td></tr>
<tr><td>595</td>
<td class="normal">
</td></tr>
<tr><td>596</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$terms[0];
</td></tr>
<tr><td>597</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>598</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>599</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;getRootAlias();
</td></tr>
<tr><td>600</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>601</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>602</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>603</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>604</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parseSelect
</td></tr>
<tr><td>605</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parses&nbsp;the&nbsp;query&nbsp;select&nbsp;part&nbsp;and
</td></tr>
<tr><td>606</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;adds&nbsp;selected&nbsp;fields&nbsp;to&nbsp;pendingFields&nbsp;array
</td></tr>
<tr><td>607</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>608</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$dql
</td></tr>
<tr><td>609</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Description:&nbsp;What&nbsp;information&nbsp;is&nbsp;extracted&nbsp;(and&nbsp;then&nbsp;stored)?
</td></tr>
<tr><td>610</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>611</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;parseSelect($dql)
</td></tr>
<tr><td>612</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>613</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$refs&nbsp;=&nbsp;$this-&gt;_tokenizer-&gt;sqlExplode($dql,&nbsp;',');
</td></tr>
<tr><td>614</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>615</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$pos&nbsp;&nbsp;&nbsp;=&nbsp;strpos(trim($refs[0]),&nbsp;'&nbsp;');
</td></tr>
<tr><td>616</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$first&nbsp;=&nbsp;substr($refs[0],&nbsp;0,&nbsp;$pos);
</td></tr>
<tr><td>617</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>618</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;for&nbsp;DISTINCT&nbsp;keyword
</td></tr>
<tr><td>619</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($first&nbsp;===&nbsp;'DISTINCT')&nbsp;{
</td></tr>
<tr><td>620</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['distinct']&nbsp;=&nbsp;true;
</td></tr>
<tr><td>621</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>622</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$refs[0]&nbsp;=&nbsp;substr($refs[0],&nbsp;++$pos);
</td></tr>
<tr><td>623</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>624</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>625</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parsedComponents&nbsp;=&nbsp;array();
</td></tr>
<tr><td>626</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>627</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($refs&nbsp;as&nbsp;$reference)&nbsp;{
</td></tr>
<tr><td>628</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reference&nbsp;=&nbsp;trim($reference);
</td></tr>
<tr><td>629</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>630</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(empty($reference))&nbsp;{
</td></tr>
<tr><td>631</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>632</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>633</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>634</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$terms&nbsp;=&nbsp;$this-&gt;_tokenizer-&gt;sqlExplode($reference,&nbsp;'&nbsp;');
</td></tr>
<tr><td>635</td>
<td class="normal">
</td></tr>
<tr><td>636</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$pos&nbsp;&nbsp;&nbsp;=&nbsp;strpos($terms[0],&nbsp;'(');
</td></tr>
<tr><td>637</td>
<td class="normal">
</td></tr>
<tr><td>638</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count($terms)&nbsp;&gt;&nbsp;1&nbsp;||&nbsp;$pos&nbsp;!==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>639</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$expression&nbsp;=&nbsp;array_shift($terms);
</td></tr>
<tr><td>640</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$alias&nbsp;=&nbsp;array_pop($terms);
</td></tr>
<tr><td>641</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>642</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$alias)&nbsp;{
</td></tr>
<tr><td>643</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$alias&nbsp;=&nbsp;substr($expression,&nbsp;0,&nbsp;$pos);
</td></tr>
<tr><td>644</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>645</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>646</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$this-&gt;getExpressionOwner($expression);
</td></tr>
<tr><td>647</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$expression&nbsp;=&nbsp;$this-&gt;parseClause($expression);
</td></tr>
<tr><td>648</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>649</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias);
</td></tr>
<tr><td>650</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>651</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$index&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;count($this-&gt;_aggregateAliasMap);
</td></tr>
<tr><td>652</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>653</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sqlAlias&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias&nbsp;.&nbsp;'__'&nbsp;.&nbsp;$index);
</td></tr>
<tr><td>654</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>655</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['select'][]&nbsp;=&nbsp;$expression&nbsp;.&nbsp;'&nbsp;AS&nbsp;'&nbsp;.&nbsp;$sqlAlias;
</td></tr>
<tr><td>656</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>657</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_aggregateAliasMap[$alias]&nbsp;=&nbsp;$sqlAlias;
</td></tr>
<tr><td>658</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_expressionMap[$alias][0]&nbsp;=&nbsp;$expression;
</td></tr>
<tr><td>659</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>660</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_queryComponents[$componentAlias]['agg'][$index]&nbsp;=&nbsp;$alias;
</td></tr>
<tr><td>661</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>662</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_neededTables[]&nbsp;=&nbsp;$tableAlias;
</td></tr>
<tr><td>663</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>664</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('.',&nbsp;$terms[0]);
</td></tr>
<tr><td>665</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>666</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($e[1]))&nbsp;{
</td></tr>
<tr><td>667</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$e[0];
</td></tr>
<tr><td>668</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$field&nbsp;=&nbsp;$e[1];
</td></tr>
<tr><td>669</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>670</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reset($this-&gt;_queryComponents);
</td></tr>
<tr><td>671</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;key($this-&gt;_queryComponents);
</td></tr>
<tr><td>672</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$field&nbsp;=&nbsp;$e[0];
</td></tr>
<tr><td>673</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>674</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>675</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingFields[$componentAlias][]&nbsp;=&nbsp;$field;
</td></tr>
<tr><td>676</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>677</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>678</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>679</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>680</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>681</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parseClause
</td></tr>
<tr><td>682</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parses&nbsp;given&nbsp;DQL&nbsp;clause
</td></tr>
<tr><td>683</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>684</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;this&nbsp;method&nbsp;handles&nbsp;five&nbsp;tasks:
</td></tr>
<tr><td>685</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>686</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;1.&nbsp;Converts&nbsp;all&nbsp;DQL&nbsp;functions&nbsp;to&nbsp;their&nbsp;native&nbsp;SQL&nbsp;equivalents
</td></tr>
<tr><td>687</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;2.&nbsp;Converts&nbsp;all&nbsp;component&nbsp;references&nbsp;to&nbsp;their&nbsp;table&nbsp;alias&nbsp;equivalents
</td></tr>
<tr><td>688</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;3.&nbsp;Converts&nbsp;all&nbsp;field&nbsp;names&nbsp;to&nbsp;actual&nbsp;column&nbsp;names
</td></tr>
<tr><td>689</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;4.&nbsp;Quotes&nbsp;all&nbsp;identifiers
</td></tr>
<tr><td>690</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;5.&nbsp;Parses&nbsp;nested&nbsp;clauses&nbsp;and&nbsp;subqueries&nbsp;recursively
</td></tr>
<tr><td>691</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>692</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string&nbsp;&nbsp;&nbsp;SQL&nbsp;string
</td></tr>
<tr><td>693</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Description:&nbsp;What&nbsp;is&nbsp;a&nbsp;'dql&nbsp;clause'&nbsp;(and&nbsp;what&nbsp;not)?
</td></tr>
<tr><td>694</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Refactor:&nbsp;Too&nbsp;long&nbsp;&amp;&nbsp;nesting&nbsp;level
</td></tr>
<tr><td>695</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>696</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;parseClause($clause)
</td></tr>
<tr><td>697</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>698</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp; $clause&nbsp;=&nbsp;trim($clause);
</td></tr>
<tr><td>699</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>700</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp; if&nbsp;(is_numeric($clause))&nbsp;{
</td></tr>
<tr><td>701</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;return&nbsp;$clause;
</td></tr>
<tr><td>702</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp; }
</td></tr>
<tr><td>703</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>704</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$terms&nbsp;=&nbsp;$this-&gt;_tokenizer-&gt;clauseExplode($clause,&nbsp;array('&nbsp;',&nbsp;'+',&nbsp;'-',&nbsp;'*',&nbsp;'/'));
</td></tr>
<tr><td>705</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>706</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$str&nbsp;=&nbsp;'';
</td></tr>
<tr><td>707</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($terms&nbsp;as&nbsp;$term)&nbsp;{
</td></tr>
<tr><td>708</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$pos&nbsp;=&nbsp;strpos($term[0],&nbsp;'(');
</td></tr>
<tr><td>709</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>710</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($pos&nbsp;!==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>711</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$name&nbsp;=&nbsp;substr($term[0],&nbsp;0,&nbsp;$pos);
</td></tr>
<tr><td>712</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($name&nbsp;!==&nbsp;'')&nbsp;{
</td></tr>
<tr><td>713</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$argStr&nbsp;=&nbsp;substr($term[0],&nbsp;($pos&nbsp;+&nbsp;1),&nbsp;-1);
</td></tr>
<tr><td>714</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>715</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$args&nbsp;&nbsp;&nbsp;=&nbsp;array();
</td></tr>
<tr><td>716</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;parse&nbsp;args
</td></tr>
<tr><td>717</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>718</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_tokenizer-&gt;sqlExplode($argStr,&nbsp;',')&nbsp;as&nbsp;$expr)&nbsp;{
</td></tr>
<tr><td>719</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$args[]&nbsp;=&nbsp;$this-&gt;parseClause($expr);
</td></tr>
<tr><td>720</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>721</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>722</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;convert&nbsp;DQL&nbsp;function&nbsp;to&nbsp;its&nbsp;RDBMS&nbsp;specific&nbsp;equivalent
</td></tr>
<tr><td>723</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{
</td></tr>
<tr><td>724</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$expr&nbsp;=&nbsp;call_user_func_array(array($this-&gt;_conn-&gt;expression,&nbsp;$name),&nbsp;$args);
</td></tr>
<tr><td>725</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(Doctrine_Expression_Exception&nbsp;$e)&nbsp;{
</td></tr>
<tr><td>726</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Unknown&nbsp;function&nbsp;'&nbsp;.&nbsp;$expr&nbsp;.&nbsp;'.');
</td></tr>
<tr><td>727</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>728</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$term[0]&nbsp;=&nbsp;$expr;
</td></tr>
<tr><td>729</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>730</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$trimmed&nbsp;=&nbsp;trim($this-&gt;_tokenizer-&gt;bracketTrim($term[0]));
</td></tr>
<tr><td>731</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>732</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;for&nbsp;possible&nbsp;subqueries
</td></tr>
<tr><td>733</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(substr($trimmed,&nbsp;0,&nbsp;4)&nbsp;==&nbsp;'FROM'&nbsp;||&nbsp;substr($trimmed,&nbsp;0,&nbsp;6)&nbsp;==&nbsp;'SELECT')&nbsp;{
</td></tr>
<tr><td>734</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;parse&nbsp;subquery
</td></tr>
<tr><td>735</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$trimmed&nbsp;=&nbsp;$this-&gt;createSubquery()-&gt;parseDqlQuery($trimmed)-&gt;getQuery();
</td></tr>
<tr><td>736</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>737</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;parse&nbsp;normal&nbsp;clause
</td></tr>
<tr><td>738</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$trimmed&nbsp;=&nbsp;$this-&gt;parseClause($trimmed);
</td></tr>
<tr><td>739</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>740</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>741</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$term[0]&nbsp;=&nbsp;'('&nbsp;.&nbsp;$trimmed&nbsp;.&nbsp;')';
</td></tr>
<tr><td>742</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>743</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>744</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(substr($term[0],&nbsp;0,&nbsp;1)&nbsp;!==&nbsp;&quot;'&quot;&nbsp;&amp;&amp;&nbsp;substr($term[0],&nbsp;-1)&nbsp;!==&nbsp;&quot;'&quot;)&nbsp;{
</td></tr>
<tr><td>745</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>746</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($term[0],&nbsp;'.')&nbsp;!==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>747</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;is_numeric($term[0]))&nbsp;{
</td></tr>
<tr><td>748</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('.',&nbsp;$term[0]);
</td></tr>
<tr><td>749</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>750</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$field&nbsp;=&nbsp;array_pop($e);
</td></tr>
<tr><td>751</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>752</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&gt;getType()&nbsp;===&nbsp;Doctrine_Query::SELECT)&nbsp;{
</td></tr>
<tr><td>753</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;implode('.',&nbsp;$e);
</td></tr>
<tr><td>754</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>755</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(empty($componentAlias))&nbsp;{
</td></tr>
<tr><td>756</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$this-&gt;getRootAlias();
</td></tr>
<tr><td>757</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>758</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>759</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;load($componentAlias);
</td></tr>
<tr><td>760</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>761</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;the&nbsp;existence&nbsp;of&nbsp;the&nbsp;component&nbsp;alias
</td></tr>
<tr><td>762</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;isset($this-&gt;_queryComponents[$componentAlias]))&nbsp;{
</td></tr>
<tr><td>763</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Unknown&nbsp;component&nbsp;alias&nbsp;'&nbsp;.&nbsp;$componentAlias);
</td></tr>
<tr><td>764</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>765</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>766</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$this-&gt;_queryComponents[$componentAlias]['table'];
</td></tr>
<tr><td>767</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>768</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$def&nbsp;=&nbsp;$table-&gt;getDefinitionOf($field);
</td></tr>
<tr><td>769</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>770</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;the&nbsp;actual&nbsp;field&nbsp;name&nbsp;from&nbsp;alias
</td></tr>
<tr><td>771</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$field&nbsp;=&nbsp;$table-&gt;getColumnName($field);
</td></tr>
<tr><td>772</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>773</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;column&nbsp;existence
</td></tr>
<tr><td>774</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$def)&nbsp;{
</td></tr>
<tr><td>775</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Unknown&nbsp;column&nbsp;'&nbsp;.&nbsp;$field);
</td></tr>
<tr><td>776</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>777</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>778</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($def['owner']))&nbsp;{
</td></tr>
<tr><td>779</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$componentAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$def['owner'];
</td></tr>
<tr><td>780</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>781</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>782</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias);
</td></tr>
<tr><td>783</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>784</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;build&nbsp;sql&nbsp;expression
</td></tr>
<tr><td>785</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$term[0]&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias)
</td></tr>
<tr><td>786</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'.'
</td></tr>
<tr><td>787</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($field);
</td></tr>
<tr><td>788</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>789</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;build&nbsp;sql&nbsp;expression
</td></tr>
<tr><td>790</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$term[0]&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($field);
</td></tr>
<tr><td>791</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>792</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>793</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>794</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>795</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($term[0])&nbsp;&amp;&amp;
</td></tr>
<tr><td>796</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;!&nbsp;in_array(strtoupper($term[0]),&nbsp;self::$_keywords)&nbsp;&amp;&amp;
</td></tr>
<tr><td>797</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;!&nbsp;is_numeric($term[0]))&nbsp;{
</td></tr>
<tr><td>798</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>799</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$this-&gt;getRootAlias();
</td></tr>
<tr><td>800</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>801</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found&nbsp;=&nbsp;false;
</td></tr>
<tr><td>802</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>803</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($componentAlias&nbsp;!==&nbsp;false&nbsp;&amp;&amp;&nbsp;
</td></tr>
<tr><td>804</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;!==&nbsp;null)&nbsp;{
</td></tr>
<tr><td>805</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$this-&gt;_queryComponents[$componentAlias]['table'];
</td></tr>
<tr><td>806</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>807</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;column&nbsp;existence
</td></tr>
<tr><td>808</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($table-&gt;hasColumn($term[0]))&nbsp;{
</td></tr>
<tr><td>809</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found&nbsp;=&nbsp;true;
</td></tr>
<tr><td>810</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>811</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>812</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$def&nbsp;=&nbsp;$table-&gt;getDefinitionOf($term[0]);
</td></tr>
<tr><td>813</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>814</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;the&nbsp;actual&nbsp;column&nbsp;name&nbsp;from&nbsp;alias
</td></tr>
<tr><td>815</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$term[0]&nbsp;=&nbsp;$table-&gt;getColumnName($term[0]);
</td></tr>
<tr><td>816</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>817</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>818</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($def['owner']))&nbsp;{
</td></tr>
<tr><td>819</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$componentAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$def['owner'];
</td></tr>
<tr><td>820</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>821</td>
<td class="normal">
</td></tr>
<tr><td>822</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias);
</td></tr>
<tr><td>823</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>824</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias);
</td></tr>
<tr><td>825</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>826</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&gt;getType()&nbsp;===&nbsp;Doctrine_Query::SELECT)&nbsp;{
</td></tr>
<tr><td>827</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;build&nbsp;sql&nbsp;expression
</td></tr>
<tr><td>828</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$term[0]&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias)
</td></tr>
<tr><td>829</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'.'
</td></tr>
<tr><td>830</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($term[0]);
</td></tr>
<tr><td>831</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>832</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;build&nbsp;sql&nbsp;expression
</td></tr>
<tr><td>833</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$term[0]&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($term[0]);
</td></tr>
<tr><td>834</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>835</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>836</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found&nbsp;=&nbsp;false;
</td></tr>
<tr><td>837</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>838</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>839</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>840</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$found)&nbsp;{
</td></tr>
<tr><td>841</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$term[0]&nbsp;=&nbsp;$this-&gt;getSqlAggregateAlias($term[0]);
</td></tr>
<tr><td>842</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>843</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>844</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>845</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>846</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>847</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>848</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$str&nbsp;.=&nbsp;$term[0]&nbsp;.&nbsp;$term[1];
</td></tr>
<tr><td>849</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>850</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$str;
</td></tr>
<tr><td>851</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>852</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>853</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>854</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parseAggregateFunction
</td></tr>
<tr><td>855</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parses&nbsp;an&nbsp;aggregate&nbsp;function&nbsp;and&nbsp;returns&nbsp;the&nbsp;parsed&nbsp;form
</td></tr>
<tr><td>856</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>857</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@see&nbsp;Doctrine_Expression
</td></tr>
<tr><td>858</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$expr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DQL&nbsp;aggregate&nbsp;function
</td></tr>
<tr><td>859</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@throws&nbsp;Doctrine_Query_Exception&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;unknown&nbsp;aggregate&nbsp;function&nbsp;given
</td></tr>
<tr><td>860</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;array&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parsed&nbsp;form&nbsp;of&nbsp;given&nbsp;function
</td></tr>
<tr><td>861</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>862</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;parseAggregateFunction($expr,&nbsp;$nestedCall&nbsp;=&nbsp;false)
</td></tr>
<tr><td>863</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>864</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;_tokenizer-&gt;bracketExplode($expr,&nbsp;'&nbsp;');
</td></tr>
<tr><td>865</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$func&nbsp;=&nbsp;$e[0];
</td></tr>
<tr><td>866</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>867</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$pos&nbsp;&nbsp;=&nbsp;strpos($func,&nbsp;'(');
</td></tr>
<tr><td>868</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($pos&nbsp;===&nbsp;false)&nbsp;{
</td></tr>
<tr><td>869</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$expr;
</td></tr>
<tr><td>870</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>871</td>
<td class="normal">
</td></tr>
<tr><td>872</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;function
</td></tr>
<tr><td>873</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$name&nbsp;&nbsp;&nbsp;=&nbsp;substr($func,&nbsp;0,&nbsp;$pos);
</td></tr>
<tr><td>874</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$argStr&nbsp;=&nbsp;substr($func,&nbsp;($pos&nbsp;+&nbsp;1),&nbsp;-1);
</td></tr>
<tr><td>875</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>876</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$args&nbsp;&nbsp;&nbsp;=&nbsp;array();
</td></tr>
<tr><td>877</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;parse&nbsp;args
</td></tr>
<tr><td>878</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_tokenizer-&gt;bracketExplode($argStr,&nbsp;',')&nbsp;as&nbsp;$expr)&nbsp;{
</td></tr>
<tr><td>879</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$args[]&nbsp;=&nbsp;$this-&gt;parseAggregateFunction($expr,&nbsp;true);
</td></tr>
<tr><td>880</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>881</td>
<td class="normal">
</td></tr>
<tr><td>882</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;convert&nbsp;DQL&nbsp;function&nbsp;to&nbsp;its&nbsp;RDBMS&nbsp;specific&nbsp;equivalent
</td></tr>
<tr><td>883</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{
</td></tr>
<tr><td>884</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$expr&nbsp;=&nbsp;call_user_func_array(array($this-&gt;_conn-&gt;expression,&nbsp;$name),&nbsp;$args);
</td></tr>
<tr><td>885</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(Doctrine_Expression_Exception&nbsp;$e)&nbsp;{
</td></tr>
<tr><td>886</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Unknown&nbsp;function&nbsp;'&nbsp;.&nbsp;$func&nbsp;.&nbsp;'.');
</td></tr>
<tr><td>887</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>888</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>889</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$nestedCall)&nbsp;{
</td></tr>
<tr><td>890</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;try&nbsp;to&nbsp;find&nbsp;all&nbsp;component&nbsp;references
</td></tr>
<tr><td>891</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;preg_match_all(&quot;/[a-z0-9_]+\.[a-z0-9_]+[\.[a-z0-9]+]*/i&quot;,&nbsp;$argStr,&nbsp;$m);
</td></tr>
<tr><td>892</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>893</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($e[1]))&nbsp;{
</td></tr>
<tr><td>894</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strtoupper($e[1])&nbsp;===&nbsp;'AS')&nbsp;{
</td></tr>
<tr><td>895</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;isset($e[2]))&nbsp;{
</td></tr>
<tr><td>896</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Missing&nbsp;aggregate&nbsp;function&nbsp;alias.');
</td></tr>
<tr><td>897</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>898</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$alias&nbsp;=&nbsp;$e[2];
</td></tr>
<tr><td>899</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>900</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$alias&nbsp;=&nbsp;$e[1];
</td></tr>
<tr><td>901</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>902</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>903</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$alias&nbsp;=&nbsp;substr($expr,&nbsp;0,&nbsp;strpos($expr,&nbsp;'('));
</td></tr>
<tr><td>904</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>905</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>906</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingAggregates[]&nbsp;=&nbsp;array($expr,&nbsp;$m[0],&nbsp;$alias);
</td></tr>
<tr><td>907</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>908</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>909</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$expr;
</td></tr>
<tr><td>910</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>911</td>
2007-10-29 20:08:24 +03:00
<td class="normal">
</td></tr>
<tr><td>912</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>913</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;processPendingSubqueries
</td></tr>
<tr><td>914</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;processes&nbsp;pending&nbsp;subqueries
</td></tr>
<tr><td>915</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>916</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;subqueries&nbsp;can&nbsp;only&nbsp;be&nbsp;processed&nbsp;when&nbsp;the&nbsp;query&nbsp;is&nbsp;fully&nbsp;constructed
</td></tr>
<tr><td>917</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;since&nbsp;some&nbsp;subqueries&nbsp;may&nbsp;be&nbsp;correlated
</td></tr>
<tr><td>918</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>919</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;void
</td></tr>
<tr><td>920</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Better&nbsp;description.&nbsp;i.e.&nbsp;What&nbsp;is&nbsp;a&nbsp;'pending&nbsp;subquery'?&nbsp;What&nbsp;does&nbsp;'processed'&nbsp;mean?
</td></tr>
<tr><td>921</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(parsed?&nbsp;sql&nbsp;is&nbsp;constructed?&nbsp;some&nbsp;information&nbsp;is&nbsp;gathered?)
</td></tr>
<tr><td>922</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>923</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;processPendingSubqueries()
</td></tr>
<tr><td>924</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>925</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_pendingSubqueries&nbsp;as&nbsp;$value)&nbsp;{
</td></tr>
<tr><td>926</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list($dql,&nbsp;$alias)&nbsp;=&nbsp;$value;
</td></tr>
<tr><td>927</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>928</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;=&nbsp;$this-&gt;createSubquery();
</td></tr>
<tr><td>929</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>930</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;$subquery-&gt;parseDqlQuery($dql,&nbsp;false)-&gt;getQuery();
</td></tr>
<tr><td>931</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>932</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reset($this-&gt;_queryComponents);
</td></tr>
<tr><td>933</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;key($this-&gt;_queryComponents);
</td></tr>
<tr><td>934</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias);
</td></tr>
<tr><td>935</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>936</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sqlAlias&nbsp;=&nbsp;$tableAlias&nbsp;.&nbsp;'__'&nbsp;.&nbsp;count($this-&gt;_aggregateAliasMap);
</td></tr>
<tr><td>937</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>938</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['select'][]&nbsp;=&nbsp;'('&nbsp;.&nbsp;$sql&nbsp;.&nbsp;')&nbsp;AS&nbsp;'&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($sqlAlias);
</td></tr>
<tr><td>939</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>940</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_aggregateAliasMap[$alias]&nbsp;=&nbsp;$sqlAlias;
</td></tr>
<tr><td>941</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_queryComponents[$componentAlias]['agg'][]&nbsp;=&nbsp;$alias;
</td></tr>
<tr><td>942</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>943</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingSubqueries&nbsp;=&nbsp;array();
</td></tr>
<tr><td>944</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>945</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>946</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>947</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;processPendingAggregates
</td></tr>
<tr><td>948</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;processes&nbsp;pending&nbsp;aggregate&nbsp;values&nbsp;for&nbsp;given&nbsp;component&nbsp;alias
</td></tr>
<tr><td>949</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>950</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;void
</td></tr>
<tr><td>951</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Better&nbsp;description.&nbsp;i.e.&nbsp;What&nbsp;is&nbsp;a&nbsp;'pending&nbsp;aggregate'?&nbsp;What&nbsp;does&nbsp;'processed'&nbsp;mean?
</td></tr>
<tr><td>952</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>953</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;processPendingAggregates()
</td></tr>
<tr><td>954</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>955</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;iterate&nbsp;trhough&nbsp;all&nbsp;aggregates
</td></tr>
<tr><td>956</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_pendingAggregates&nbsp;as&nbsp;$aggregate)&nbsp;{
</td></tr>
<tr><td>957</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list&nbsp;($expression,&nbsp;$components,&nbsp;$alias)&nbsp;=&nbsp;$aggregate;
</td></tr>
<tr><td>958</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>959</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAliases&nbsp;=&nbsp;array();
</td></tr>
<tr><td>960</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>961</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;iterate&nbsp;through&nbsp;the&nbsp;component&nbsp;references&nbsp;within&nbsp;the&nbsp;aggregate&nbsp;function
</td></tr>
<tr><td>962</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty&nbsp;($components))&nbsp;{
</td></tr>
<tr><td>963</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($components&nbsp;as&nbsp;$component)&nbsp;{
</td></tr>
<tr><td>964</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>965</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(is_numeric($component))&nbsp;{
</td></tr>
<tr><td>966</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>967</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>968</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>969</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('.',&nbsp;$component);
</td></tr>
<tr><td>970</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>971</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$field&nbsp;=&nbsp;array_pop($e);
</td></tr>
<tr><td>972</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;implode('.',&nbsp;$e);
</td></tr>
<tr><td>973</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>974</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;the&nbsp;existence&nbsp;of&nbsp;the&nbsp;component&nbsp;alias
</td></tr>
<tr><td>975</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;isset($this-&gt;_queryComponents[$componentAlias]))&nbsp;{
</td></tr>
<tr><td>976</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Unknown&nbsp;component&nbsp;alias&nbsp;'&nbsp;.&nbsp;$componentAlias);
</td></tr>
<tr><td>977</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>978</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>979</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$this-&gt;_queryComponents[$componentAlias]['table'];
</td></tr>
<tr><td>980</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>981</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$field&nbsp;=&nbsp;$table-&gt;getColumnName($field);
</td></tr>
<tr><td>982</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>983</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;check&nbsp;column&nbsp;existence
</td></tr>
<tr><td>984</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$table-&gt;hasColumn($field))&nbsp;{
</td></tr>
<tr><td>985</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception('Unknown&nbsp;column&nbsp;'&nbsp;.&nbsp;$field);
</td></tr>
<tr><td>986</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>987</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>988</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sqlTableAlias&nbsp;=&nbsp;$this-&gt;getSqlTableAlias($componentAlias);
</td></tr>
<tr><td>989</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>990</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAliases[$sqlTableAlias]&nbsp;=&nbsp;true;
</td></tr>
<tr><td>991</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>992</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;build&nbsp;sql&nbsp;expression
</td></tr>
<tr><td>993</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>994</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$identifier&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($sqlTableAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$field);
</td></tr>
<tr><td>995</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$expression&nbsp;=&nbsp;str_replace($component,&nbsp;$identifier,&nbsp;$expression);
</td></tr>
<tr><td>996</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>997</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>998</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>999</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count($tableAliases)&nbsp;!==&nbsp;1)&nbsp;{
</td></tr>
<tr><td>1000</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;reset($this-&gt;_tableAliasMap);
</td></tr>
<tr><td>1001</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;key($this-&gt;_tableAliasMap);
</td></tr>
<tr><td>1002</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1003</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1004</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$index&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;count($this-&gt;_aggregateAliasMap);
</td></tr>
<tr><td>1005</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sqlAlias&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias&nbsp;.&nbsp;'__'&nbsp;.&nbsp;$index);
</td></tr>
<tr><td>1006</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1007</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['select'][]&nbsp;=&nbsp;$expression&nbsp;.&nbsp;'&nbsp;AS&nbsp;'&nbsp;.&nbsp;$sqlAlias;
</td></tr>
<tr><td>1008</td>
<td class="normal">
</td></tr>
<tr><td>1009</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_aggregateAliasMap[$alias]&nbsp;=&nbsp;$sqlAlias;
</td></tr>
<tr><td>1010</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_expressionMap[$alias][0]&nbsp;=&nbsp;$expression;
</td></tr>
<tr><td>1011</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1012</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_queryComponents[$componentAlias]['agg'][$index]&nbsp;=&nbsp;$alias;
</td></tr>
<tr><td>1013</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1014</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_neededTables[]&nbsp;=&nbsp;$tableAlias;
</td></tr>
<tr><td>1015</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1016</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;reset&nbsp;the&nbsp;state
</td></tr>
<tr><td>1017</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingAggregates&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1018</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1019</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1020</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1021</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;_buildSqlQueryBase
</td></tr>
<tr><td>1022</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;returns&nbsp;the&nbsp;base&nbsp;of&nbsp;the&nbsp;generated&nbsp;sql&nbsp;query
</td></tr>
<tr><td>1023</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;On&nbsp;mysql&nbsp;driver&nbsp;special&nbsp;strategy&nbsp;has&nbsp;to&nbsp;be&nbsp;used&nbsp;for&nbsp;DELETE&nbsp;statements
</td></tr>
<tr><td>1024</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;(where&nbsp;is&nbsp;this&nbsp;special&nbsp;strategy??)
</td></tr>
<tr><td>1025</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1026</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;base&nbsp;of&nbsp;the&nbsp;generated&nbsp;sql&nbsp;query
</td></tr>
<tr><td>1027</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1028</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;function&nbsp;_buildSqlQueryBase()
</td></tr>
<tr><td>1029</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1030</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch&nbsp;($this-&gt;_type)&nbsp;{
</td></tr>
<tr><td>1031</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;self::DELETE:
</td></tr>
<tr><td>1032</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;=&nbsp;'DELETE&nbsp;FROM&nbsp;';
</td></tr>
<tr><td>1033</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1034</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;self::UPDATE:
</td></tr>
<tr><td>1035</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;=&nbsp;'UPDATE&nbsp;';
</td></tr>
<tr><td>1036</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1037</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;self::SELECT:
</td></tr>
<tr><td>1038</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$distinct&nbsp;=&nbsp;($this-&gt;_sqlParts['distinct'])&nbsp;?&nbsp;'DISTINCT&nbsp;'&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1039</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;=&nbsp;'SELECT&nbsp;'&nbsp;.&nbsp;$distinct&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_sqlParts['select'])&nbsp;.&nbsp;'&nbsp;FROM&nbsp;';
</td></tr>
<tr><td>1040</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1041</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1042</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$q;
</td></tr>
<tr><td>1043</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1044</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1045</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1046</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;_buildSqlFromPart
</td></tr>
<tr><td>1047</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;builds&nbsp;the&nbsp;from&nbsp;part&nbsp;of&nbsp;the&nbsp;query&nbsp;and&nbsp;returns&nbsp;it
</td></tr>
<tr><td>1048</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1049</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string&nbsp;&nbsp;&nbsp;the&nbsp;query&nbsp;sql&nbsp;from&nbsp;part
</td></tr>
<tr><td>1050</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1051</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;function&nbsp;_buildSqlFromPart()
</td></tr>
<tr><td>1052</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1053</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;=&nbsp;'';
</td></tr>
<tr><td>1054</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_sqlParts['from']&nbsp;as&nbsp;$k&nbsp;=&gt;&nbsp;$part)&nbsp;{
</td></tr>
<tr><td>1055</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($k&nbsp;===&nbsp;0)&nbsp;{
</td></tr>
<tr><td>1056</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;$part;
</td></tr>
<tr><td>1057</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1058</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1059</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1060</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;preserve&nbsp;LEFT&nbsp;JOINs&nbsp;only&nbsp;if&nbsp;needed
</td></tr>
<tr><td>1061</td>
2007-11-25 23:32:49 +03:00
<td class="normal"> //&nbsp;Check&nbsp;if&nbsp;it's&nbsp;JOIN,&nbsp;if&nbsp;not&nbsp;add&nbsp;a&nbsp;comma&nbsp;separator&nbsp;instead&nbsp;of&nbsp;space
</td></tr>
<tr><td>1062</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!preg_match('/\bJOIN\b/i',&nbsp;$part)&nbsp;&amp;&amp;&nbsp;!isset($this-&gt;_pendingJoinConditions[$k]))&nbsp;{
</td></tr>
<tr><td>1063</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;',&nbsp;'&nbsp;.&nbsp;$part;
</td></tr>
<tr><td>1064</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>1065</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(substr($part,&nbsp;0,&nbsp;9)&nbsp;===&nbsp;'LEFT&nbsp;JOIN')&nbsp;{
</td></tr>
<tr><td>1066</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('&nbsp;',&nbsp;$part);
</td></tr>
<tr><td>1067</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1068</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$aliases&nbsp;=&nbsp;array_merge($this-&gt;_subqueryAliases,
</td></tr>
<tr><td>1069</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array_keys($this-&gt;_neededTables));
</td></tr>
<tr><td>1070</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1071</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;in_array($e[3],&nbsp;$aliases)&nbsp;&amp;&amp;
</td></tr>
<tr><td>1072</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;!&nbsp;in_array($e[2],&nbsp;$aliases)&nbsp;&amp;&amp;
</td></tr>
<tr><td>1073</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1074</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;!&nbsp;empty($this-&gt;_pendingFields))&nbsp;{
</td></tr>
<tr><td>1075</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1076</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1077</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1078</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1079</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1080</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($this-&gt;_pendingJoinConditions[$k]))&nbsp;{
</td></tr>
<tr><td>1081</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parser&nbsp;=&nbsp;new&nbsp;Doctrine_Query_JoinCondition($this,&nbsp;$this-&gt;_tokenizer);
</td></tr>
<tr><td>1082</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1083</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($part,&nbsp;'&nbsp;ON&nbsp;')&nbsp;!==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>1084</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$part&nbsp;.=&nbsp;'&nbsp;AND&nbsp;';
</td></tr>
<tr><td>1085</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>1086</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$part&nbsp;.=&nbsp;'&nbsp;ON&nbsp;';
</td></tr>
<tr><td>1087</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1088</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$part&nbsp;.=&nbsp;$parser-&gt;parse($this-&gt;_pendingJoinConditions[$k]);
</td></tr>
<tr><td>1089</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1090</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unset($this-&gt;_pendingJoinConditions[$k]);
</td></tr>
<tr><td>1091</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1092</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1093</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;'&nbsp;'&nbsp;.&nbsp;$part;
</td></tr>
<tr><td>1094</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1095</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1096</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['from'][$k]&nbsp;=&nbsp;$part;
</td></tr>
<tr><td>1097</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1098</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$q;
</td></tr>
<tr><td>1099</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1100</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1101</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1102</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;preQuery
</td></tr>
<tr><td>1103</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1104</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Empty&nbsp;template&nbsp;method&nbsp;to&nbsp;provide&nbsp;Query&nbsp;subclasses&nbsp;with&nbsp;the&nbsp;possibility
</td></tr>
<tr><td>1105</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;to&nbsp;hook&nbsp;into&nbsp;the&nbsp;query&nbsp;building&nbsp;procedure,&nbsp;doing&nbsp;any&nbsp;custom&nbsp;/&nbsp;specialized
</td></tr>
<tr><td>1106</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;query&nbsp;building&nbsp;procedures&nbsp;that&nbsp;are&nbsp;neccessary.
</td></tr>
<tr><td>1107</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1108</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;void
</td></tr>
<tr><td>1109</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1110</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;preQuery()
</td></tr>
<tr><td>1111</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1112</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1113</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1114</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1115</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1116</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;postQuery
</td></tr>
<tr><td>1117</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1118</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Empty&nbsp;template&nbsp;method&nbsp;to&nbsp;provide&nbsp;Query&nbsp;subclasses&nbsp;with&nbsp;the&nbsp;possibility
</td></tr>
<tr><td>1119</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;to&nbsp;hook&nbsp;into&nbsp;the&nbsp;query&nbsp;building&nbsp;procedure,&nbsp;doing&nbsp;any&nbsp;custom&nbsp;/&nbsp;specialized
</td></tr>
<tr><td>1120</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;post&nbsp;query&nbsp;procedures&nbsp;(for&nbsp;example&nbsp;logging)&nbsp;that&nbsp;are&nbsp;neccessary.
</td></tr>
<tr><td>1121</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1122</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;void
</td></tr>
<tr><td>1123</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1124</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;postQuery()
</td></tr>
<tr><td>1125</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1126</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1127</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1128</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1129</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1130</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;builds&nbsp;the&nbsp;sql&nbsp;query&nbsp;from&nbsp;the&nbsp;given&nbsp;parameters&nbsp;and&nbsp;applies&nbsp;things&nbsp;such&nbsp;as
</td></tr>
<tr><td>1131</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;column&nbsp;aggregation&nbsp;inheritance&nbsp;and&nbsp;limit&nbsp;subqueries&nbsp;if&nbsp;needed
</td></tr>
<tr><td>1132</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1133</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;array&nbsp;$params&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;of&nbsp;prepared&nbsp;statement&nbsp;params&nbsp;(needed&nbsp;only&nbsp;in&nbsp;mysql&nbsp;driver
</td></tr>
<tr><td>1134</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when&nbsp;limit&nbsp;subquery&nbsp;algorithm&nbsp;is&nbsp;used)
</td></tr>
<tr><td>1135</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;built&nbsp;sql&nbsp;query
</td></tr>
<tr><td>1136</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1137</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getSqlQuery($params&nbsp;=&nbsp;array())
</td></tr>
<tr><td>1138</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1139</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&gt;_state&nbsp;!==&nbsp;self::STATE_DIRTY)&nbsp;{
</td></tr>
<tr><td>1140</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;_sql;
</td></tr>
<tr><td>1141</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1142</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1143</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;reset&nbsp;the&nbsp;state
</td></tr>
<tr><td>1144</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$this-&gt;isSubquery())&nbsp;{
</td></tr>
<tr><td>1145</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_queryComponents&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1146</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingAggregates&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1147</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_aggregateAliasMap&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1148</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1149</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;reset();
</td></tr>
<tr><td>1150</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1151</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;invoke&nbsp;the&nbsp;preQuery&nbsp;hook
</td></tr>
<tr><td>1152</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;preQuery();
</td></tr>
<tr><td>1153</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1154</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;the&nbsp;DQL&nbsp;parts&nbsp;=&gt;&nbsp;generate&nbsp;the&nbsp;SQL&nbsp;parts.
</td></tr>
<tr><td>1155</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;this&nbsp;will&nbsp;also&nbsp;populate&nbsp;the&nbsp;$_queryComponents.
</td></tr>
<tr><td>1156</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_dqlParts&nbsp;as&nbsp;$queryPartName&nbsp;=&gt;&nbsp;$queryParts)&nbsp;{
</td></tr>
<tr><td>1157</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_processDqlQueryPart($queryPartName,&nbsp;$queryParts);
</td></tr>
<tr><td>1158</td>
2007-11-09 01:14:39 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1159</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_state&nbsp;=&nbsp;self::STATE_CLEAN;
</td></tr>
<tr><td>1160</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1161</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$params&nbsp;=&nbsp;$this-&gt;convertEnums($params);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1162</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1163</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1164</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Proceed&nbsp;with&nbsp;the&nbsp;generated&nbsp;SQL
</td></tr>
<tr><td>1165</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1166</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(empty($this-&gt;_sqlParts['from']))&nbsp;{
</td></tr>
<tr><td>1167</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;
</td></tr>
<tr><td>1168</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1169</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1170</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$needsSubQuery&nbsp;=&nbsp;false;
</td></tr>
<tr><td>1171</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;=&nbsp;'';
</td></tr>
<tr><td>1172</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$map&nbsp;=&nbsp;reset($this-&gt;_queryComponents);
</td></tr>
<tr><td>1173</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$map['table'];
</td></tr>
<tr><td>1174</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$rootAlias&nbsp;=&nbsp;key($this-&gt;_queryComponents);
</td></tr>
<tr><td>1175</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1176</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['limit'])&nbsp;&amp;&amp;&nbsp;$this-&gt;_needsSubquery&nbsp;&amp;&amp;
</td></tr>
<tr><td>1177</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table-&gt;getAttribute(Doctrine::ATTR_QUERY_LIMIT)&nbsp;==&nbsp;Doctrine::LIMIT_RECORDS)&nbsp;{
</td></tr>
<tr><td>1178</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_isLimitSubqueryUsed&nbsp;=&nbsp;true;
</td></tr>
<tr><td>1179</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$needsSubQuery&nbsp;=&nbsp;true;
</td></tr>
<tr><td>1180</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1181</td>
<td class="normal">
</td></tr>
<tr><td>1182</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1183</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_queryComponents&nbsp;as&nbsp;$alias&nbsp;=&gt;&nbsp;$map)&nbsp;{
</td></tr>
<tr><td>1184</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fieldSql&nbsp;=&nbsp;$this-&gt;processPendingFields($alias);
</td></tr>
<tr><td>1185</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($fieldSql))&nbsp;{
</td></tr>
<tr><td>1186</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql[]&nbsp;=&nbsp;$fieldSql;
</td></tr>
<tr><td>1187</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1188</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1189</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($sql))&nbsp;{
</td></tr>
<tr><td>1190</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array_unshift($this-&gt;_sqlParts['select'],&nbsp;implode(',&nbsp;',&nbsp;$sql));
</td></tr>
<tr><td>1191</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1192</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1193</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingFields&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1194</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1195</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;build&nbsp;the&nbsp;basic&nbsp;query
</td></tr>
<tr><td>1196</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;&nbsp;=&nbsp;$this-&gt;_buildSqlQueryBase();
</td></tr>
<tr><td>1197</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;$this-&gt;_buildSqlFromPart();
</td></tr>
<tr><td>1198</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1199</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['set']))&nbsp;{
</td></tr>
<tr><td>1200</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;'&nbsp;SET&nbsp;'&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_sqlParts['set']);
</td></tr>
<tr><td>1201</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1202</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1203</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1204</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$string&nbsp;=&nbsp;$this-&gt;applyInheritance();
</td></tr>
<tr><td>1205</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1206</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;apply&nbsp;inheritance&nbsp;to&nbsp;WHERE&nbsp;part
</td></tr>
<tr><td>1207</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($string))&nbsp;{
</td></tr>
<tr><td>1208</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(substr($string,&nbsp;0,&nbsp;1)&nbsp;===&nbsp;'('&nbsp;&amp;&amp;&nbsp;substr($string,&nbsp;-1)&nbsp;===&nbsp;')')&nbsp;{
</td></tr>
<tr><td>1209</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['where'][]&nbsp;=&nbsp;$string;
</td></tr>
<tr><td>1210</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>1211</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['where'][]&nbsp;=&nbsp;'('&nbsp;.&nbsp;$string&nbsp;.&nbsp;')';
</td></tr>
<tr><td>1212</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1213</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1214</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1215</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$modifyLimit&nbsp;=&nbsp;true;
</td></tr>
<tr><td>1216</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['limit'])&nbsp;||&nbsp;!&nbsp;empty($this-&gt;_sqlParts['offset']))&nbsp;{
</td></tr>
<tr><td>1217</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1218</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($needsSubQuery)&nbsp;{
</td></tr>
<tr><td>1219</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;=&nbsp;$this-&gt;getLimitSubquery();
</td></tr>
<tr><td>1220</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;what&nbsp;about&nbsp;composite&nbsp;keys?
</td></tr>
<tr><td>1221</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$idColumnName&nbsp;=&nbsp;$table-&gt;getColumnName($table-&gt;getIdentifier());
</td></tr>
<tr><td>1222</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch&nbsp;(strtolower($this-&gt;_conn-&gt;getName()))&nbsp;{
</td></tr>
<tr><td>1223</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'mysql':
</td></tr>
<tr><td>1224</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;mysql&nbsp;doesn't&nbsp;support&nbsp;LIMIT&nbsp;in&nbsp;subqueries
</td></tr>
<tr><td>1225</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$list&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;_conn-&gt;execute($subquery,&nbsp;$params)-&gt;fetchAll(Doctrine::FETCH_COLUMN);
</td></tr>
<tr><td>1226</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;=&nbsp;implode(',&nbsp;',&nbsp;array_map(array($this-&gt;_conn,&nbsp;'quote'),&nbsp;$list));
</td></tr>
<tr><td>1227</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1228</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'pgsql':
</td></tr>
<tr><td>1229</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;pgsql&nbsp;needs&nbsp;special&nbsp;nested&nbsp;LIMIT&nbsp;subquery
</td></tr>
<tr><td>1230</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;=&nbsp;'SELECT&nbsp;doctrine_subquery_alias.'&nbsp;.&nbsp;$idColumnName&nbsp;.&nbsp;'&nbsp;FROM&nbsp;('&nbsp;.&nbsp;$subquery&nbsp;.&nbsp;')&nbsp;AS&nbsp;doctrine_subquery_alias';
</td></tr>
<tr><td>1231</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1232</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1233</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1234</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$field&nbsp;=&nbsp;$this-&gt;getSqlTableAlias($rootAlias)&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$idColumnName;
</td></tr>
<tr><td>1235</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1236</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;only&nbsp;append&nbsp;the&nbsp;subquery&nbsp;if&nbsp;it&nbsp;actually&nbsp;contains&nbsp;something
</td></tr>
<tr><td>1237</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($subquery&nbsp;!==&nbsp;'')&nbsp;{
</td></tr>
<tr><td>1238</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array_unshift($this-&gt;_sqlParts['where'],&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($field)&nbsp;.&nbsp;'&nbsp;IN&nbsp;('&nbsp;.&nbsp;$subquery&nbsp;.&nbsp;')');
</td></tr>
<tr><td>1239</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1240</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1241</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$modifyLimit&nbsp;=&nbsp;false;
</td></tr>
<tr><td>1242</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1243</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1244</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1245</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['where']))?&nbsp;&nbsp;&nbsp;'&nbsp;WHERE&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;AND&nbsp;',&nbsp;$this-&gt;_sqlParts['where'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1246</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['groupby']))?&nbsp;'&nbsp;GROUP&nbsp;BY&nbsp;'&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_sqlParts['groupby'])&nbsp;&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1247</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['having']))?&nbsp;&nbsp;'&nbsp;HAVING&nbsp;'&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;AND&nbsp;',&nbsp;$this-&gt;_sqlParts['having']):&nbsp;'';
</td></tr>
<tr><td>1248</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['orderby']))?&nbsp;'&nbsp;ORDER&nbsp;BY&nbsp;'&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_sqlParts['orderby'])&nbsp;&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1249</td>
<td class="normal">
</td></tr>
<tr><td>1250</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($modifyLimit)&nbsp;{
</td></tr>
<tr><td>1251</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;=&nbsp;$this-&gt;_conn-&gt;modifyLimitQuery($q,&nbsp;$this-&gt;_sqlParts['limit'],&nbsp;$this-&gt;_sqlParts['offset']);
</td></tr>
<tr><td>1252</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1253</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1254</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;return&nbsp;to&nbsp;the&nbsp;previous&nbsp;state
</td></tr>
<tr><td>1255</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($string))&nbsp;{
</td></tr>
<tr><td>1256</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array_pop($this-&gt;_sqlParts['where']);
</td></tr>
<tr><td>1257</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1258</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($needsSubQuery)&nbsp;{
</td></tr>
<tr><td>1259</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array_shift($this-&gt;_sqlParts['where']);
</td></tr>
<tr><td>1260</td>
2007-11-09 01:14:39 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1261</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sql&nbsp;=&nbsp;$q;
</td></tr>
<tr><td>1262</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1263</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$q;
</td></tr>
<tr><td>1264</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1265</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1266</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1267</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;getLimitSubquery
</td></tr>
<tr><td>1268</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;this&nbsp;is&nbsp;method&nbsp;is&nbsp;used&nbsp;by&nbsp;the&nbsp;record&nbsp;limit&nbsp;algorithm
</td></tr>
<tr><td>1269</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1270</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;when&nbsp;fetching&nbsp;one-to-many,&nbsp;many-to-many&nbsp;associated&nbsp;data&nbsp;with&nbsp;LIMIT&nbsp;clause
</td></tr>
<tr><td>1271</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;an&nbsp;additional&nbsp;subquery&nbsp;is&nbsp;needed&nbsp;for&nbsp;limiting&nbsp;the&nbsp;number&nbsp;of&nbsp;returned&nbsp;records&nbsp;instead
</td></tr>
<tr><td>1272</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;of&nbsp;limiting&nbsp;the&nbsp;number&nbsp;of&nbsp;sql&nbsp;result&nbsp;set&nbsp;rows
</td></tr>
<tr><td>1273</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1274</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;limit&nbsp;subquery
</td></tr>
<tr><td>1275</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;A&nbsp;little&nbsp;refactor&nbsp;to&nbsp;make&nbsp;the&nbsp;method&nbsp;easier&nbsp;to&nbsp;understand&nbsp;&amp;&nbsp;maybe&nbsp;shorter?
</td></tr>
<tr><td>1276</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1277</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getLimitSubquery()
</td></tr>
<tr><td>1278</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1279</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$map&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;reset($this-&gt;_queryComponents);
</td></tr>
<tr><td>1280</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;&nbsp;=&nbsp;$map['table'];
</td></tr>
<tr><td>1281</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;key($this-&gt;_queryComponents);
</td></tr>
<tr><td>1282</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1283</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;short&nbsp;alias
</td></tr>
<tr><td>1284</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$alias&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias);
</td></tr>
<tr><td>1285</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;what&nbsp;about&nbsp;composite&nbsp;keys?
</td></tr>
<tr><td>1286</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$primaryKey&nbsp;=&nbsp;$alias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$table-&gt;getColumnName($table-&gt;getIdentifier());
</td></tr>
<tr><td>1287</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1288</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;initialize&nbsp;the&nbsp;base&nbsp;of&nbsp;the&nbsp;subquery
</td></tr>
<tr><td>1289</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;&nbsp;&nbsp;=&nbsp;'SELECT&nbsp;DISTINCT&nbsp;'&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($primaryKey);
</td></tr>
<tr><td>1290</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1291</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$driverName&nbsp;=&nbsp;$this-&gt;_conn-&gt;getAttribute(Doctrine::ATTR_DRIVER_NAME);
</td></tr>
<tr><td>1292</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1293</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;pgsql&nbsp;needs&nbsp;the&nbsp;order&nbsp;by&nbsp;fields&nbsp;to&nbsp;be&nbsp;preserved&nbsp;in&nbsp;select&nbsp;clause
</td></tr>
<tr><td>1294</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($driverName&nbsp;==&nbsp;'pgsql')&nbsp;{
</td></tr>
<tr><td>1295</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_sqlParts['orderby']&nbsp;as&nbsp;$part)&nbsp;{
</td></tr>
<tr><td>1296</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$part&nbsp;=&nbsp;trim($part);
</td></tr>
<tr><td>1297</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;$this-&gt;_tokenizer-&gt;bracketExplode($part,&nbsp;'&nbsp;');
</td></tr>
<tr><td>1298</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$part&nbsp;=&nbsp;trim($e[0]);
</td></tr>
<tr><td>1299</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1300</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($part,&nbsp;'.')&nbsp;===&nbsp;false)&nbsp;{
</td></tr>
<tr><td>1301</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1302</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1303</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1304</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;don't&nbsp;add&nbsp;functions
</td></tr>
<tr><td>1305</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($part,&nbsp;'(')&nbsp;!==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>1306</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1307</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1308</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1309</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;don't&nbsp;add&nbsp;primarykey&nbsp;column&nbsp;(its&nbsp;already&nbsp;in&nbsp;the&nbsp;select&nbsp;clause)
</td></tr>
<tr><td>1310</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($part&nbsp;!==&nbsp;$primaryKey)&nbsp;{
</td></tr>
<tr><td>1311</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;.=&nbsp;',&nbsp;'&nbsp;.&nbsp;$part;
</td></tr>
<tr><td>1312</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1313</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1314</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1315</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1316</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($driverName&nbsp;==&nbsp;'mysql'&nbsp;||&nbsp;$driverName&nbsp;==&nbsp;'pgsql')&nbsp;{
</td></tr>
<tr><td>1317</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_expressionMap&nbsp;as&nbsp;$dqlAlias&nbsp;=&gt;&nbsp;$expr)&nbsp;{
</td></tr>
<tr><td>1318</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($expr[1]))&nbsp;{
</td></tr>
<tr><td>1319</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;.=&nbsp;',&nbsp;'&nbsp;.&nbsp;$expr[0]&nbsp;.&nbsp;'&nbsp;AS&nbsp;'&nbsp;.&nbsp;$this-&gt;_aggregateAliasMap[$dqlAlias];
</td></tr>
<tr><td>1320</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1321</td>
2007-11-09 01:14:39 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1322</td>
2007-11-09 01:14:39 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1323</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1324</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;.=&nbsp;'&nbsp;FROM';
</td></tr>
<tr><td>1325</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1326</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_sqlParts['from']&nbsp;as&nbsp;$part)&nbsp;{
</td></tr>
<tr><td>1327</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;preserve&nbsp;LEFT&nbsp;JOINs&nbsp;only&nbsp;if&nbsp;needed
</td></tr>
<tr><td>1328</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(substr($part,&nbsp;0,&nbsp;9)&nbsp;===&nbsp;'LEFT&nbsp;JOIN')&nbsp;{
</td></tr>
<tr><td>1329</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('&nbsp;',&nbsp;$part);
</td></tr>
<tr><td>1330</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1331</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(empty($this-&gt;_sqlParts['orderby'])&nbsp;&amp;&amp;&nbsp;empty($this-&gt;_sqlParts['where']))&nbsp;{
</td></tr>
<tr><td>1332</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1333</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1334</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1335</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1336</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;.=&nbsp;'&nbsp;'&nbsp;.&nbsp;$part;
</td></tr>
<tr><td>1337</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1338</td>
<td class="normal">
</td></tr>
<tr><td>1339</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;all&nbsp;conditions&nbsp;must&nbsp;be&nbsp;preserved&nbsp;in&nbsp;subquery
</td></tr>
<tr><td>1340</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['where']))?&nbsp;&nbsp;&nbsp;'&nbsp;WHERE&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;AND&nbsp;',&nbsp;$this-&gt;_sqlParts['where'])&nbsp;&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1341</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['groupby']))?&nbsp;'&nbsp;GROUP&nbsp;BY&nbsp;'&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_sqlParts['groupby'])&nbsp;&nbsp;&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1342</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['having']))?&nbsp;&nbsp;'&nbsp;HAVING&nbsp;'&nbsp;&nbsp;&nbsp;.&nbsp;implode('&nbsp;AND&nbsp;',&nbsp;$this-&gt;_sqlParts['having'])&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1343</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1344</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($this-&gt;_sqlParts['orderby']))?&nbsp;'&nbsp;ORDER&nbsp;BY&nbsp;'&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$this-&gt;_sqlParts['orderby'])&nbsp;&nbsp;&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1345</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1346</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;add&nbsp;driver&nbsp;specific&nbsp;limit&nbsp;clause
</td></tr>
<tr><td>1347</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;=&nbsp;$this-&gt;_conn-&gt;modifyLimitQuery($subquery,&nbsp;$this-&gt;_sqlParts['limit'],&nbsp;$this-&gt;_sqlParts['offset']);
</td></tr>
<tr><td>1348</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1349</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parts&nbsp;=&nbsp;$this-&gt;_tokenizer-&gt;quoteExplode($subquery,&nbsp;'&nbsp;',&nbsp;&quot;'&quot;,&nbsp;&quot;'&quot;);
</td></tr>
<tr><td>1350</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1351</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($parts&nbsp;as&nbsp;$k&nbsp;=&gt;&nbsp;$part)&nbsp;{
</td></tr>
<tr><td>1352</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($part,&nbsp;'&nbsp;')&nbsp;!==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>1353</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1354</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1355</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1356</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$part&nbsp;=&nbsp;trim($part,&nbsp;&quot;\&quot;'`&quot;);
</td></tr>
<tr><td>1357</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1358</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&gt;hasSqlTableAlias($part))&nbsp;{
</td></tr>
<tr><td>1359</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parts[$k]&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($this-&gt;generateNewSqlTableAlias($part));
</td></tr>
<tr><td>1360</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1361</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1362</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1363</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($part,&nbsp;'.')&nbsp;===&nbsp;false)&nbsp;{
</td></tr>
<tr><td>1364</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1365</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1366</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;preg_match_all(&quot;/[a-zA-Z0-9_]+\.[a-z0-9_]+/i&quot;,&nbsp;$part,&nbsp;$m);
</td></tr>
<tr><td>1367</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1368</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($m[0]&nbsp;as&nbsp;$match)&nbsp;{
</td></tr>
<tr><td>1369</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('.',&nbsp;$match);
</td></tr>
<tr><td>1370</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e[0]&nbsp;=&nbsp;$this-&gt;generateNewSqlTableAlias($e[0]);
</td></tr>
<tr><td>1371</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1372</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parts[$k]&nbsp;=&nbsp;str_replace($match,&nbsp;implode('.',&nbsp;$e),&nbsp;$parts[$k]);
</td></tr>
<tr><td>1373</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1374</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1375</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1376</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($driverName&nbsp;==&nbsp;'mysql'&nbsp;||&nbsp;$driverName&nbsp;==&nbsp;'pgsql')&nbsp;{
</td></tr>
<tr><td>1377</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($parts&nbsp;as&nbsp;$k&nbsp;=&gt;&nbsp;$part)&nbsp;{
</td></tr>
<tr><td>1378</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($part,&nbsp;&quot;'&quot;)&nbsp;!==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>1379</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1380</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1381</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($part,&nbsp;'__')&nbsp;==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>1382</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1383</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1384</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1385</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;preg_match_all(&quot;/[a-zA-Z0-9_]+\_\_[a-z0-9_]+/i&quot;,&nbsp;$part,&nbsp;$m);
</td></tr>
<tr><td>1386</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1387</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($m[0]&nbsp;as&nbsp;$match)&nbsp;{
</td></tr>
<tr><td>1388</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('__',&nbsp;$match);
</td></tr>
<tr><td>1389</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e[0]&nbsp;=&nbsp;$this-&gt;generateNewTableAlias($e[0]);
</td></tr>
<tr><td>1390</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1391</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parts[$k]&nbsp;=&nbsp;str_replace($match,&nbsp;implode('__',&nbsp;$e),&nbsp;$parts[$k]);
</td></tr>
<tr><td>1392</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1393</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1394</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1395</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1396</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subquery&nbsp;=&nbsp;implode('&nbsp;',&nbsp;$parts);
</td></tr>
<tr><td>1397</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$subquery;
</td></tr>
<tr><td>1398</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1399</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1400</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1401</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;DQL&nbsp;PARSER
</td></tr>
<tr><td>1402</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parses&nbsp;a&nbsp;DQL&nbsp;query
</td></tr>
<tr><td>1403</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;first&nbsp;splits&nbsp;the&nbsp;query&nbsp;in&nbsp;parts&nbsp;and&nbsp;then&nbsp;uses&nbsp;individual
</td></tr>
<tr><td>1404</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;parsers&nbsp;for&nbsp;each&nbsp;part
</td></tr>
<tr><td>1405</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1406</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$query&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DQL&nbsp;query
</td></tr>
<tr><td>1407</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;boolean&nbsp;$clear&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;whether&nbsp;or&nbsp;not&nbsp;to&nbsp;clear&nbsp;the&nbsp;aliases
</td></tr>
<tr><td>1408</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@throws&nbsp;Doctrine_Query_Exception&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;some&nbsp;generic&nbsp;parsing&nbsp;error&nbsp;occurs
</td></tr>
<tr><td>1409</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Query
</td></tr>
<tr><td>1410</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1411</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;parseDqlQuery($query,&nbsp;$clear&nbsp;=&nbsp;true)
</td></tr>
<tr><td>1412</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1413</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($clear)&nbsp;{
</td></tr>
<tr><td>1414</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;clear();
</td></tr>
<tr><td>1415</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1416</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1417</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query&nbsp;=&nbsp;trim($query);
</td></tr>
<tr><td>1418</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query&nbsp;=&nbsp;str_replace(&quot;\n&quot;,&nbsp;'&nbsp;',&nbsp;$query);
</td></tr>
<tr><td>1419</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query&nbsp;=&nbsp;str_replace(&quot;\r&quot;,&nbsp;'&nbsp;',&nbsp;$query);
</td></tr>
<tr><td>1420</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1421</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parts&nbsp;=&nbsp;$this-&gt;_tokenizer-&gt;tokenizeQuery($query);
</td></tr>
<tr><td>1422</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1423</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($parts&nbsp;as&nbsp;$partName&nbsp;=&gt;&nbsp;$subParts)&nbsp;{
</td></tr>
<tr><td>1424</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$subParts&nbsp;=&nbsp;trim($subParts);
</td></tr>
<tr><td>1425</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$partName&nbsp;=&nbsp;strtolower($partName);
</td></tr>
<tr><td>1426</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch&nbsp;($partName)&nbsp;{
</td></tr>
<tr><td>1427</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'create':
</td></tr>
<tr><td>1428</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_type&nbsp;=&nbsp;self::CREATE;
</td></tr>
<tr><td>1429</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1430</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'insert':
</td></tr>
<tr><td>1431</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_type&nbsp;=&nbsp;self::INSERT;
</td></tr>
<tr><td>1432</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1433</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'delete':
</td></tr>
<tr><td>1434</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_type&nbsp;=&nbsp;self::DELETE;
</td></tr>
<tr><td>1435</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1436</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'select':
</td></tr>
<tr><td>1437</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_type&nbsp;=&nbsp;self::SELECT;
</td></tr>
<tr><td>1438</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_addDqlQueryPart($partName,&nbsp;$subParts);
</td></tr>
<tr><td>1439</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1440</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'update':
</td></tr>
<tr><td>1441</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_type&nbsp;=&nbsp;self::UPDATE;
</td></tr>
<tr><td>1442</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$partName&nbsp;=&nbsp;'from';
</td></tr>
<tr><td>1443</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'from':
</td></tr>
<tr><td>1444</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_addDqlQueryPart($partName,&nbsp;$subParts);
</td></tr>
<tr><td>1445</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1446</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'set':
</td></tr>
<tr><td>1447</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_addDqlQueryPart($partName,&nbsp;$subParts,&nbsp;true);
</td></tr>
<tr><td>1448</td>
2007-11-09 01:14:39 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1449</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'group':
</td></tr>
<tr><td>1450</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'order':
</td></tr>
<tr><td>1451</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$partName&nbsp;.=&nbsp;'by';
</td></tr>
<tr><td>1452</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'where':
</td></tr>
<tr><td>1453</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'having':
</td></tr>
<tr><td>1454</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'limit':
</td></tr>
<tr><td>1455</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'offset':
</td></tr>
<tr><td>1456</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_addDqlQueryPart($partName,&nbsp;$subParts);
</td></tr>
<tr><td>1457</td>
2007-11-09 01:14:39 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
</td></tr>
<tr><td>1458</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1459</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1460</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1461</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this;
</td></tr>
<tr><td>1462</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1463</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1464</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1465</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;Describe&nbsp;&amp;&nbsp;refactor...&nbsp;too&nbsp;long&nbsp;and&nbsp;nested.
</td></tr>
<tr><td>1466</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1467</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;load($path,&nbsp;$loadFields&nbsp;=&nbsp;true)
</td></tr>
<tr><td>1468</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1469</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp; if&nbsp;(isset($this-&gt;_queryComponents[$path]))&nbsp;{
</td></tr>
<tr><td>1470</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;_queryComponents[$path];
</td></tr>
<tr><td>1471</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp; }
</td></tr>
<tr><td>1472</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;$this-&gt;_tokenizer-&gt;quoteExplode($path,&nbsp;'&nbsp;INDEXBY&nbsp;');
</td></tr>
<tr><td>1473</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1474</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$mapWith&nbsp;=&nbsp;null;
</td></tr>
<tr><td>1475</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count($e)&nbsp;&gt;&nbsp;1)&nbsp;{
</td></tr>
<tr><td>1476</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$mapWith&nbsp;=&nbsp;trim($e[1]);
</td></tr>
<tr><td>1477</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1478</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$path&nbsp;=&nbsp;$e[0];
</td></tr>
<tr><td>1479</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1480</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1481</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;parse&nbsp;custom&nbsp;join&nbsp;conditions
</td></tr>
<tr><td>1482</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('&nbsp;ON&nbsp;',&nbsp;$path);
</td></tr>
<tr><td>1483</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1484</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$joinCondition&nbsp;=&nbsp;'';
</td></tr>
<tr><td>1485</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1486</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count($e)&nbsp;&gt;&nbsp;1)&nbsp;{
</td></tr>
<tr><td>1487</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$joinCondition&nbsp;=&nbsp;$e[1];
</td></tr>
<tr><td>1488</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$overrideJoin&nbsp;=&nbsp;true;
</td></tr>
<tr><td>1489</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$path&nbsp;=&nbsp;$e[0];
</td></tr>
<tr><td>1490</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>1491</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('&nbsp;WITH&nbsp;',&nbsp;$path);
</td></tr>
<tr><td>1492</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1493</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count($e)&nbsp;&gt;&nbsp;1)&nbsp;{
</td></tr>
<tr><td>1494</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$joinCondition&nbsp;=&nbsp;$e[1];
</td></tr>
<tr><td>1495</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$path&nbsp;=&nbsp;$e[0];
</td></tr>
<tr><td>1496</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1497</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$overrideJoin&nbsp;=&nbsp;false;
</td></tr>
<tr><td>1498</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1499</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1500</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tmp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;explode('&nbsp;',&nbsp;$path);
</td></tr>
<tr><td>1501</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$originalAlias&nbsp;=&nbsp;(count($tmp)&nbsp;&gt;&nbsp;1)&nbsp;?&nbsp;end($tmp)&nbsp;:&nbsp;null;
</td></tr>
<tr><td>1502</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1503</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;preg_split(&quot;/[.:]/&quot;,&nbsp;$tmp[0],&nbsp;-1);
</td></tr>
<tr><td>1504</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1505</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fullPath&nbsp;=&nbsp;$tmp[0];
</td></tr>
<tr><td>1506</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$prevPath&nbsp;=&nbsp;'';
</td></tr>
<tr><td>1507</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fullLength&nbsp;=&nbsp;strlen($fullPath);
</td></tr>
<tr><td>1508</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1509</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($this-&gt;_queryComponents[$e[0]]))&nbsp;{
</td></tr>
<tr><td>1510</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$this-&gt;_queryComponents[$e[0]]['table'];
</td></tr>
<tr><td>1511</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$e[0];
</td></tr>
<tr><td>1512</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1513</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$prevPath&nbsp;=&nbsp;$parent&nbsp;=&nbsp;array_shift($e);
</td></tr>
<tr><td>1514</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1515</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1516</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($e&nbsp;as&nbsp;$key&nbsp;=&gt;&nbsp;$name)&nbsp;{
</td></tr>
<tr><td>1517</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;length&nbsp;of&nbsp;the&nbsp;previous&nbsp;path
</td></tr>
<tr><td>1518</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$length&nbsp;=&nbsp;strlen($prevPath);
</td></tr>
<tr><td>1519</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1520</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;build&nbsp;the&nbsp;current&nbsp;component&nbsp;path
</td></tr>
<tr><td>1521</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$prevPath&nbsp;=&nbsp;($prevPath)&nbsp;?&nbsp;$prevPath&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$name&nbsp;:&nbsp;$name;
</td></tr>
<tr><td>1522</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1523</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$delimeter&nbsp;=&nbsp;substr($fullPath,&nbsp;$length,&nbsp;1);
</td></tr>
<tr><td>1524</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1525</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;if&nbsp;an&nbsp;alias&nbsp;is&nbsp;not&nbsp;given&nbsp;use&nbsp;the&nbsp;current&nbsp;path&nbsp;as&nbsp;an&nbsp;alias&nbsp;identifier
</td></tr>
<tr><td>1526</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strlen($prevPath)&nbsp;===&nbsp;$fullLength&nbsp;&amp;&amp;&nbsp;isset($originalAlias))&nbsp;{
</td></tr>
<tr><td>1527</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$originalAlias;
</td></tr>
<tr><td>1528</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>1529</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;$prevPath;
</td></tr>
<tr><td>1530</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1531</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1532</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;if&nbsp;the&nbsp;current&nbsp;alias&nbsp;already&nbsp;exists,&nbsp;skip&nbsp;it
</td></tr>
<tr><td>1533</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($this-&gt;_queryComponents[$componentAlias]))&nbsp;{
</td></tr>
<tr><td>1534</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
</td></tr>
<tr><td>1535</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1536</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1537</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;isset($table))&nbsp;{
</td></tr>
<tr><td>1538</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;the&nbsp;root&nbsp;of&nbsp;the&nbsp;path
</td></tr>
<tr><td>1539</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1540</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$this-&gt;loadRoot($name,&nbsp;$componentAlias);
</td></tr>
<tr><td>1541</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>1542</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$join&nbsp;=&nbsp;($delimeter&nbsp;==&nbsp;':')&nbsp;?&nbsp;'INNER&nbsp;JOIN&nbsp;'&nbsp;:&nbsp;'LEFT&nbsp;JOIN&nbsp;';
</td></tr>
<tr><td>1543</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1544</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$relation&nbsp;=&nbsp;$table-&gt;getRelation($name);
</td></tr>
<tr><td>1545</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$localTable&nbsp;=&nbsp;$table;
</td></tr>
<tr><td>1546</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1547</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;$relation-&gt;getTable();
</td></tr>
<tr><td>1548</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_queryComponents[$componentAlias]&nbsp;=&nbsp;array('table'&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;$table,
</td></tr>
<tr><td>1549</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'parent'&nbsp;&nbsp;&nbsp;=&gt;&nbsp;$parent,
</td></tr>
<tr><td>1550</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'relation'&nbsp;=&gt;&nbsp;$relation,
</td></tr>
<tr><td>1551</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'map'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;null);
</td></tr>
<tr><td>1552</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$relation-&gt;isOneToOne())&nbsp;{
</td></tr>
<tr><td>1553</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_needsSubquery&nbsp;=&nbsp;true;
</td></tr>
<tr><td>1554</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1555</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1556</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$localAlias&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;getTableAlias($parent,&nbsp;$table-&gt;getTableName());
</td></tr>
<tr><td>1557</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$foreignAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias,&nbsp;$relation-&gt;getTable()-&gt;getTableName());
</td></tr>
<tr><td>1558</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$localSql&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($table-&gt;getTableName())
</td></tr>
<tr><td>1559</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;'
</td></tr>
<tr><td>1560</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($localAlias);
</td></tr>
<tr><td>1561</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1562</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$foreignSql&nbsp;&nbsp;&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($relation-&gt;getTable()-&gt;getTableName())
</td></tr>
<tr><td>1563</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;'
</td></tr>
<tr><td>1564</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($foreignAlias);
</td></tr>
<tr><td>1565</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1566</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$map&nbsp;=&nbsp;$relation-&gt;getTable()-&gt;inheritanceMap;
</td></tr>
<tr><td>1567</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1568</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$loadFields&nbsp;||&nbsp;!&nbsp;empty($map)&nbsp;||&nbsp;$joinCondition)&nbsp;{
</td></tr>
<tr><td>1569</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_subqueryAliases[]&nbsp;=&nbsp;$foreignAlias;
</td></tr>
<tr><td>1570</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1571</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1572</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($relation&nbsp;instanceof&nbsp;Doctrine_Relation_Association)&nbsp;{
</td></tr>
<tr><td>1573</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$asf&nbsp;=&nbsp;$relation-&gt;getAssociationTable();
</td></tr>
<tr><td>1574</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1575</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$assocTableName&nbsp;=&nbsp;$asf-&gt;getTableName();
</td></tr>
<tr><td>1576</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1577</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$loadFields&nbsp;||&nbsp;!&nbsp;empty($map)&nbsp;||&nbsp;$joinCondition)&nbsp;{
</td></tr>
<tr><td>1578</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_subqueryAliases[]&nbsp;=&nbsp;$assocTableName;
</td></tr>
<tr><td>1579</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1580</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1581</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$assocPath&nbsp;=&nbsp;$prevPath&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$asf-&gt;getComponentName();
</td></tr>
<tr><td>1582</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1583</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_queryComponents[$assocPath]&nbsp;=&nbsp;array('parent'&nbsp;=&gt;&nbsp;$prevPath,&nbsp;'relation'&nbsp;=&gt;&nbsp;$relation,&nbsp;'table'&nbsp;=&gt;&nbsp;$asf);
</td></tr>
<tr><td>1584</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1585</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$assocAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($assocPath,&nbsp;$asf-&gt;getTableName());
</td></tr>
<tr><td>1586</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1587</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;=&nbsp;$join&nbsp;.&nbsp;$assocTableName&nbsp;.&nbsp;'&nbsp;'&nbsp;.&nbsp;$assocAlias;
</td></tr>
<tr><td>1588</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1589</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;'&nbsp;ON&nbsp;'&nbsp;.&nbsp;$localAlias
</td></tr>
<tr><td>1590</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'.'
</td></tr>
<tr><td>1591</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$localTable-&gt;getIdentifier()&nbsp;//&nbsp;what&nbsp;about&nbsp;composite&nbsp;keys?
</td></tr>
<tr><td>1592</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;=&nbsp;'
</td></tr>
<tr><td>1593</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$assocAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$relation-&gt;getLocal();
</td></tr>
<tr><td>1594</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1595</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($relation-&gt;isEqual())&nbsp;{
</td></tr>
<tr><td>1596</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;equal&nbsp;nest&nbsp;relation&nbsp;needs&nbsp;additional&nbsp;condition
</td></tr>
<tr><td>1597</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;'&nbsp;OR&nbsp;'&nbsp;.&nbsp;$localAlias
</td></tr>
<tr><td>1598</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'.'
</td></tr>
<tr><td>1599</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$table-&gt;getColumnName($table-&gt;getIdentifier())
</td></tr>
<tr><td>1600</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;=&nbsp;'
</td></tr>
<tr><td>1601</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$assocAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$relation-&gt;getForeign();
</td></tr>
<tr><td>1602</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1603</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1604</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['from'][]&nbsp;=&nbsp;$queryPart;
</td></tr>
<tr><td>1605</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1606</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;=&nbsp;$join&nbsp;.&nbsp;$foreignSql;
</td></tr>
<tr><td>1607</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1608</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$overrideJoin)&nbsp;{
</td></tr>
<tr><td>1609</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;'&nbsp;ON&nbsp;';
</td></tr>
<tr><td>1610</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1611</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($relation-&gt;isEqual())&nbsp;{
</td></tr>
<tr><td>1612</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;'(';
</td></tr>
<tr><td>1613</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1614</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1615</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($foreignAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$relation-&gt;getTable()-&gt;getIdentifier())
</td></tr>
<tr><td>1616</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;=&nbsp;'
</td></tr>
<tr><td>1617</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($assocAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$relation-&gt;getForeign());
</td></tr>
<tr><td>1618</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1619</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($relation-&gt;isEqual())&nbsp;{
</td></tr>
<tr><td>1620</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;'&nbsp;OR&nbsp;'
</td></tr>
<tr><td>1621</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($foreignAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$table-&gt;getColumnName($table-&gt;getIdentifier()))
</td></tr>
<tr><td>1622</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;=&nbsp;'&nbsp;
</td></tr>
<tr><td>1623</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($assocAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$relation-&gt;getLocal())
</td></tr>
<tr><td>1624</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;')&nbsp;AND&nbsp;'&nbsp;
</td></tr>
<tr><td>1625</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($foreignAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$table-&gt;getIdentifier())
</td></tr>
<tr><td>1626</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;!=&nbsp;'&nbsp;&nbsp;
</td></tr>
<tr><td>1627</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($localAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$table-&gt;getIdentifier());
</td></tr>
<tr><td>1628</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1629</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1630</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>1631</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1632</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;=&nbsp;$join&nbsp;.&nbsp;$foreignSql;
</td></tr>
<tr><td>1633</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1634</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$overrideJoin)&nbsp;{
</td></tr>
<tr><td>1635</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;'&nbsp;ON&nbsp;'
</td></tr>
<tr><td>1636</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($localAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$relation-&gt;getLocal())
</td></tr>
<tr><td>1637</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;=&nbsp;'&nbsp;
</td></tr>
<tr><td>1638</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($foreignAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$relation-&gt;getForeign());
</td></tr>
<tr><td>1639</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1640</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1641</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1642</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;$this-&gt;buildInheritanceJoinSql($table-&gt;getComponentName(),&nbsp;$componentAlias);
</td></tr>
<tr><td>1643</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1644</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['from'][$componentAlias]&nbsp;=&nbsp;$queryPart;
</td></tr>
<tr><td>1645</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($joinCondition))&nbsp;{
</td></tr>
<tr><td>1646</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingJoinConditions[$componentAlias]&nbsp;=&nbsp;$joinCondition;
</td></tr>
<tr><td>1647</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1648</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1649</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($loadFields)&nbsp;{
</td></tr>
<tr><td>1650</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1651</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$restoreState&nbsp;=&nbsp;false;
</td></tr>
<tr><td>1652</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;load&nbsp;fields&nbsp;if&nbsp;necessary
</td></tr>
<tr><td>1653</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($loadFields&nbsp;&amp;&amp;&nbsp;empty($this-&gt;_dqlParts['select']))&nbsp;{
</td></tr>
<tr><td>1654</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_pendingFields[$componentAlias]&nbsp;=&nbsp;array('*');
</td></tr>
<tr><td>1655</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1656</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1657</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parent&nbsp;=&nbsp;$prevPath;
</td></tr>
<tr><td>1658</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1659</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1660</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$this-&gt;_queryComponents[$componentAlias]['table'];
</td></tr>
<tr><td>1661</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1662</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$indexBy&nbsp;=&nbsp;null;
</td></tr>
<tr><td>1663</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1664</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($mapWith))&nbsp;{
</td></tr>
<tr><td>1665</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$e&nbsp;=&nbsp;explode('.',&nbsp;$mapWith);
</td></tr>
<tr><td>1666</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1667</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($e[1]))&nbsp;{
</td></tr>
<tr><td>1668</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$indexBy&nbsp;=&nbsp;$e[1];
</td></tr>
<tr><td>1669</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1670</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;($table-&gt;getBoundQueryPart('indexBy')&nbsp;!==&nbsp;null)&nbsp;{
</td></tr>
<tr><td>1671</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$indexBy&nbsp;=&nbsp;$table-&gt;getBoundQueryPart('indexBy');
</td></tr>
<tr><td>1672</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1673</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1674</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($indexBy&nbsp;!==&nbsp;null)&nbsp;{
</td></tr>
<tr><td>1675</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$table-&gt;hasColumn($indexBy))&nbsp;{
</td></tr>
<tr><td>1676</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Doctrine_Query_Exception(&quot;Couldn't&nbsp;use&nbsp;key&nbsp;mapping.&nbsp;Column&nbsp;&quot;&nbsp;.&nbsp;$indexBy&nbsp;.&nbsp;&quot;&nbsp;does&nbsp;not&nbsp;exist.&quot;);
</td></tr>
<tr><td>1677</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1678</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1679</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_queryComponents[$componentAlias]['map']&nbsp;=&nbsp;$table-&gt;getColumnName($indexBy);
</td></tr>
<tr><td>1680</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1681</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;_queryComponents[$componentAlias];
</td></tr>
<tr><td>1682</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1683</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1684</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1685</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;loadRoot
</td></tr>
<tr><td>1686</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1687</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$name
</td></tr>
<tr><td>1688</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$componentAlias
</td></tr>
<tr><td>1689</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;DESCRIBE&nbsp;ME!
</td></tr>
<tr><td>1690</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1691</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;loadRoot($name,&nbsp;$componentAlias)
</td></tr>
<tr><td>1692</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1693</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;the&nbsp;connection&nbsp;for&nbsp;the&nbsp;component
</td></tr>
<tr><td>1694</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_conn&nbsp;=&nbsp;Doctrine_Manager::getInstance()
</td></tr>
<tr><td>1695</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;getConnectionForComponent($name);
</td></tr>
<tr><td>1696</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1697</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$this-&gt;_conn-&gt;getTable($name);
</td></tr>
<tr><td>1698</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableName&nbsp;=&nbsp;$table-&gt;getTableName();
</td></tr>
<tr><td>1699</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1700</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;the&nbsp;short&nbsp;alias&nbsp;for&nbsp;this&nbsp;table
</td></tr>
<tr><td>1701</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias,&nbsp;$tableName);
</td></tr>
<tr><td>1702</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;quote&nbsp;table&nbsp;name
</td></tr>
<tr><td>1703</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableName);
</td></tr>
<tr><td>1704</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1705</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&gt;_type&nbsp;===&nbsp;self::SELECT)&nbsp;{
</td></tr>
<tr><td>1706</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;'&nbsp;'&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias);
</td></tr>
<tr><td>1707</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1708</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1709</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_tableAliasMap[$tableAlias]&nbsp;=&nbsp;$componentAlias;
</td></tr>
<tr><td>1710</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1711</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;$this-&gt;buildInheritanceJoinSql($name,&nbsp;$componentAlias);
</td></tr>
<tr><td>1712</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1713</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_sqlParts['from'][]&nbsp;=&nbsp;$queryPart;
</td></tr>
<tr><td>1714</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1715</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_queryComponents[$componentAlias]&nbsp;=&nbsp;array('table'&nbsp;=&gt;&nbsp;$table,&nbsp;'map'&nbsp;=&gt;&nbsp;null);
</td></tr>
<tr><td>1716</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1717</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$table;
</td></tr>
<tr><td>1718</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1719</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1720</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1721</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@todo&nbsp;DESCRIBE&nbsp;ME!
</td></tr>
<tr><td>1722</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1723</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;buildInheritanceJoinSql($name,&nbsp;$componentAlias)
</td></tr>
<tr><td>1724</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1725</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;the&nbsp;connection&nbsp;for&nbsp;the&nbsp;component
</td></tr>
<tr><td>1726</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_conn&nbsp;=&nbsp;Doctrine_Manager::getInstance()-&gt;getConnectionForComponent($name);
</td></tr>
<tr><td>1727</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1728</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$this-&gt;_conn-&gt;getTable($name);
</td></tr>
<tr><td>1729</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableName&nbsp;=&nbsp;$table-&gt;getTableName();
</td></tr>
<tr><td>1730</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1731</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;the&nbsp;short&nbsp;alias&nbsp;for&nbsp;this&nbsp;table
</td></tr>
<tr><td>1732</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($componentAlias,&nbsp;$tableName);
</td></tr>
<tr><td>1733</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1734</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;=&nbsp;'';
</td></tr>
<tr><td>1735</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1736</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($table-&gt;getOption('joinedParents')&nbsp;as&nbsp;$parent)&nbsp;{
</td></tr>
<tr><td>1737</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $parentTable&nbsp;=&nbsp;$this-&gt;_conn-&gt;getTable($parent);
</td></tr>
<tr><td>1738</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1739</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parentAlias&nbsp;=&nbsp;$componentAlias&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$parent;
</td></tr>
<tr><td>1740</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1741</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;the&nbsp;short&nbsp;alias&nbsp;for&nbsp;the&nbsp;parent&nbsp;table
</td></tr>
<tr><td>1742</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parentTableAlias&nbsp;=&nbsp;$this-&gt;getTableAlias($parentAlias,&nbsp;$parentTable-&gt;getTableName());
</td></tr>
<tr><td>1743</td>
2007-11-09 01:14:39 +03:00
<td class="normal">
</td></tr>
<tr><td>1744</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;'&nbsp;LEFT&nbsp;JOIN&nbsp;'&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($parentTable-&gt;getTableName())
</td></tr>
<tr><td>1745</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;'&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($parentTableAlias)&nbsp;.&nbsp;'&nbsp;ON&nbsp;';
</td></tr>
<tr><td>1746</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1747</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Doctrine::dump($table-&gt;getIdentifier());
</td></tr>
<tr><td>1748</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;((array)&nbsp;$table-&gt;getIdentifier()&nbsp;as&nbsp;$identifier)&nbsp;{
</td></tr>
<tr><td>1749</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$column&nbsp;=&nbsp;$table-&gt;getColumnName($identifier);
</td></tr>
<tr><td>1750</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1751</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$queryPart&nbsp;.=&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($tableAlias)&nbsp;
</td></tr>
<tr><td>1752</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($column)
</td></tr>
<tr><td>1753</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'&nbsp;=&nbsp;'&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($parentTableAlias)
</td></tr>
<tr><td>1754</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'.'&nbsp;.&nbsp;$this-&gt;_conn-&gt;quoteIdentifier($column);
</td></tr>
<tr><td>1755</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1756</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1757</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1758</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$queryPart;
</td></tr>
<tr><td>1759</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1760</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1761</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1762</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;count
</td></tr>
<tr><td>1763</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;fetches&nbsp;the&nbsp;count&nbsp;of&nbsp;the&nbsp;query
</td></tr>
<tr><td>1764</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1765</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;method&nbsp;executes&nbsp;the&nbsp;main&nbsp;query&nbsp;without&nbsp;all&nbsp;the
</td></tr>
<tr><td>1766</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;selected&nbsp;fields,&nbsp;ORDER&nbsp;BY&nbsp;part,&nbsp;LIMIT&nbsp;part&nbsp;and&nbsp;OFFSET&nbsp;part.
</td></tr>
<tr><td>1767</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1768</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Example:
</td></tr>
<tr><td>1769</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Main&nbsp;query:&nbsp;
</td></tr>
<tr><td>1770</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT&nbsp;u.*,&nbsp;p.phonenumber&nbsp;FROM&nbsp;User&nbsp;u
</td></tr>
<tr><td>1771</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LEFT&nbsp;JOIN&nbsp;u.Phonenumber&nbsp;p&nbsp;
</td></tr>
<tr><td>1772</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;p.phonenumber&nbsp;=&nbsp;'123&nbsp;123'&nbsp;LIMIT&nbsp;10
</td></tr>
<tr><td>1773</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1774</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;modified&nbsp;DQL&nbsp;query:
</td></tr>
<tr><td>1775</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT&nbsp;COUNT(DISTINCT&nbsp;u.id)&nbsp;FROM&nbsp;User&nbsp;u
</td></tr>
<tr><td>1776</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LEFT&nbsp;JOIN&nbsp;u.Phonenumber&nbsp;p
</td></tr>
<tr><td>1777</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;p.phonenumber&nbsp;=&nbsp;'123&nbsp;123'
</td></tr>
<tr><td>1778</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1779</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;array&nbsp;$params&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;of&nbsp;prepared&nbsp;statement&nbsp;parameters
</td></tr>
<tr><td>1780</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;count&nbsp;of&nbsp;this&nbsp;query
</td></tr>
<tr><td>1781</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1782</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;count($params&nbsp;=&nbsp;array())
</td></tr>
<tr><td>1783</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1784</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;triggers&nbsp;dql&nbsp;parsing/processing
</td></tr>
<tr><td>1785</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;getQuery();&nbsp;//&nbsp;this&nbsp;is&nbsp;ugly
</td></tr>
<tr><td>1786</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1787</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;initialize&nbsp;temporary&nbsp;variables
</td></tr>
<tr><td>1788</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$where&nbsp;&nbsp;=&nbsp;$this-&gt;_sqlParts['where'];
</td></tr>
<tr><td>1789</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$having&nbsp;=&nbsp;$this-&gt;_sqlParts['having'];
</td></tr>
<tr><td>1790</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$groupby&nbsp;=&nbsp;$this-&gt;_sqlParts['groupby'];
</td></tr>
<tr><td>1791</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$map&nbsp;=&nbsp;reset($this-&gt;_queryComponents);
</td></tr>
<tr><td>1792</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$componentAlias&nbsp;=&nbsp;key($this-&gt;_queryComponents);
</td></tr>
<tr><td>1793</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$table&nbsp;=&nbsp;$map['table'];
</td></tr>
<tr><td>1794</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1795</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;build&nbsp;the&nbsp;query&nbsp;base
</td></tr>
<tr><td>1796</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;&nbsp;=&nbsp;'SELECT&nbsp;COUNT(DISTINCT&nbsp;'&nbsp;.&nbsp;$this-&gt;getTableAlias($componentAlias)
</td></tr>
<tr><td>1797</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;'.'&nbsp;.&nbsp;implode(',',&nbsp;(array)&nbsp;$table-&gt;getIdentifier())
</td></tr>
<tr><td>1798</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&nbsp;')&nbsp;AS&nbsp;num_results';
</td></tr>
<tr><td>1799</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1800</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($this-&gt;_sqlParts['select']&nbsp;as&nbsp;$field)&nbsp;{
</td></tr>
<tr><td>1801</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strpos($field,&nbsp;'(')&nbsp;!==&nbsp;false)&nbsp;{
</td></tr>
<tr><td>1802</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;',&nbsp;'&nbsp;.&nbsp;$field;
</td></tr>
<tr><td>1803</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1804</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1805</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1806</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;'&nbsp;FROM&nbsp;'&nbsp;.&nbsp;$this-&gt;_buildSqlFromPart();
</td></tr>
<tr><td>1807</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1808</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;append&nbsp;column&nbsp;aggregation&nbsp;inheritance&nbsp;(if&nbsp;needed)
</td></tr>
<tr><td>1809</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$string&nbsp;=&nbsp;$this-&gt;applyInheritance();
</td></tr>
<tr><td>1810</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1811</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;empty($string))&nbsp;{
</td></tr>
<tr><td>1812</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$where[]&nbsp;=&nbsp;$string;
</td></tr>
<tr><td>1813</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1814</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;append&nbsp;conditions
</td></tr>
<tr><td>1815</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($where))&nbsp;?&nbsp;&nbsp;'&nbsp;WHERE&nbsp;'&nbsp;&nbsp;.&nbsp;implode('&nbsp;AND&nbsp;',&nbsp;$where)&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1816</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($groupby))&nbsp;?&nbsp;&nbsp;'&nbsp;GROUP&nbsp;BY&nbsp;'&nbsp;&nbsp;.&nbsp;implode(',&nbsp;',&nbsp;$groupby)&nbsp;:&nbsp;'';
</td></tr>
<tr><td>1817</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$q&nbsp;.=&nbsp;(&nbsp;!&nbsp;empty($having))&nbsp;?&nbsp;'&nbsp;HAVING&nbsp;'&nbsp;.&nbsp;implode('&nbsp;AND&nbsp;',&nbsp;$having):&nbsp;'';
</td></tr>
<tr><td>1818</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1819</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;is_array($params))&nbsp;{
</td></tr>
<tr><td>1820</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$params&nbsp;=&nbsp;array($params);
</td></tr>
<tr><td>1821</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1822</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;append&nbsp;parameters
</td></tr>
<tr><td>1823</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$params&nbsp;=&nbsp;array_merge($this-&gt;_params['where'],&nbsp;$this-&gt;_params['having'],&nbsp;$params);
</td></tr>
<tr><td>1824</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1825</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$params&nbsp;=&nbsp;$this-&gt;convertEnums($params);
</td></tr>
<tr><td>1826</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1827</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$results&nbsp;=&nbsp;$this-&gt;getConnection()-&gt;fetchAll($q,&nbsp;$params);
</td></tr>
<tr><td>1828</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1829</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count($results)&nbsp;&gt;&nbsp;1)&nbsp;{
</td></tr>
<tr><td>1830</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count&nbsp;=&nbsp;0;
</td></tr>
<tr><td>1831</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($results&nbsp;as&nbsp;$result)&nbsp;{
</td></tr>
<tr><td>1832</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count&nbsp;+=&nbsp;$result['num_results'];
</td></tr>
<tr><td>1833</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1834</td>
2007-11-25 23:32:49 +03:00
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
</td></tr>
<tr><td>1835</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count&nbsp;=&nbsp;isset($results[0])&nbsp;?&nbsp;$results[0]['num_results']:0;
</td></tr>
<tr><td>1836</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1837</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1838</td>
2007-11-25 23:32:49 +03:00
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(int)&nbsp;$count;
</td></tr>
<tr><td>1839</td>
2007-11-25 23:32:49 +03:00
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1840</td>
2007-11-25 23:32:49 +03:00
<td class="normal">
</td></tr>
<tr><td>1841</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1842</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;query
</td></tr>
<tr><td>1843</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;query&nbsp;the&nbsp;database&nbsp;with&nbsp;DQL&nbsp;(Doctrine&nbsp;Query&nbsp;Language)
</td></tr>
<tr><td>1844</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
2007-10-29 20:08:24 +03:00
</td></tr>
<tr><td>1845</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$query&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DQL&nbsp;query
2007-11-09 01:14:39 +03:00
</td></tr>
<tr><td>1846</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;array&nbsp;$params&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prepared&nbsp;statement&nbsp;parameters
2007-11-09 01:14:39 +03:00
</td></tr>
<tr><td>1847</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;int&nbsp;$hydrationMode&nbsp;Doctrine::FETCH_ARRAY&nbsp;or&nbsp;Doctrine::FETCH_RECORD
2007-11-09 01:14:39 +03:00
</td></tr>
<tr><td>1848</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@see&nbsp;Doctrine::FETCH_*&nbsp;constants
2007-11-09 01:14:39 +03:00
</td></tr>
<tr><td>1849</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;mixed
2007-11-09 01:14:39 +03:00
</td></tr>
<tr><td>1850</td>
2007-11-25 23:32:49 +03:00
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1851</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;query($query,&nbsp;$params&nbsp;=&nbsp;array(),&nbsp;$hydrationMode&nbsp;=&nbsp;null)
</td></tr>
<tr><td>1852</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1853</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;parseDqlQuery($query);
</td></tr>
<tr><td>1854</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$this-&gt;execute($params,&nbsp;$hydrationMode);
</td></tr>
<tr><td>1855</td>
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1856</td>
<td class="normal">
</td></tr>
<tr><td>1857</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1858</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Copies&nbsp;a&nbsp;Doctrine_Query&nbsp;object.
</td></tr>
<tr><td>1859</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1860</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;Doctrine_Query&nbsp;&nbsp;&nbsp;Doctrine&nbsp;query&nbsp;instance.
</td></tr>
<tr><td>1861</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;ommited&nbsp;the&nbsp;instance&nbsp;itself&nbsp;will&nbsp;be&nbsp;used&nbsp;as&nbsp;source.
</td></tr>
<tr><td>1862</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Query&nbsp;&nbsp;Copy&nbsp;of&nbsp;the&nbsp;Doctrine_Query&nbsp;instance.
</td></tr>
<tr><td>1863</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1864</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;copy(Doctrine_Query&nbsp;$query&nbsp;=&nbsp;null)
</td></tr>
<tr><td>1865</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1866</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;!&nbsp;$query)&nbsp;{
</td></tr>
<tr><td>1867</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query&nbsp;=&nbsp;$this;
</td></tr>
<tr><td>1868</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1869</td>
<td class="normal">
</td></tr>
<tr><td>1870</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$new&nbsp;=&nbsp;new&nbsp;Doctrine_Query();
</td></tr>
<tr><td>1871</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$new-&gt;_dqlParts&nbsp;=&nbsp;$query-&gt;_dqlParts;
</td></tr>
<tr><td>1872</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$new-&gt;_params&nbsp;=&nbsp;$query-&gt;_params;
</td></tr>
<tr><td>1873</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$new-&gt;_hydrator&nbsp;=&nbsp;$query-&gt;_hydrator;
</td></tr>
<tr><td>1874</td>
<td class="normal">
</td></tr>
<tr><td>1875</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$new;
</td></tr>
<tr><td>1876</td>
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1877</td>
<td class="normal">
</td></tr>
<tr><td>1878</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1879</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Frees&nbsp;the&nbsp;resources&nbsp;used&nbsp;by&nbsp;the&nbsp;query&nbsp;object.&nbsp;It&nbsp;especially&nbsp;breaks&nbsp;a&nbsp;
</td></tr>
<tr><td>1880</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;cyclic&nbsp;reference&nbsp;between&nbsp;the&nbsp;query&nbsp;object&nbsp;and&nbsp;it's&nbsp;parsers.&nbsp;This&nbsp;enables
</td></tr>
<tr><td>1881</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;PHP's&nbsp;current&nbsp;GC&nbsp;to&nbsp;reclaim&nbsp;the&nbsp;memory.
</td></tr>
<tr><td>1882</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;method&nbsp;can&nbsp;therefore&nbsp;be&nbsp;used&nbsp;to&nbsp;reduce&nbsp;memory&nbsp;usage&nbsp;when&nbsp;creating&nbsp;a&nbsp;lot
</td></tr>
<tr><td>1883</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;of&nbsp;query&nbsp;objects&nbsp;during&nbsp;a&nbsp;request.
</td></tr>
<tr><td>1884</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1885</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;Doctrine_Query&nbsp;&nbsp;&nbsp;this&nbsp;object
</td></tr>
<tr><td>1886</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1887</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;free()
</td></tr>
<tr><td>1888</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1889</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;reset();
</td></tr>
<tr><td>1890</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_parsers&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1891</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_dqlParts&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1892</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;_enumParams&nbsp;=&nbsp;array();
</td></tr>
<tr><td>1893</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1894</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>1895</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1896</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;serialize
</td></tr>
<tr><td>1897</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;this&nbsp;method&nbsp;is&nbsp;automatically&nbsp;called&nbsp;when&nbsp;this&nbsp;Doctrine_Hydrate&nbsp;is&nbsp;serialized
</td></tr>
<tr><td>1898</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1899</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;array&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;of&nbsp;serialized&nbsp;properties
</td></tr>
<tr><td>1900</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1901</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;serialize()
</td></tr>
<tr><td>1902</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1903</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$vars&nbsp;=&nbsp;get_object_vars($this);
</td></tr>
<tr><td>1904</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1905</td>
<td class="normal">
</td></tr>
<tr><td>1906</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>1907</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;unseralize
</td></tr>
<tr><td>1908</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;this&nbsp;method&nbsp;is&nbsp;automatically&nbsp;called&nbsp;everytime&nbsp;a&nbsp;Doctrine_Hydrate&nbsp;object&nbsp;is&nbsp;unserialized
</td></tr>
<tr><td>1909</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>1910</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$serialized&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Doctrine_Record&nbsp;as&nbsp;serialized&nbsp;string
</td></tr>
<tr><td>1911</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;void
</td></tr>
<tr><td>1912</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>1913</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;unserialize($serialized)
</td></tr>
<tr><td>1914</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>1915</td>
<td class="normal">
</td></tr>
<tr><td>1916</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>1917</td>
<td class="normal">}
</td></tr>
</table></body></html>