You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The datetime/timestamp value can include a trailing fractional seconds part. (like this: YYYY-MM-DD hh:mm:ss[.fraction])
deno_mysql currently truncates a fraction part of these types.
Steps to reproduce
import{Client,Connection}from"https://deno.land/x/mysql@2.2.0/mod.ts";import{assertEquals}from"https://deno.land/std@0.60.0/testing/asserts.ts";constclient=awaitnewClient().connect({hostname: "localhost",port: 3306,username: "test",db: "test",password: "test",});awaitclient.query(`DROP TABLE IF EXISTS test`);awaitclient.query(`CREATE TABLE test ( id int(11) NOT NULL AUTO_INCREMENT, datetime datetime(6) NOT NULL, PRIMARY KEY (id)) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4`);constdatetime=newDate();awaitclient.execute(` INSERT INTO test (datetime) VALUES (?)`,[datetime]);constexpected=datetime;const[{datetime: actual}]=awaitclient.query(`SELECT datetime FROM test`);assertEquals(expected.toISOString(),actual.toISOString());// See https://github.com/denoland/deno/issues/6643 for why not simply using `assertEquals(actual, expected)`.
Expected behavior:
The above code shouldn't fail.
Actual behavior:
The above code fails with the fowlloing logs:
INFO connecting localhost:3306
INFO connected to localhost
error: Uncaught AssertionError: Values are not equal:
[Diff] Actual / Expected
- "2020-07-07T19:32:24.464Z"
+ "2020-07-07T19:32:24.000Z"
throw new AssertionError(message);
^
at assertEquals (asserts.ts:183:9)
at file:///home/uki00a/work/test.ts:22:1
Summary
datetime
/timestamp
value can include a trailing fractional seconds part. (like this: YYYY-MM-DD hh:mm:ss[.fraction])deno_mysql
currently truncates a fraction part of these types.Steps to reproduce
Expected behavior:
The above code shouldn't fail.
Actual behavior:
The above code fails with the fowlloing logs:
Environment
Ref
https://dev.mysql.com/doc/refman/5.6/en/datetime.html
The text was updated successfully, but these errors were encountered: