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
e6dbc733
Commit
e6dbc733
authored
Mar 23, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Added remaining supported functions for 2.0.
parent
ae5d2122
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
404 additions
and
0 deletions
+404
-0
AbsFunction.php
lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php
+44
-0
CurrentDateFunction.php
lib/Doctrine/ORM/Query/AST/Functions/CurrentDateFunction.php
+34
-0
CurrentTimeFunction.php
lib/Doctrine/ORM/Query/AST/Functions/CurrentTimeFunction.php
+34
-0
CurrentTimestampFunction.php
...rine/ORM/Query/AST/Functions/CurrentTimestampFunction.php
+34
-0
LengthFunction.php
lib/Doctrine/ORM/Query/AST/Functions/LengthFunction.php
+44
-0
LocateFunction.php
lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php
+70
-0
ModFunction.php
lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php
+56
-0
SizeFunction.php
lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php
+44
-0
SqrtFunction.php
lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php
+44
-0
No files found.
lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "ABS" "(" SimpleArithmeticExpression ")"
*
* @author robo
*/
class
AbsFunction
extends
FunctionNode
{
private
$_simpleArithmeticExpression
;
public
function
getSimpleArithmeticExpression
()
{
return
$this
->
_simpleArithmeticExpression
;
}
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Use platform to get SQL
return
'ABS('
.
$sqlWalker
->
walkSimpleArithmeticExpression
(
$this
->
_simpleArithmeticExpression
)
.
')'
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
$parser
->
match
(
'('
);
$this
->
_simpleArithmeticExpression
=
$parser
->
_SimpleArithmeticExpression
();
$parser
->
match
(
')'
);
}
}
lib/Doctrine/ORM/Query/AST/Functions/CurrentDateFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "CURRENT_DATE"
*
* @author robo
*/
class
CurrentDateFunction
extends
FunctionNode
{
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Use platform to get SQL
return
'CURRENT_DATE'
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
}
}
lib/Doctrine/ORM/Query/AST/Functions/CurrentTimeFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "CURRENT_TIME"
*
* @author robo
*/
class
CurrentTimeFunction
extends
FunctionNode
{
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Use platform to get SQL
return
'CURRENT_TIME'
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
}
}
lib/Doctrine/ORM/Query/AST/Functions/CurrentTimestampFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "CURRENT_TIMESTAMP"
*
* @author robo
*/
class
CurrentTimestampFunction
extends
FunctionNode
{
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Use platform to get SQL
return
'CURRENT_TIMESTAMP'
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
}
}
lib/Doctrine/ORM/Query/AST/Functions/LengthFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "LENGTH" "(" StringPrimary ")"
*
* @author robo
*/
class
LengthFunction
extends
FunctionNode
{
private
$_stringPrimary
;
public
function
getStringPrimary
()
{
return
$this
->
_stringPrimary
;
}
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Use platform to get SQL
return
'LENGTH('
.
$sqlWalker
->
walkStringPrimary
(
$this
->
_stringPrimary
)
.
')'
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
$parser
->
match
(
'('
);
$this
->
_stringPrimary
=
$parser
->
_StringPrimary
();
$parser
->
match
(
')'
);
}
}
lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "LOCATE" "(" StringPrimary "," StringPrimary ["," SimpleArithmeticExpression]")"
*
* @author robo
*/
class
LocateFunction
extends
FunctionNode
{
private
$_firstStringPrimary
;
private
$_secondStringPrimary
;
private
$_simpleArithmeticExpression
;
public
function
getFirstStringPrimary
()
{
return
$this
->
_firstStringPrimary
;
}
public
function
getSecondStringPrimary
()
{
return
$this
->
_secondStringPrimary
;
}
public
function
getSimpleArithmeticExpression
()
{
return
$this
->
_simpleArithmeticExpression
;
}
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Use platform to get SQL
$sql
=
'LOCATE('
.
$sqlWalker
->
walkStringPrimary
(
$this
->
_firstStringPrimary
)
.
', '
.
$sqlWalker
->
walkStringPrimary
(
$this
->
_secondStringPrimary
);
if
(
$this
->
_simpleArithmeticExpression
)
{
$sql
.=
', '
.
$sqlWalker
->
walkSimpleArithmeticExpression
(
$this
->
_simpleArithmeticExpression
);
}
return
$sql
.
')'
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
$parser
->
match
(
'('
);
$this
->
_firstStringPrimary
=
$parser
->
_StringPrimary
();
$parser
->
match
(
','
);
$this
->
_secondStringPrimary
=
$parser
->
_StringPrimary
();
if
(
$lexer
->
isNextToken
(
','
))
{
$parser
->
match
(
','
);
$this
->
_simpleArithmeticExpression
=
$parser
->
_SimpleArithmeticExpression
();
}
$parser
->
match
(
')'
);
}
}
lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "MOD" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")"
*
* @author robo
*/
class
ModFunction
extends
FunctionNode
{
private
$_firstSimpleArithmeticExpression
;
private
$_secondSimpleArithmeticExpression
;
public
function
getFirstSimpleArithmeticExpression
()
{
return
$this
->
_firstSimpleArithmeticExpression
;
}
public
function
getSecondSimpleArithmeticExpression
()
{
return
$this
->
_secondSimpleArithmeticExpression
;
}
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Use platform to get SQL
return
'SQRT('
.
$sqlWalker
->
walkSimpleArithmeticExpression
(
$this
->
_firstSimpleArithmeticExpression
)
.
', '
.
$sqlWalker
->
walkSimpleArithmeticExpression
(
$this
->
_secondSimpleArithmeticExpression
)
.
')'
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
$parser
->
match
(
'('
);
$this
->
_firstSimpleArithmeticExpression
=
$parser
->
_SimpleArithmeticExpression
();
$parser
->
match
(
','
);
$this
->
_secondSimpleArithmeticExpression
=
$parser
->
_SimpleArithmeticExpression
();
$parser
->
match
(
')'
);
}
}
lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "SIZE" "(" CollectionValuedPathExpression ")"
*
* @author robo
*/
class
SizeFunction
extends
FunctionNode
{
private
$_collectionPathExpression
;
public
function
getCollectionPathExpression
()
{
return
$this
->
_collectionPathExpression
;
}
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Construct appropriate SQL
return
""
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
$parser
->
match
(
'('
);
$this
->
_collectionPathExpression
=
$parser
->
_CollectionValuedPathExpression
();
$parser
->
match
(
')'
);
}
}
lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php
0 → 100644
View file @
e6dbc733
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace
Doctrine\ORM\Query\AST\Functions
;
/**
* "SQRT" "(" SimpleArithmeticExpression ")"
*
* @author robo
*/
class
SqrtFunction
extends
FunctionNode
{
private
$_simpleArithmeticExpression
;
public
function
getSimpleArithmeticExpression
()
{
return
$this
->
_simpleArithmeticExpression
;
}
/**
* @override
*/
public
function
getSql
(
\Doctrine\ORM\Query\SqlWalker
$sqlWalker
)
{
//TODO: Use platform to get SQL
return
'SQRT('
.
$sqlWalker
->
walkSimpleArithmeticExpression
(
$this
->
_simpleArithmeticExpression
)
.
')'
;
}
/**
* @override
*/
public
function
parse
(
\Doctrine\ORM\Query\Parser
$parser
)
{
$lexer
=
$parser
->
getLexer
();
$parser
->
match
(
$lexer
->
lookahead
[
'value'
]);
$parser
->
match
(
'('
);
$this
->
_simpleArithmeticExpression
=
$parser
->
_SimpleArithmeticExpression
();
$parser
->
match
(
')'
);
}
}
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