What steps will reproduce the problem?
1. This sql:
SELECT dbo.fn_GetDayOfWeekMonIs0(DATEADD(SECOND, -21600,
calls_cstm.date_logged_c)) AS N'Date'
FROM calls
LEFT JOIN calls_cstm ON calls.id = calls_cstm.id_c
LEFT JOIN users users0 ON calls.assigned_user_id = users0.id
LEFT JOIN contacts contacts2 ON calls.contact_id = contacts2.id
WHERE calls.deleted = 0
AND (
(dbo.fn_GetDayOfWeekMonIs0(DATEADD(SECOND, 0, calls_cstm.date_logged_c)) IN ('4'))
AND DATENAME(YEAR, DATEADD(SECOND, 0, calls_cstm.date_logged_c)) = '2013'
AND (DATEPART(MONTH, DATEADD(SECOND, 0, calls_cstm.date_logged_c)) IN ('10'))
)
GROUP BY dbo.fn_GetDayOfWeekMonIs0(DATEADD(SECOND, -21600,
calls_cstm.date_logged_c))
ORDER BY dbo.fn_GetDayOfWeekMonIs0(DATEADD(SECOND, -21600,
calls_cstm.date_logged_c)) ASC
What is the expected output? What do you see instead?
Successful parse. Instead get these errors:
Fatal error: Uncaught exception 'UnableToCreateSQLException' with message
'unknown expr_type in GROUP[0] function' in
C:\php-sql-parser-20131217\src\builders\GroupByBuilder.php:74
Stack trace:
#0 C:\php-sql-parser-20131217\src\builders\SelectStatementBuilder.php(76):
GroupByBuilder->build(Array)
#1 C:\php-sql-parser-20131217\src\builders\SelectStatementBuilder.php(98):
SelectStatementBuilder->buildGROUP(Array)
#2 C:\php-sql-parser-20131217\src\PHPSQLCreator.php(75):
SelectStatementBuilder->build(Array)
#3 C:\php-sql-parser-20131217\src\PHPSQLCreator.php(61):
PHPSQLCreator->create(Array)
#4 C:\php-sql-parser-20131217\examples\php-limit-test.php(42):
PHPSQLCreator->__construct(Array)
#5 {main}
thrown in C:\php-sql-parser-20131217\src\builders\GroupByBuilder.php on line 74
What version of the product are you using? On what operating system?
r827 from trunk. Windows 7.
Please provide any additional information below.
Similar issue fixed in Issue #105 for Order By.
I can fix it by adding the following to GroupByBuilder.php: (really the same
changes made to OrderByBuilder.php Issue #105)
1.After line 64:
protected function buildFunction($parsed) {
$builder = new FunctionBuilder();
return $builder->build($parsed);
}
2. After line 71:
$sql .= $this->buildFunction($v);
Original issue reported on code.google.com by ljwilson...@gmail.com on 17 Dec 2013 at 11:37
Original issue reported on code.google.com by
ljwilson...@gmail.com
on 17 Dec 2013 at 11:37