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
43980029
Commit
43980029
authored
Sep 20, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gzip datatype added
parent
ed1f7aca
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
5 deletions
+49
-5
DataDict.php
Doctrine/DataDict.php
+1
-0
Record.php
Doctrine/Record.php
+19
-4
Validator.php
Doctrine/Validator.php
+1
-0
RecordTestCase.php
tests/RecordTestCase.php
+23
-0
classes.php
tests/classes.php
+5
-1
No files found.
Doctrine/DataDict.php
View file @
43980029
...
...
@@ -68,6 +68,7 @@ class Doctrine_DataDict {
case
"array"
:
case
"object"
:
case
"string"
:
case
"gzip"
:
if
(
$length
<=
255
)
return
"C(
$length
)"
;
elseif
(
$length
<=
4000
)
...
...
Doctrine/Record.php
View file @
43980029
...
...
@@ -274,7 +274,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*
* @return integer
*/
private
function
cleanData
()
{
private
function
cleanData
(
$debug
=
false
)
{
$tmp
=
$this
->
data
;
$this
->
data
=
array
();
...
...
@@ -303,8 +303,19 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this
->
data
[
$name
]
=
$value
;
}
break
;
case
"enum"
:
case
"gzip"
:
if
(
$tmp
[
$name
]
!==
self
::
$null
)
{
$value
=
gzuncompress
(
$tmp
[
$name
]);
if
(
$value
===
false
)
throw
new
Doctrine_Record_Exception
(
"Uncompressing of
$name
failed."
);
$this
->
data
[
$name
]
=
$value
;
}
break
;
case
"enum"
:
$this
->
data
[
$name
]
=
$this
->
table
->
enumValue
(
$name
,
$tmp
[
$name
]);
break
;
default
:
...
...
@@ -314,6 +325,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
}
}
return
$count
;
}
/**
...
...
@@ -500,7 +512,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this
->
data
=
array_change_key_case
(
$this
->
data
,
CASE_LOWER
);
$this
->
modified
=
array
();
$this
->
cleanData
();
$this
->
cleanData
(
true
);
$this
->
prepareIdentifiers
();
...
...
@@ -864,7 +876,10 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
case
'array'
:
case
'object'
:
$a
[
$v
]
=
serialize
(
$this
->
data
[
$v
]);
break
;;
break
;
case
'gzip'
:
$a
[
$v
]
=
gzcompress
(
$this
->
data
[
$v
],
5
);
break
;
case
'enum'
:
$a
[
$v
]
=
$this
->
table
->
enumIndex
(
$v
,
$this
->
data
[
$v
]);
break
;
...
...
Doctrine/Validator.php
View file @
43980029
...
...
@@ -239,6 +239,7 @@ class Doctrine_Validator {
case
'mbstring'
:
case
'timestamp'
:
case
'date'
:
case
'gzip'
:
return
'string'
;
break
;
default
:
...
...
tests/RecordTestCase.php
View file @
43980029
...
...
@@ -6,8 +6,31 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
public
function
prepareTables
()
{
$this
->
tables
[]
=
"enumTest"
;
$this
->
tables
[]
=
"fieldNameTest"
;
$this
->
tables
[]
=
"GzipTest"
;
parent
::
prepareTables
();
}
public
function
testGzipType
()
{
$gzip
=
new
GzipTest
();
$gzip
->
gzip
=
"compressed"
;
$this
->
assertEqual
(
$gzip
->
gzip
,
"compressed"
);
$gzip
->
save
();
$this
->
assertEqual
(
$gzip
->
gzip
,
"compressed"
);
$gzip
->
refresh
();
$this
->
assertEqual
(
$gzip
->
gzip
,
"compressed"
);
$this
->
connection
->
clear
();
$gzip
=
$gzip
->
getTable
()
->
find
(
$gzip
->
id
);
$this
->
assertEqual
(
$gzip
->
gzip
,
"compressed"
);
$gzip
->
gzip
=
"compressed 2"
;
$this
->
assertEqual
(
$gzip
->
gzip
,
"compressed 2"
);
$gzip
->
save
();
$this
->
assertEqual
(
$gzip
->
gzip
,
"compressed 2"
);
$gzip
->
refresh
();
$this
->
assertEqual
(
$gzip
->
gzip
,
"compressed 2"
);
}
public
function
testEnumType
()
{
...
...
tests/classes.php
View file @
43980029
...
...
@@ -409,7 +409,11 @@ class DateTest extends Doctrine_Record {
$this
->
hasColumn
(
"date"
,
"date"
,
20
);
}
}
class
GzipTest
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"gzip"
,
"gzip"
,
100000
);
}
}
class
Tag
extends
Doctrine_Record
{
public
function
setUp
()
{
...
...
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