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
4d437439
Commit
4d437439
authored
Sep 05, 2009
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Added boolean type support
parent
a65ea05f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
18 deletions
+77
-18
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+8
-5
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+17
-2
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+8
-0
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+11
-2
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+32
-8
BooleanType.php
lib/Doctrine/DBAL/Types/BooleanType.php
+1
-1
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
4d437439
...
...
@@ -769,6 +769,14 @@ abstract class AbstractPlatform
return
'NUMERIC('
.
$columnDef
[
'precision'
]
.
', '
.
$columnDef
[
'scale'
]
.
')'
;
}
/**
* Gets the SQL snippet that declares a boolean column.
*
* @param array $columnDef
* @return string
*/
abstract
public
function
getBooleanTypeDeclarationSql
(
array
$columnDef
);
/**
* Gets the SQL snippet that declares a 4 byte integer column.
*
...
...
@@ -1543,11 +1551,6 @@ abstract class AbstractPlatform
*/
abstract
public
function
getVarcharTypeDeclarationSql
(
array
$field
);
public
function
getBooleanTypeDeclarationSql
(
array
$field
)
{
return
$this
->
getIntegerTypeDeclarationSql
(
$field
);
}
/**
* Gets the name of the platform.
*
...
...
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
4d437439
...
...
@@ -324,19 +324,34 @@ class MsSqlPlatform extends AbstractPlatform
{
return
'SET TRANSACTION ISOLATION LEVEL '
.
$this
->
_getTransactionIsolationLevelSql
(
$level
);
}
/**
* @override
*/
public
function
getBooleanTypeDeclarationSql
(
array
$field
)
{
return
'BIT'
;
}
/**
* @override
*/
public
function
getIntegerTypeDeclarationSql
(
array
$field
)
{
return
'INT'
.
$this
->
_getCommonIntegerTypeDeclarationSql
(
$field
);
}
/** @override */
/**
* @override
*/
public
function
getBigIntTypeDeclarationSql
(
array
$field
)
{
return
'BIGINT'
.
$this
->
_getCommonIntegerTypeDeclarationSql
(
$field
);
}
/** @override */
/**
* @override
*/
public
function
getSmallIntTypeDeclarationSql
(
array
$field
)
{
return
'SMALLINT'
.
$this
->
_getCommonIntegerTypeDeclarationSql
(
$field
);
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
4d437439
...
...
@@ -152,6 +152,14 @@ class OraclePlatform extends AbstractPlatform
return
parent
::
_getTransactionIsolationLevelSql
(
$level
);
}
}
/**
* @override
*/
public
function
getBooleanTypeDeclarationSql
(
array
$field
)
{
return
'NUMBER(1)'
;
}
/**
* @override
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
4d437439
...
...
@@ -218,10 +218,10 @@ class PostgreSqlPlatform extends AbstractPlatform
* @param string $value boolean value to be parsed
* @return string parsed boolean value
*/
public
function
parseBoolean
(
$value
)
/*
public function parseBoolean($value)
{
return $value;
}
}
*/
/**
* Whether the platform supports sequences.
...
...
@@ -656,6 +656,14 @@ class PostgreSqlPlatform extends AbstractPlatform
return
'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL '
.
$this
->
_getTransactionIsolationLevelSql
(
$level
);
}
/**
* @override
*/
public
function
getBooleanTypeDeclarationSql
(
array
$field
)
{
return
'BOOLEAN'
;
}
/**
* @override
...
...
@@ -665,6 +673,7 @@ class PostgreSqlPlatform extends AbstractPlatform
if
(
!
empty
(
$field
[
'autoincrement'
]))
{
return
'SERIAL'
;
}
return
'INT'
;
}
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
4d437439
...
...
@@ -193,43 +193,65 @@ class SqlitePlatform extends AbstractPlatform
return
'PRAGMA read_uncommitted = '
.
$this
->
_getTransactionIsolationLevelSql
(
$level
);
}
/** @override */
/**
* @override
*/
public
function
prefersIdentityColumns
()
{
return
true
;
}
/**
* @override
*/
public
function
getBooleanTypeDeclarationSql
(
array
$field
)
{
return
'BOOLEAN'
;
}
/** @override */
/**
* @override
*/
public
function
getIntegerTypeDeclarationSql
(
array
$field
)
{
return
$this
->
_getCommonIntegerTypeDeclarationSql
(
$field
);
}
/** @override */
/**
* @override
*/
public
function
getBigIntTypeDeclarationSql
(
array
$field
)
{
return
$this
->
_getCommonIntegerTypeDeclarationSql
(
$field
);
}
/** @override */
/**
* @override
*/
public
function
getTinyIntTypeDeclarationSql
(
array
$field
)
{
return
$this
->
_getCommonIntegerTypeDeclarationSql
(
$field
);
}
/** @override */
/**
* @override
*/
public
function
getSmallIntTypeDeclarationSql
(
array
$field
)
{
return
$this
->
_getCommonIntegerTypeDeclarationSql
(
$field
);
}
/** @override */
/**
* @override
*/
public
function
getMediumIntTypeDeclarationSql
(
array
$field
)
{
return
$this
->
_getCommonIntegerTypeDeclarationSql
(
$field
);
}
/** @override */
/**
* @override
*/
public
function
getDateTimeTypeDeclarationSql
(
array
$fieldDeclaration
)
{
return
'DATETIME'
;
...
...
@@ -243,7 +265,9 @@ class SqlitePlatform extends AbstractPlatform
return
'DATE'
;
}
/** @override */
/**
* @override
*/
protected
function
_getCommonIntegerTypeDeclarationSql
(
array
$columnDef
)
{
$autoinc
=
!
empty
(
$columnDef
[
'autoincrement'
])
?
' AUTOINCREMENT'
:
''
;
...
...
lib/Doctrine/DBAL/Types/BooleanType.php
View file @
4d437439
...
...
@@ -13,7 +13,7 @@ class BooleanType extends Type
{
public
function
getSqlDeclaration
(
array
$fieldDeclaration
,
AbstractPlatform
$platform
)
{
return
$platform
->
getBoolean
DeclarationSql
(
);
return
$platform
->
getBoolean
TypeDeclarationSql
(
$fieldDeclaration
);
}
public
function
convertToDatabaseValue
(
$value
,
AbstractPlatform
$platform
)
...
...
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