Changeset 6003
- Timestamp:
- 11/13/07 22:59:28 (10 months ago)
- Files:
-
- branches/1.0/lib/vendor/creole/Creole.php (modified) (5 diffs)
- branches/1.0/lib/vendor/creole/CreoleTypes.php (modified) (2 diffs)
- branches/1.0/lib/vendor/creole/contrib (added)
- branches/1.0/lib/vendor/creole/contrib/DebugConnection.php (added)
- branches/1.0/lib/vendor/creole/drivers/mssql/MSSQLCallableStatement.php (modified) (1 diff)
- branches/1.0/lib/vendor/creole/drivers/mysql/MySQLResultSet.php (modified) (3 diffs)
- branches/1.0/lib/vendor/creole/drivers/mysqli/MySQLiConnection.php (modified) (8 diffs)
- branches/1.0/lib/vendor/creole/drivers/mysqli/metadata/MySQLiTableInfo.php (modified) (3 diffs)
- branches/1.0/lib/vendor/creole/drivers/oracle/OCI8Connection.php (modified) (2 diffs)
- branches/1.0/lib/vendor/creole/drivers/oracle/OCI8Types.php (modified) (2 diffs)
- branches/1.0/lib/vendor/creole/drivers/pgsql/metadata/PgSQLDatabaseInfo.php (modified) (2 diffs)
- branches/1.0/lib/vendor/creole/drivers/sqlite/SQLiteResultSet.php (modified) (1 diff)
- branches/1.0/lib/vendor/creole/drivers/sqlite/metadata/SQLiteTableInfo.php (modified) (4 diffs)
- branches/1.0/lib/vendor/creole/metadata/DatabaseInfo.php (modified) (1 diff)
- branches/1.0/lib/vendor/creole/util/Clob.php (modified) (1 diff)
- branches/1.0/lib/vendor/patch/propel-generator-1.patch (deleted)
- branches/1.0/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php (modified) (2 diffs)
- branches/1.0/lib/vendor/propel-generator/classes/propel/engine/database/model/AppData.php (modified) (3 diffs)
- branches/1.0/lib/vendor/propel-generator/classes/propel/engine/database/model/Table.php (modified) (3 diffs)
- branches/1.0/lib/vendor/propel-generator/classes/propel/phing/PropelSQLExec.php (modified) (3 diffs)
- branches/1.0/lib/vendor/propel-generator/default.properties (modified) (1 diff)
- branches/1.0/lib/vendor/propel-generator/pear/build-pear-package.xml (modified) (1 diff)
- branches/1.0/lib/vendor/propel-generator/projects (deleted)
- branches/1.0/lib/vendor/propel/Propel.php (modified) (3 diffs)
- branches/1.0/lib/vendor/propel/adapter/DBMSSQL.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/vendor/creole/Creole.php
r1537 r6003 252 252 return self::$connectionMap[$connectionMapKey][(int)$persistent] = $obj; 253 253 } 254 255 /**254 255 /** 256 256 * Parse a data source name. 257 257 * … … 269 269 * The format of the supplied DSN is in its fullest form: 270 270 * 271 * phptype://username:password@ protocol+hostspec/database271 * phptype://username:password@hostspec/database 272 272 * 273 273 * Most variations are allowed: 274 274 * 275 * phptype://username:password@protocol +hostspec:110//usr/db_file.db275 * phptype://username:password@protocol(hostspec:110)//usr/db_file.db 276 276 * phptype://username:password@hostspec/database_name 277 277 * phptype://username:password@hostspec … … 301 301 ); 302 302 303 $info = parse_url($dsn); 304 305 if (count($info) === 1) { // if there's only one element in result, then it must be the phptype 306 $parsed['phptype'] = array_pop($info); 307 return $parsed; 308 } 309 310 // some values can be copied directly 311 $parsed['phptype'] = @$info['scheme']; 312 $parsed['username'] = @$info['user']; 313 $parsed['password'] = @$info['pass']; 314 $parsed['port'] = @$info['port']; 315 316 $host = @$info['host']; 317 if (false !== ($pluspos = strpos($host, '+'))) { 318 $parsed['protocol'] = substr($host,0,$pluspos); 319 if ($parsed['protocol'] === 'unix') { 320 $parsed['socket'] = substr($host,$pluspos+1); 321 } else { 322 $parsed['hostspec'] = substr($host,$pluspos+1); 323 } 324 } else { 325 $parsed['hostspec'] = $host; 326 } 327 328 if (isset($info['path'])) { 329 $parsed['database'] = substr($info['path'], 1); // remove first char, which is '/' 330 } 331 332 if (isset($info['query'])) { 333 $opts = explode('&', $info['query']); 334 foreach ($opts as $opt) { 335 list($key, $value) = explode('=', $opt); 336 if (!isset($parsed[$key])) { // don't allow params overwrite 337 $parsed[$key] = urldecode($value); 338 } 339 } 340 } 303 $preg_query = "!^(([a-z0-9]+)(\(([^()]+)\))?)(://((((([^@/:]+)(:([^@/]+))?)@)?((([a-z]+)\((([^?():]+)(:([^()?]+))?)\))|((([^/?:]+)(:([^/?]+))?))))/?)?([^?]+)?(\?(.+))?)?$!i"; 304 305 $info = array(); 306 307 if (preg_match($preg_query,$dsn,$info)) { // only if it is matching 308 309 $parsed['phptype'] = @$info[2]; // Group 2 should always exist. 310 311 // Don't know what to do with Group 4: phptype(xx) should => check first if available 312 313 if (isset($info[5])) { // There is more than just the phptype 314 315 if (strlen($info[10]) > 0) { // There is a username specified 316 $parsed['username'] = @$info[10]; 317 } 318 319 if (strlen($info[12]) > 0) { // There is a password specified 320 $parsed['password'] = @$info[12]; 321 } 322 323 if (strlen($info[15]) > 0) { // There is a protocol specified: protocol(hostspec) 324 $parsed['protocol'] = @$info[15]; 325 326 if ($parsed["protocol"] === "unix") { 327 $parsed['socket'] = @$info[16]; 328 } else { 329 $parsed["hostspec"] = @$info[17]; 330 if (strlen($info[19]) > 0) { 331 $parsed["port"] = @$info[19]; 332 } 333 } 334 } elseif (strlen($info[20]) > 0) { 335 $parsed["hostspec"] = @$info[22]; 336 337 if ((isset($info[24]) && (strlen($info[24]) > 0))) { // There is a port set (not always available) 338 $parsed["port"] = @$info[24]; 339 } 340 } 341 342 if ((isset($info[25])) && (strlen($info[25]) > 0)) { // There is a database 343 $parsed["database"] = @$info[25]; 344 } 345 346 if ((isset($info[27])) && (strlen($info[27]) >0)) { // There is a query 347 $opts = explode('&', $info[27]); 348 foreach ($opts as $opt) { 349 list($key, $value) = explode('=', $opt); 350 if (!isset($parsed[$key])) { // don't allow params overwrite 351 $parsed[$key] = urldecode($value); 352 } 353 } 354 } 355 356 } 357 } 341 358 342 359 return $parsed; … … 353 370 */ 354 371 public static function import($class) { 355 $pos = strrpos($class, '.'); 356 // get just classname ('path.to.ClassName' -> 'ClassName') 357 if ($pos !== false) { 358 $classname = substr($class, $pos + 1); 359 } 360 else 361 { 362 $classname = $class; 363 } 364 if (!class_exists($classname, false)) { 372 if (!class_exists($class, false)) { 365 373 $path = strtr($class, '.', DIRECTORY_SEPARATOR) . '.php'; 366 374 $ret = include_once($path); … … 368 376 throw new SQLException("Unable to load driver class: " . $class); 369 377 } 370 if (!class_exists($classname)) { 371 throw new SQLException("Unable to find loaded class: $classname (Hint: make sure classname matches filename)"); 372 } 373 } 374 return $classname; 378 // get just classname ('path.to.ClassName' -> 'ClassName') 379 $pos = strrpos($class, '.'); 380 if ($pos !== false) { 381 $class = substr($class, $pos + 1); 382 } 383 if (!class_exists($class)) { 384 throw new SQLException("Unable to find loaded class: $class (Hint: make sure classname matches filename)"); 385 } 386 } 387 return $class; 375 388 } 376 389 branches/1.0/lib/vendor/creole/CreoleTypes.php
r1723 r6003 122 122 * @return int Creole native type (e.g. Types::LONGVARCHAR, Types::BINARY, etc.). 123 123 */ 124 public static function getType($nativeType) { 125 throw new Exception('This method must be overridden in subclasses!'); // abstract static not allowed since PHP 5.2 126 } 124 abstract static function getType($nativeType); 127 125 128 126 /** … … 133 131 * @return string Native type string. 134 132 */ 135 public static function getNativeType($creoleType) { 136 throw new Exception('This method must be overridden in subclasses!'); // abstract static not allowed since PHP 5.2 137 } 133 abstract static function getNativeType($creoleType); 138 134 139 135 /** branches/1.0/lib/vendor/creole/drivers/mssql/MSSQLCallableStatement.php
r2135 r6003 89 89 public function __construct(Connection $conn, $stmt) 90 90 { 91 print " - > IN CONSTRUCTOR \n";92 91 $this->conn = $conn; 93 92 $this->stmt = $stmt; branches/1.0/lib/vendor/creole/drivers/mysql/MySQLResultSet.php
r1723 r6003 94 94 function close() 95 95 { 96 if(is_resource($this->result)) 97 @mysql_free_result($this->result); 96 @mysql_free_result($this->result); 98 97 $this->fields = array(); 99 98 } … … 122 121 if (is_int($column)) { $column--; } // because Java convention is to start at 1 123 122 if (!array_key_exists($column, $this->fields)) { throw new SQLException("Invalid resultset column: " . (is_int($column) ? $column + 1 : $column)); } 124 if ($this->fields[$column] === null ) { return null; }123 if ($this->fields[$column] === null || $this->fields[$column] == '0000-00-00 00:00:00') { return null; } 125 124 126 125 $ts = strtotime($this->fields[$column]); … … 147 146 } 148 147 148 /** 149 * @see ResultSetCommon::getDate() 150 */ 151 public function getDate($column, $format = '%X') 152 { 153 /* As of PHP 5.2.4, strftime() returns false for '0000-00-00' which 154 is impossible to tell apart from illegal dates. (Pre-PHP 5.2.4 155 even interpreted such dates incorrectly, see 156 http://bugs.php.net/bug.php?id=41523). 157 We catch this special case and return null as the date here. 158 However, we need to know the exact format the DBMS returns this 159 date, which is why we make this decision here in the specific 160 driver before dispatching to the common implementation. */ 161 $idx = (is_int($column) ? $column - 1 : $column); 162 if (array_key_exists($idx, $this->fields) && $this->fields[$idx] == '0000-00-00') return null; 163 return parent::getDate($column, $format); 164 } 165 149 166 } branches/1.0/lib/vendor/creole/drivers/mysqli/MySQLiConnection.php
r2135 r6003 33 33 */ 34 34 class MySQLiConnection extends ConnectionCommon implements Connection { 35 /** Current database (used in mysqli_select_db()). */36 private $database;37 35 38 36 /** … … 56 54 $dbhost = null; 57 55 58 59 56 if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix') { 60 57 $dbhost = ':' . $dsninfo['socket']; … … 73 70 $socket = !empty($dsninfo['socket']) ? $dsninfo['socket'] : null; 74 71 $database = !empty($dsninfo['database']) ? $dsninfo['database'] : null; 75 72 76 73 $encoding = !empty($dsninfo['encoding']) ? $dsninfo['encoding'] : null; 77 74 78 75 @ini_set('track_errors', true); 79 76 80 77 $conn = mysqli_connect($host, $user, $pw, $database, $port, $socket); 81 78 82 @ini_restore('track_errors');83 84 if ( empty($conn)) {79 @ini_restore('track_errors'); 80 81 if (!$conn) { 85 82 if (($err = @mysqli_error()) != '') { 86 83 throw new SQLException("connect failed", $err); … … 91 88 } 92 89 } 93 94 if ($dsninfo['database']) { 95 if (!@mysqli_select_db($conn, $dsninfo['database'])) { 96 switch(mysqli_errno($conn)) { 97 case 1049: 98 $exc = new SQLException("no such database", mysqli_error($conn)); 99 break; 100 case 1044: 101 $exc = new SQLException("access violation", mysqli_error($conn)); 102 break; 103 default: 104 $exc = new SQLException("cannot select database", mysqli_error($conn)); 105 } 106 107 throw $exc; 108 109 } 110 111 // fix to allow calls to different databases in the same script 112 $this->database = $dsninfo['database']; 113 } 114 90 115 91 $this->dblink = $conn; 116 92 117 93 if ($encoding) { 118 94 $this->executeUpdate("SET NAMES " . $encoding); … … 192 168 $this->lastQuery = $sql; 193 169 194 if ($this->database) {195 if (!@mysqli_select_db($this->dblink, $this->database)) {196 throw new SQLException('No database selected', mysqli_error($this->dblink));197 }198 }199 200 170 $result = @mysqli_query($this->dblink, $sql); 201 171 … … 214 184 $this->lastQuery = $sql; 215 185 216 if ($this->database) {217 if (!@mysqli_select_db($this->dblink, $this->database)) {218 throw new SQLException('No database selected', mysqli_error($this->dblink));219 }220 }221 222 186 $result = @mysqli_query($this->dblink, $sql); 223 187 … … 248 212 protected function commitTrans() 249 213 { 250 if ($this->database) {251 if (!@mysqli_select_db($this->dblink, $this->database)) {252 throw new SQLException('No database selected', mysqli_error($this->dblink));253 }254 }255 256 214 if (!mysqli_commit($this->dblink)) { 257 215 throw new SQLException('Can not commit transaction', mysqli_error($this->dblink)); 258 216 } 259 260 217 mysqli_autocommit($this->dblink, TRUE); 261 218 } … … 268 225 protected function rollbackTrans() 269 226 { 270 if ($this->database) {271 if (!@mysqli_select_db($this->dblink, $this->database)) {272 throw new SQLException('No database selected', mysqli_error($this->dblink));273 }274 }275 276 227 if (!mysqli_rollback($this->dblink)) { 277 228 throw new SQLException('Could not rollback transaction', mysqli_error($this->dblink)); 278 229 } 279 280 230 mysqli_autocommit($this->dblink, TRUE); 281 231 } branches/1.0/lib/vendor/creole/drivers/mysqli/metadata/MySQLiTableInfo.php
r2135 r6003 35 35 require_once 'creole/metadata/ColumnInfo.php'; 36 36 require_once 'creole/drivers/mysql/MySQLTypes.php'; 37 38 if (!@mysqli_select_db($this->conn->getResource(), $this->dbname)) {39 throw new SQLException('No database selected');40 }41 37 42 38 // To get all of the attributes we need, we use … … 91 87 } 92 88 93 if (!@mysqli_select_db($this->conn->getResource(), $this->dbname)) {94 throw new SQLException('No database selected');95 }96 97 89 // Primary Keys 98 90 $res = mysqli_query($this->conn->getResource(), "SHOW KEYS FROM " . $this->name); … … 120 112 $this->initColumns(); 121 113 } 122 123 if (!@mysqli_select_db($this->conn->getResource(), $this->dbname)) { 124 throw new SQLException('No database selected'); 125 } 126 114 127 115 // Indexes 128 116 $res = mysqli_query($this->conn->getResource(), "SHOW INDEX FROM " . $this->name); branches/1.0/lib/vendor/creole/drivers/oracle/OCI8Connection.php
r2135 r6003 70 70 $pw = $dsninfo[ 'password' ]; 71 71 $hostspec = $dsninfo[ 'hostspec' ]; 72 $port = $dsninfo[ 'port' ];73 72 $db = $dsninfo[ 'database' ]; 74 73 … … 76 75 ? 'oci_pconnect' 77 76 : 'oci_connect'; 77 78 78 $encoding = !empty($dsninfo['encoding']) ? $dsninfo['encoding'] : null; 79 79 80 80 @ini_set( 'track_errors', true ); 81 82 if ( $hostspec && $port )83 {84 $hostspec .= ':' . $port;85 }86 81 87 82 if ( $db && $hostspec && $user && $pw ) branches/1.0/lib/vendor/creole/drivers/oracle/OCI8Types.php
r1723 r6003 45 45 'raw' => CreoleTypes::VARBINARY, 46 46 'longraw' => CreoleTypes::LONGVARBINARY, 47 'date' => CreoleTypes::DATE, 48 'timestamp' => CreoleTypes::TIMESTAMP, 47 'date' => CreoleTypes::TIMESTAMP, 49 48 'blob' => CreoleTypes::BLOB, 50 49 'clob' => CreoleTypes::CLOB, … … 63 62 public static function getType($nativeType) 64 63 { 65 $t = str_replace(' ', '', strtolower($nativeType)); 66 if ( substr($t, 0, 9) == 'timestamp' ) return CreoleTypes::TIMESTAMP; 64 $t = strtolower($nativeType); 67 65 if (isset(self::$typeMap[$t])) { 68 66 return self::$typeMap[$t]; branches/1.0/lib/vendor/creole/drivers/pgsql/metadata/PgSQLDatabaseInfo.php
r1404 r6003 56 56 $result = null; 57 57 58 $result = pg_query($this->conn->getResource(), "SELECT oid, relname FROM pg_class 59 WHERE relkind = 'r' AND relnamespace = (SELECT oid 60 FROM pg_namespace 61 WHERE 62 nspname NOT IN ('information_schema','pg_catalog') 63 AND nspname NOT LIKE 'pg_temp%' 64 AND nspname NOT LIKE 'pg_toast%' 65 LIMIT 1) 66 ORDER BY relname"); 58 $result = pg_query($this->conn->getResource(), "SELECT c.oid, 59 case when n.nspname='public' then c.relname else n.nspname||'.'||c.relname end as relname 60 FROM pg_class c join pg_namespace n on (c.relnamespace=n.oid) 61 WHERE c.relkind = 'r' 62 AND n.nspname NOT IN ('information_schema','pg_catalog') 63 AND n.nspname NOT LIKE 'pg_temp%' 64 AND n.nspname NOT LIKE 'pg_toast%' 65 ORDER BY relname"); 67 66 68 67 if (!$result) { … … 88 87 $this->sequences = array(); 89 88 90 $result = pg_query($this->conn->getResource(), "SELECT oid, relname FROM pg_class 91 WHERE relkind = 'S' AND relnamespace = (SELECT oid 92 FROM pg_namespace 93 WHERE 94 nspname NOT IN ('information_schema','pg_catalog') 95 AND nspname NOT LIKE 'pg_temp%' 96 AND nspname NOT LIKE 'pg_toast%' 97 LIMIT 1) 98 ORDER BY relname"); 99 89 $result = pg_query($this->conn->getResource(), "SELECT c.oid, 90 case when n.nspname='public' then c.relname else n.nspname||'.'||c.relname end as relname 91 FROM pg_class c join pg_namespace n on (c.relnamespace=n.oid) 92 WHERE c.relkind = 'S' 93 AND n.nspname NOT IN ('information_schema','pg_catalog') 94 AND n.nspname NOT LIKE 'pg_temp%' 95 AND n.nspname NOT LIKE 'pg_toast%' 96 ORDER BY name"); 97 100 98 if (!$result) { 101 99 throw new SQLException("Could not list sequences", pg_last_error($this->dblink)); branches/1.0/lib/vendor/creole/drivers/sqlite/SQLiteResultSet.php
r1723 r6003 116 116 { 117 117 $this->fields = array(); 118 $this->result = null;119 118 } 120 119 } branches/1.0/lib/vendor/creole/drivers/sqlite/metadata/SQLiteTableInfo.php
r2135 r6003 43 43 // the second will fill in some more details. 44 44 45 $sql = "PRAGMA table_info('".$this->name."')";45 $sql = 'PRAGMA table_info('.$this->name.')'; 46 46 47 47 $res = sqlite_query($this->conn->getResource(), $sql); … … 67 67 $type = $fulltype; 68 68 } 69 // If column is primary key and of type INTEGER, it is auto increment 70 // See: http://sqlite.org/faq.html#q1 71 $is_auto_increment = ($row['pk'] == 1 && $fulltype == 'INTEGER'); 69 72 70 $not_null = $row['notnull']; 73 71 $is_nullable = !$not_null; … … 106 104 if (!$this->colsLoaded) $this->initColumns(); 107 105 108 $sql = "PRAGMA index_list('".$this->name."')";106 $sql = 'PRAGMA index_list('.$this->name.')'; 109 107 $res = sqlite_query($this->conn->getResource(), $sql); 110 108 … … 114 112 115 113 // get columns for that index 116 $res2 = sqlite_query($this->conn->getResource(), "PRAGMA index_info('$name')");114 $res2 = sqlite_query($this->conn->getResource(), 'PRAGMA index_info('.$name.')'); 117 115 while($row2 = sqlite_fetch_array($res2, SQLITE_ASSOC)) { 118 116 $colname = $row2['name']; branches/1.0/lib/vendor/creole/metadata/DatabaseInfo.php
r1723 r6003 140 140 public function hasTable($name) 141 141 { 142 if(!$this->tablesLoaded) $this->initTables();143 142 return isset($this->tables[strtoupper($name)]); 144 143 } branches/1.0/lib/vendor/creole/util/Clob.php
r2135 r6003 74 74 throw new Exception('No data to write to file'); 75 75 } 76 $f ile = fopen($this->inFile, "wt");77 if (fputs($f ile, $this->data) === false)76 $fp = fopen($this->outFile, "wt"); 77 if (fputs($fp, $this->data) === false) 78 78 throw new Exception('Unable to write to file: '.$this->outFile); 79 79 fclose($file); branches/1.0/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php
r3752 r6003 2 2 3 3 /* 4 * $Id: PHP5ComplexObjectBuilder.php 536 2007-01-10 14:30:38Z heltem $4 * $Id: PHP5ComplexObjectBuilder.php 706 2007-10-11 10:02:27Z heltem $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 377 377 public function get".$this->getFKPhpNameAffix($fk, $plural = false)."(\$con = null) 378 378 { 379 // include the related Peer class380 include_once '".$fkPeerBuilder->getClassFilePath()."';381 382 379 if (\$this->$varName === null && ($conditional)) { 380 // include the related Peer class 381 include_once '".$fkPeerBuilder->getClassFilePath()."'; 383 382 "; 384 383 $script .= " branches/1.0/lib/vendor/propel-generator/classes/propel/engine/database/model/AppData.php
r3752 r6003 1 1 <?php 2 2 /* 3 * $Id: AppData.php 536 2007-01-10 14:30:38Z heltem$3 * $Id: AppData.php 803 2007-11-13 21:24:21Z dwhittle $ 4 4 * 5 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 30 30 * @author John McNally <jmcnally@collab.net> (Torque) 31 31 * @author Daniel Rall <dlr@finemaltcoding.com> (Torque) 32 * @version $Revision: 536$32 * @version $Revision: 803 $ 33 33 * @package propel.engine.database.model 34 34 */ … … 96 96 public function getShortName() 97 97 { 98 return str_replace("-schema", "", $ name);98 return str_replace("-schema", "", $this->name); 99 99 } 100 100 branches/1.0/lib/vendor/propel-generator/classes/propel/engine/database/model/Table.php
r3752 r6003 2 2 3 3 /* 4 * $Id: Table.php 536 2007-01-10 14:30:38Z heltem$4 * $Id: Table.php 803 2007-11-13 21:24:21Z dwhittle $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 41 41 * @author Daniel Rall <dlr@collab.net> (Torque) 42 42 * @author Byron Foster <byron_foster@yahoo.com> (Torque) 43 * @version $Revision: 536$43 * @version $Revision: 803 $ 44 44 * @package propel.engine.database.model 45 45 */ … … 1016 1016 if ($this->abstractValue) { 1017 1017 $result .= " abstract=\"" 1018 . ($ abstractValue ? "true" : "false")1018 . ($this->abstractValue ? "true" : "false") 1019 1019 . '"'; 1020 1020 } branches/1.0/lib/vendor/propel-generator/classes/propel/phing/PropelSQLExec.php
r3752 r6003 2 2 3 3 /* 4 * $Id: PropelSQLExec.php 536 2007-01-10 14:30:38Z heltem$4 * $Id: PropelSQLExec.php 803 2007-11-13 21:24:21Z dwhittle $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 37 37 * @author Jason van Zyl <jvanzyl@apache.org> (Torque) 38 38 * @author Martin Poeschl <mpoeschl@marmot.at> (Torque) 39 * @version $Revision: 536$39 * @version $Revision: 803 $ 40 40 * @package propel.phing 41 41 */ … … 668 668 if (!empty($this->tSqlCommand)) { 669 669 $this->parent->log("Executing commands", PROJECT_MSG_INFO); 670 $this->parent->runStatements($t SqlCommand, $out);670 $this->parent->runStatements($this->tSqlCommand, $out); 671 671 } 672 672 branches/1.0/lib/vendor/propel-generator/default.properties
r3090 r6003 82 82 83 83 propel.defaultTimeStampFormat = Y-m-d H:i:s 84 propel.defaultTimeFormat = H:i:s85 propel.defaultDateFormat = Y-m-d84 propel.defaultTimeFormat = %X 85 propel.defaultDateFormat = %x 86 86 87 87 propel.omtar.src.base = false branches/1.0/lib/vendor/propel-generator/pear/build-pear-package.xml
r3754 r6003 20 20 21 21 <!-- some default properties --> 22 <property name="notes"><![CDATA[This is the a bugfix release to the 1.2 branch of the Propel Generator. 23 See: http://propel.phpdb.org/trac/query?status=closed&milestone=1.2.1&resolution=fixed&order=priority for CHANGELOG. 24 ]]></property> 22 <property name="notes">This is the latest snapshot of the Propel Generator.</property> 25 23 <property name="state" value="devel"/> 26 24 branches/1.0/lib/vendor/propel/Propel.php
r3750 r6003 2 2 3 3 /* 4 * $Id: Propel.php 601 2007-03-07 13:23:12Z hans$4 * $Id: Propel.php 536 2007-01-10 14:30:38Z heltem $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 38 38 * @author Henning P. Schmiedehausen <hps@intermeta.de> (Torque) 39 39 * @author Kurt Schrader <kschrader@karmalab.org> (Torque) 40 * @version $Revision: 601$40 * @version $Revision: 536 $ 41 41 * @package propel 42 42 */ … … 91 91 * The Propel version. 92 92 */ 93 const VERSION = '1.2.1 ';93 const VERSION = '1.2.1-dev'; 94 94 95 95 /** branches/1.0/lib/vendor/propel/adapter/DBMSSQL.php
r3750 r6003 2 2 3 3 /* 4 * $Id: DBMSSQL.php 536 2007-01-10 14:30:38Z heltem $ 5 * 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 7 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 8 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 9 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 10 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 11 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 12 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 13 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 14 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 16 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17 * 18 * This software consists of voluntary contributions made by many individuals 19 * and is licensed under the LGPL. For more information please see 20 * <http://propel.phpdb.org>. 21 */ 22 23 require_once 'propel/adapter/DBSybase.php'; 4 * $Id: DBMSSQL.php 800 2007-11-09 22:45:59Z justin $ 5 * 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 7 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 8 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 9 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 10 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 11 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 12 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 13 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 14 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 16 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17 * 18 * This software consists of voluntary contributions made by many individuals 19 * and is licensed under the LGPL. For more information please see 20 * <http://propel.phpdb.org>. 21 */ 24 22 25 23 /** … … 28 26 * 29 27 * @author Hans Lellelid <hans@xmpl.org> (Propel) 30 * @author Gonzalo Diethelm <gonzalo.diethelm@sonda.com> (Torque) 31 * @version $Revision: 536 $ 28 * @version $Revision: 800 $ 32 29 * @package propel.adapter 33 30 */ 34 31 class DBMSSQL extends DBSybase { 35 // no difference currently 32 33 /** 34 * Simulated Limit/Offset 35 * This rewrites the $sql query to apply the offset and limit. 36 * @see DBAdapter::applyLimit() 37 * @author Justin Carlson <justin.carlson@gmail.com> 38 */ 39 public function applyLimit(&$sql, $offset, $limit) 40 { 41 // make sure offset and limit are numeric 42 if(!is_numeric($offset) || !is_numeric($limit)){ 43 throw new Exception("DBMSSQL ::applyLimit() expects a number for argument 2 and 3"); 44 } 45 46 // obtain the original select statement 47 preg_match('/\A(.*)select(.*)from/si',$sql,$select_segment); 48 if(count($select_segment)>0) 49 { 50 $original_select = $select_segment[0]; 51 } else { 52 throw new Exception("DBMSSQL ::applyLimit() could not locate the select statement at the start of the query. "); 53 } 54 $modified_select = substr_replace($original_select, null, stristr($original_select,'select') , 6 ); 55 56 // obtain the original order by clause, or create one if there isn't one 57 preg_match('/order by(.*)\Z/si',$sql,$order_segment); 58 if(count($order_segment)>0) 59 { 60 $order_by = $order_segment[0]; 61 } else { 62 63 // no order by clause, if there are columns we can attempt to sort by the columns in the select statement 64 $select_items = split(',',$modified_select); 65 if(count($select_items)>0) 66 { 67 $item_number = 0; 68 $order_by = null; 69 while($order_by === null && $item_number<count($select_items)) 70 { 71 if($select_items[$item_number]!='*' && !strstr($select_items[$item_number],'(')) 72 { 73 $order_by = 'order by ' . $select_items[0] . ' asc'; 74 } 75 $item_number++; 76 } 77 } 78 if($order_by === null) 79 { 80 throw new Exception("DBMSSQL ::applyLimit() could not locate the order by statement at the end of your query or any columns at the start of your query. "); 81 } else { 82 $sql.= ' ' . $order_by; 83 } 84 85 } 86 87 // remove the original select statement 88 $sql = str_replace($original_select , null, $sql); 89 90 /* modify the sort order by for paging */ 91 $inverted_order = ''; 92 $order_columns = split(',',str_ireplace('order by ','',$order_by)); 93 $original_order_by = $order_by; 94 $order_by = ''; 95 foreach($order_columns as $column) 96 { 97 // strip "table." from order by columns 98 $column = array_reverse(split("\.",$column)); 99 $column = $column[0]; 100 101 // commas if we have multiple sort columns 102 if(strlen($inverted_order)>0){ 103 $order_by.= ', '; 104 $inverted_order.=', '; 105 } 106 107 // put together order for paging wrapper 108 if(stristr($column,' desc')) 109 { 110 $order_by .= $column; 111 $inverted_order .= str_ireplace(' desc',' asc',$column); 112 } elseif(stristr($column,' asc')) { 113 $order_by .= $column; 114 $inverted_order .= str_ireplace(' asc',' desc',$column); 115 } else { 116 $order_by .= $column; 117 $inverted_order .= $colu