Bug #49892 Make Item::val_int/str/real/ return status code

Submitted: 23 Dec 2009 12:26
Reporter: Georgi Kodinov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S4 (Feature request)
Version:4.1+ OS:Any
Assigned to: CPU Architecture:Any
Tags: reengineering

[23 Dec 2009 12:26] Georgi Kodinov
Description:
Item::val_int(), Item::val_str() etc do not return execution status code. They return the value produced instead. 
However evaluating the value can cause errors to be thrown. 
The only way to currently check for these errors is to look at thread's diagnostic area (THD::is_error()).
This is cumbersome to do, probably slow (because of the method call) and easy to forget when coding.
As a result we have a lot of bugs like e.g. Bug#46175, Bug#39022 etc.

How to repeat:
Look at the code

Suggested fix:
Make Item::val_xxx() methods return status. We may follow MySQL's best coding practices here and make Item::val_xxx() return status code and use an output parameter to return the value.
Or if this is deemed to much of a change use output parameter to return the status.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.