2007-10-14 01:45:08 +04:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Coverage for Doctrine_Connection_Mysql</title>
|
|
|
|
<style type="text/css">
|
|
|
|
.covered{ background: green;}
|
|
|
|
.normal{ background: white;}
|
|
|
|
.red{ background: red;}
|
|
|
|
.orange{ background: #f90;}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body><h1>Coverage for Doctrine_Connection_Mysql</h1><p><a href="index.php">Back to coverage report</a></p><table>
|
|
|
|
<tr><td>1</td>
|
|
|
|
<td class="normal"><?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"> * $Id: Mysql.php 3183 2007-11-18 16:06:37Z romanb $
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>4</td>
|
|
|
|
<td class="normal"> *
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>5</td>
|
|
|
|
<td class="normal"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>6</td>
|
|
|
|
<td class="normal"> * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>7</td>
|
|
|
|
<td class="normal"> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>8</td>
|
|
|
|
<td class="normal"> * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>9</td>
|
|
|
|
<td class="normal"> * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>10</td>
|
|
|
|
<td class="normal"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>11</td>
|
|
|
|
<td class="normal"> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>12</td>
|
|
|
|
<td class="normal"> * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>13</td>
|
|
|
|
<td class="normal"> * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>14</td>
|
|
|
|
<td class="normal"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>15</td>
|
|
|
|
<td class="normal"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>16</td>
|
|
|
|
<td class="normal"> *
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>17</td>
|
|
|
|
<td class="normal"> * This software consists of voluntary contributions made by many individuals
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>18</td>
|
|
|
|
<td class="normal"> * and is licensed under the LGPL. For more information, see
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>19</td>
|
|
|
|
<td class="normal"> * <http://www.phpdoctrine.com>.
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>20</td>
|
|
|
|
<td class="normal"> */
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>21</td>
|
|
|
|
<td class="covered">Doctrine::autoload('Doctrine_Connection_Common');
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>22</td>
|
|
|
|
<td class="normal">/**
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>23</td>
|
|
|
|
<td class="normal"> * Doctrine_Connection_Mysql
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>24</td>
|
|
|
|
<td class="normal"> *
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>25</td>
|
|
|
|
<td class="normal"> * @package Doctrine
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>26</td>
|
|
|
|
<td class="normal"> * @subpackage Connection
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>27</td>
|
|
|
|
<td class="normal"> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>28</td>
|
|
|
|
<td class="normal"> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>29</td>
|
|
|
|
<td class="normal"> * @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>30</td>
|
2007-11-25 23:32:49 +03:00
|
|
|
<td class="normal"> * @version $Revision: 3183 $
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>31</td>
|
|
|
|
<td class="normal"> * @link www.phpdoctrine.com
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>32</td>
|
|
|
|
<td class="normal"> * @since 1.0
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>33</td>
|
|
|
|
<td class="normal"> */
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>34</td>
|
|
|
|
<td class="covered">class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>35</td>
|
|
|
|
<td class="normal">{
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>36</td>
|
|
|
|
<td class="normal"> /**
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>37</td>
|
|
|
|
<td class="normal"> * @var string $driverName the name of this connection driver
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>38</td>
|
|
|
|
<td class="normal"> */
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>39</td>
|
|
|
|
<td class="normal"> protected $driverName = 'Mysql';
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>40</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>41</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> /**
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>42</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> * the constructor
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>43</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>44</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> * @param Doctrine_Manager $manager
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>45</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> * @param PDO|Doctrine_Adapter $adapter database handler
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>46</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> */
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>47</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> public function __construct(Doctrine_Manager $manager, $adapter)
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>48</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>49</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>50</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> $this->setAttribute(Doctrine::ATTR_DEFAULT_TABLE_TYPE, 'INNODB');
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>51</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>52</td>
|
2007-10-24 00:21:22 +04:00
|
|
|
<td class="red"> $this->supported = array(
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>53</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'sequences' => 'emulated',
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>54</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'indexes' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>55</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'affected_rows' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>56</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'transactions' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>57</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'savepoints' => false,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>58</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'summary_functions' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>59</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'order_by_text' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>60</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'current_id' => 'emulated',
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>61</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'limit_queries' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>62</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'LOBs' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>63</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'replace' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>64</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'sub_selects' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>65</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'auto_increment' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>66</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'primary_key' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>67</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'result_introspection' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>68</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'prepared_statements' => 'emulated',
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>69</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'identifier_quoting' => true,
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>70</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> 'pattern_escaping' => true
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>71</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> );
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>72</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>73</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> $this->properties['string_quoting'] = array('start' => "'",
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>74</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'end' => "'",
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>75</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'escape' => '\\',
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>76</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'escape_pattern' => '\\');
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>77</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>78</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> $this->properties['identifier_quoting'] = array('start' => '`',
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>79</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'end' => '`',
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>80</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> 'escape' => '`');
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>81</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>82</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> $this->properties['sql_comments'] = array(
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>83</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> array('start' => '-- ', 'end' => "\n", 'escape' => false),
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>84</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> array('start' => '#', 'end' => "\n", 'escape' => false),
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>85</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> array('start' => '/*', 'end' => '*/', 'escape' => false),
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>86</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> );
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>87</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>88</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> $this->properties['varchar_max_length'] = 255;
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>89</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>90</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> parent::__construct($manager, $adapter);
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>91</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="covered"> }
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>92</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>93</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> /**
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>94</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> * Set the charset on the current connection
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>95</td>
|
|
|
|
<td class="normal"> *
|
|
|
|
</td></tr>
|
|
|
|
<tr><td>96</td>
|
2007-10-21 20:12:20 +04:00
|
|
|
<td class="normal"> * @param string charset
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>97</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> */
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>98</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> public function setCharset($charset)
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>99</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>100</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $query = 'SET NAMES ' . $this->quote($charset);
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>101</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>102</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $this->exec($query);
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>103</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> }
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>104</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>105</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> /**
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>106</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>107</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * query, except that if there is already a row in the table with the same
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>108</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * key field values, the REPLACE query just updates its values instead of
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>109</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * inserting a new row.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>110</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>111</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * The REPLACE type of query does not make part of the SQL standards. Since
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>112</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * practically only MySQL implements it natively, this type of query is
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>113</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * emulated through this method for other DBMS using standard types of
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>114</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * queries inside a transaction to assure the atomicity of the operation.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>115</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>116</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * @access public
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>117</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>118</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * @param string $table name of the table on which the REPLACE query will
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>119</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * be executed.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>120</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * @param array $fields associative array that describes the fields and the
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>121</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * values that will be inserted or updated in the specified table. The
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>122</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * indexes of the array are the names of all the fields of the table. The
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>123</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * values of the array are also associative arrays that describe the
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>124</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * values and other properties of the table fields.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>125</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>126</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Here follows a list of field properties that need to be specified:
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>127</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>128</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * value:
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>129</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Value to be assigned to the specified field. This value may be
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>130</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * of specified in database independent type format as this
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>131</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * function can perform the necessary datatype conversions.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>132</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>133</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Default:
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>134</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * this property is required unless the Null property
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>135</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * is set to 1.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>136</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>137</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * type
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>138</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Name of the type of the field. Currently, all types Metabase
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>139</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * are supported except for clob and blob.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>140</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>141</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Default: no type conversion
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>142</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>143</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * null
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>144</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Boolean property that indicates that the value for this field
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>145</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * should be set to null.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>146</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>147</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * The default value for fields missing in INSERT queries may be
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>148</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * specified the definition of a table. Often, the default value
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>149</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * is already null, but since the REPLACE may be emulated using
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>150</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * an UPDATE query, make sure that all fields of the table are
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>151</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * listed in this function argument array.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>152</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>153</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Default: 0
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>154</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>155</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * key
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>156</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Boolean property that indicates that this field should be
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>157</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * handled as a primary key or at least as part of the compound
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>158</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * unique index of the table that will determine the row that will
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>159</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * updated if it exists or inserted a new row otherwise.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>160</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>161</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * This function will fail if no key field is specified or if the
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>162</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * value of a key field is set to null because fields that are
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>163</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * part of unique index they may not be null.
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>164</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>165</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * Default: 0
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>166</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> *
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>167</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> * @return integer the number of affected rows
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>168</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> */
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>169</td>
|
2007-11-25 23:32:49 +03:00
|
|
|
<td class="normal"> public function replace(Doctrine_Table $table, array $fields, array $keys)
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>170</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>171</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $count = count($fields);
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>172</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $query = $values = '';
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>173</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $keys = $colnum = 0;
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>174</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>175</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> for (reset($fields); $colnum < $count; next($fields), $colnum++) {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>176</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $name = key($fields);
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>177</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>178</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> if ($colnum > 0) {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>179</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $query .= ',';
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>180</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $values.= ',';
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>181</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> }
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>182</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>183</td>
|
2007-11-25 23:32:49 +03:00
|
|
|
<td class="red"> $query .= $table->getColumnName($name);
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>184</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>185</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> if (isset($fields[$name]['null']) && $fields[$name]['null']) {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>186</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $value = 'NULL';
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>187</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> } else {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>188</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $type = isset($fields[$name]['type']) ? $fields[$name]['type'] : null;
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>189</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $value = $this->quote($fields[$name]['value'], $type);
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>190</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal"> }
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>191</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>192</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $values .= $value;
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>193</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>194</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> if (isset($fields[$name]['key']) && $fields[$name]['key']) {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>195</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> if ($value === 'NULL') {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>196</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> throw new Doctrine_Connection_Mysql_Exception('key value '.$name.' may not be NULL');
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>197</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="orange"> }
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>198</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> $keys++;
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>199</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> }
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>200</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> }
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>201</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>202</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> if ($keys == 0) {
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>203</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> throw new Doctrine_Connection_Mysql_Exception('not specified which fields are keys');
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>204</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="orange"> }
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>205</td>
|
2007-11-25 23:32:49 +03:00
|
|
|
<td class="red"> $query = 'REPLACE INTO ' . $table->getTableName() . ' (' . $query . ') VALUES (' . $values . ')';
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>206</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">
|
2007-10-14 01:45:08 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>207</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="red"> return $this->exec($query);
|
2007-10-21 20:12:20 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>208</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="orange"> }
|
2007-10-21 20:12:20 +04:00
|
|
|
</td></tr>
|
|
|
|
<tr><td>209</td>
|
2007-11-04 00:02:50 +03:00
|
|
|
<td class="normal">}
|
2007-10-21 20:12:20 +04:00
|
|
|
</td></tr>
|
2007-10-14 01:45:08 +04:00
|
|
|
</table></body></html>
|