[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 /* 3 * $Id: Unique.php 105 2005-06-04 23:21:07Z david $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://propel.phpdb.org>. 20 */ 21 22 include_once 'propel/engine/database/model/Index.php'; 23 24 /** 25 * Information about unique columns of a table. This class assumes 26 * that in the underlying RDBMS, unique constraints and unique indices 27 * are roughly equivalent. For example, adding a unique constraint to 28 * a column also creates an index on that column (this is known to be 29 * true for MySQL and Oracle). 30 * 31 * @author Hans Lellelid <hans@xmpl.org> (Propel) 32 * @author Jason van Zyl <jvanzyl@apache.org> (Torque) 33 * @author Daniel Rall <dlr@collab.net> (Torque) 34 * @version $Revision: 105 $ 35 * @package propel.engine.database.model 36 */ 37 class Unique extends Index { 38 39 /** 40 * Default constructor. 41 */ 42 public function __construct(Table $table, $indexColumns = array()) 43 { 44 } 45 46 /** 47 * Returns <code>true</code>. 48 */ 49 public function isUnique() 50 { 51 return true; 52 } 53 54 /** 55 * String representation of the index. This is an xml representation. 56 */ 57 public function toString() 58 { 59 $result = " <unique name=\"" . $this->getName() . "\">\n"; 60 $columns = $this->getColumns(); 61 for ($i=0, $size=count($columns); $i < $size; $i++) { 62 $result .= " <unique-column name=\"" 63 . $columns[$i] 64 . "\"/>\n"; 65 } 66 $result .= " </unique>\n"; 67 return $result; 68 } 69 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |