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
a8bf19ea
Commit
a8bf19ea
authored
Feb 26, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DBAL-88' into 2.0.x
parents
2775ab9c
ff2a856c
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 @
a8bf19ea
...
@@ -1660,7 +1660,20 @@ abstract class AbstractPlatform
...
@@ -1660,7 +1660,20 @@ abstract class AbstractPlatform
throw
DBALException
::
notSupported
(
__METHOD__
);
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__
);
throw
DBALException
::
notSupported
(
__METHOD__
);
}
}
...
...
lib/Doctrine/DBAL/Platforms/DB2Platform.php
View file @
a8bf19ea
...
@@ -234,7 +234,7 @@ class DB2Platform extends AbstractPlatform
...
@@ -234,7 +234,7 @@ class DB2Platform extends AbstractPlatform
return
"SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS"
;
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
.
"')"
;
return
"SELECT NAME, COLNAMES, UNIQUERULE FROM SYSIBM.SYSINDEXES WHERE TBNAME = UPPER('"
.
$table
.
"')"
;
}
}
...
...
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
a8bf19ea
...
@@ -340,7 +340,7 @@ class MsSqlPlatform extends AbstractPlatform
...
@@ -340,7 +340,7 @@ class MsSqlPlatform extends AbstractPlatform
/**
/**
* @override
* @override
*/
*/
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
{
return
"exec sp_helpindex '"
.
$table
.
"'"
;
return
"exec sp_helpindex '"
.
$table
.
"'"
;
}
}
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
a8bf19ea
...
@@ -109,10 +109,26 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -109,10 +109,26 @@ class MySqlPlatform extends AbstractPlatform
return
'SHOW INDEX FROM '
.
$table
;
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
;
return
'SHOW INDEX FROM '
.
$table
;
}
}
}
public
function
getListViewsSQL
(
$database
)
public
function
getListViewsSQL
(
$database
)
{
{
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
a8bf19ea
...
@@ -296,7 +296,7 @@ class OraclePlatform extends AbstractPlatform
...
@@ -296,7 +296,7 @@ class OraclePlatform extends AbstractPlatform
* @param string $table
* @param string $table
* @return string
* @return string
*/
*/
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
{
$table
=
strtoupper
(
$table
);
$table
=
strtoupper
(
$table
);
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
a8bf19ea
...
@@ -217,7 +217,7 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -217,7 +217,7 @@ class PostgreSqlPlatform extends AbstractPlatform
* @param string $table
* @param string $table
* @return string
* @return string
*/
*/
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
{
return
"SELECT relname, pg_index.indisunique, pg_index.indisprimary,
return
"SELECT relname, pg_index.indisunique, pg_index.indisprimary,
pg_index.indkey, pg_index.indrelid
pg_index.indkey, pg_index.indrelid
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
a8bf19ea
...
@@ -316,12 +316,12 @@ class SqlitePlatform extends AbstractPlatform
...
@@ -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"
;
return
"SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name = '
$table
' AND sql NOT NULL ORDER BY name"
;
}
}
public
function
getListTableColumnsSQL
(
$table
)
public
function
getListTableColumnsSQL
(
$table
,
$currentDatabase
=
null
)
{
{
return
"PRAGMA table_info(
$table
)"
;
return
"PRAGMA table_info(
$table
)"
;
}
}
public
function
getListTableIndexesSQL
(
$table
)
public
function
getListTableIndexesSQL
(
$table
,
$currentDatabase
=
null
)
{
{
return
"PRAGMA index_list(
$table
)"
;
return
"PRAGMA index_list(
$table
)"
;
}
}
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
a8bf19ea
...
@@ -33,7 +33,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
...
@@ -33,7 +33,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
* @author Roman Borschel <roman@code-factory.org>
* @author Roman Borschel <roman@code-factory.org>
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @version $Revision$
* @since 2.0
* @since 2.0
*/
*/
abstract
class
AbstractSchemaManager
abstract
class
AbstractSchemaManager
...
@@ -162,7 +161,7 @@ abstract class AbstractSchemaManager
...
@@ -162,7 +161,7 @@ abstract class AbstractSchemaManager
*/
*/
public
function
listTableIndexes
(
$table
)
public
function
listTableIndexes
(
$table
)
{
{
$sql
=
$this
->
_platform
->
getListTableIndexesSQL
(
$table
);
$sql
=
$this
->
_platform
->
getListTableIndexesSQL
(
$table
,
$this
->
_conn
->
getDatabase
()
);
$tableIndexes
=
$this
->
_conn
->
fetchAll
(
$sql
);
$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