Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007225TestLinkMilestonespublic2015-08-10 10:212015-08-10 18:12
Reporteranushajoisa 
Assigned Tofman 
PrioritynormalSeveritymajorReproducibilityalways
StatusassignedResolutionopen 
PlatformWindowsOSWindowsOS VersionServer 2012 R2
Product Version1.9.13 (2015 #1) 
Fixed in Version 
Summary0007225: MSSQL - Creation of Milestones and subsequent of Milestones section causes DB access error
DescriptionMSSQL SPECIFIC
When a milestone is created, the milestone gets created successfully, but DB access error is displayed. Later every time the 'Milestones' section is accessed, DB error access error is displayed.
Steps To Reproduce1. Create a test project T1.
2. Create 3 test cases TC1, TC2 and TC3.
3. Create a test plan TP1.
4. Go to 'Milestones' section. Create a milestone with a start date (say the current date) and an end date (say the end of the current month).
5. Go to the home page and then go to 'Milestones' section.

DB access errors are displayed after steps 4 and 5.
Additional InformationThe DB error seen from 'Events' section is:

ERROR ON exec_query() - database.class.php
241 - SQLState: 22007 Error Code: 241 Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting date and/or time from character string. SQLState: 22007 Error Code: 241 Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting date and/or time from character string. - SELECT COUNT(DISTINCT(TPTCV.id )) FROM testplan_tcversions TPTCV JOIN executions E ON TPTCV.tcversion_id = E.tcversion_id JOIN tcversions TCV ON TPTCV.tcversion_id = TCV.id WHERE TPTCV.testplan_id = 203924 AND TPTCV.platform_id = E.platform_id AND E.testplan_id = 203924 AND NOT E.status = 'n' AND TCV.importance=1 AND TPTCV.urgency=1 AND execution_ts < '2015-08-26 00:00:0023:59:59' AND execution_ts > '2015-08-10 00:00:0000:00:00'


THE MESSAGE : SELECT COUNT(DISTINCT(TPTCV.id )) FROM testplan_tcversions TPTCV JOIN executions E ON TPTCV.tcversion_id = E.tcversion_id JOIN tcversions TCV ON TPTCV.tcversion_id = TCV.id WHERE TPTCV.testplan_id = 203924 AND TPTCV.platform_id = E.platform_id AND E.testplan_id = 203924 AND NOT E.status = 'n' AND TCV.importance=1 AND TPTCV.urgency=1 AND execution_ts < '2015-08-26 00:00:0023:59:59' AND execution_ts > '2015-08-10 00:00:0000:00:00' Query failed: errorcode[241] errormsg:SQLState: 22007 Error Code: 241 Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting date and/or time from character string.

In the file tlTestPlanMetrics.php, in the function getPrioritizedResults(),

if the line

$sql .= " AND execution_ts < '" . $milestoneTargetDate . $end_of_the_day ."'";

is replaced with

// $sql .= " AND execution_ts < convert(datetime, '" . substr($milestoneTargetDate, 0, 10) . "T" . $end_of_the_day ."')";

it works fine.
TagsNo tags attached.
Database (MySQL,Postgres,etc)MSSQL
BrowserChrome
PHP Version
TestCaseID
QA Team - Task Workflow StatusTBD
Attached Filespng file icon Milestones_DB_error.png [^] (48,699 bytes) 2015-08-10 10:21

- Relationships

-  Notes
(0023709)
anushajoisa (reporter)
2015-08-10 10:23
edited on: 2015-08-10 10:26

In the 'Additional Information' section of this ticket, I mentioned the ine only for the milestone start date (There the line that I suggested to replace with is commented by mistake. Please ignore the '//'). Adding the line here for the milestone target date. If the line

$sql .= " AND execution_ts > '" . $milestoneStartDate . $beginning_of_the_day ."'";

id replaced with

$sql .= " AND execution_ts > convert(datetime, '" . substr($milestoneStartDate, 0, 10) . "T" . $beginning_of_the_day ."')";

it works fine.

(0023712)
fman (administrator)
2015-08-10 10:31

Unfortunately YOUR solution can not be used because is MSSQL SPECIFIC.
This can be consider a workaround for MSSQL.
I'm going to check for a Cross:DB solution, but can not provide ETA
(0023715)
anushajoisa (reporter)
2015-08-10 10:32

Ok. Thanks.

- Issue History
Date Modified Username Field Change
2015-08-10 10:21 anushajoisa New Issue
2015-08-10 10:21 anushajoisa File Added: Milestones_DB_error.png
2015-08-10 10:23 anushajoisa Note Added: 0023709
2015-08-10 10:26 anushajoisa Note Edited: 0023709 View Revisions
2015-08-10 10:31 fman Note Added: 0023712
2015-08-10 10:31 fman Assigned To => fman
2015-08-10 10:31 fman Status new => feedback
2015-08-10 10:32 anushajoisa Note Added: 0023715
2015-08-10 10:32 anushajoisa Status feedback => assigned
2015-08-10 10:34 fman QA Team - Task Workflow Status => TBD
2015-08-10 10:34 fman Summary Creation of Milestones and subsequent of Milestones section causes DB access error => MSSQL - Creation of Milestones and subsequent of Milestones section causes DB access error
2015-08-10 10:34 fman Description Updated View Revisions
2015-08-10 10:34 fman Additional Information Updated View Revisions
2015-08-10 18:12 fman Note Added: 0023722
2015-08-10 18:14 fman Note Deleted: 0023722



Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker