Commit 34da8376 authored by jwage's avatar jwage

[2.0] Fixing __call() in AbstractSchemaManager, doc blocks, clean up

parent ac8492d2
......@@ -513,9 +513,9 @@ abstract class AbstractPlatform
return 'DROP TABLE ' . $table;
}
public function getDropIndexSql($index, $name)
public function getDropIndexSql($table, $name)
{
return 'DROP INDEX ' . $index;
return 'DROP INDEX ' . $name;
}
public function getDropConstraintSql($table, $name, $primary = false)
......
<?php
namespace Doctrine\DBAL\Platforms;
class Db2Platform extends AbstractPlatform
{
public function getSequenceNextValSql($sequenceName)
{
return 'SELECT NEXTVAL FOR ' . $this->quoteIdentifier($sequenceName)
. ' FROM SYSIBM.SYSDUMMY1';
}
/**
* Get the platform name for this instance
*
* @return string
*/
public function getName()
{
return 'db2';
}
}
\ No newline at end of file
<?php
namespace Doctrine\DBAL\Platforms;
class FirebirdPlatform extends AbstractPlatform
{
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
}
/**
* Adds an driver-specific LIMIT clause to the query
*
* @param string $query query to modify
* @param integer $limit limit the number of rows
* @param integer $offset start reading from given offset
* @return string modified query
* @override
*/
public function writeLimitClause($query, $limit, $offset)
{
if ( ! $offset) {
$offset = 0;
}
if ($limit > 0) {
$query = preg_replace('/^([\s(])*SELECT(?!\s*FIRST\s*\d+)/i',
"SELECT FIRST $limit SKIP $offset", $query);
}
return $query;
}
/**
* return string for internal table used when calling only a function
*
* @return string for internal table used when calling only a function
*/
public function getFunctionTableExpression()
{
return ' FROM RDB$DATABASE';
}
/**
* build string to define escape pattern string
*
* @return string define escape pattern
* @override
*/
public function getPatternEscapeStringExpression()
{
return " ESCAPE '". $this->_properties['escape_pattern'] ."'";
}
/**
* 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;
}
/**
* Obtain DBMS specific SQL code portion needed to set the COLLATION
* of a field declaration to be used in statements like CREATE TABLE.
*
* @param string $collation name of the collation
* @return string DBMS specific SQL code portion needed to set the COLLATION
* of a field declaration.
*/
public function getCollationFieldDeclaration($collation)
{
return 'COLLATE ' . $collation;
}
public function getSequenceNextValSql($sequenceName)
{
return 'SELECT GEN_ID(' . $this->quoteIdentifier($sequenceName) . ', 1) FROM RDB$DATABASE';
}
protected function _getTransactionIsolationLevelSql($level)
{
switch ($level) {
case Doctrine_DBAL_Connection::TRANSACTION_READ_UNCOMMITTED:
return 'READ COMMITTED RECORD_VERSION';
case Doctrine_DBAL_Connection::TRANSACTION_READ_COMMITTED:
return 'READ COMMITTED NO RECORD_VERSION';
case Doctrine_DBAL_Connection::TRANSACTION_REPEATABLE_READ:
return 'SNAPSHOT';
case Doctrine_DBAL_Connection::TRANSACTION_SERIALIZABLE:
return 'SNAPSHOT TABLE STABILITY';
default:
return parent::_getTransactionIsolationLevelSql($level);
}
}
public function getSetTransactionIsolationSql($level)
{
return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSql($level);
}
public function getName()
{
return 'firebird';
}
}
\ No newline at end of file
<?php
namespace Doctrine\DBAL\Platforms;
class InformixPlatform extends AbstractPlatform
{
public function __construct()
{
parent::__construct();
}
/**
* Get the platform name for this instance
*
* @return string
*/
public function getName()
{
return 'informix';
}
}
\ No newline at end of file
This diff is collapsed.
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
namespace Doctrine\DBAL\Schema;
/**
* xxx
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @author Lorenzo Alberton <l.alberton@quipo.it> (PEAR MDB2 Interbase driver)
* @version $Revision$
* @since 2.0
*/
class InformixSchemaManager extends AbstractSchemaManager
{
protected $sql = array(
'listTables' => "SELECT tabname,tabtype FROM systables WHERE tabtype IN ('T','V') AND owner != 'informix'",
'listColumns' => "SELECT c.colname, c.coltype, c.collength, d.default, c.colno
FROM syscolumns c, systables t,outer sysdefaults d
WHERE c.tabid = t.tabid AND d.tabid = t.tabid AND d.colno = c.colno
AND tabname='%s' ORDER BY c.colno",
'listPk' => "SELECT part1, part2, part3, part4, part5, part6, part7, part8 FROM
systables t, sysconstraints s, sysindexes i WHERE t.tabname='%s'
AND s.tabid=t.tabid AND s.constrtype='P'
AND i.idxname=s.idxname",
'listForeignKeys' => "SELECT tr.tabname,updrule,delrule,
i.part1 o1,i2.part1 d1,i.part2 o2,i2.part2 d2,i.part3 o3,i2.part3 d3,i.part4 o4,i2.part4 d4,
i.part5 o5,i2.part5 d5,i.part6 o6,i2.part6 d6,i.part7 o7,i2.part7 d7,i.part8 o8,i2.part8 d8
from systables t,sysconstraints s,sysindexes i,
sysreferences r,systables tr,sysconstraints s2,sysindexes i2
where t.tabname='%s'
and s.tabid=t.tabid and s.constrtype='R' and r.constrid=s.constrid
and i.idxname=s.idxname and tr.tabid=r.ptabid
and s2.constrid=r.primary and i2.idxname=s2.idxname",
);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment