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
a0dd44ad
Commit
a0dd44ad
authored
Jun 19, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
c5d08909
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
5 deletions
+56
-5
Mysql.php
lib/Doctrine/Export/Mysql.php
+3
-2
Query.php
lib/Doctrine/Query.php
+53
-3
No files found.
lib/Doctrine/Export/Mysql.php
View file @
a0dd44ad
...
...
@@ -112,10 +112,11 @@ class Doctrine_Export_Mysql extends Doctrine_Export
}
if
(
!
$found
)
{
$options
[
'indexes'
]
=
array
(
$local
=>
array
(
'fields'
=>
array
(
$local
=>
array
(
))));
$options
[
'indexes'
]
=
array
_merge
(
$options
[
'indexes'
],
array
(
$local
=>
array
(
'fields'
=>
array
(
$local
=>
array
()
))));
}
}
}
// add all indexes
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
foreach
(
$options
[
'indexes'
]
as
$index
=>
$definition
)
{
...
...
@@ -146,7 +147,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
$type
=
false
;
// get the type of the table
if
(
!
empty
(
$options
[
'type'
]))
{
if
(
isset
(
$options
[
'type'
]))
{
$type
=
$options
[
'type'
];
}
else
{
$type
=
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_DEFAULT_TABLE_TYPE
);
...
...
lib/Doctrine/Query.php
View file @
a0dd44ad
...
...
@@ -32,6 +32,15 @@ Doctrine::autoload('Doctrine_Query_Abstract');
*/
class
Doctrine_Query
extends
Doctrine_Query_Abstract
implements
Countable
{
const
STATE_CLEAN
=
1
;
const
STATE_DIRTY
=
2
;
const
STATE_DIRECT
=
3
;
const
STATE_LOCKED
=
4
;
protected
$subqueryAliases
=
array
();
/**
* @param boolean $needsSubquery
...
...
@@ -86,6 +95,8 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
* @var array $_pendingJoinConditions an array containing pending joins
*/
protected
$_pendingJoinConditions
=
array
();
protected
$_state
=
Doctrine_Query
::
STATE_CLEAN
;
/**
* create
...
...
@@ -262,7 +273,11 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
* @return Doctrine_Query this object
*/
public
function
parseQueryPart
(
$queryPartName
,
$queryPart
,
$append
=
false
)
{
{
if
(
$this
->
_state
===
self
::
STATE_LOCKED
)
{
throw
new
Doctrine_Query_Exception
(
'This query object is locked. No query parts can be manipulated.'
);
}
// sanity check
if
(
$queryPart
===
''
||
$queryPart
===
null
)
{
...
...
@@ -276,6 +291,19 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$this
->
_dqlParts
[
$queryPartName
]
=
array
(
$queryPart
);
}
if
(
$this
->
_state
===
self
::
STATE_DIRECT
)
{
$parser
=
$this
->
getParser
(
$queryPartName
);
$sql
=
$parser
->
parse
(
$queryPart
);
if
(
isset
(
$sql
))
{
if
(
$append
)
{
$this
->
addQueryPart
(
$queryPartName
,
$sql
);
}
else
{
$this
->
setQueryPart
(
$queryPartName
,
$sql
);
}
}
}
return
$this
;
}
...
...
@@ -623,6 +651,19 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$this
->
parts
[
'from'
][
$k
]
=
$part
;
}
return
$q
;
}
/**
* preQuery
*
* Empty template method to provide Query subclasses with the possibility
* to hook into the query building procedure, doing any custom / specialized
* query building procedures that are neccessary.
*
* @return void
*/
public
function
preQuery
()
{
}
/**
* builds the sql query from the given parameters and applies things such as
...
...
@@ -634,14 +675,16 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
*/
public
function
getQuery
(
$params
=
array
())
{
// check if parser cache is on
$parts
=
$this
->
_dqlParts
;
// reset the state
$this
->
_aliasMap
=
array
();
$this
->
pendingAggregates
=
array
();
$this
->
aggregateMap
=
array
();
$this
->
reset
();
$this
->
reset
();
// parse the DQL parts
foreach
(
$this
->
_dqlParts
as
$queryPartName
=>
$queryParts
)
{
$this
->
parts
[
$queryPartName
]
=
array
();
if
(
is_array
(
$queryParts
)
&&
!
empty
(
$queryParts
))
{
...
...
@@ -664,6 +707,13 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
}
}
}
$this
->
_state
=
self
::
STATE_DIRECT
;
// invoke the preQuery hook
$this
->
preQuery
();
$this
->
_state
=
self
::
STATE_CLEAN
;
$this
->
_dqlParts
=
$parts
;
if
(
empty
(
$this
->
parts
[
'from'
]))
{
return
false
;
...
...
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