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
d9d4e877
Commit
d9d4e877
authored
Dec 30, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed many small bugs
parent
1febda11
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
19 deletions
+47
-19
Firebird.php
lib/Doctrine/DataDict/Firebird.php
+5
-5
Mssql.php
lib/Doctrine/DataDict/Mssql.php
+12
-5
Mysql.php
lib/Doctrine/DataDict/Mysql.php
+9
-2
Oracle.php
lib/Doctrine/DataDict/Oracle.php
+6
-2
Pgsql.php
lib/Doctrine/DataDict/Pgsql.php
+9
-3
Sqlite.php
lib/Doctrine/DataDict/Sqlite.php
+6
-2
No files found.
lib/Doctrine/DataDict/Firebird.php
View file @
d9d4e877
...
...
@@ -100,16 +100,16 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
*/
public
function
getPortableDeclaration
(
$field
)
{
$length
=
$field
[
'length'
];
if
((
int
)
$length
<=
0
)
$length
=
null
;
$length
=
(
isset
(
$field
[
'length'
])
&&
$field
[
'length'
]
>
0
)
?
$field
[
'length'
]
:
null
;
$type
=
array
();
$unsigned
=
$fixed
=
null
;
$dbType
=
strtolower
(
$field
[
'type'
]);
$field
[
'field_sub_type'
]
=
!
empty
(
$field
[
'field_sub_type'
])
?
strtolower
(
$field
[
'field_sub_type'
])
:
null
;
if
(
!
isset
(
$field
[
'name'
]))
$field
[
'name'
]
=
''
;
switch
(
$dbType
)
{
case
'smallint'
:
...
...
@@ -134,7 +134,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
$fixed
=
false
;
case
'char'
:
case
'cstring'
:
$type
[]
=
'
text
'
;
$type
[]
=
'
string
'
;
if
(
$length
==
'1'
)
{
$type
[]
=
'boolean'
;
if
(
preg_match
(
'/^(is|has)/'
,
$field
[
'name'
]))
{
...
...
lib/Doctrine/DataDict/Mssql.php
View file @
d9d4e877
...
...
@@ -116,19 +116,24 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
public
function
getPortableDeclaration
(
$field
)
{
$db_type
=
preg_replace
(
'/\d/'
,
''
,
strtolower
(
$field
[
'type'
])
);
$length
=
$field
[
'length'
];
if
((
int
)
$length
<=
0
)
{
$length
=
null
;
}
$length
=
(
isset
(
$field
[
'length'
])
&&
$field
[
'length'
]
>
0
)
?
$field
[
'length'
]
:
null
;
$type
=
array
();
// todo: unsigned handling seems to be missing
$unsigned
=
$fixed
=
null
;
if
(
!
isset
(
$field
[
'name'
]))
$field
[
'name'
]
=
''
;
switch
(
$db_type
)
{
case
'bit'
:
$type
[
0
]
=
'boolean'
;
break
;
case
'int'
:
$type
[
0
]
=
'integer'
;
if
(
$length
==
1
)
{
$type
[]
=
'boolean'
;
}
break
;
case
'datetime'
:
$type
[
0
]
=
'timestamp'
;
...
...
@@ -146,7 +151,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
case
'varchar'
:
$fixed
=
false
;
case
'char'
:
$type
[
0
]
=
'
text
'
;
$type
[
0
]
=
'
string
'
;
if
(
$length
==
'1'
)
{
$type
[]
=
'boolean'
;
if
(
preg_match
(
'/^[is|has]/'
,
$field
[
'name'
]))
{
...
...
@@ -168,6 +173,8 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
throw
new
Doctrine_DataDict_Mssql_Exception
(
'unknown database attribute type: '
.
$db_type
);
}
return
array
(
$type
,
$length
,
$unsigned
,
$fixed
);
}
}
lib/Doctrine/DataDict/Mysql.php
View file @
d9d4e877
...
...
@@ -226,7 +226,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
if
(
$dbType
==
'national'
)
{
$dbType
=
strtok
(
'(), '
);
}
if
(
!
empty
(
$field
[
'length'
]))
{
if
(
isset
(
$field
[
'length'
]))
{
$length
=
$field
[
'length'
];
$decimal
=
''
;
}
else
{
...
...
@@ -235,6 +235,10 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
}
$type
=
array
();
$unsigned
=
$fixed
=
null
;
if
(
!
isset
(
$field
[
'name'
]))
$field
[
'name'
]
=
''
;
switch
(
$dbType
)
{
case
'tinyint'
:
$type
[]
=
'integer'
;
...
...
@@ -275,7 +279,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
$fixed
=
false
;
case
'string'
:
case
'char'
:
$type
[]
=
'
text
'
;
$type
[]
=
'
string
'
;
if
(
$length
==
'1'
)
{
$type
[]
=
'boolean'
;
if
(
preg_match
(
'/^(is|has)/'
,
$field
[
'name'
]))
{
...
...
@@ -354,6 +358,9 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
throw
new
Doctrine_DataDict_Mysql_Exception
(
'unknown database attribute type: '
.
$dbType
);
}
$length
=
((
int
)
$length
==
0
)
?
null
:
(
int
)
$length
;
return
array
(
$type
,
$length
,
$unsigned
,
$fixed
);
}
/**
...
...
lib/Doctrine/DataDict/Oracle.php
View file @
d9d4e877
...
...
@@ -103,6 +103,10 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
if
(
!
empty
(
$field
[
'length'
]))
{
$length
=
$field
[
'length'
];
}
if
(
!
isset
(
$field
[
'name'
]))
$field
[
'name'
]
=
''
;
switch
(
$db_type
)
{
case
'integer'
:
case
'pls_integer'
:
...
...
@@ -121,7 +125,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
$fixed
=
false
;
case
'char'
:
case
'nchar'
:
$type
[]
=
'
text
'
;
$type
[]
=
'
string
'
;
if
(
$length
==
'1'
)
{
$type
[]
=
'boolean'
;
if
(
preg_match
(
'/^(is|has)/'
,
$field
[
'name'
]))
{
...
...
@@ -154,7 +158,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
}
break
;
case
'long'
:
$type
[]
=
'
text
'
;
$type
[]
=
'
string
'
;
case
'clob'
:
case
'nclob'
:
$type
[]
=
'clob'
;
...
...
lib/Doctrine/DataDict/Pgsql.php
View file @
d9d4e877
...
...
@@ -425,7 +425,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
public
function
getPortableDeclaration
(
array
$field
)
{
$length
=
$field
[
'length'
]
;
$length
=
(
isset
(
$field
[
'length'
]))
?
$field
[
'length'
]
:
null
;
if
(
$length
==
'-1'
&&
isset
(
$field
[
'atttypmod'
]))
{
$length
=
$field
[
'atttypmod'
]
-
4
;
}
...
...
@@ -434,7 +434,13 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
}
$type
=
array
();
$unsigned
=
$fixed
=
null
;
switch
(
strtolower
(
$field
[
'type'
]))
{
if
(
!
isset
(
$field
[
'name'
]))
$field
[
'name'
]
=
''
;
$db_type
=
strtolower
(
$field
[
'type'
]);
switch
(
$db_type
)
{
case
'smallint'
:
case
'int2'
:
$type
[]
=
'integer'
;
...
...
@@ -475,7 +481,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
case
'unknown'
:
case
'char'
:
case
'bpchar'
:
$type
[]
=
'
text
'
;
$type
[]
=
'
string
'
;
if
(
$length
==
'1'
)
{
$type
[]
=
'boolean'
;
if
(
preg_match
(
'/^(is|has)/'
,
$field
[
'name'
]))
{
...
...
lib/Doctrine/DataDict/Sqlite.php
View file @
d9d4e877
...
...
@@ -123,10 +123,14 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
public
function
getPortableDeclaration
(
array
$field
)
{
$dbType
=
strtolower
(
$field
[
'type'
]);
$length
=
(
!
empty
(
$field
[
'length'
]))
?
$field
[
'length'
]
:
null
;
$unsigned
=
(
!
empty
(
$field
[
'unsigned'
]))
?
$field
[
'unsigned'
]
:
null
;
$length
=
(
isset
(
$field
[
'length'
]))
?
$field
[
'length'
]
:
null
;
$unsigned
=
(
isset
(
$field
[
'unsigned'
]))
?
$field
[
'unsigned'
]
:
null
;
$fixed
=
null
;
$type
=
array
();
if
(
!
isset
(
$field
[
'name'
]))
$field
[
'name'
]
=
''
;
switch
(
$dbType
)
{
case
'boolean'
:
$type
[]
=
'boolean'
;
...
...
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