From b9daf621cfa018a6a727d727d1b2fb042af0d124 Mon Sep 17 00:00:00 2001 From: beberlei Date: Thu, 11 Feb 2010 14:29:12 +0000 Subject: [PATCH] [2.0] DDC-313 - Removed lots of dead and unnecessary code --- .../DBAL/Platforms/AbstractPlatform.php | 35 ----- lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php | 34 +---- lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 83 +---------- .../DBAL/Platforms/OraclePlatform.php | 19 --- .../DBAL/Platforms/PostgreSqlPlatform.php | 140 ------------------ .../DBAL/Platforms/SqlitePlatform.php | 101 +------------ .../DBAL/Platforms/MsSqlPlatformTest.php | 2 - .../DBAL/Platforms/MySqlPlatformTest.php | 2 - .../DBAL/Platforms/OraclePlatformTest.php | 9 -- .../DBAL/Platforms/PostgreSqlPlatformTest.php | 1 - 10 files changed, 5 insertions(+), 421 deletions(-) diff --git a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php index 90b1928b2..d1c4ac2fe 100644 --- a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php @@ -1314,28 +1314,6 @@ abstract class AbstractPlatform return ''; } - /** - * build a pattern matching string - * - * EXPERIMENTAL - * - * WARNING: this function is experimental and may change signature at - * any time until labelled as non-experimental - * - * @access public - * - * @param array $pattern even keys are strings, odd are patterns (% and _) - * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future) - * @param string $field optional field name that is being matched against - * (might be required when emulating ILIKE) - * - * @return string SQL pattern - */ - public function getMatchPatternExpression($pattern, $operator = null, $field = null) - { - throw DBALException::notSupported(__METHOD__); - } - /** * Whether the platform prefers sequences for ID generation. * Subclasses should override this method to return TRUE if they prefer sequences. @@ -1530,19 +1508,6 @@ abstract class AbstractPlatform throw DBALException::notSupported(__METHOD__); } - /** - * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET - * of a field declaration to be used in statements like CREATE TABLE. - * - * @param string $charset name of the charset - * @return string DBMS specific SQL code portion needed to set the CHARACTER SET - * of a field declaration. - */ - public function getCharsetFieldDeclaration($charset) - { - throw DBALException::notSupported(__METHOD__); - } - /** * Obtain DBMS specific SQL to be used to create datetime fields in * statements like CREATE TABLE diff --git a/lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php index 4ed49c782..4eb758b0f 100644 --- a/lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php @@ -32,17 +32,10 @@ use Doctrine\Common\DoctrineException; * @since 2.0 * @author Roman Borschel * @author Jonathan H. Wage + * @author Benjamin Eberlei */ class MsSqlPlatform extends AbstractPlatform -{ - /** - * the constructor - */ - public function __construct() - { - parent::__construct(); - } - +{ /** * Adds an adapter-specific LIMIT clause to the SELECT statement. * [ borrowed from Zend Framework ] @@ -144,16 +137,6 @@ class MsSqlPlatform extends AbstractPlatform return 'RLIKE'; } - /** - * return string to call a function to get random value inside an SQL statement - * - * @return string to generate float between 0 and 1 - */ - public function getRandomExpression() - { - return 'RAND()'; - } - /** * Return string to call a variable with the current timestamp inside an SQL statement * There are three special variables for current date and time: @@ -351,19 +334,6 @@ class MsSqlPlatform extends AbstractPlatform return $unsigned . $autoinc; } - /** - * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET - * of a field declaration to be used in statements like CREATE TABLE. - * - * @param string $charset name of the charset - * @return string DBMS specific SQL code portion needed to set the CHARACTER SET - * of a field declaration. - */ - public function getCharsetFieldDeclaration($charset) - { - return 'CHARACTER SET ' . $charset; - } - /** * @override */ diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index 0ae1520ad..fd42bb6c2 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -31,17 +31,10 @@ use Doctrine\Common\DoctrineException, * * @since 2.0 * @author Roman Borschel + * @author Benjamin Eberlei */ class MySqlPlatform extends AbstractPlatform -{ - /** - * Creates a new MySqlPlatform instance. - */ - public function __construct() - { - parent::__construct(); - } - +{ /** * Gets the character used for identifier quoting. * @@ -64,65 +57,6 @@ class MySqlPlatform extends AbstractPlatform return 'RLIKE'; } - /** - * return string to call a function to get random value inside an SQL statement - * - * @return string to generate float between 0 and 1 - */ - public function getRandomExpression() - { - return 'RAND()'; - } - - /** - * Builds a pattern matching string. - * - * EXPERIMENTAL - * - * WARNING: this function is experimental and may change signature at - * any time until labelled as non-experimental. - * - * @param array $pattern even keys are strings, odd are patterns (% and _) - * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future) - * @param string $field optional field name that is being matched against - * (might be required when emulating ILIKE) - * - * @return string SQL pattern - * @override - */ - public function getMatchPatternExpression($pattern, $operator = null, $field = null) - { - $match = ''; - if ( ! is_null($operator)) { - $field = is_null($field) ? '' : $field.' '; - $operator = strtoupper($operator); - switch ($operator) { - // case insensitive - case 'ILIKE': - $match = $field.'LIKE '; - break; - // case sensitive - case 'LIKE': - $match = $field.'LIKE BINARY '; - break; - default: - throw DoctrineException::operatorNotSupported($operator); - } - } - $match.= "'"; - foreach ($pattern as $key => $value) { - if ($key % 2) { - $match .= $value; - } else { - $match .= $this->conn->escapePattern($this->conn->escape($value)); - } - } - $match.= "'"; - $match.= $this->patternEscapeString(); - - return $match; - } - /** * Returns global unique identifier * @@ -235,19 +169,6 @@ class MySqlPlatform extends AbstractPlatform return 'LONGTEXT'; } - /** - * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET - * of a field declaration to be used in statements like CREATE TABLE. - * - * @param string $charset name of the charset - * @return string DBMS specific SQL code portion needed to set the CHARACTER SET - * of a field declaration. - */ - public function getCharsetFieldDeclaration($charset) - { - return 'CHARACTER SET ' . $charset; - } - /** * @override */ diff --git a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php index 560fbb14e..0fc18446a 100644 --- a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php @@ -33,14 +33,6 @@ use Doctrine\DBAL\Schema\TableDiff; */ class OraclePlatform extends AbstractPlatform { - /** - * Constructor. - */ - public function __construct() - { - parent::__construct(); - } - /** * return string to call a function to get a substring inside an SQL statement * @@ -82,17 +74,6 @@ class OraclePlatform extends AbstractPlatform } } - /** - * random - * - * @return string an oracle SQL string that generates a float between 0 and 1 - * @override - */ - public function getRandomExpression() - { - return 'dbms_random.value'; - } - /** * Returns global unique identifier * diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php index ddddae8e8..a9beb420c 100644 --- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php @@ -33,44 +33,6 @@ use Doctrine\DBAL\Schema\TableDiff; */ class PostgreSqlPlatform extends AbstractPlatform { - /** - * Constructor. - * Creates a new PostgreSqlPlatform. - */ - public function __construct() - { - parent::__construct(); - } - - - /** - * Returns the md5 sum of a field. - * - * Note: Not SQL92, but common functionality - * - * md5() works with the default PostgreSQL 8 versions. - * - * If you are using PostgreSQL 7.x or older you need - * to make sure that the digest procedure is installed. - * If you use RPMS (Redhat and Mandrake) install the postgresql-contrib - * package. You must then install the procedure by running this shell command: - * - * psql [dbname] < /usr/share/pgsql/contrib/pgcrypto.sql - * - * You should make sure you run this as the postgres user. - * - * @return string - * @override - */ - public function getMd5Expression($column) - { - if ($this->_version > 7) { - return 'MD5(' . $column . ')'; - } else { - return 'encode(digest(' . $column .', md5), hex)'; - } - } - /** * Returns part of a string. * @@ -91,45 +53,6 @@ class PostgreSqlPlatform extends AbstractPlatform } } - /** - * PostgreSQLs AGE( [, ]) function. - * - * @param string $timestamp1 timestamp to subtract from NOW() - * @param string $timestamp2 optional; if given: subtract arguments - * @return string - */ - public function getAgeExpression($timestamp1, $timestamp2 = null) - { - if ( $timestamp2 == null ) { - return 'AGE(' . $timestamp1 . ')'; - } - return 'AGE(' . $timestamp1 . ', ' . $timestamp2 . ')'; - } - - /** - * PostgreSQLs DATE_PART( ,