-
-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility issue - Possible corruption of values with min and max values for a double. #2928
Labels
Comments
MySQL version of test case import mysql from 'mysql'
import fs from 'fs'
class Test {
vendorProperties = {
"multipleStatements":true
,"typeCast":true
,"supportBigNumbers":true
,"bigNumberStrings":true
,"dateStrings":true
,"trace":true
,"user":"root"
,"password": "oracle"
,"host":"yadamu-db1"
,"database":"sys"
,"port":33061
, infileStreamFactory : (path) => {return fs.createReadStream(path)}
}
async createConnectionPool() {
let stack, operation
try {
stack = new Error().stack;
operation = 'mysql.createPool()'
this.pool = mysql.createPool(this.vendorProperties)
console.log('Pool Created')
} catch (e) {
throw e
}
}
async getConnectionFromPool() {
const connection = await new Promise((resolve,reject) => {
this.pool.getConnection((err,connection) => {
if (err) {
reject(this.getDatabaseException(this.DRIVER_ID,err,stack,'mysql.Pool.getConnection()'))
}
resolve(connection)
})
})
return connection
}
async closeConnection(options) {
if ((this.connection !== undefined) && (typeof this.connection.release === 'function')) {
let stack;
try {
stack = new Error().stack
await this.connection.release()
this.connection = undefined;
} catch (e) {
this.connection = undefined;
throw e
}
}
};
async closePool(options) {
if ((this.pool !== undefined) && (typeof this.pool.end === 'function')) {
let stack;
try {
stack = new Error().stack
await this.pool.end()
this.pool = undefined;
} catch (e) {
this.pool = undefined;
throw e
}
}
}
executeSQL(sqlStatement,args) {
return new Promise((resolve,reject) => {
const stack = new Error().stack;
const sqlStartTime = performance.now()
this.connection.query(sqlStatement,args,async (err,results,fields) => {
console.log(results)
resolve(results)
})
})
}
async test() {
const data = [[1 , -1.7976931348623157e308],[2,1.7976931348623157e308]]
let results
try {
await this.createConnectionPool()
this.connection = await this.getConnectionFromPool()
results = await this.executeSQL(`SET AUTOCOMMIT = 0, TIME_ZONE = '+00:00',SESSION INTERACTIVE_TIMEOUT = 600000, WAIT_TIMEOUT = 600000, SQL_MODE='ANSI_QUOTES,PAD_CHAR_TO_FULL_LENGTH', GROUP_CONCAT_MAX_LEN = 1024000, GLOBAL LOCAL_INFILE = 'ON'`);
results = await this.executeSQL(`CREATE TEMPORARY table if not exists "t1"("key" smallint ,"double_col" double); `);
results = await this.executeSQL(`insert into "t1"("key","double_col") values ?`,[data]);
results = await this.executeSQL(`select "key", "double_col", cast("double_col" as char(64)) as "cast_result" from "t1"`);
console.log(results)
await this.closeConnection();
await this.closePool();
} catch (e) {
await this.closeConnection();
await this.closePool();
console.log(e)
}
}
}
const test = new Test();
test.test().then(() => console.log('Success')).catch((e) => console.log(e)) results in
|
Simplified Test Case (No Table Required)..
Results in
Expected results are 'true' for C1 thru C8. I can use this test to 'duck-type' the error and code a workaround for moment. |
Could i get an update on this issue, are you able to reproduce ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given the following example
I get
As you can see the values in question appear to have been stored correctly in the database, given the cast() returns the expected values, but the values retrieved appear to have been corrupted at the least significant digits. This is working with the lastest MYSQL Docker VM (9.x).
I als see the issue when I run MYSQL2 against the latest MYSQL 8.0 docker container.
The text was updated successfully, but these errors were encountered: