Skip to content

Conversation

SubtleSpark
Copy link

What was done:

When using MySQL JDBC driver to process result sets containing BigDecimal values (including zero values), the application retrieves numeric fields that evaluate to 0 (e.g., SELECT amount FROM orders WHERE amount = 0).

What was expected:

Following the behavior of the Oracle JDBC driver, which reuses the same BigDecimal instance for zero values to minimize memory allocation and optimize memory footprint. This ensures consistent reference equality (i.e., object1 == object2 for zero values) and reduces redundant object creation.

What actually happened:

The MySQL JDBC driver creates a new BigDecimal instance for each zero value encountered in the result set, even when the value is logically identical to BigDecimal.ZERO.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@SubtleSpark
Copy link
Author

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=118329 for updates.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants