coverage report against head
This commit is contained in:
parent
ea803566b6
commit
4640cb2be4
@ -16,7 +16,7 @@
|
||||
<td class="normal">/*
|
||||
</td></tr>
|
||||
<tr><td>3</td>
|
||||
<td class="normal"> * $Id: Doctrine.php 3055 2007-11-01 22:52:40Z zYne $
|
||||
<td class="normal"> * $Id: Doctrine.php 3066 2007-11-02 16:07:11Z meus $
|
||||
</td></tr>
|
||||
<tr><td>4</td>
|
||||
<td class="normal"> *
|
||||
@ -103,7 +103,7 @@
|
||||
<td class="normal"> * @since 1.0
|
||||
</td></tr>
|
||||
<tr><td>32</td>
|
||||
<td class="normal"> * @version $Revision: 3055 $
|
||||
<td class="normal"> * @version $Revision: 3066 $
|
||||
</td></tr>
|
||||
<tr><td>33</td>
|
||||
<td class="normal"> */
|
||||
|
@ -16,7 +16,7 @@
|
||||
<td class="normal">/*
|
||||
</td></tr>
|
||||
<tr><td>3</td>
|
||||
<td class="normal"> * $Id: Configurable.php 3059 2007-11-01 23:03:32Z zYne $
|
||||
<td class="normal"> * $Id: Configurable.php 3067 2007-11-02 16:59:20Z phuson $
|
||||
</td></tr>
|
||||
<tr><td>4</td>
|
||||
<td class="normal"> *
|
||||
@ -103,7 +103,7 @@
|
||||
<td class="normal"> * @since 1.0
|
||||
</td></tr>
|
||||
<tr><td>32</td>
|
||||
<td class="normal"> * @version $Revision: 3059 $
|
||||
<td class="normal"> * @version $Revision: 3067 $
|
||||
</td></tr>
|
||||
<tr><td>33</td>
|
||||
<td class="normal"> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||
@ -469,7 +469,7 @@
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>154</td>
|
||||
<td class="red"> if ($namespace = null) {
|
||||
<td class="red"> if ($namespace == null) {
|
||||
</td></tr>
|
||||
<tr><td>155</td>
|
||||
<td class="red"> $namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE);
|
||||
@ -523,7 +523,7 @@
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>172</td>
|
||||
<td class="red"> if ($namespace = null) {
|
||||
<td class="red"> if ($namespace == null) {
|
||||
</td></tr>
|
||||
<tr><td>173</td>
|
||||
<td class="red"> $namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE);
|
||||
@ -556,7 +556,7 @@
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>183</td>
|
||||
<td class="red"> if ($namespace = null) {
|
||||
<td class="red"> if ($namespace == null) {
|
||||
</td></tr>
|
||||
<tr><td>184</td>
|
||||
<td class="red"> $namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE);
|
||||
|
@ -16,7 +16,7 @@
|
||||
<td class="normal">/*
|
||||
</td></tr>
|
||||
<tr><td>3</td>
|
||||
<td class="normal"> * $Id: Mysql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $
|
||||
<td class="normal"> * $Id: Mysql.php 3070 2007-11-03 15:47:24Z zYne $
|
||||
</td></tr>
|
||||
<tr><td>4</td>
|
||||
<td class="normal"> *
|
||||
@ -97,7 +97,7 @@
|
||||
<td class="normal"> * @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
|
||||
</td></tr>
|
||||
<tr><td>30</td>
|
||||
<td class="normal"> * @version $Revision: 2963 $
|
||||
<td class="normal"> * @version $Revision: 3070 $
|
||||
</td></tr>
|
||||
<tr><td>31</td>
|
||||
<td class="normal"> * @link www.phpdoctrine.com
|
||||
@ -298,344 +298,342 @@
|
||||
<td class="normal"> * @param string charset
|
||||
</td></tr>
|
||||
<tr><td>97</td>
|
||||
<td class="normal"> *
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>98</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>99</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>100</td>
|
||||
<td class="normal"> public function setCharset($charset)
|
||||
</td></tr>
|
||||
<tr><td>101</td>
|
||||
<tr><td>99</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>100</td>
|
||||
<td class="red"> $query = 'SET NAMES ' . $this->quote($charset);
|
||||
</td></tr>
|
||||
<tr><td>101</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>102</td>
|
||||
<td class="red"> $query = 'SET NAMES '.$this->dbh->quote($charset);
|
||||
</td></tr>
|
||||
<tr><td>103</td>
|
||||
<td class="red"> $this->exec($query);
|
||||
</td></tr>
|
||||
<tr><td>104</td>
|
||||
<tr><td>103</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>105</td>
|
||||
<tr><td>104</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>106</td>
|
||||
<tr><td>105</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>107</td>
|
||||
<tr><td>106</td>
|
||||
<td class="normal"> * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
|
||||
</td></tr>
|
||||
<tr><td>108</td>
|
||||
<tr><td>107</td>
|
||||
<td class="normal"> * query, except that if there is already a row in the table with the same
|
||||
</td></tr>
|
||||
<tr><td>109</td>
|
||||
<tr><td>108</td>
|
||||
<td class="normal"> * key field values, the REPLACE query just updates its values instead of
|
||||
</td></tr>
|
||||
<tr><td>110</td>
|
||||
<tr><td>109</td>
|
||||
<td class="normal"> * inserting a new row.
|
||||
</td></tr>
|
||||
<tr><td>111</td>
|
||||
<tr><td>110</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>112</td>
|
||||
<tr><td>111</td>
|
||||
<td class="normal"> * The REPLACE type of query does not make part of the SQL standards. Since
|
||||
</td></tr>
|
||||
<tr><td>113</td>
|
||||
<tr><td>112</td>
|
||||
<td class="normal"> * practically only MySQL implements it natively, this type of query is
|
||||
</td></tr>
|
||||
<tr><td>114</td>
|
||||
<tr><td>113</td>
|
||||
<td class="normal"> * emulated through this method for other DBMS using standard types of
|
||||
</td></tr>
|
||||
<tr><td>115</td>
|
||||
<tr><td>114</td>
|
||||
<td class="normal"> * queries inside a transaction to assure the atomicity of the operation.
|
||||
</td></tr>
|
||||
<tr><td>116</td>
|
||||
<tr><td>115</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>117</td>
|
||||
<tr><td>116</td>
|
||||
<td class="normal"> * @access public
|
||||
</td></tr>
|
||||
<tr><td>118</td>
|
||||
<tr><td>117</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>119</td>
|
||||
<tr><td>118</td>
|
||||
<td class="normal"> * @param string $table name of the table on which the REPLACE query will
|
||||
</td></tr>
|
||||
<tr><td>120</td>
|
||||
<tr><td>119</td>
|
||||
<td class="normal"> * be executed.
|
||||
</td></tr>
|
||||
<tr><td>121</td>
|
||||
<tr><td>120</td>
|
||||
<td class="normal"> * @param array $fields associative array that describes the fields and the
|
||||
</td></tr>
|
||||
<tr><td>122</td>
|
||||
<tr><td>121</td>
|
||||
<td class="normal"> * values that will be inserted or updated in the specified table. The
|
||||
</td></tr>
|
||||
<tr><td>123</td>
|
||||
<tr><td>122</td>
|
||||
<td class="normal"> * indexes of the array are the names of all the fields of the table. The
|
||||
</td></tr>
|
||||
<tr><td>124</td>
|
||||
<tr><td>123</td>
|
||||
<td class="normal"> * values of the array are also associative arrays that describe the
|
||||
</td></tr>
|
||||
<tr><td>125</td>
|
||||
<tr><td>124</td>
|
||||
<td class="normal"> * values and other properties of the table fields.
|
||||
</td></tr>
|
||||
<tr><td>126</td>
|
||||
<tr><td>125</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>127</td>
|
||||
<tr><td>126</td>
|
||||
<td class="normal"> * Here follows a list of field properties that need to be specified:
|
||||
</td></tr>
|
||||
<tr><td>128</td>
|
||||
<tr><td>127</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>129</td>
|
||||
<tr><td>128</td>
|
||||
<td class="normal"> * value:
|
||||
</td></tr>
|
||||
<tr><td>130</td>
|
||||
<tr><td>129</td>
|
||||
<td class="normal"> * Value to be assigned to the specified field. This value may be
|
||||
</td></tr>
|
||||
<tr><td>131</td>
|
||||
<tr><td>130</td>
|
||||
<td class="normal"> * of specified in database independent type format as this
|
||||
</td></tr>
|
||||
<tr><td>132</td>
|
||||
<tr><td>131</td>
|
||||
<td class="normal"> * function can perform the necessary datatype conversions.
|
||||
</td></tr>
|
||||
<tr><td>133</td>
|
||||
<tr><td>132</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>134</td>
|
||||
<tr><td>133</td>
|
||||
<td class="normal"> * Default:
|
||||
</td></tr>
|
||||
<tr><td>135</td>
|
||||
<tr><td>134</td>
|
||||
<td class="normal"> * this property is required unless the Null property
|
||||
</td></tr>
|
||||
<tr><td>136</td>
|
||||
<tr><td>135</td>
|
||||
<td class="normal"> * is set to 1.
|
||||
</td></tr>
|
||||
<tr><td>137</td>
|
||||
<tr><td>136</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>138</td>
|
||||
<tr><td>137</td>
|
||||
<td class="normal"> * type
|
||||
</td></tr>
|
||||
<tr><td>139</td>
|
||||
<tr><td>138</td>
|
||||
<td class="normal"> * Name of the type of the field. Currently, all types Metabase
|
||||
</td></tr>
|
||||
<tr><td>140</td>
|
||||
<tr><td>139</td>
|
||||
<td class="normal"> * are supported except for clob and blob.
|
||||
</td></tr>
|
||||
<tr><td>141</td>
|
||||
<tr><td>140</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>142</td>
|
||||
<tr><td>141</td>
|
||||
<td class="normal"> * Default: no type conversion
|
||||
</td></tr>
|
||||
<tr><td>143</td>
|
||||
<tr><td>142</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>144</td>
|
||||
<tr><td>143</td>
|
||||
<td class="normal"> * null
|
||||
</td></tr>
|
||||
<tr><td>145</td>
|
||||
<tr><td>144</td>
|
||||
<td class="normal"> * Boolean property that indicates that the value for this field
|
||||
</td></tr>
|
||||
<tr><td>146</td>
|
||||
<tr><td>145</td>
|
||||
<td class="normal"> * should be set to null.
|
||||
</td></tr>
|
||||
<tr><td>147</td>
|
||||
<tr><td>146</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>148</td>
|
||||
<tr><td>147</td>
|
||||
<td class="normal"> * The default value for fields missing in INSERT queries may be
|
||||
</td></tr>
|
||||
<tr><td>149</td>
|
||||
<tr><td>148</td>
|
||||
<td class="normal"> * specified the definition of a table. Often, the default value
|
||||
</td></tr>
|
||||
<tr><td>150</td>
|
||||
<tr><td>149</td>
|
||||
<td class="normal"> * is already null, but since the REPLACE may be emulated using
|
||||
</td></tr>
|
||||
<tr><td>151</td>
|
||||
<tr><td>150</td>
|
||||
<td class="normal"> * an UPDATE query, make sure that all fields of the table are
|
||||
</td></tr>
|
||||
<tr><td>152</td>
|
||||
<tr><td>151</td>
|
||||
<td class="normal"> * listed in this function argument array.
|
||||
</td></tr>
|
||||
<tr><td>153</td>
|
||||
<tr><td>152</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>153</td>
|
||||
<td class="normal"> * Default: 0
|
||||
</td></tr>
|
||||
<tr><td>154</td>
|
||||
<td class="normal"> * Default: 0
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>155</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>156</td>
|
||||
<td class="normal"> * key
|
||||
</td></tr>
|
||||
<tr><td>157</td>
|
||||
<tr><td>156</td>
|
||||
<td class="normal"> * Boolean property that indicates that this field should be
|
||||
</td></tr>
|
||||
<tr><td>158</td>
|
||||
<tr><td>157</td>
|
||||
<td class="normal"> * handled as a primary key or at least as part of the compound
|
||||
</td></tr>
|
||||
<tr><td>159</td>
|
||||
<tr><td>158</td>
|
||||
<td class="normal"> * unique index of the table that will determine the row that will
|
||||
</td></tr>
|
||||
<tr><td>160</td>
|
||||
<tr><td>159</td>
|
||||
<td class="normal"> * updated if it exists or inserted a new row otherwise.
|
||||
</td></tr>
|
||||
<tr><td>161</td>
|
||||
<tr><td>160</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>162</td>
|
||||
<tr><td>161</td>
|
||||
<td class="normal"> * This function will fail if no key field is specified or if the
|
||||
</td></tr>
|
||||
<tr><td>163</td>
|
||||
<tr><td>162</td>
|
||||
<td class="normal"> * value of a key field is set to null because fields that are
|
||||
</td></tr>
|
||||
<tr><td>164</td>
|
||||
<tr><td>163</td>
|
||||
<td class="normal"> * part of unique index they may not be null.
|
||||
</td></tr>
|
||||
<tr><td>165</td>
|
||||
<tr><td>164</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>166</td>
|
||||
<tr><td>165</td>
|
||||
<td class="normal"> * Default: 0
|
||||
</td></tr>
|
||||
<tr><td>167</td>
|
||||
<tr><td>166</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>168</td>
|
||||
<tr><td>167</td>
|
||||
<td class="normal"> * @return integer the number of affected rows
|
||||
</td></tr>
|
||||
<tr><td>169</td>
|
||||
<tr><td>168</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>170</td>
|
||||
<tr><td>169</td>
|
||||
<td class="normal"> public function replace($table, array $fields, array $keys)
|
||||
</td></tr>
|
||||
<tr><td>171</td>
|
||||
<tr><td>170</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>172</td>
|
||||
<tr><td>171</td>
|
||||
<td class="red"> $count = count($fields);
|
||||
</td></tr>
|
||||
<tr><td>173</td>
|
||||
<tr><td>172</td>
|
||||
<td class="red"> $query = $values = '';
|
||||
</td></tr>
|
||||
<tr><td>174</td>
|
||||
<tr><td>173</td>
|
||||
<td class="red"> $keys = $colnum = 0;
|
||||
</td></tr>
|
||||
<tr><td>175</td>
|
||||
<tr><td>174</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>176</td>
|
||||
<tr><td>175</td>
|
||||
<td class="red"> for (reset($fields); $colnum < $count; next($fields), $colnum++) {
|
||||
</td></tr>
|
||||
<tr><td>177</td>
|
||||
<tr><td>176</td>
|
||||
<td class="red"> $name = key($fields);
|
||||
</td></tr>
|
||||
<tr><td>178</td>
|
||||
<tr><td>177</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>179</td>
|
||||
<tr><td>178</td>
|
||||
<td class="red"> if ($colnum > 0) {
|
||||
</td></tr>
|
||||
<tr><td>180</td>
|
||||
<tr><td>179</td>
|
||||
<td class="red"> $query .= ',';
|
||||
</td></tr>
|
||||
<tr><td>181</td>
|
||||
<tr><td>180</td>
|
||||
<td class="red"> $values.= ',';
|
||||
</td></tr>
|
||||
<tr><td>182</td>
|
||||
<tr><td>181</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>182</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>183</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>184</td>
|
||||
<td class="red"> $query .= $name;
|
||||
</td></tr>
|
||||
<tr><td>185</td>
|
||||
<tr><td>184</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>186</td>
|
||||
<tr><td>185</td>
|
||||
<td class="red"> if (isset($fields[$name]['null']) && $fields[$name]['null']) {
|
||||
</td></tr>
|
||||
<tr><td>187</td>
|
||||
<tr><td>186</td>
|
||||
<td class="red"> $value = 'NULL';
|
||||
</td></tr>
|
||||
<tr><td>188</td>
|
||||
<tr><td>187</td>
|
||||
<td class="red"> } else {
|
||||
</td></tr>
|
||||
<tr><td>189</td>
|
||||
<tr><td>188</td>
|
||||
<td class="red"> $type = isset($fields[$name]['type']) ? $fields[$name]['type'] : null;
|
||||
</td></tr>
|
||||
<tr><td>190</td>
|
||||
<tr><td>189</td>
|
||||
<td class="red"> $value = $this->quote($fields[$name]['value'], $type);
|
||||
</td></tr>
|
||||
<tr><td>191</td>
|
||||
<tr><td>190</td>
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>192</td>
|
||||
<tr><td>191</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>193</td>
|
||||
<tr><td>192</td>
|
||||
<td class="red"> $values .= $value;
|
||||
</td></tr>
|
||||
<tr><td>194</td>
|
||||
<tr><td>193</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>195</td>
|
||||
<tr><td>194</td>
|
||||
<td class="red"> if (isset($fields[$name]['key']) && $fields[$name]['key']) {
|
||||
</td></tr>
|
||||
<tr><td>196</td>
|
||||
<tr><td>195</td>
|
||||
<td class="red"> if ($value === 'NULL') {
|
||||
</td></tr>
|
||||
<tr><td>197</td>
|
||||
<tr><td>196</td>
|
||||
<td class="red"> throw new Doctrine_Connection_Mysql_Exception('key value '.$name.' may not be NULL');
|
||||
</td></tr>
|
||||
<tr><td>198</td>
|
||||
<tr><td>197</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>199</td>
|
||||
<tr><td>198</td>
|
||||
<td class="red"> $keys++;
|
||||
</td></tr>
|
||||
<tr><td>200</td>
|
||||
<tr><td>199</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>201</td>
|
||||
<tr><td>200</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>202</td>
|
||||
<tr><td>201</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>203</td>
|
||||
<tr><td>202</td>
|
||||
<td class="red"> if ($keys == 0) {
|
||||
</td></tr>
|
||||
<tr><td>204</td>
|
||||
<tr><td>203</td>
|
||||
<td class="red"> throw new Doctrine_Connection_Mysql_Exception('not specified which fields are keys');
|
||||
</td></tr>
|
||||
<tr><td>205</td>
|
||||
<tr><td>204</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>206</td>
|
||||
<tr><td>205</td>
|
||||
<td class="red"> $query = 'REPLACE INTO ' . $table . ' (' . $query . ') VALUES (' . $values . ')';
|
||||
</td></tr>
|
||||
<tr><td>207</td>
|
||||
<tr><td>206</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>208</td>
|
||||
<tr><td>207</td>
|
||||
<td class="red"> return $this->exec($query);
|
||||
</td></tr>
|
||||
<tr><td>209</td>
|
||||
<tr><td>208</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>210</td>
|
||||
<td class="covered">}</td></tr>
|
||||
<tr><td>209</td>
|
||||
<td class="normal">}
|
||||
</td></tr>
|
||||
</table></body></html>
|
@ -3739,6 +3739,5 @@
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>1244</td>
|
||||
<td class="normal">}
|
||||
</td></tr>
|
||||
<td class="covered">}</td></tr>
|
||||
</table></body></html>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user