Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
05f6fc93
Commit
05f6fc93
authored
Feb 26, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DBAL-88'
parents
76fa4a80
27eb9416
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
12 deletions
+40
-12
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+14
-1
DB2Platform.php
lib/Doctrine/DBAL/Platforms/DB2Platform.php
+1
-1
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+1
-1
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+19
-3
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+1
-1
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+1
-1
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+2
-2
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+1
-2
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
05f6fc93
...
...
@@ -1753,7 +1753,20 @@ abstract class AbstractPlatform
throw
DBALException
::
notSupported
(
__METHOD__
);
}
public
function
getListTableIndexesSQL
(
$table
)
/**
* Get the list of indexes for the current database.
*
* The current database parameter is optional but will always be passed
* when using the SchemaManager API and is the database the given table is in.
*
* Attention: Some platforms only support currentDatabase when they
* are connected with that database. Cross-database information schema
* requests may be impossible.
*
* @param string $table
* @param string $currentDatabase
*/
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
throw
DBALException
::
notSupported
(
__METHOD__
);
}
...
...
lib/Doctrine/DBAL/Platforms/DB2Platform.php
View file @
05f6fc93
...
...
@@ -234,7 +234,7 @@ class DB2Platform extends AbstractPlatform
return
"SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS"
;
}
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
return
"SELECT NAME, COLNAMES, UNIQUERULE FROM SYSIBM.SYSINDEXES WHERE TBNAME = UPPER('"
.
$table
.
"')"
;
}
...
...
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
05f6fc93
...
...
@@ -340,7 +340,7 @@ class MsSqlPlatform extends AbstractPlatform
/**
* @override
*/
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
return
"exec sp_helpindex '"
.
$table
.
"'"
;
}
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
05f6fc93
...
...
@@ -109,10 +109,26 @@ class MySqlPlatform extends AbstractPlatform
return
'SHOW INDEX FROM '
.
$table
;
}
public
function
getListTableIndexesSQL
(
$table
)
{
/**
* Two approaches to listing the table indexes. The information_schema is
* prefered, because it doesn't cause problems with SQL keywords such as "order" or "table".
*
* @param string $table
* @param string $currentDatabase
* @return string
*/
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
if
(
$currentDatabase
)
{
return
"SELECT TABLE_NAME AS `Table`, NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, "
.
"SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, "
.
"CARDINALITY AS Cardinality, SUB_PART AS Sub_Part, PACKED AS Packed, "
.
"NULLABLE AS `Null`, INDEX_TYPE AS Index_Type, COMMENT AS Comment "
.
"FROM information_schema.STATISTICS WHERE TABLE_NAME = '"
.
$table
.
"' AND TABLE_SCHEMA = '"
.
$currentDatabase
.
"'"
;
}
else
{
return
'SHOW INDEX FROM '
.
$table
;
}
}
public
function
getListViewsSQL
(
$database
)
{
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
05f6fc93
...
...
@@ -296,7 +296,7 @@ class OraclePlatform extends AbstractPlatform
* @param string $table
* @return string
*/
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
$table
=
strtoupper
(
$table
);
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
05f6fc93
...
...
@@ -222,7 +222,7 @@ class PostgreSqlPlatform extends AbstractPlatform
* @param string $table
* @return string
*/
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
return
"SELECT relname, pg_index.indisunique, pg_index.indisprimary,
pg_index.indkey, pg_index.indrelid
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
05f6fc93
...
...
@@ -316,12 +316,12 @@ class SqlitePlatform extends AbstractPlatform
return
"SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name = '
$table
' AND sql NOT NULL ORDER BY name"
;
}
public
function
getListTableColumnsSQL
(
$table
,
$
d
atabase
=
null
)
public
function
getListTableColumnsSQL
(
$table
,
$
currentD
atabase
=
null
)
{
return
"PRAGMA table_info(
$table
)"
;
}
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
return
"PRAGMA index_list(
$table
)"
;
}
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
05f6fc93
...
...
@@ -33,7 +33,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
* @author Roman Borschel <roman@code-factory.org>
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @version $Revision$
* @since 2.0
*/
abstract
class
AbstractSchemaManager
...
...
@@ -167,7 +166,7 @@ abstract class AbstractSchemaManager
*/
public
function
listTableIndexes
(
$table
)
{
$sql
=
$this
->
_platform
->
getListTableIndexesSQL
(
$table
);
$sql
=
$this
->
_platform
->
getListTableIndexesSQL
(
$table
,
$this
->
_conn
->
getDatabase
()
);
$tableIndexes
=
$this
->
_conn
->
fetchAll
(
$sql
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment