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
9df8e4d0
Commit
9df8e4d0
authored
Nov 28, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fixes for datadict drivers
parent
b8257aad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
47 deletions
+60
-47
Firebird.php
lib/Doctrine/DataDict/Firebird.php
+13
-6
Mssql.php
lib/Doctrine/DataDict/Mssql.php
+47
-41
No files found.
lib/Doctrine/DataDict/Firebird.php
View file @
9df8e4d0
...
...
@@ -53,12 +53,19 @@ class Doctrine_DataDict_Firebird extends Doctrine_Connection_Module {
* @return string DBMS specific SQL code portion that should be used to
* declare the specified field.
*/
public
function
getTypeDeclaration
(
$field
)
{
switch
(
$field
[
'type'
])
{
public
function
getNativeDeclaration
(
$field
)
{
switch
(
$field
[
'type'
])
{
case
'varchar'
:
case
'string'
:
case
'array'
:
case
'object'
:
case
'char'
:
case
'text'
:
$length
=
!
empty
(
$field
[
'length'
])
?
$field
[
'length'
]
:
$db
->
options
[
'default_text_field_length'
];
$fixed
=
!
empty
(
$field
[
'fixed'
])
?
$field
[
'fixed'
]
:
false
;
?
$field
[
'length'
]
:
16777215
;
// TODO: $db->options['default_text_field_length'];
$fixed
=
((
isset
(
$field
[
'fixed'
])
&&
$field
[
'fixed'
])
||
$field
[
'type'
]
==
'char'
)
?
true
:
false
;
return
$fixed
?
'CHAR('
.
$length
.
')'
:
'VARCHAR('
.
$length
.
')'
;
case
'clob'
:
return
'BLOB SUB_TYPE 1'
;
...
...
@@ -83,12 +90,12 @@ class Doctrine_DataDict_Firebird extends Doctrine_Connection_Module {
return
''
;
}
/**
* Maps a native array description of a field to a
MDB2
datatype and length
* Maps a native array description of a field to a
Doctrine
datatype and length
*
* @param array $field native field description
* @return array containing the various possible types, length, sign, fixed
*/
public
function
mapNativeDatatype
(
$field
)
{
public
function
getPortableDeclaration
(
$field
)
{
$length
=
$field
[
'length'
];
if
((
int
)
$length
<=
0
)
...
...
lib/Doctrine/DataDict/Mssql.php
View file @
9df8e4d0
...
...
@@ -50,16 +50,23 @@ class Doctrine_DataDict_Mssql extends Doctrine_Connection_Module {
* notnull
* Boolean flag that indicates whether this field is constrained
* to not be set to null.
*
@author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
*
* @return string DBMS specific SQL code portion that should be used to
* declare the specified field.
*/
public
function
get
Typ
eDeclaration
(
$field
)
{
public
function
get
Nativ
eDeclaration
(
$field
)
{
switch
(
$field
[
'type'
])
{
case
'array'
:
case
'object'
:
case
'text'
:
case
'char'
:
case
'varchar'
:
case
'string'
:
$length
=
!
empty
(
$field
[
'length'
])
?
$field
[
'length'
]
:
false
;
$fixed
=
!
empty
(
$field
[
'fixed'
])
?
$field
[
'fixed'
]
:
false
;
$fixed
=
((
isset
(
$field
[
'fixed'
])
&&
$field
[
'fixed'
])
||
$field
[
'type'
]
==
'char'
)
?
true
:
false
;
return
$fixed
?
(
$length
?
'CHAR('
.
$length
.
')'
:
'CHAR('
.
$db
->
options
[
'default_text_field_length'
]
.
')'
)
:
(
$length
?
'VARCHAR('
.
$length
.
')'
:
'TEXT'
);
case
'clob'
:
...
...
@@ -83,11 +90,11 @@ class Doctrine_DataDict_Mssql extends Doctrine_Connection_Module {
case
'boolean'
:
return
'BIT'
;
case
'date'
:
return
'CHAR ('
.
strlen
(
'YYYY-MM-DD'
)
.
')'
;
return
'CHAR('
.
strlen
(
'YYYY-MM-DD'
)
.
')'
;
case
'time'
:
return
'CHAR ('
.
strlen
(
'HH:MM:SS'
)
.
')'
;
return
'CHAR('
.
strlen
(
'HH:MM:SS'
)
.
')'
;
case
'timestamp'
:
return
'CHAR ('
.
strlen
(
'YYYY-MM-DD HH:MM:SS'
)
.
')'
;
return
'CHAR('
.
strlen
(
'YYYY-MM-DD HH:MM:SS'
)
.
')'
;
case
'float'
:
return
'FLOAT'
;
case
'decimal'
:
...
...
@@ -100,10 +107,9 @@ class Doctrine_DataDict_Mssql extends Doctrine_Connection_Module {
* Maps a native array description of a field to a MDB2 datatype and length
*
* @param array $field native field description
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @return array containing the various possible types, length, sign, fixed
*/
public
function
mapNativeDatatype
(
$field
)
{
public
function
getPortableDeclaration
(
$field
)
{
$db_type
=
preg_replace
(
'/\d/'
,
''
,
strtolower
(
$field
[
'type'
])
);
$length
=
$field
[
'length'
];
if
((
int
)
$length
<=
0
)
{
...
...
@@ -154,7 +160,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_Connection_Module {
$length
=
null
;
break
;
default
:
throw
new
Doctrine_DataDict_Mssql_Exception
(
'
mapNativeDatatype:
unknown database attribute type: '
.
$db_type
);
throw
new
Doctrine_DataDict_Mssql_Exception
(
'unknown database attribute type: '
.
$db_type
);
}
return
array
(
$type
,
$length
,
$unsigned
,
$fixed
);
...
...
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