Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006793TestLinkReports - Req. Based Reportpublic2014-11-26 09:382019-04-02 20:41
Reporterenlaceptolosa 
Assigned Tofman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionunable to reproduce 
Platformx64OSWindows ServerOS Version2008R2
Product Version1.9.11 (2014 Q2 - bug fixing) 
Fixed in Version 
Summary0006793: DB Error on Requirements based Report if no child requirments - Spanish
DescriptionHi,

When accesing Reports-> Requirements based Report we got the following DB error and no results are shown:

==============================================================================
 DB Access Error - debug_print_backtrace() OUTPUT START
 ==============================================================================
#0 database->exec_query() called at [E:\Apache24\htdocs\TestLink\lib\functions\database.class.php:750]
#1 database->get_recordset() called at [E:\Apache24\htdocs\TestLink\lib\functions\requirement_spec_mgr.class.php:229]
0000002 requirement_spec_mgr->get_by_id() called at [E:\Apache24\htdocs\TestLink\lib\results\resultsReqs.php:697]
0000003 buildReqSpecMap() called at [E:\Apache24\htdocs\TestLink\lib\results\resultsReqs.php:70]

 ==============================================================================

In logs we have the following errors:

Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'AND'.
 - /* Class:requirement_spec_mgr - Method: get_by_id */ SELECT RSPEC.id,RSPEC.doc_id, RSPEC.testproject_id, RSPEC_REV.id AS revision_id, RSPEC_REV.revision , '' AS author, '' AS modifier, NH_RSPEC.node_order, RSPEC_REV.scope,RSPEC_REV.total_req,RSPEC_REV.type, RSPEC_REV.author_id,RSPEC_REV.creation_ts,RSPEC_REV.modifier_id, RSPEC_REV.modification_ts,NH_RSPEC.name AS title FROM req_specs RSPEC JOIN req_specs_revisions RSPEC_REV ON RSPEC_REV.parent_id = RSPEC.id JOIN nodes_hierarchy NH_RSPEC ON RSPEC.id = NH_RSPEC.id WHERE RSPEC.id = NH_RSPEC.id AND RSPEC_REV.id = AND RSPEC.id = 525705
THE MESSAGE : /* Class:requirement_spec_mgr - Method: get_by_id */ SELECT RSPEC.id,RSPEC.doc_id, RSPEC.testproject_id, RSPEC_REV.id AS revision_id, RSPEC_REV.revision , '' AS author, '' AS modifier, NH_RSPEC.node_order, RSPEC_REV.scope,RSPEC_REV.total_req,RSPEC_REV.type, RSPEC_REV.author_id,RSPEC_REV.creation_ts,RSPEC_REV.modifier_id, RSPEC_REV.modification_ts,NH_RSPEC.name AS title FROM req_specs RSPEC JOIN req_specs_revisions RSPEC_REV ON RSPEC_REV.parent_id = RSPEC.id JOIN nodes_hierarchy NH_RSPEC ON RSPEC.id = NH_RSPEC.id WHERE RSPEC.id = NH_RSPEC.id AND RSPEC_REV.id = AND RSPEC.id = 525705
Query failed: errorcode[156]
    errormsg:SQLState: 42000

Steps To Reproduce- Have data in [testlink].[dbo].[req_specs_revisions] with parent ID
- Have no data with child ID asociated to a parent ID.
- Access Reports-> Requirements based Report
Additional InformationWe pulled from log files and saw that the error is produced in requirement_spec_mgr.class.php in lib\functions most specific in the "get_by_id" function in the following stattemnt:

    $sql .= " FROM {$this->object_table} RSPEC " .
            " JOIN {$this->tables['req_specs_revisions']} RSPEC_REV " .
            " ON RSPEC_REV.parent_id = RSPEC.id " .
            " JOIN {$this->tables['nodes_hierarchy']} NH_RSPEC " .
            " ON RSPEC.id = NH_RSPEC.id " .
            " WHERE RSPEC.id = NH_RSPEC.id " .
            " AND RSPEC_REV.id = {$childID} " .
            " AND RSPEC.id = {$id} ";

 By commenting this line we eliminate the error and the report generates results.
" AND RSPEC_REV.id = {$childID} " .

My question is, it's this approach correct or you have to define an if in case no childID found?
TagsNo tags attached.
Database (MySQL,Postgres,etc)MS SQL
BrowseriExplorer8
PHP Version5.5
TestCaseID
QA Team - Task Workflow Status
Attached Filespng file icon Requirements based Report .PNG [^] (87,242 bytes) 2014-11-26 09:38


png file icon Correction.PNG [^] (21,733 bytes) 2014-11-26 09:40


png file icon Results OK.PNG [^] (81,526 bytes) 2014-11-26 09:40

- Relationships

-  Notes
(0022258)
fman (administrator)
2014-11-26 09:49
edited on: 2014-11-26 09:50

please get latest code from gitorious, install in sandbox and retest
IMHO in this way you will find the solution

please provide detailed steps to reproduce as indicated on forum


- Issue History
Date Modified Username Field Change
2014-11-26 09:38 enlaceptolosa New Issue
2014-11-26 09:38 enlaceptolosa File Added: Requirements based Report .PNG
2014-11-26 09:40 enlaceptolosa File Added: Correction.PNG
2014-11-26 09:40 enlaceptolosa File Added: Results OK.PNG
2014-11-26 09:49 fman Note Added: 0022258
2014-11-26 09:50 fman Note Edited: 0022258 View Revisions
2014-11-26 09:50 fman Assigned To => fman
2014-11-26 09:50 fman Status new => feedback
2019-01-19 15:08 fman Status feedback => resolved
2019-01-19 15:08 fman Resolution open => unable to reproduce
2019-04-02 20:41 fman Status resolved => closed



Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker