Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002621TestLinkDatabase Generalpublic2009-06-16 21:392010-05-01 20:34
ReporterEloff 
Assigned Tofman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Fixed in Version1.9 Beta 2 
Summary0002621: Table prefix is not used by all scripts
DescriptionWhen using a table prefix, many pages shows SQL errors.

I'm willing to fix fix some of those errors. But it's hard to find the origins, because they are all from database.class.php

Do you have any hint or technique to search and destroy them?

Using nightly build as of today 2009-06-16
Additional InformationFor example, excute on a TC in a testplan:

ERROR ON exec_query() - database.class.php
1054 - Unknown column 'req_coverage.testcase_id' in 'field list' - SELECT REQ.id,REQ.req_doc_id,NHA.name AS title, NHB.name AS req_spec_title,req_coverage.testcase_id FROM head_requirements REQ, head_req_coverage REQ_COVERAGE, head_nodes_hierarchy NHA, head_nodes_hierarchy NHB, head_req_specs RSPEC WHERE REQ_COVERAGE.testcase_id IN (9) AND REQ.srs_id=RSPEC.id AND REQ_COVERAGE.req_id=REQ.id AND NHA.id=REQ.id AND NHB.id=RSPEC.id

THE MESSAGE :: SQL [31] executed [took 0.0002 secs][all took 0.015 secs]: SELECT REQ.id,REQ.req_doc_id,NHA.name AS title, NHB.name AS req_spec_title,req_coverage.testcase_id FROM head_requirements REQ, head_req_coverage REQ_COVERAGE, head_nodes_hierarchy NHA, head_nodes_hierarchy NHB, head_req_specs RSPEC WHERE REQ_COVERAGE.testcase_id IN (9) AND REQ.srs_id=RSPEC.id AND REQ_COVERAGE.req_id=REQ.id AND NHA.id=REQ.id AND NHB.id=RSPEC.id Query failed: errorcode[1054] errormsg:Unknown column 'req_coverage.testcase_id' in 'field list'
ERROR ON exec_query() - database.class.php
1064 - 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 'e ON NHA.id = e.tcversion_id AND e.testpla' at line 13 - SELECT NHB.name,NHA.parent_id AS testcase_id, tcversions.*, users.login AS tester_login, users.first AS tester_first_name, users.last AS tester_last_name, e.tester_id AS tester_id, e.id AS execution_id, e.status,e.tcversion_number, e.notes AS execution_notes, e.execution_ts, e.execution_type AS execution_run_type, e.build_id AS build_id, b.name AS build_name, b.active AS build_is_active, b.is_open AS build_is_open FROM head_nodes_hierarchy NHA JOIN head_nodes_hierarchy NHB ON NHA.parent_id = NHB.id JOIN head_tcversions tcversions ON NHA.id = tcversions.id JOIN head_executions executions e ON NHA.id = e.tcversion_id AND e.testplan_id = 2 AND e.build_id IN (1) JOIN head_builds b ON e.build_id=b.id LEFT OUTER JOIN head_users ON e.tester_id = users.id WHERE NHA.parent_id = 9 AND tcversions.id = 10 ORDER BY NHA.node_order ASC, NHA.parent_id ASC, execution_id DESC

THE MESSAGE :: SQL [32] executed [took 0.0001 secs][all took 0.0153 secs]: SELECT NHB.name,NHA.parent_id AS testcase_id, tcversions.*, users.login AS tester_login, users.first AS tester_first_name, users.last AS tester_last_name, e.tester_id AS tester_id, e.id AS execution_id, e.status,e.tcversion_number, e.notes AS execution_notes, e.execution_ts, e.execution_type AS execution_run_type, e.build_id AS build_id, b.name AS build_name, b.active AS build_is_active, b.is_open AS build_is_open FROM head_nodes_hierarchy NHA JOIN head_nodes_hierarchy NHB ON NHA.parent_id = NHB.id JOIN head_tcversions tcversions ON NHA.id = tcversions.id JOIN head_executions executions e ON NHA.id = e.tcversion_id AND e.testplan_id = 2 AND e.build_id IN (1) JOIN head_builds b ON e.build_id=b.id LEFT OUTER JOIN head_users ON e.tester_id = users.id WHERE NHA.parent_id = 9 AND tcversions.id = 10 ORDER BY NHA.node_order ASC, NHA.parent_id ASC, execution_id DESC Query failed: errorcode[1064] errormsg: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 'e ON NHA.id = e.tcversion_id AND e.testpla' at line 13
TagsNo tags attached.
Database (MySQL,Postgres,etc)
BrowserFirefox 3
PHP Version5.2
TestCaseID
QA Team - Task Workflow Status
Attached Filespatch file icon use_table_prefix_in_results.patch [^] (1,445 bytes) 2009-06-18 14:57 [Show Content]
patch file icon use_table_prefix_in_results_2.patch [^] (3,917 bytes) 2009-06-18 15:59 [Show Content]

- Relationships
related to 0002726closedfman [DEV] History of all executions have broken SQL 

-  Notes
(0007265)
Eloff (reporter)
2009-06-16 21:51

Not really sure if the additional info is this issue, sorry about that.

This Is what I get in the left sidebar under Results:

using db: "testlink_head" and prefix: "head_"

ERROR ON exec_query() - database.class.php
1146 - Table 'testlink_head.testplan_tcversions' doesn't exist - SELECT COUNT(*) FROM testplan_tcversions WHERE testplan_id = 2

THE MESSAGE :: SQL [12] executed [took 0.0001 secs][all took 0.0053 secs]: SELECT COUNT(*) FROM testplan_tcversions WHERE testplan_id = 2 Query failed: errorcode[1146] errormsg:Table 'testlink_head.testplan_tcversions' doesn't exist
ERROR ON exec_query() - database.class.php
1146 - Table 'testlink_head.builds' doesn't exist - SELECT COUNT(*) FROM builds WHERE builds.testplan_id = 2 AND active=1

THE MESSAGE :: SQL [13] executed [took 0.0001 secs][all took 0.0055 secs]: SELECT COUNT(*) FROM builds WHERE builds.testplan_id = 2 AND active=1 Query failed: errorcode[1146] errormsg:Table 'testlink_head.builds' doesn't exist
(0007277)
Eloff (reporter)
2009-06-18 14:58

Added a patch that makes tlReports use the table prefix
(0007278)
Eloff (reporter)
2009-06-18 16:02

Added some table prefixes in results.

sorry about the filenames:
use_table_prefix_in_results.patch (tlReports class)
use_table_prefix_in_results_2.patch (results class))
(0007280)
mhavlat (reporter)
2009-06-18 16:35

hey, you are faster than development ;-) Francisco tooks the most part of this really boring update of all SQL requests. But the job is not finished yet.
(0007291)
fman (administrator)
2009-06-19 00:43

thanks for your help.
your changes on report and results class has been commited to HEAD
(0007388)
Eloff (reporter)
2009-06-29 20:32

One thing from the patch does not seem to have been applied.

tlReports should extend tlObjectsWithDB

I noticed this because the results navigator gets broken otherwise
(0008124)
Eloff (reporter)
2009-10-24 00:00

This looks finished to me.

Can we close it?

- Issue History
Date Modified Username Field Change
2009-06-16 21:39 Eloff New Issue
2009-06-16 21:39 Eloff Browser => Firefox 3
2009-06-16 21:39 Eloff PHP Version => 5.2
2009-06-16 21:51 Eloff Note Added: 0007265
2009-06-18 14:57 Eloff File Added: use_table_prefix_in_results.patch
2009-06-18 14:58 Eloff Note Added: 0007277
2009-06-18 15:59 Eloff File Added: use_table_prefix_in_results_2.patch
2009-06-18 16:02 Eloff Note Added: 0007278
2009-06-18 16:35 mhavlat Note Added: 0007280
2009-06-18 23:51 fman Status new => assigned
2009-06-18 23:51 fman Assigned To => fman
2009-06-19 00:43 fman Note Added: 0007291
2009-06-19 00:44 fman Status assigned => resolved
2009-06-19 00:44 fman Fixed in Version => 1.9 (DEV)
2009-06-19 00:44 fman Resolution open => fixed
2009-06-29 20:32 Eloff Note Added: 0007388
2009-06-29 20:32 Eloff Status resolved => assigned
2009-06-29 20:32 Eloff Resolution fixed => reopened
2009-07-15 19:46 Eloff Relationship added related to 0002726
2009-07-27 22:20 fman Status assigned => work in progress
2009-10-24 00:00 Eloff Note Added: 0008124
2009-12-08 18:50 fman Status work in progress => assigned
2009-12-08 18:51 fman Status assigned => resolved
2009-12-08 18:51 fman Resolution reopened => fixed
2010-05-01 20:34 fman Status resolved => closed



Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker