In-Portal Issue Tracker

Welcome to the In-Portal Open Source CMS Issue Tracker! This is a central management / tracking tool for all types of tasks / issues / bugs for the In-Portal Project. Before reporting any issues, please make sure to read the Guide into Issue Tracker and How to Properly Test and Report Bugs!

Viewing Issue Simple Details Jump to Notes ] Wiki ] View Advanced ] Issue History ] Print ]
ID Category Type Reproducibility Date Submitted Last Update
0000953 [In-Portal CMS] Database bug report always 2010-12-14 10:20 2011-03-30 09:53
Reporter alex View Status public Project Name In-Portal CMS
Assigned To alex Developer
Priority normal Resolution fixed Fixed in Version 5.1.2-RC1
Status closed Product Version 5.1.1 Target Version 5.1.2
Time EstimateNo estimate
Summary 0000953: Incorrect database query error reporting
Description In-Portal has kDBConnection class, that can handle any type of database interactions. When database query being executed produces an error, then it's handled differently based on criteria listed below:

debug mode enabled AND DBG_SQL_FAILURE option set in debug.php file - will be PHP fatal error and script stops
debug mode enabled AND DBG_SQL_FAILURE option not set in debug.php file - will be PHP warning and script continues to execute
debug mode is disabled - will be PHP warning and script continues to execute
All works ok, until you need to check if last database query ended with error in last 2 cases from above mentioned.

Class kDBConnection has "getErrorCode", "getErrorMsg" and "hasError" methods, that do the trick, but if there was a query with error before checked query, then error isn't cleared an all methods will tell, that there is an error, but there are none.

I propose to reset "last remembered error information" before running new database query.
Additional Information
Tags No tags attached.
Change Log Message Fixes database query error reporting
Estimate Points 0
Attached Files patch file icon reset_db_error_before_each_query.patch [^] (952 bytes) 2010-12-30 06:57 [Show Content]
patch file icon processing_of_mysql_has_gone_away_error.patch [^] (5,178 bytes) 2011-02-18 02:11 [Show Content]
patch file icon improved_db_error_processing.patch [^] (5,794 bytes) 2011-02-18 02:11 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
parent of 0001002closed (5.1.2)alex Process critical database errors even when debug mode is off 
related to 0000956needs work (Icebox)!COMMUNITY Insufficient database permission handling 
related to 0000973needs work (Icebox)!COMMUNITY Daemon mode 

-  Notes
User avatar (0003124)
alex (manager)
2010-12-30 07:01

To test:
1. find any 2 subsequent SELECT database queries in debugger report
2. find places in PHP code, where they are invoked
3. make error in first query
4. set DBG_SQL_FAILURE in debug.php to 0
5. display $this->Conn->getErrorCode() after both queries

When patch is not applied, then database error from 1st query will stay even after 2nd query execution was successful. After patch is applied, then there will be no error after 2nd query execution.
User avatar (0003270)
alex (manager)
2011-02-18 02:12

Patch "improved_db_error_processing.patch" is combination of "reset_db_error_before_each_query.patch" and "processing_of_mysql_has_gone_away_error.patch" patches, since when applied one after another merging conflict was created.

That's why patch "improved_db_error_processing.patch" should be tested here.
User avatar (0003271)
alex (manager)
2011-02-18 02:16

Moving to 5.1.2, since it's database error handing and catching an error, when it happens is a high priority.
User avatar (0003277)
Dmitry (manager)
2011-02-18 16:58

Patch "improved_db_error_processing.patch" tested good as part of 0001002 task and fully covers all patches in the task.

Ready to be committed to 5.1.2-RC1
User avatar (0003278)
alex (manager)
2011-02-19 06:13

Fix committed to 5.1.x branch. Commit Message:

Fixes 0000953: Incorrect database query error reporting
User avatar (0003322)
Dmitry (manager)
2011-03-30 09:53

Closing, since 5.1.2 release has been released.

- Related Changesets
In-Portal CMS: 5.1.x r14235
Timestamp: 2011-02-19 06:13:06
Author: alex
Details ] Diff ]
Fixes 0000953: Incorrect database query error reporting
mod - /in-portal/branches/5.1.x/core/kernel/db/db_connection.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2011-03-30 09:53 Dmitry Note Added: 0003322
2011-03-30 09:53 Dmitry Status resolved => closed
2011-02-19 06:13 alex Note Added: 0003278
2011-02-19 06:13 alex Status reviewed and tested => resolved
2011-02-19 06:13 alex Fixed in Version => 5.1.2-RC1
2011-02-19 06:13 alex Resolution open => fixed
2011-02-19 06:13 alex Assigned To !COMMUNITY => alex
2011-02-19 06:13 alex Changeset attached 5.1.x r14235
2011-02-18 16:58 Dmitry Note Added: 0003277
2011-02-18 16:58 Dmitry Status needs testing => reviewed and tested
2011-02-18 02:16 alex Target Version Icebox => 5.1.2
2011-02-18 02:16 alex Note Added: 0003271
2011-02-18 02:13 alex Relationship added parent of 0001002
2011-02-18 02:12 alex Note Added: 0003270
2011-02-18 02:11 alex File Added: improved_db_error_processing.patch
2011-02-18 02:11 alex File Added: processing_of_mysql_has_gone_away_error.patch
2011-01-25 04:22 alex Relationship added related to 0000973
2011-01-10 12:46 alex Relationship added related to 0000956
2010-12-30 07:01 alex Note Added: 0003124
2010-12-30 07:01 alex Assigned To => !COMMUNITY
2010-12-30 07:01 alex Developer => alex
2010-12-30 07:01 alex Status active => needs testing
2010-12-30 06:57 alex File Added: reset_db_error_before_each_query.patch
2010-12-14 10:20 alex New Issue
2010-12-14 10:20 alex Reference =>
2010-12-14 10:20 alex Change Log Message => Fixes database query error reporting

Web Development by Intechnic
In-Portal Open Source CMS
In-Portal Open Source CMS
Copyright © 2000 - 2009 MantisBT Group

Powered by Mantis Bugtracker