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
e21d8fff
Commit
e21d8fff
authored
Jun 15, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Removing old enum stuff
parent
c89d0e63
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
305 deletions
+0
-305
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+0
-226
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+0
-21
AbstractQuery.php
lib/Doctrine/ORM/AbstractQuery.php
+0
-43
AbstractResult.php
lib/Doctrine/ORM/Query/AbstractResult.php
+0
-15
No files found.
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
e21d8fff
...
...
@@ -38,233 +38,7 @@ class PostgreSqlPlatform extends AbstractPlatform
{
parent
::
__construct
();
}
/**
* Obtain DBMS specific SQL code portion needed to declare an text type
* field to be used in statements like CREATE TABLE.
*
* @param array $field associative array with the name of the properties
* of the field being declared as array indexes. Currently, the types
* of supported field properties are as follows:
*
* length
* Integer value that determines the maximum length of the text
* field. If this argument is missing the field should be
* declared to have the longest length allowed by the DBMS.
*
* default
* Text value to be used as default for this field.
*
* notnull
* Boolean flag that indicates whether this field is constrained
* to not be set to null.
*
* @return string DBMS specific SQL code portion that should be used to
* declare the specified field.
* @override
*/
public
function
getNativeDeclaration
(
array
$field
)
{
if
(
!
isset
(
$field
[
'type'
]))
{
throw
DoctrineException
::
updateMe
(
'Missing column type.'
);
}
switch
(
$field
[
'type'
])
{
case
'char'
:
case
'string'
:
case
'array'
:
case
'object'
:
case
'varchar'
:
case
'gzip'
:
// TODO: what is the maximum VARCHAR length in pgsql ?
$length
=
(
isset
(
$field
[
'length'
])
&&
$field
[
'length'
]
&&
$field
[
'length'
]
<
10000
)
?
$field
[
'length'
]
:
null
;
$fixed
=
((
isset
(
$field
[
'fixed'
])
&&
$field
[
'fixed'
])
||
$field
[
'type'
]
==
'char'
)
?
true
:
false
;
return
$fixed
?
(
$length
?
'CHAR('
.
$length
.
')'
:
'CHAR('
.
$this
->
conn
->
options
[
'default_text_field_length'
]
.
')'
)
:
(
$length
?
'VARCHAR('
.
$length
.
')'
:
'TEXT'
);
case
'clob'
:
return
'TEXT'
;
case
'blob'
:
return
'BYTEA'
;
case
'enum'
:
case
'integer'
:
case
'int'
:
if
(
!
empty
(
$field
[
'autoincrement'
]))
{
if
(
!
empty
(
$field
[
'length'
]))
{
$length
=
$field
[
'length'
];
if
(
$length
>
4
)
{
return
'BIGSERIAL'
;
}
}
return
'SERIAL'
;
}
if
(
!
empty
(
$field
[
'length'
]))
{
$length
=
$field
[
'length'
];
if
(
$length
<=
2
)
{
return
'SMALLINT'
;
}
elseif
(
$length
==
3
||
$length
==
4
)
{
return
'INT'
;
}
elseif
(
$length
>
4
)
{
return
'BIGINT'
;
}
}
return
'INT'
;
case
'boolean'
:
return
'BOOLEAN'
;
case
'date'
:
return
'DATE'
;
case
'time'
:
return
'TIME without time zone'
;
case
'timestamp'
:
return
'TIMESTAMP without time zone'
;
case
'float'
:
case
'double'
:
return
'FLOAT'
;
case
'decimal'
:
$length
=
!
empty
(
$field
[
'length'
])
?
$field
[
'length'
]
:
18
;
$scale
=
!
empty
(
$field
[
'scale'
])
?
$field
[
'scale'
]
:
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_DECIMAL_PLACES
);
return
'NUMERIC('
.
$length
.
','
.
$scale
.
')'
;
}
throw
DoctrineException
::
updateMe
(
'Unknown field type \''
.
$field
[
'type'
]
.
'\'.'
);
}
/**
* Maps a native array description of a field to a portable Doctrine datatype and length
*
* @param array $field native field description
*
* @return array containing the various possible types, length, sign, fixed
* @override
*/
public
function
getPortableDeclaration
(
array
$field
)
{
$length
=
(
isset
(
$field
[
'length'
]))
?
$field
[
'length'
]
:
null
;
if
(
$length
==
'-1'
&&
isset
(
$field
[
'atttypmod'
]))
{
$length
=
$field
[
'atttypmod'
]
-
4
;
}
if
((
int
)
$length
<=
0
)
{
$length
=
null
;
}
$type
=
array
();
$unsigned
=
$fixed
=
null
;
if
(
!
isset
(
$field
[
'name'
]))
{
$field
[
'name'
]
=
''
;
}
$dbType
=
strtolower
(
$field
[
'type'
]);
switch
(
$dbType
)
{
case
'smallint'
:
case
'int2'
:
$type
[]
=
'integer'
;
$unsigned
=
false
;
$length
=
2
;
if
(
$length
==
'2'
)
{
$type
[]
=
'boolean'
;
if
(
preg_match
(
'/^(is|has)/'
,
$field
[
'name'
]))
{
$type
=
array_reverse
(
$type
);
}
}
break
;
case
'int'
:
case
'int4'
:
case
'integer'
:
case
'serial'
:
case
'serial4'
:
$type
[]
=
'integer'
;
$unsigned
=
false
;
$length
=
4
;
break
;
case
'bigint'
:
case
'int8'
:
case
'bigserial'
:
case
'serial8'
:
$type
[]
=
'integer'
;
$unsigned
=
false
;
$length
=
8
;
break
;
case
'bool'
:
case
'boolean'
:
$type
[]
=
'boolean'
;
$length
=
1
;
break
;
case
'text'
:
case
'varchar'
:
case
'interval'
:
case
'_varchar'
:
$fixed
=
false
;
case
'unknown'
:
case
'char'
:
case
'bpchar'
:
$type
[]
=
'string'
;
if
(
$length
==
'1'
)
{
$type
[]
=
'boolean'
;
if
(
preg_match
(
'/^(is|has)/'
,
$field
[
'name'
]))
{
$type
=
array_reverse
(
$type
);
}
}
elseif
(
strstr
(
$dbType
,
'text'
))
{
$type
[]
=
'clob'
;
}
if
(
$fixed
!==
false
)
{
$fixed
=
true
;
}
break
;
case
'date'
:
$type
[]
=
'date'
;
$length
=
null
;
break
;
case
'datetime'
:
case
'timestamp'
:
case
'timestamptz'
:
$type
[]
=
'timestamp'
;
$length
=
null
;
break
;
case
'time'
:
$type
[]
=
'time'
;
$length
=
null
;
break
;
case
'float'
:
case
'float4'
:
case
'float8'
:
case
'double'
:
case
'double precision'
:
case
'real'
:
$type
[]
=
'float'
;
break
;
case
'decimal'
:
case
'money'
:
case
'numeric'
:
$type
[]
=
'decimal'
;
break
;
case
'tinyblob'
:
case
'mediumblob'
:
case
'longblob'
:
case
'blob'
:
case
'bytea'
:
$type
[]
=
'blob'
;
$length
=
null
;
break
;
case
'oid'
:
$type
[]
=
'blob'
;
$type
[]
=
'clob'
;
$length
=
null
;
break
;
case
'year'
:
$type
[]
=
'integer'
;
$type
[]
=
'date'
;
$length
=
null
;
break
;
default
:
throw
DoctrineException
::
updateMe
(
'unknown database attribute type: '
.
$dbType
);
}
return
array
(
'type'
=>
$type
,
'length'
=>
$length
,
'unsigned'
=>
$unsigned
,
'fixed'
=>
$fixed
);
}
/**
* Returns the md5 sum of a field.
...
...
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
e21d8fff
...
...
@@ -166,27 +166,6 @@ class MySqlSchemaManager extends AbstractSchemaManager
$fixed
=
true
;
}
break
;
case
'enum'
:
$type
=
'enum'
;
preg_match_all
(
'/\'((?:\'\'|[^\'])*)\'/'
,
$tableColumn
[
'type'
],
$matches
);
$length
=
0
;
$fixed
=
false
;
if
(
is_array
(
$matches
))
{
foreach
(
$matches
[
1
]
as
&
$value
)
{
$value
=
str_replace
(
'\'\''
,
'\''
,
$value
);
$length
=
max
(
$length
,
strlen
(
$value
));
}
if
(
$length
==
'1'
&&
count
(
$matches
[
1
])
==
2
)
{
$type
=
'boolean'
;
if
(
preg_match
(
'/^(is|has)/'
,
$tableColumn
[
'name'
]))
{
$type
=
array_reverse
(
$type
);
}
}
$values
=
$matches
[
1
];
}
$type
=
'integer'
;
break
;
case
'set'
:
$fixed
=
false
;
$type
=
'text'
;
...
...
lib/Doctrine/ORM/AbstractQuery.php
View file @
e21d8fff
...
...
@@ -61,11 +61,6 @@ abstract class AbstractQuery
*/
protected
$_params
=
array
();
/**
* @var array $_enumParams Array containing the keys of the parameters that should be enumerated.
*/
//protected $_enumParams = array();
/**
* The user-specified ResultSetMapping to use.
*
...
...
@@ -133,46 +128,8 @@ abstract class AbstractQuery
public
function
free
()
{
$this
->
_params
=
array
();
$this
->
_enumParams
=
array
();
}
/**
* Set enumerated parameters
*
* @param array $enumParams Enum parameters.
*/
/*protected function _setEnumParams($enumParams = array())
{
$this->_enumParams = $enumParams;
}*/
/**
* Get all enumerated parameters
*
* @return array All enumerated parameters
*/
/*public function getEnumParams()
{
return $this->_enumParams;
}*/
/**
* Convert ENUM parameters to their integer equivalents
*
* @param $params Parameters to be converted
* @return array Converted parameters array
*/
/*public function convertEnums($params)
{
foreach ($this->_enumParams as $key => $values) {
if (isset($params[$key]) && ! empty($values)) {
$params[$key] = $values[0]->enumIndex($values[1], $params[$key]);
}
}
return $params;
}*/
/**
* Get all defined parameters
*
...
...
lib/Doctrine/ORM/Query/AbstractResult.php
View file @
e21d8fff
...
...
@@ -41,21 +41,6 @@ abstract class AbstractResult
*/
protected
$_data
;
/**
* @var array Enum params.
*/
//protected $_enumParams = array();
/**
* Returns the enum parameters.
*
* @return mixed Enum parameters.
*/
/*public function getEnumParams()
{
return $this->_enumParams;
}*/
/**
* Returns this object in serialized format, revertable using fromCached*.
*
...
...
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