Author Topic: [1.7-beta2] SQL Errors on Overview  (Read 4110 times)

cguweb

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
[1.7-beta2] SQL Errors on Overview
« on: April 17, 2010, 07:12:21 pm »
on every overview page with a fresh install (not upgrade) , I get the following sql error with debug on:

Code: [Select]
Query failed with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(DAY, (`repeat_num`-1)*`repeat_d`, `start`) >= '2010-04-11 04:00:00' OR ' at line 28'
Error params:
File: /var/www/vhosts/cguweb.com/httpdocs/cguCRM2/environment/library/database/adapters/AbstractDBAdapter.class.php
Line: 386
Sql: SELECT * FROM `feng_project_events` WHERE `trashed_on` = '0000-00-00 00:00:00' AND ( ( -- -- THIS RETURNS EVENTS ON THE ACTUAL DAY IT'S SET FOR (ONE TIME EVENTS) -- ( `repeat_h` = 0 AND ( `duration` > `start` AND (`start` >= '2010-04-11 04:00:00' AND `start` < '2010-04-12 04:00:00' OR `duration` <= '2010-04-12 04:00:00' AND `duration` > '2010-04-11 04:00:00' OR `start` < '2010-04-11 04:00:00' AND `duration` > '2010-04-12 04:00:00') OR `type_id` = 2 AND `start` >= '2010-04-11 04:00:00' AND `start` < '2010-04-12 04:00:00' ) ) -- -- THIS RETURNS REGULAR REPEATING EVENTS - DAILY, WEEKLY, MONTHLY, OR YEARLY. -- OR ( `repeat_h` = 0 AND DATE(`start`) <= '2010-04-11 04:00:00' AND ( ( MOD( DATEDIFF(ADDDATE(`start`, INTERVAL -4 HOUR), '2010-04-11') ,repeat_d) = 0 AND ( TIMESTAMPADD(DAY, (`repeat_num`-1)*`repeat_d`, `start`) >= '2010-04-11 04:00:00' OR repeat_forever = 1 OR repeat_end >= '2010-04-11' ) ) OR ( MOD( PERIOD_DIFF(DATE_FORMAT(`start`,'%Y%m'),DATE_FORMAT('2010-04-11 04:00:00','%Y%m')) ,repeat_m) = 0 AND `start` <= '2010-04-11 04:00:00' AND DAY(`start`) = 11 AND ( TIMESTAMPADD(MONTH, (`repeat_num`-1)*`repeat_m`, `start`) >= '2010-04-11 04:00:00' OR repeat_forever = 1 OR repeat_end >= '2010-04-11' ) ) OR ( MOD( (YEAR(DATE(`start`))-YEAR('2010-04-11 04:00:00')) ,repeat_y) = 0 AND `start` <= '2010-04-11 04:00:00' AND DAY(`start`) = 11 AND MONTH(`start`) = 04 AND ( TIMESTAMPADD(YEAR, (`repeat_num`-1)*`repeat_y`, `start`) >= '2010-04-11 04:00:00' OR repeat_forever = 1 OR repeat_end >= '2010-04-11' ) ) ) ) -- -- THIS RETURNS EVENTS SET TO BE A CERTAIN DAY OF THE WEEK IN A CERTAIN WEEK EVERY CERTAIN AMOUNT OF MONTHS -- OR ( DATE(`start`) <= '2010-04-11 04:00:00' AND `repeat_h` = 1 AND `repeat_dow` = DAYOFWEEK('2010-04-11 04:00:00') AND `repeat_wnum` + 13 - 1 = WEEK('2010-04-11 04:00:00', 3) AND MOD( PERIOD_DIFF(DATE_FORMAT(`start`, '%Y%m'), DATE_FORMAT('2010-04-11 04:00:00', '%Y%m')), `repeat_mjump`) = 0 ) ) AND ( ( ( `created_by_id` = 1) OR ( EXISTS(SELECT * FROM `feng_users` `xx_u`, `feng_workspace_objects` `xx_wo` WHERE `xx_u`.`id` = 1 AND `xx_u`.`personal_project_id` = `xx_wo`.`workspace_id` AND `xx_wo`.`object_id` = feng_project_events.id AND `xx_wo`.`object_manager` = 'ProjectEvents' )) OR ( EXISTS ( SELECT * FROM `feng_object_user_permissions` `xx_oup` WHERE `xx_oup`.`rel_object_id` = feng_project_events.id AND `xx_oup`.`rel_object_manager` = 'ProjectEvents' AND `xx_oup`.`user_id` IN (1,10000000) AND `xx_oup`.can_read = true) ) OR ( EXISTS ( SELECT * FROM `feng_project_users` `xx_pu`, `feng_workspace_objects` `xx_wo` WHERE `xx_pu`.`user_id` IN (1,10000000) AND `xx_pu`.`project_id` = `xx_wo`.`workspace_id` AND `xx_wo`.`object_id` = feng_project_events.id AND `xx_wo`.`object_manager` = 'ProjectEvents' AND `xx_pu`.can_read_events = true ) ) ) ) AND `archived_by_id` = 0) ORDER BY `start`
Error number: 1064
Error message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(DAY, (`repeat_num`-1)*`repeat_d`, `start`) >= '2010-04-11 04:00:00' OR ' at line 28


alvarotm01

  • Administrator
  • Sr. Member
  • *****
  • Posts: 335
    • View Profile
    • Email
Re: [1.7-beta2] SQL Errors on Overview
« Reply #1 on: April 19, 2010, 12:38:06 pm »
Hi,

Which version of MySql are you using?
Required version is MySql 5 or above, in order to support some functions (e.g. TIMESTAMPADD)

regards

dj atrac

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Re: [1.7-beta2] SQL Errors on Overview
« Reply #2 on: April 26, 2010, 06:09:29 am »
hi. same problem with mysql Version 4.1.22:

Error (DBQueryError)
Query failed with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(DAY, (`repeat_num`-1)*`repeat_d`, `start`) >= '2010-04-24 22:00:00' OR ' at line 28'
Error params:
File:    /kunden/155010_66780/foffice/environment/library/database/adapters/AbstractDBAdapter.class.php
Line:    386
Sql:    SELECT * FROM `foffice_project_events` WHERE `trashed_on` = '0000-00-00 00:00:00' AND ( ( -- -- THIS RETURNS EVENTS ON THE ACTUAL DAY IT'S SET FOR (ONE TIME EVENTS) -- ( `repeat_h` = 0 AND ( `duration` > `start` AND (`start` >= '2010-04-24 22:00:00' AND `start` < '2010-04-25 22:00:00' OR `duration` <= '2010-04-25 22:00:00' AND `duration` > '2010-04-24 22:00:00' OR `start` < '2010-04-24 22:00:00' AND `duration` > '2010-04-25 22:00:00') OR `type_id` = 2 AND `start` >= '2010-04-24 22:00:00' AND `start` < '2010-04-25 22:00:00' ) ) -- -- THIS RETURNS REGULAR REPEATING EVENTS - DAILY, WEEKLY, MONTHLY, OR YEARLY. -- OR ( `repeat_h` = 0 AND DATE(`start`) <= '2010-04-24 22:00:00' AND ( ( MOD( DATEDIFF(ADDDATE(`start`, INTERVAL 2 HOUR), '2010-04-25') ,repeat_d) = 0 AND ( TIMESTAMPADD(DAY, (`repeat_num`-1)*`repeat_d`, `start`) >= '2010-04-24 22:00:00' OR repeat_forever = 1 OR repeat_end >= '2010-04-25' ) ) OR ( MOD( PERIOD_DIFF(DATE_FORMAT(`start`,'%Y%m'),DATE_FORMAT('2010-04-24 22:00:00','%Y%m')) ,repeat_m) = 0 AND `start` <= '2010-04-24 22:00:00' AND DAY(`start`) = 25 AND ( TIMESTAMPADD(MONTH, (`repeat_num`-1)*`repeat_m`, `start`) >= '2010-04-24 22:00:00' OR repeat_forever = 1 OR repeat_end >= '2010-04-25' ) ) OR ( MOD( (YEAR(DATE(`start`))-YEAR('2010-04-24 22:00:00')) ,repeat_y) = 0 AND `start` <= '2010-04-24 22:00:00' AND DAY(`start`) = 25 AND MONTH(`start`) = 04 AND ( TIMESTAMPADD(YEAR, (`repeat_num`-1)*`repeat_y`, `start`) >= '2010-04-24 22:00:00' OR repeat_forever = 1 OR repeat_end >= '2010-04-25' ) ) ) ) -- -- THIS RETURNS EVENTS SET TO BE A CERTAIN DAY OF THE WEEK IN A CERTAIN WEEK EVERY CERTAIN AMOUNT OF MONTHS -- OR ( DATE(`start`) <= '2010-04-24 22:00:00' AND `repeat_h` = 1 AND `repeat_dow` = DAYOFWEEK('2010-04-24 22:00:00') AND `repeat_wnum` + 13 - 1 = WEEK('2010-04-24 22:00:00', 3) AND MOD( PERIOD_DIFF(DATE_FORMAT(`start`, '%Y%m'), DATE_FORMAT('2010-04-24 22:00:00', '%Y%m')), `repeat_mjump`) = 0 ) ) AND ( ( ( `created_by_id` = 1) OR ( EXISTS ( SELECT * FROM `foffice_object_user_permissions` `xx_oup` WHERE `xx_oup`.`rel_object_id` = foffice_project_events.id AND `xx_oup`.`rel_object_manager` = 'ProjectEvents' AND `xx_oup`.`user_id` IN (1,10000000) AND `xx_oup`.can_read = true) ) OR ( EXISTS ( SELECT * FROM `foffice_project_users` `xx_pu`, `foffice_workspace_objects` `xx_wo` WHERE `xx_pu`.`user_id` IN (1,10000000) AND `xx_pu`.`project_id` = `xx_wo`.`workspace_id` AND `xx_wo`.`object_id` = foffice_project_events.id AND `xx_wo`.`object_manager` = 'ProjectEvents' AND `xx_pu`.can_read_events = true ) ) ) ) AND `archived_by_id` = 0) ORDER BY `start`
Error number:    1064
Error message:    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(DAY, (`repeat_num`-1)*`repeat_d`, `start`) >= '2010-04-24 22:00:00' OR ' at line 28
Backtrace:
#0 /kunden/155010_66780/foffice/environment/library/database/adapters/AbstractDBAdapter.class.php(304): AbstractDBAdapter->prepareAndExecute('SELECT * FROM `...', NULL)
#1 /kunden/155010_66780/foffice/environment/library/database/DB.class.php(211): AbstractDBAdapter->executeAll('SELECT * FROM `...', NULL)
#2 /kunden/155010_66780/foffice/environment/classes/dataaccess/DataManager.class.php(262): DB::executeAll('SELECT * FROM `...')
#3 /kunden/155010_66780/foffice/application/models/ProjectDataObjects.class.php(31): DataManager->find(Array)
#4 /kunden/155010_66780/foffice/application/models/project_events/base/BaseProjectEvents.class.php(176): ProjectDataObjects->find(Array)
#5 /kunden/155010_66780/foffice/environment/classes/dataaccess/DataManager.class.php(299): BaseProjectEvents->find(Array)
#6 /kunden/155010_66780/foffice/application/models/project_events/base/BaseProjectEvents.class.php(193): DataManager->findAll(Array)
#7 /kunden/155010_66780/foffice/application/models/project_events/base/BaseProjectEvents.class.php(195): BaseProjectEvents->findAll(Array)
#8 /kunden/155010_66780/foffice/application/models/project_events/ProjectEvents.class.php(158): BaseProjectEvents::findAll(Array)
#9 /kunden/155010_66780/foffice/application/views/dashboard/widget_calendar.php(181): ProjectEvents::getDayProjectEvents(Object(DateTimeValue), NULL, NULL, 1, ' 0 1 3')
#10 /kunden/155010_66780/foffice/environment/classes/template/Template.class.php(85): include('/kunden/155010_...')
#11 /kunden/155010_66780/foffice/application/views/dashboard/widget.php(34): Template->includeTemplate('/kunden/155010_...')
#12 /kunden/155010_66780/foffice/environment/classes/template/Template.class.php(85): include('/kunden/155010_...')
#13 /kunden/155010_66780/foffice/application/views/dashboard/index.php(100): Template->includeTemplate('/kunden/155010_...')
#14 /kunden/155010_66780/foffice/environment/classes/template/Template.class.php(85): include('/kunden/155010_...')
#15 /kunden/155010_66780/foffice/environment/classes/template/Template.class.php(56): Template->includeTemplate('/kunden/155010_...')
#16 /kunden/155010_66780/foffice/environment/classes/template/template.php(35): Template->fetch('/kunden/155010_...')
#17 /kunden/155010_66780/foffice/environment/classes/controller/PageController.class.php(115): tpl_fetch('/kunden/155010_...')
#18 /kunden/155010_66780/foffice/environment/classes/Env.class.php(139): PageController->getContent()
#19 /kunden/155010_66780/foffice/init.php(150): Env::executeAction('dashboard', 'index')
#20 /kunden/155010_66780/foffice/index.php(9): require('/kunden/155010_...')
#21 {main}
Autoglobal varibles:
$_GET:    Array (
  ['ajax'] => (string) 'true'
  ['c'] => (string) 'dashboard'
  ['a'] => (string) 'index'
)
$_POST:    
$_COOKIE:    Array (
  ['PHPSESSID'] => (string) 'a2de5c17b5ea77a4c3daf4067edfe3af'
  ['id'] => (string) '1'
  ['token'] => (string) '2cf02923df0a80cadea1484df750d36cf3f90711'
)
$_SESSION:    Array (
  ['year'] => (string) '2010'
  ['month'] => (string) '4'
  ['day'] => (string) '26'
)
Execution time:
Total execution time: 0.234777 seconds