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
5059dbc9
Commit
5059dbc9
authored
Aug 20, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sqlite Datadict updated, Doctrine_Record::merge fixed
parent
33d8f27e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
19 deletions
+37
-19
Doctrine.php
Doctrine.php
+11
-5
Hydrate.php
Doctrine/Hydrate.php
+4
-3
Record.php
Doctrine/Record.php
+2
-1
Table.php
Doctrine/Table.php
+1
-2
Email.php
Doctrine/Validator/Email.php
+9
-1
adodb-datadict.inc.php
Doctrine/adodb-hack/adodb-datadict.inc.php
+1
-1
datadict-sqlite.inc.php
Doctrine/adodb-hack/drivers/datadict-sqlite.inc.php
+4
-3
ValidatorTestCase.php
tests/ValidatorTestCase.php
+3
-1
ValueHolderTestCase.php
tests/ValueHolderTestCase.php
+2
-2
No files found.
Doctrine.php
View file @
5059dbc9
...
...
@@ -196,19 +196,25 @@ final class Doctrine {
* mode for lazy offset fetching
*/
const
FETCH_LAZY_OFFSET
=
4
;
/**
*
RETURN
CONSTANTS
*
FETCH
CONSTANTS
*/
/**
* RETURN VALUEHOLDER
* FETCH VALUEHOLDER
*/
const
FETCH_VHOLDER
=
1
;
/**
* FETCH RECORD
*/
const
RETURN_VHOLDER
=
1
;
const
FETCH_RECORD
=
2
;
/**
*
RETURN RECORD
*
FETCH ARRAY
*/
const
RETURN_RECORD
=
2
;
const
FETCH_ARRAY
=
3
;
/**
* LOCKMODE CONSTANTS
...
...
Doctrine/Hydrate.php
View file @
5059dbc9
...
...
@@ -226,7 +226,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
* @param string $params
* @return Doctrine_Collection the root collection
*/
public
function
execute
(
$params
=
array
(),
$return
=
Doctrine
::
RETURN
_RECORD
)
{
public
function
execute
(
$params
=
array
(),
$return
=
Doctrine
::
FETCH
_RECORD
)
{
$this
->
data
=
array
();
$this
->
collections
=
array
();
...
...
@@ -275,9 +275,10 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
$array
=
$this
->
parseData
(
$stmt
);
if
(
$return
==
Doctrine
::
RETURN
_VHOLDER
)
{
if
(
$return
==
Doctrine
::
FETCH
_VHOLDER
)
{
return
$this
->
hydrateHolders
(
$array
);
}
}
elseif
(
$return
==
Doctrine
::
FETCH_ARRAY
)
return
$array
;
foreach
(
$array
as
$data
)
{
/**
...
...
Doctrine/Record.php
View file @
5059dbc9
...
...
@@ -1239,7 +1239,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
public
function
merge
(
array
$values
)
{
foreach
(
$this
->
table
->
getColumnNames
()
as
$value
)
{
try
{
$this
->
data
[
$value
]
=
$values
[
$value
];
if
(
isset
(
$values
[
$value
]))
$this
->
set
(
$value
,
$values
[
$value
]);
}
catch
(
Exception
$e
)
{
}
}
}
...
...
Doctrine/Table.php
View file @
5059dbc9
...
...
@@ -143,7 +143,6 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
// reverse names
$names
=
array_reverse
(
$names
);
// create database table
if
(
method_exists
(
$record
,
"setTableDefinition"
))
{
$record
->
setTableDefinition
();
...
...
@@ -734,7 +733,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
$users
=
$q
->
query
(
"FROM "
.
$this
->
name
.
" WHERE "
.
$dql
,
$params
);
return
$users
;
}
public
function
findByDql
(
$dql
,
array
$params
=
array
())
{
return
$this
->
findBySql
(
$dql
,
$params
);
}
...
...
Doctrine/Validator/Email.php
View file @
5059dbc9
...
...
@@ -11,6 +11,14 @@ class Doctrine_Validator_Email {
if
(
empty
(
$value
))
return
true
;
return
self
::
validateEmail
(
$value
);
}
/**
* validateEmail
*
* @param string $value
*/
public
static
function
validateEmail
(
$value
)
{
$parts
=
explode
(
"@"
,
$value
);
if
(
count
(
$parts
)
!=
2
)
...
...
@@ -27,7 +35,7 @@ class Doctrine_Validator_Email {
if
(
!
ereg
(
"^(([A-Za-z0-9!#$%&'*+/=?^_`
{
|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62
}
\"
))$"
,
$parts
[
$i
]))
{
return
false
;
}
}
}
if
(
!
ereg
(
"^\[?[0-9\.]+\]?$"
,
$parts
[
1
]))
{
// Check if domain is IP. If not, it should be valid domain name
$domain_array
=
explode
(
"."
,
$parts
[
1
]);
if
(
count
(
$domain_array
)
<
2
)
{
...
...
Doctrine/adodb-hack/adodb-datadict.inc.php
View file @
5059dbc9
...
...
@@ -898,7 +898,7 @@ class ADODB_DataDict {
}
// return string must begin with space
function
_CreateSuffix
(
$fname
,
$ftype
,
$fnotnull
,
$fdefault
,
$fautoinc
,
$fconstraint
)
function
_CreateSuffix
(
$fname
,
$ftype
,
$fnotnull
,
$fdefault
,
$fautoinc
,
$fconstraint
,
$funsigned
=
null
)
{
$suffix
=
''
;
if
(
strlen
(
$fdefault
))
$suffix
.=
" DEFAULT
$fdefault
"
;
...
...
Doctrine/adodb-hack/drivers/datadict-sqlite.inc.php
View file @
5059dbc9
...
...
@@ -50,7 +50,8 @@ class ADODB2_sqlite extends ADODB_DataDict {
}
}
// return string must begin with space
function
_CreateSuffix
(
$fname
,
$ftype
,
$fnotnull
,
$fdefault
,
$fautoinc
,
$fconstraint
,
$funsigned
)
function
_CreateSuffix
(
$fname
,
$ftype
,
$fnotnull
,
$fdefault
,
$fautoinc
,
$fconstraint
,
$funsigned
=
null
)
{
$suffix
=
''
;
if
(
$funsigned
)
$suffix
.=
' UNSIGNED'
;
...
...
@@ -97,14 +98,14 @@ class ADODB2_sqlite extends ADODB_DataDict {
return
$sql
;
}
function
AlterColumnSQL
(
$tabname
,
$flds
)
function
AlterColumnSQL
(
$tabname
,
$flds
,
$tableflds
=
''
,
$tableoptions
=
''
)
{
if
(
$this
->
debug
)
$this
->
outp
(
"AlterColumnSQL not supported"
);
return
array
();
}
function
DropColumnSQL
(
$tabname
,
$flds
)
function
DropColumnSQL
(
$tabname
,
$flds
,
$tableflds
=
''
,
$tableoptions
=
''
)
{
if
(
$this
->
debug
)
$this
->
outp
(
"DropColumnSQL not supported"
);
return
array
();
...
...
tests/ValidatorTestCase.php
View file @
5059dbc9
...
...
@@ -84,11 +84,13 @@ class Doctrine_ValidatorTestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$stack
[
'mystring'
],
Doctrine_Validator
::
ERR_NOTNULL
);
$this
->
assertEqual
(
$stack
[
'myemail2'
],
Doctrine_Validator
::
ERR_NOTBLANK
);
$test
->
mystring
=
'str'
;
$test
->
save
();
}
public
function
testEmailValidation
()
{
}
public
function
testValidate
()
{
$user
=
$this
->
session
->
getTable
(
"User"
)
->
find
(
4
);
...
...
tests/ValueHolderTestCase.php
View file @
5059dbc9
...
...
@@ -19,7 +19,7 @@ class Doctrine_ValueHolder_TestCase extends Doctrine_UnitTestCase {
public
function
testSimpleQuery
()
{
$q
=
new
Doctrine_Query
(
$this
->
session
);
$q
->
from
(
"User"
);
$users
=
$q
->
execute
(
array
(),
Doctrine
::
RETURN
_VHOLDER
);
$users
=
$q
->
execute
(
array
(),
Doctrine
::
FETCH
_VHOLDER
);
$this
->
assertEqual
(
$users
->
count
(),
8
);
...
...
@@ -27,7 +27,7 @@ class Doctrine_ValueHolder_TestCase extends Doctrine_UnitTestCase {
public
function
testQueryWithOneToManyRelation
()
{
$q
=
new
Doctrine_Query
(
$this
->
session
);
$q
->
from
(
"User.Phonenumber"
);
$users
=
$q
->
execute
(
array
(),
Doctrine
::
RETURN
_VHOLDER
);
$users
=
$q
->
execute
(
array
(),
Doctrine
::
FETCH
_VHOLDER
);
$this
->
assertEqual
(
$users
->
count
(),
8
);
$this
->
assertTrue
(
$users
[
0
]
instanceof
Doctrine_ValueHolder
);
$this
->
assertTrue
(
$users
[
3
]
instanceof
Doctrine_ValueHolder
);
...
...
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