Bug #27826 'DB Error: unknown error' on class.issue.php [2]
Submitted: 14 Apr 2007 17:17 Modified: 9 Jul 2013 8:30
Reporter: Schalk Neethling Email Updates:
Status: Closed Impact on me:
None 
Category:Eventum Severity:S3 (Non-critical)
Version:2.0 beta 1 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: db-error

[14 Apr 2007 17:17] Schalk Neethling
Description:
Hello,

An error was found at 04/12/2007 09:59:31 (1176361171) on line '2021' of script 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\eventum\include\class.issue.php'.

The error message passed to us was:

'DB Error: unknown error'

A more detailed error message follows:

'INSERT INTO
                    eventum.eventum_issue
                 (
                    iss_prj_id,
iss_grp_id,
iss_prc_id,
iss_pri_id,
iss_usr_id,iss_sta_id,
                    iss_created_date,
                    iss_last_public_action_date,
                    iss_last_public_action_type,
                    iss_summary,
                    iss_description,
                    iss_dev_time,
                    iss_private,
                    iss_root_message_id
                 ) VALUES (
                    2,
2,
7,
8,10,7,
                    '2007-04-12 06:59:31',
                    '2007-04-12 06:59:31',
                    'created',
                    'The vendor below is not displaying correctly on P&A index, when you view the index on page 1 it shows a , and when you click on the order it errors.  Please investigate and advise accordingly',
                    'Please ensure that the following branch is updated accordingly:\r\n\r\nBranch ID: 1875\r\nCompany ID: 136\r\nSymbol: 30032\r\nName: ATS Light Allow Wheels\r\n',
                    0,
                    0 ,
                    '<eventum.4644moudg.9hnwv5@10.200.64.234:90>'
                 ) [nativecode=1406 ** Data too long for column 'iss_summary' at row 1]'

That happened on page '/eventum/new.php' from IP Address '0.0.0.0' coming from the page (referrer) 'http://10.200.64.234:90/eventum/new.php'.

The user agent given was 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; {09F12508-E7F9-92A5-BFB1-99130AA912A8}; SV1; InfoPath.1; .NET CLR 2.0.50727)'.

--
Sincerely yours,
Automated Error_Handler Class

How to repeat:
Form field summary allows user to add more data then db field can accept.

Suggested fix:
Implement JavaScript validation to ensure the amount of data entered into the summary field does not exceed the length allowed by the db field.
[16 Apr 2007 5:52] Bryan Alsdorf
Hi,

This appears to be from having a particular SQL mode set. Can you post the output from this command?

show variables like '%sql_mode%';

Best Regards,
/bryan
[16 Apr 2007 23:41] Schalk Neethling
SQL result

Host: localhost
Database: eventum
Generation Time: Apr 17, 2007 at 02:41 AM
Generated by: phpMyAdmin 2.9.2 / MySQL 5.0.27-community-nt
SQL query: show variables like '%sql_mode%';
Rows: 1
Variable_name 	Value
sql_mode 	STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
[17 Apr 2007 0:04] Bryan Alsdorf
Hi,

This is caused by STRICT_TRANS_TABLES.

You can remove this SQL mode for Eventum by changing class.db_api.php, to run the following query everytime it connects

SET SQL_MODE = '';

Let me know if you need exact details on how to do this.

For future development I will enable strict mode for my development of Eventum.

Best Regards,
/bryan
[17 Apr 2007 8:16] Schalk Neethling
Hi Bryan,

Would you suggest I place at the top of the file before, or after the require's

$TOTAL_QUERIES = 0;
SET SQL_MODE = '';

require_once("DB.php");
require_once(APP_INC_PATH . "class.error_handler.php");

or

$TOTAL_QUERIES = 0;

require_once("DB.php");
require_once(APP_INC_PATH . "class.error_handler.php");

SET SQL_MODE = '';

Thanks!
[25 May 2007 6:32] Bryan Alsdorf
Set this:

$this->dbh->query("SET SQL_MODE=''");

After this line:
$this->dbh = DB::connect($dsn);
[9 Jul 2013 8:30] Yngve Svendsen
Hi. Eventum is now a project independent of MySQL, and its new home (including bug tracking) is here: https://launchpad.net/eventum

I am closing this, and ask that the issue, if still relevant, be reported to the Launchpad bug tracker.