| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "DATE" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class Date extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'DATE(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 13-31 (lines=19) @@ | ||
| 10 | /** |
|
| 11 | * DateFunction ::= "DAY" "(" ArithmeticPrimary ")" |
|
| 12 | */ |
|
| 13 | class Day extends FunctionNode |
|
| 14 | { |
|
| 15 | public $dateExpression; |
|
| 16 | ||
| 17 | public function parse(Parser $parser) |
|
| 18 | { |
|
| 19 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 20 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 21 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 22 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function getSql(SqlWalker $sqlWalker) |
|
| 26 | { |
|
| 27 | return 'DAY(' . |
|
| 28 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 29 | ')'; |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "DAYOFMONTH" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class DayOfMonth extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'DAYOFMONTH(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "DAYOFWEEK" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class DayOfWeek extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'DAYOFWEEK(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "DAYOFYEAR" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class DayOfYear extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'DAYOFYEAR(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "HOUR" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class Hour extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'HOUR(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "MINUTE" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class Minute extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'MINUTE(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "MONTH" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class Month extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'MONTH(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 13-31 (lines=19) @@ | ||
| 10 | /** |
|
| 11 | * DateFunction ::= "QUARTER" "(" ArithmeticPrimary ")" |
|
| 12 | */ |
|
| 13 | class Quarter extends FunctionNode |
|
| 14 | { |
|
| 15 | public $dateExpression; |
|
| 16 | ||
| 17 | public function parse(Parser $parser) |
|
| 18 | { |
|
| 19 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 20 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 21 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 22 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function getSql(SqlWalker $sqlWalker) |
|
| 26 | { |
|
| 27 | return 'QUARTER(' . |
|
| 28 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 29 | ')'; |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "SECOND" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class Second extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'SECOND(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "TIME" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class Time extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'TIME(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| @@ 13-31 (lines=19) @@ | ||
| 10 | /** |
|
| 11 | * DateFunction ::= "WEEK" "(" ArithmeticPrimary ")" |
|
| 12 | */ |
|
| 13 | class Week extends FunctionNode |
|
| 14 | { |
|
| 15 | public $dateExpression; |
|
| 16 | ||
| 17 | public function parse(Parser $parser) |
|
| 18 | { |
|
| 19 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 20 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 21 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 22 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function getSql(SqlWalker $sqlWalker) |
|
| 26 | { |
|
| 27 | return 'WEEK(' . |
|
| 28 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 29 | ')'; |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 14-32 (lines=19) @@ | ||
| 11 | * DateFunction ::= "YEAR" "(" ArithmeticPrimary ")" |
|
| 12 | * @author Florent Viel <[email protected]> |
|
| 13 | */ |
|
| 14 | class Year extends FunctionNode |
|
| 15 | { |
|
| 16 | public $dateExpression; |
|
| 17 | ||
| 18 | public function parse(Parser $parser) |
|
| 19 | { |
|
| 20 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 21 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 22 | $this->dateExpression = $parser->ArithmeticPrimary(); |
|
| 23 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getSql(SqlWalker $sqlWalker) |
|
| 27 | { |
|
| 28 | return 'YEAR(' . |
|
| 29 | $this->dateExpression->dispatch($sqlWalker) . |
|
| 30 | ')'; |
|
| 31 | } |
|
| 32 | } |
|
| @@ 13-31 (lines=19) @@ | ||
| 10 | /** |
|
| 11 | * DateFunction ::= "MD5" "(" StringPrimary ")" |
|
| 12 | */ |
|
| 13 | class Md5 extends FunctionNode |
|
| 14 | { |
|
| 15 | public $md5Expression; |
|
| 16 | ||
| 17 | public function parse(Parser $parser) |
|
| 18 | { |
|
| 19 | $parser->match(Lexer::T_IDENTIFIER); |
|
| 20 | $parser->match(Lexer::T_OPEN_PARENTHESIS); |
|
| 21 | $this->md5Expression = $parser->StringPrimary(); |
|
| 22 | $parser->match(Lexer::T_CLOSE_PARENTHESIS); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function getSql(SqlWalker $sqlWalker) |
|
| 26 | { |
|
| 27 | return 'MD5(' . |
|
| 28 | $this->md5Expression->dispatch($sqlWalker) . |
|
| 29 | ')'; |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||