View Issue Details

IDProjectCategoryView StatusLast Update
0013363mantisbtdb mssqlpublic2014-09-23 18:05
Reporterrfoster Assigned Torombert  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformWindows IIS ServerOSWindows ServerOS Version2008
Product Version1.2.8 
Target Version1.2.9Fixed in Version1.2.9 
Summary0013363: Application Failure when trying to select an issue
Description

With a new installation using SQL Server 2008 with the new Microsoft sqlsrv database plugin (patches from new issues applied)

When selecting created issues I get this error when there are no Tags created through the Management interface:

APPLICATION ERROR 0000401
Database query failed. Error received from database was 0000102: SQLState: 42000
Error Code: 102
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near ')'.
for the query: SELECT id, name, description FROM mantis_tag_table WHERE id IN ( ) ORDER BY name ASC .

Steps To Reproduce
  1. Create a project
  2. DON'T create any tags
  3. Create an issue
  4. try to select any issue by it's ID
  5. Create a tag, labelled "tesT"
  6. try to select any issue by it's ID
    • issue loaded correctly
TagsNo tags attached.
Attached Files
Correct-tag-retrieval-on-SQL-Server-when-no-tags-are.patch (847 bytes)   
From 4184a9e0da19236c1fb855e5944e90011f09f779 Fri, 30 Sep 2011 21:03:29 +0300
From: Robert Munteanu <robert.munteanu@gmail.com>
Date: Fri, 30 Sep 2011 21:02:52 +0300
Subject: [PATCH] Correct tag retrieval on SQL Server when no tags are defined

Fix #13363 : Application Failure when trying to select an issue

diff --git a/core/tag_api.php b/core/tag_api.php
index fd31424..4cd1b3e 100644
--- a/core/tag_api.php
+++ b/core/tag_api.php
@@ -421,6 +421,11 @@
 			while( $row = db_fetch_array( $result ) ) {
 				$t_subquery_results[] = (int)$row;
 			}
+			
+			if ( count ( $t_subquery_results ) == 0 ) {
+			    return array();
+			}
+			
 			$query = "SELECT id, name, description FROM $t_tag_table WHERE id IN ( " . implode( ', ', $t_subquery_results ) . ')';
 		} else {
 			$query = "SELECT id, name, description FROM $t_tag_table WHERE id IN (

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 

Activities

rombert

rombert

2011-09-30 14:04

reporter   ~0029904

Please apply the following patch and let me know if it fixed the issue. I do not have an SQL Server instance around to test.

jyperion

jyperion

2011-10-14 06:34

reporter   ~0029958

thats works (MS SQL Server2005) and I add another patch in the case , you add Tags

grangeway

grangeway

2013-04-05 17:57

reporter   ~0036324

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

grangeway

grangeway

2014-05-16 15:00

reporter   ~0040350

MantisBT currently supports Mysql and has support for other database engines.

The support for other databases is known to be problematic.

Having implemented the current database layer into Mantis 10 years ago, I'm currently working on replacing the current layer.

If you are interested in using Mantis with non-mysql databases - for example, Oracle, PGSQL or MSSQL, and would be willing to help out testing the new database layer, please drop me an email at paul@mantisforge.org

In the meantime, I'd advise running Mantis with Mysql Only to avoid issues.

Thanks
Paul

Related Changesets

MantisBT: master 47a2de44

2011-09-30 07:02

rombert


Details Diff
Correct tag retrieval on SQL Server when no tags are defined

Fix 0013363 : Application Failure when trying to select an issue
Affected Issues
0013363
mod - core/tag_api.php Diff File

MantisBT: master-1.2.x 59b1fff9

2011-09-30 07:02

rombert


Details Diff
Correct tag retrieval on SQL Server when no tags are defined

Fix 0013363 : Application Failure when trying to select an issue
Affected Issues
0013363
mod - core/tag_api.php Diff File