Changeset 1310
- Timestamp:
- 05/04/06 09:36:54 (3 years ago)
- Files:
-
- trunk/data/bin/build.xml (modified) (1 diff)
- trunk/data/skeleton/project/config/propel.ini (modified) (1 diff)
- trunk/lib/vendor/creole/drivers/oracle/OCI8Connection.php (modified) (2 diffs)
- trunk/lib/vendor/creole/drivers/oracle/OCI8PreparedStatement.php (modified) (7 diffs)
- trunk/lib/vendor/propel-generator/CHANGELOG (modified) (3 diffs)
- trunk/lib/vendor/propel-generator/build (deleted)
- trunk/lib/vendor/propel-generator/build-propel.xml (modified) (11 diffs)
- trunk/lib/vendor/propel-generator/build.xml (modified) (7 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/DataModelBuilder.php (modified) (18 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicPeerBuilder.php (modified) (4 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php (modified) (2 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5MultiExtendObjectBuilder.php (modified) (1 diff)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/DDLBuilder.php (modified) (6 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/DataSQLBuilder.php (modified) (17 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/mssql/MssqlDDLBuilder.php (modified) (10 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/mysql/MysqlDDLBuilder.php (modified) (19 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/oracle/OracleDDLBuilder.php (modified) (12 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/pgsql/PgsqlDDLBuilder.php (modified) (14 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/sqlite/SqliteDDLBuilder.php (modified) (9 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/database/model/Column.php (modified) (8 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/database/model/ForeignKey.php (modified) (6 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/database/model/Index.php (modified) (7 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/database/model/Table.php (modified) (9 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/engine/database/transform/XmlToAppData.php (modified) (4 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/phing/AbstractPropelDataModelTask.php (modified) (5 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/phing/PropelDataDumpTask.php (modified) (4 diffs)
- trunk/lib/vendor/propel-generator/classes/propel/phing/PropelGraphvizTask.php (modified) (9 diffs)
- trunk/lib/vendor/propel-generator/default.properties (modified) (7 diffs)
- trunk/lib/vendor/propel-generator/pear/BuildPropelGenPEARPackageTask.php (added)
- trunk/lib/vendor/propel-generator/pear/build-pear-package.xml (modified) (7 diffs)
- trunk/lib/vendor/propel-generator/pear/build.properties (modified) (1 diff)
- trunk/lib/vendor/propel-generator/pear/pear-build.xml (modified) (3 diffs)
- trunk/lib/vendor/propel-generator/projects/build (deleted)
- trunk/lib/vendor/propel-generator/resources (added)
- trunk/lib/vendor/propel-generator/resources/dtd (moved) (moved from trunk/lib/vendor/propel-generator/dtd)
- trunk/lib/vendor/propel-generator/resources/xsd (moved) (moved from trunk/lib/vendor/propel-generator/classes/propel/engine/database/transform/xsd)
- trunk/lib/vendor/propel-generator/resources/xsd/database.xsd (modified) (2 diffs)
- trunk/lib/vendor/propel-generator/resources/xsl (moved) (moved from trunk/lib/vendor/propel-generator/classes/propel/engine/database/transform/xsl)
- trunk/lib/vendor/propel-generator/resources/xsl/database.xsl (modified) (1 diff)
- trunk/lib/vendor/propel-generator/templates/conf/xml.tpl (modified) (3 diffs)
- trunk/lib/vendor/propel/util/Criteria.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/bin/build.xml
r699 r1310 2 2 3 3 <property name="project.dir" value="${application.startdir}/config" /> 4 <property name=" propel.buildProperties" value="${propel_ini}"/>4 <property name="build.properties" value="${propel_ini}"/> 5 5 6 6 <target name="build-om"> trunk/data/skeleton/project/config/propel.ini
r695 r1310 38 38 propel.builder.nodepeerstub.class = propel.engine.builder.om.php5.PHP5ExtensionNodePeerBuilder 39 39 40 propel.schema.validate = false trunk/lib/vendor/creole/drivers/oracle/OCI8Connection.php
r497 r1310 70 70 $pw = $dsninfo[ 'password' ]; 71 71 $hostspec = $dsninfo[ 'hostspec' ]; 72 $db = $dsninfo[ 'database' ]; 72 73 73 74 $connect_function = ( $persistent ) … … 77 78 @ini_set( 'track_errors', true ); 78 79 79 if ( $hostspec && $user && $pw ) 80 if ( $db && $hostspec && $user && $pw ) 81 { 82 $conn = @$connect_function( $user, $pw, "//$hostspec/$db" ); 83 } 84 elseif ( $hostspec && $user && $pw ) 80 85 { 81 86 $conn = @$connect_function( $user, $pw, $hostspec ); trunk/lib/vendor/creole/drivers/oracle/OCI8PreparedStatement.php
r497 r1310 1 1 <?php 2 2 /* 3 * $Id: OCI8PreparedStatement.php,v 1.2 5 2005/11/21 17:54:11sethr Exp $3 * $Id: OCI8PreparedStatement.php,v 1.26 2006/01/30 21:32:05 sethr Exp $ 4 4 * 5 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 28 28 * @author David Giffin <david@giffin.org> 29 29 * @author Hans Lellelid <hans@xmpl.org> 30 * @version $Revision: 1.2 5$30 * @version $Revision: 1.26 $ 31 31 * @package creole.drivers.oracle 32 32 */ … … 67 67 68 68 /** 69 * ' -> ''69 * Nothing to do - since oci_bind is used to insert data, no escaping is needed 70 70 * @param string $str 71 71 * @return string … … 73 73 protected function escape($str) 74 74 { 75 return str_replace("'","''", $str);75 return $str; 76 76 } 77 77 … … 323 323 // __toString() and is being passed to this method. 324 324 if ( is_object ( $value ) ) { 325 $this->boundInVars[$paramIndex] = $ this->escape($value->__toString());325 $this->boundInVars[$paramIndex] = $value->__toString(); 326 326 } else { 327 $this->boundInVars[$paramIndex] = $this->escape((string)$value);327 $this->boundInVars[$paramIndex] = (string)$value; 328 328 } 329 329 } … … 346 346 if (is_numeric($value)) $value = date('Y-m-d H:i:s', $value); 347 347 elseif (is_object($value)) $value = date('Y-m-d H:i:s', $value->getTime()); 348 $this->boundInVars[$paramIndex] = $ this->escape($value);348 $this->boundInVars[$paramIndex] = $value; 349 349 } 350 350 } … … 365 365 if (is_numeric($value)) $value = date("Y-m-d", $value); 366 366 elseif (is_object($value)) $value = date("Y-m-d", $value->getTime()); 367 $this->boundInVars[$paramIndex] = $ this->escape($value);367 $this->boundInVars[$paramIndex] = $value; 368 368 } 369 369 } trunk/lib/vendor/propel-generator/CHANGELOG
r1 r1310 3 3 ============================ 4 4 5 Feb ??, 2006 - 1.2.0 6 7 Breaking Changes: 8 *** New API for accessors and settors (see API docs). The methods are the same 9 but the default indexing has changed. 10 *** New API for validators (see Wiki / docs). 11 12 Major Changes (for complete list see issue tracker at http://propel.phpdb.org): 13 - Propel now compatible w/ PHP >= 5.0.5 & 5.1.x 14 - New MySQLi driver for Propel (use 'mysqli' instead of 'mysql') 15 - Added propel-gen script to standard-installed versions of Propel also 16 - New XSD schema for validating the XML datamodel descriptions (schema.xml) 17 - Support for specifying vendor-specific info in the schema.xml 18 - Better support for sequences in reverse engineering PostgreSQL databases 19 - #146 Added 'size' attribute to <index-column> and <unique-column> 20 - New extensible OO builder classes for generating PHP5 classes and SQL DDL 21 - Identifier escaping in generated SQL (note: for Postgres this means columns 22 are case-sensitive) 23 - Numerous improvements to validation framework, including new, cleaner API 24 - Added doCountJoin*() methods to the generated Peer classes 25 - Obj->save() calls now return the number of affected rows (if supported by db) 26 - ... & numerous bug fixes which can be seen on the site issue tracker. 27 5 28 April 7, 2005 - 1.1.0 6 29 7 30 Big Changes: 8 31 *** Changed retrieveByPK() to return NULL instead of throw Exception if no row … … 11 34 *** Dropped support for deprecated ini-format runtime properties file. (Hans) 12 35 *** Cleanup of build properties files, removal of deprecated properties. (Hans) 13 14 New Features: 36 37 New Features: 15 38 - Schema attributes are no longer case-sensitive. 16 39 - New <vendor> tag allows specifying vendor-specific attributes. (Pavel) … … 23 46 - Added PHPUnit2-based unit testing framework to replace old bookstore-test.php 24 47 - Added schema validation / error throwing to schema parser. (Pavel) 25 - Logging is now optional (no log section means no logger used). (David Z� 26 - Added TIMESTAMP_BU, DATE_BU types for "before-unix" (pre 1970) dates. (Hans) 27 28 Bug Fixes: 48 - Logging is now optional (no log section means no logger used). (David Z� - Added TIMESTAMP_BU, DATE_BU types for "before-unix" (pre 1970) dates. (Hans) 49 50 Bug Fixes: 29 51 - Fixed E_STRICT error in generated Peer doCount() method (Hans) 30 52 - Fixed bug when using doSelectJoin*() methods with tables that have lazyload columns. (Hans) trunk/lib/vendor/propel-generator/build-propel.xml
r497 r1310 125 125 </target> 126 126 127 <!-- temporary target to check whether postgres is being used with identifier quoting ON. 128 If so, a warning is issued, since identifier quoting is only paritally implemented & this point. --> 129 <target name="pgsql-quoting-check"> 130 <if> 131 <and> 132 <equals arg1="${propel.database}" arg2="pgsql"/> 133 <equals arg1="${propel.disableIdentifierQuoting}" arg2=""/> 134 </and> 135 <then> 136 <warn>ATTENTION: It appears you are using PostgreSQL and you have identifier-quoting turned on.</warn> 137 <warn>It is suggested that you disable identifier quoting when using PostgreSQL -- especially if you</warn> 138 <warn>have case-sensitive columns in your database.</warn> 139 <warn></warn> 140 <warn>To disable identifier quoting, add the following property to your build.properties (or specify</warn> 141 <warn>it using -D on commandline):</warn> 142 <warn></warn> 143 <warn>propel.disableIdentifierQuoting=true</warn> 144 <warn></warn> 145 <warn>You can ignore this warning if you understand the issues related to case-sensitivity and Propel's</warn> 146 <warn>DDL-only implementation of identifier quoting.</warn> 147 </then> 148 </if> 149 </target> 150 127 151 <target 128 152 name="sql" 129 depends="sql-check "153 depends="sql-check,pgsql-quoting-check" 130 154 unless="propel.internal.sql.uptodate" 131 155 description="==> generates the SQL for your project"> … … 143 167 <target name="sql-template"> 144 168 <propel-sql 169 validate="${propel.schema.validate}" 170 xsd="${propel.schema.xsd.file}" 171 xsl="${propel.schema.xsl.file}" 145 172 outputDirectory="${propel.sql.dir}" 146 173 sqldbmap="${propel.sql.dir}/sqldb.map" … … 157 184 </target> 158 185 159 186 160 187 <target 161 188 name="old-sql" … … 177 204 <target name="old-sql-template"> 178 205 <propel-old-sql 206 validate="${propel.schema.validate}" 207 xsd="${propel.schema.xsd.file}" 208 xsl="${propel.schema.xsl.file}" 179 209 outputDirectory="${propel.sql.dir}" 180 210 sqldbmap="${propel.sql.dir}/sqldb.map" … … 190 220 </propel-old-sql> 191 221 </target> 192 222 193 223 <!-- ================================================================ --> 194 224 <!-- C R E A T E T A R G E T D A T A B A S E --> … … 211 241 212 242 <propel-data-model 243 validate="${propel.schema.validate}" 244 xsd="${propel.schema.xsd.file}" 245 xsl="${propel.schema.xsl.file}" 213 246 controlTemplate="${propel.template.sqlDbInit}" 214 247 outputDirectory="${propel.sql.dir}" … … 295 328 296 329 <propel-data-sql 330 validate="${propel.schema.validate}" 331 xsd="${propel.schema.xsd.file}" 332 xsl="${propel.schema.xsl.file}" 297 333 outputDirectory="${propel.sql.dir}" 298 334 sqldbmap="${propel.sql.dir}/sqldb.map" … … 326 362 327 363 <propel-data-dump 364 validate="${propel.schema.validate}" 365 xsd="${propel.schema.xsd.file}" 366 xsl="${propel.schema.xsl.file}" 328 367 targetDatabase="${propel.database}" 329 368 datadbmap="${propel.schema.dir}/datadb.map" … … 358 397 359 398 <propel-data-dtd 399 validate="${propel.schema.validate}" 400 xsd="${propel.schema.xsd.file}" 401 xsl="${propel.schema.xsl.file}" 360 402 targetDatabase="${propel.database}" 361 403 outputDirectory="${propel.output.dir}" … … 407 449 <target name="om-template"> 408 450 <propel-om 451 validate="${propel.schema.validate}" 452 xsd="${propel.schema.xsd.file}" 453 xsl="${propel.schema.xsl.file}" 409 454 outputDirectory="${propel.php.dir}" 410 455 targetDatabase="${propel.database}" … … 442 487 <target name="old-om-template"> 443 488 <propel-old-om 489 validate="${propel.schema.validate}" 490 xsd="${propel.schema.xsd.file}" 491 xsl="${propel.schema.xsl.file}" 444 492 outputDirectory="${propel.php.dir}" 445 493 targetDatabase="${propel.database}" trunk/lib/vendor/propel-generator/build.xml
r543 r1310 1 1 <!-- 2 2 Use this file to faciliate easy per-project building. 3 3 4 4 Simply create a build.properties file in your project directory, 5 5 for example ./projects/bookstore/build.properties, that contains 6 6 any needed (i.e. to override) values for that project. 7 7 8 8 Call this build script and specify the name of the project and 9 9 (optionally) the name of the target you wish to execute (default is … … 12 12 Normal use: 13 13 $> phing -Dproject=bookstore 14 15 Specific target: 14 15 Specific target: 16 16 $> phing -Dproject=bookstore -Dtarget=insert-sql 17 17 … … 21 21 <!-- in case ${project.dir} was specified on command line, we set the project.dir 22 22 property here. If it wasn't set, then this will be bogus, but it will 23 be overridden by the "set-project-dir" target. --> 23 be overridden by the "set-project-dir" target. --> 24 24 <property name="propel.project.dir" value="${project.dir}"/> 25 <resolvepath propertyName="propel.project.dir" file="${propel.project.dir}" dir="${application.startdir}"/> 25 26 26 27 <!-- set a default target if none provided --> 27 28 <property name="target" value="main"/> 28 29 30 <!-- Set a default name for the build.properties file. 31 This allows for overriding the name of the build.properties file; however, 32 Propel still expects to find the file in the ${propel.project.dir}. 33 --> 34 <property name="build.properties" value="build.properties"/> 35 29 36 <target name="check-buildprops-exists"> 30 <available file="${propel.project.dir}/${ propel.buildProperties}" property="projBuildPopertiesExists"/>37 <available file="${propel.project.dir}/${build.properties}" property="projBuildPopertiesExists"/> 31 38 </target> 32 39 33 40 <target name="check-buildprops" unless="projBuildPopertiesExists" depends="check-buildprops-exists"> 34 41 <echo message="====================================================="/> 35 <echo message="Could not open ${ propel.buildProperties} file:"/>36 <echo message=" ${propel.project.dir}/${ propel.buildProperties}"/>42 <echo message="Could not open ${build.properties} file:"/> 43 <echo message=" ${propel.project.dir}/${build.properties}"/> 37 44 <echo message=" "/> 38 45 <echo message="Make sure that '${propel.project.dir}' is a valid path"/> 39 <echo message="and that it contains a ${ propel.buildProperties} file."/>40 <echo message="====================================================="/> 41 46 <echo message="and that it contains a ${build.properties} file."/> 47 <echo message="====================================================="/> 48 42 49 <fail message="Missing configuration file (see description above)."/> 43 50 </target> … … 54 61 <target name="check-buildprops-for-propel-gen" if="using.propel-gen" unless="projBuildPopertiesExists" depends="check-buildprops-exists"> 55 62 <echo message="=========================================================="/> 56 <echo message="Could not open ${ propel.buildProperties} file:"/>57 <echo message=" ${propel.project.dir}/${ propel.buildProperties}"/>63 <echo message="Could not open ${build.properties} file:"/> 64 <echo message=" ${propel.project.dir}/${build.properties}"/> 58 65 <echo message=" "/> 59 66 <echo message="Project directory not specified or invalid. You must "/> 60 <echo message="specify the ABSOLUTE path to your project directory and"/>61 <echo message=" your project directory must contain your ${propel.buildProperties} "/>67 <echo message="specify the path to your project directory and your "/> 68 <echo message="project directory must contain your ${build.properties} "/> 62 69 <echo message="and schema.xml files. "/> 63 70 <echo message=" "/> … … 66 73 <echo message="$> propel-gen /path/to/projectdir [target]"/> 67 74 <echo message=" "/> 68 <echo message="=========================================================="/> 69 <fail message="No project directory specified (did you specify a relative path instead of absolute?)."/>75 <echo message="=========================================================="/> 76 <fail message="No project directory specified."/> 70 77 </target> 71 78 … … 84 91 <echo message=" "/> 85 92 <echo message="-Dproject.dir=/path/to/bookstore"/> 86 <echo message="====================================================="/> 93 <echo message="====================================================="/> 87 94 <input propertyname="project" promptChar=":">Project name</input> 88 95 <property name="propel.project" value="${project}" override="true"/> … … 95 102 96 103 <target name="configure" depends="set-project-dir,check-buildprops-for-propel-gen,check-buildprops"> 97 <echo msg="Loading project-specific props from ${propel.project.dir}/${ propel.buildProperties}"/>98 <property file="${propel.project.dir}/${ propel.buildProperties}"/>104 <echo msg="Loading project-specific props from ${propel.project.dir}/${build.properties}"/> 105 <property file="${propel.project.dir}/${build.properties}"/> 99 106 </target> 100 107 101 <target name="main" depends="configure" description="The main target. Includes project-specific ${propel.buildProperties}and calls the build-propel.xml script">108 <target name="main" depends="configure" description="The main target. Includes project-specific build.properties and calls the build-propel.xml script"> 102 109 103 <!--<property file="${project.dir}/${propel.buildProperties}"/>-->104 110 <phing phingfile="./build-propel.xml" target="${target}"/> 105 111 106 112 </target> 107 113 108 <!-- 109 Convenience mappings to build-propel.xml main targets 110 114 <!-- 115 Convenience mappings to build-propel.xml main targets 116 111 117 This makes it possible to use this buildfile w/o needing to specify 112 118 target as a property, e.g.: 113 119 114 120 $> phing -Dproject=bookstore insert-sql 115 121 116 122 The main reason for this is just consistency w/ old build-propel.xml file 117 123 (primarily for documentation & user confusion avoidance reasons). There are relatively trunk/lib/vendor/propel-generator/classes/propel/engine/builder/DataModelBuilder.php
r137 r1310 2 2 3 3 /* 4 * $Id: DataModelBuilder.php 258 2005-11-07 16:12:09Z hans $4 * $Id: DataModelBuilder.php 351 2006-03-15 18:42:34Z hans $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 24 24 /** 25 25 * This is the base class for any builder class that is using the data model. 26 * 26 * 27 27 * This could be extended by classes that build SQL DDL, PHP classes, configuration 28 28 * files, input forms, etc. 29 * 30 * This class has a static method to return the correct builder subclass identified by 29 * 30 * This class has a static method to return the correct builder subclass identified by 31 31 * a given key. Note that in order for this factory method to work, the properties have to have 32 32 * been loaded first. Usage should look something like this (from within a AbstractProelDataModelTask subclass): 33 * 33 * 34 34 * <code> 35 35 * DataModelBuilder::setBuildProperties($this->getPropelProperties()); … … 37 37 * // $builder (by default) instanceof PHP5ComplexPeerBuilder 38 38 * </code> 39 * 39 * 40 40 * @author Hans Lellelid <hans@xmpl.org> 41 41 * @package propel.engine.builder 42 42 */ 43 43 abstract class DataModelBuilder { 44 44 45 45 // -------------------------------------------------------------- 46 46 // Static properties & methods 47 47 // -------------------------------------------------------------- 48 48 49 49 /** 50 50 * Build properties (after they've been transformed from "propel.some.name" => "someName"). … … 52 52 */ 53 53 private static $buildProperties = array(); 54 54 55 55 /** 56 56 * Sets the [name transformed] build properties to use. … … 61 61 self::$buildProperties = $props; 62 62 } 63 63 64 64 /** 65 65 * Get a specific [name transformed] build property. … … 71 71 return isset(self::$buildProperties[$name]) ? self::$buildProperties[$name] : null; 72 72 } 73 73 74 74 /** 75 75 * Imports and returns the classname of the builder class for specified 'type'. … … 84 84 $propname = 'builder' . ucfirst(strtolower($type)) . 'Class'; 85 85 $classpath = self::getBuildProperty($propname); 86 86 87 87 if (empty($classpath)) { 88 88 throw new BuildException("Unable to find class path for '$propname' property."); 89 89 } 90 90 91 91 // This is a slight hack to workaround camel case inconsistencies for the DDL classes. 92 92 // Basically, we want to turn ?.?.?.sqliteDDLBuilder into ?.?.?.SqliteDDLBuilder … … 94 94 if ($lastdotpos) $classpath{$lastdotpos+1} = strtoupper($classpath{$lastdotpos+1}); 95 95 else ucfirst($classpath); 96 96 97 97 return Phing::import($classpath); 98 98 } 99 99 100 100 /** 101 101 * Factory method to load a new builder instance based on specified type. … … 109 109 return new $classname($table); 110 110 } 111 111 112 112 /** 113 113 * Utility function to build a path for use in include()/require() statement. 114 * 114 * 115 115 * Supports two function signatures: 116 116 * (1) getFilePath($dotPathClass); 117 117 * (2) getFilePath($dotPathPrefix, $className); 118 * 118 * 119 119 * @param string $path dot-path to class or to package prefix. 120 120 * @param string $classname class name … … 131 131 } 132 132 } 133 133 134 134 // -------------------------------------------------------------- 135 135 // Non-static properties & methods inherited by subclasses … … 140 140 * @var Table 141 141 */ 142 private $table; 142 private $table; 143 143 144 144 /** … … 147 147 */ 148 148 private $warnings = array(); 149 149 150 150 /** 151 151 * Creates new instance of DataModelBuilder subclass. … … 156 156 $this->table = $table; 157 157 } 158 158 159 159 /** 160 160 * Returns the Platform class for this table (database). … … 165 165 return $this->getTable()->getDatabase()->getPlatform(); 166 166 } 167 167 168 168 /** 169 169 * Returns the database for current table. … … 174 174 return $this->getTable()->getDatabase(); 175 175 } 176 176 177 177 /** 178 178 * Returns the current Table object. … … 182 182 { 183 183 return $this->table; 184 } 185 184 } 185 186 186 /** 187 187 * Pushes a message onto the stack of warnings. … … 192 192 $this->warnings[] = $msg; 193 193 } 194 194 195 195 /** 196 196 * Gets array of warning messages. … … 201 201 return $this->warnings; 202 202 } 203 204 /** 205 * Wraps call to Platform->quoteIdentifier() with a check to see whether quoting is enabled. 206 * 207 * All subclasses should call this quoteIdentifier() method rather than calling the Platform 208 * method directly. This method is used by both DataSQLBuilder and DDLBuilder, and potentially 209 * in the OM builders also, which is why it is defined in this class. 210 * 211 * @param string $text The text to quote. 212 * @return string Quoted text. 213 */ 214 public function quoteIdentifier($text) 215 { 216 if (!self::getBuildProperty('disableIdentifierQuoting')) { 217 return $this->getPlatform()->quoteIdentifier($text); 218 } 219 return $text; 220 } 203 221 } trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicPeerBuilder.php
r497 r1310 2 2 3 3 /* 4 * $Id: PHP5BasicPeerBuilder.php 3 06 2005-12-19 20:57:11Z hans$4 * $Id: PHP5BasicPeerBuilder.php 358 2006-04-18 17:40:40Z oliver $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 404 404 /** A key representing a particular subclass */ 405 405 const CLASSKEY_".strtoupper($child->getKey())." = '" . $child->getKey() . "'; 406 407 /** A key representing a particular subclass */ 408 const CLASSKEY_".strtoupper($child->getClassName())." = '" . $child->getKey() . "'; 406 409 407 410 /** A class that can be returned by this peer. */ … … 1337 1340 1338 1341 \$v = ".$this->getPeerClassname()."::doSelect(\$criteria, \$con); 1339 return !empty(\$v) > 0 ? \$v[0] : null; 1342 1343 return !empty(\$v) > 0 ? \$v[0] : null; 1340 1344 } 1341 1345 "; … … 1440 1444 $script .= " 1441 1445 \$v = ".$this->getPeerClassname()."::doSelect(\$criteria, \$con); 1442 return !empty(\$v) ? \$v[0] : null; 1446 1447 return !empty(\$v) ? \$v[0] : null; 1443 1448 }"; 1444 1449 } trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php
r497 r1310 2 2 3 3 /* 4 * $Id: PHP5ComplexObjectBuilder.php 3 24 2006-01-06 14:30:01Z hans$4 * $Id: PHP5ComplexObjectBuilder.php 346 2006-03-01 16:46:49Z soenke $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 1228 1228 "; 1229 1229 foreach ($table->getReferrers() as $fk) { 1230 //HL: commenting out self-referrential check below 1231 // it seems to work as expected and is probably desireable to have those referrers from same table deep-copied. 1232 //if ( $fk->getTable()->getName() != $table->getName() ) { 1233 $script .= " 1230 // Continue if $this and $copyObj are the same class and have the same primary key 1231 // to avoid endless loops 1232 $script .= " 1234 1233 foreach(\$this->get".$this->getRefFKPhpNameAffix($fk, true)."() as \$relObj) { 1235 if(\$ relObj !== \$this) { // ensure that we don't try to copy a reference to ourselves1236 \$copyObj->add".$this->getRefFKPhpNameAffix($fk)."(\$relObj->copy(\$deepCopy));1234 if(\$copyObj instanceof self && \$this->getPrimaryKey() === \$relObj->getPrimaryKey()) { 1235 continue; 1237 1236 } 1237 \$copyObj->add".$this->getRefFKPhpNameAffix($fk)."(\$relObj->copy(\$deepCopy)); 1238 1238 } 1239 1239 "; trunk/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5MultiExtendObjectBuilder.php
r137 r1310 110 110 protected function getParentClassFilePath() 111 111 { 112 $this->getFilePath($this->getParentClasspath());112 return $this->getFilePath($this->getParentClasspath()); 113 113 } 114 114 trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/DDLBuilder.php
r137 r1310 25 25 /** 26 26 * Baseclass for SQL DDL-building classes. 27 * 27 * 28 28 * DDL-building classes are those that build all the SQL DDL for a single table. 29 * 29 * 30 30 * @author Hans Lellelid <hans@xmpl.org> 31 31 * @package propel.engine.builder.sql 32 32 */ 33 abstract class DDLBuilder extends DataModelBuilder { 33 abstract class DDLBuilder extends DataModelBuilder { 34 34 35 35 /** 36 36 * Builds the SQL for current table and returns it as a string. 37 * 38 * This is the main entry point and defines a basic structure that classes should follow. 37 * 38 * This is the main entry point and defines a basic structure that classes should follow. 39 39 * In most cases this method will not need to be overridden by subclasses. 40 * 40 * 41 41 * @return string The resulting SQL DDL. 42 42 */ … … 49 49 return $script; 50 50 } 51 51 52 /** 53 * Builds the DDL SQL for a Column object. 54 * @return string 55 */ 56 public function getColumnDDL(Column $col) 57 { 58 $platform = $this->getPlatform(); 59 $domain = $col->getDomain(); 60 61 $sb = ""; 62 $sb .= $this->quoteIdentifier($col->getName()) . " "; 63 $sb .= $domain->getSqlType(); 64 if ($platform->hasSize($domain->getSqlType())) { 65 $sb .= $domain->printSize(); 66 } 67 $sb .= " "; 68 $sb .= $col->getDefaultSetting() . " "; 69 $sb .= $col->getNotNullString() . " "; 70 $sb .= $col->getAutoIncrementString(); 71 72 return trim($sb); 73 } 74 75 /** 76 * Creates a delimiter-delimited string list of column names, quoted using quoteIdentifier(). 77 * @param array Column[] or string[] 78 * @param string $delim The delimiter to use in separating the column names. 79 * @return string 80 */ 81 public function getColumnList($columns, $delim=',') 82 { 83 $list = array(); 84 foreach($columns as $col) { 85 if ($col instanceof Column) { 86 $col = $col->getName(); 87 } 88 $list[] = $this->quoteIdentifier($col); 89 } 90 return implode($delim, $list); 91 } 92 52 93 /** 53 94 * This function adds any _database_ start/initialization SQL. … … 59 100 return ''; 60 101 } 61 102 62 103 /** 63 104 * This function adds any _database_ end/cleanup SQL. … … 69 110 return ''; 70 111 } 71 112 72 113 /** 73 114 * Adds table definition. … … 81 122 */ 82 123 abstract protected function addIndices(&$script); 83 124 84 125 /** 85 126 * Adds foreign key constraint definitions. … … 87 128 */ 88 129 abstract protected function addForeignKeys(&$script); 89 130 90 131 } trunk/lib/vendor/propel-generator/classes/propel/engine/builder/sql/DataSQLBuilder.php
r497 r1310 25 25 /** 26 26 * Baseclass for SQL data dump SQL building classes. 27 * 27 * 28 28 * @author Hans Lellelid <hans@xmpl.org> 29 29 * @package propel.engine.builder.sql 30 30 */ 31 31 abstract class DataSQLBuilder extends DataModelBuilder { 32 32 33 33 /** 34 34 * The main method in this class, returns the SQL for INSERTing data into a row. … … 41 41 $platform = $this->getPlatform(); 42 42 $table = $this->getTable(); 43 44 $sql .= "INSERT INTO ".$this-> getPlatform()->quoteIdentifier($this->getTable()->getName())." (";45 43 44 $sql .= "INSERT INTO ".$this->quoteIdentifier($this->getTable()->getName())." ("; 45 46 46 // add column names to SQL 47 47 $colNames = array(); 48 48 foreach ($row->getColumnValues() as $colValue) { 49 $colNames[] = $ platform->quoteIdentifier($colValue->getColumn()->getName());50 } 51 49 $colNames[] = $this->quoteIdentifier($colValue->getColumn()->getName()); 50 } 51 52 52 $sql .= implode(',', $colNames); 53 53 54 54 $sql .= ") VALUES ("; 55 55 56 56 $colVals = array(); 57 57 foreach ($row->getColumnValues() as $colValue) { 58 58 $colVals[] = $this->getColumnValueSql($colValue); 59 59 } 60 61 $sql .= implode(',', $colVals); 60 61 $sql .= implode(',', $colVals); 62 62 $sql .= "); 63 63 "; 64 64 65 65 return $sql; 66 66 } 67 67 68 68 /** 69 69 * Gets the propertly escaped (and quoted) value for a column. … … 75 75 $column = $colValue->getColumn(); 76 76 $creoleTypeString = PropelTypes::getCreoleType($column->getPropelType()); 77 $creoleTypeCode = CreoleTypes::getCreoleCode($creoleTypeString); 77 $creoleTypeCode = CreoleTypes::getCreoleCode($creoleTypeString); 78 78 $method = 'get' . CreoleTypes::getAffix($creoleTypeCode) . 'Sql'; 79 79 return $this->$method($colValue->getValue()); 80 80 } 81 82 83 81 82 83 84 84 /** 85 85 * Gets a representation of a binary value suitable for use in a SQL statement. … … 88 88 * @return int 89 89 */ 90 protected function getBooleanSql($value) 91 { 90 protected function getBooleanSql($value) 91 { 92 92 return (int) $value; 93 93 } 94 94 95 95 96 96 /** … … 99 99 * @return string 100 100 */ 101 protected function getBlobSql($blob) 102 { 101 protected function getBlobSql($blob) 102 { 103 103 // they took magic __toString() out of PHP5.0.0; this sucks 104 104 if (is_object($blob)) { … … 107 107 return "'" . $this->escape($blob) . "'"; 108 108 } 109 }