PostgreSQL and MySQL accepts microsecond #1815

Closed
skanehira wants to merge 3 commits from master into master
First-time contributor

In PostgreSQL TIMESTAMP type and MySQL DATETIME can treat microsecond resolution, but xorm can't.

This PR makes xorm puts a timestamp value with microsecond.

In PostgreSQL TIMESTAMP type and MySQL DATETIME can treat microsecond resolution, but xorm can't. This PR makes xorm puts a timestamp value with microsecond.
lunny reviewed 2020-10-23 11:58:49 +00:00
Dismissed
@ -0,0 +1,109 @@
package dialects
Owner

Please add copyright header.

Please add copyright header.
Author
First-time contributor

Done :)

Done :)
skanehira marked this conversation as resolved
lunny added the
kind
enhancement
label 2020-10-23 11:59:55 +00:00
Owner

I will leave this to wait CI ready.

I will leave this to wait CI ready.
Author
First-time contributor

@lunny
When will the CI be ready?
I'm having trouble with this problem at work.

@lunny When will the CI be ready? I'm having trouble with this problem at work.
Owner

@skanehira Please force push this PR and CI will run

@skanehira Please force push this PR and CI will run
skanehira force-pushed master from 26caae7854 to 9d5c45d331 2020-10-26 04:57:57 +00:00 Compare
Author
First-time contributor

@lunny I try push -f but CI looks like doesn't run

@lunny I try `push -f` but CI looks like doesn't run
Author
First-time contributor

@lunny
There some tests is failed.
I think the cause is microsecond was rounded up.

Should xorm truncated it?

=== RUN   TestTimeUserCreatedDiffLoc/user_created2
[xorm] [info]  2020/10/26 13:08:18.520898 [SQL] [8e58f4d0ce65eb6973eb] BEGIN TRANSACTION [] - 697.361µs
[xorm] [info]  2020/10/26 13:08:18.523099 [SQL] [8e58f4d0ce65eb6973eb] DROP TABLE IF EXISTS `user_created2` [] - 2.073194ms
[xorm] [info]  2020/10/26 13:08:18.523590 [SQL] [8e58f4d0ce65eb6973eb] COMMIT [] - 318.735µs
[xorm] [info]  2020/10/26 13:08:18.525052 [SQL] [95a791cab8081e329ba8] SELECT `TABLE_NAME`, `ENGINE`, `AUTO_INCREMENT`, `TABLE_COMMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB') [xorm_test] - 1.239027ms
[xorm] [info]  2020/10/26 13:08:18.538621 [SQL] [95a791cab8081e329ba8] CREATE TABLE IF NOT EXISTS `user_created2` (`id` VARCHAR(255) NULL, `created_at` DATETIME NULL) DEFAULT CHARSET utf8 [] - 13.073981ms
user 0001-01-01 00:00:00 +0000 UTC
[xorm] [info]  2020/10/26 13:08:18.543861 [SQL] [31f8497df6446966dbd4] INSERT INTO `user_created2` (`id`,`created_at`) VALUES (?,?) [lunny 2020-10-26T09:08:18.539184] - 4.485798ms
[xorm] [info]  2020/10/26 13:08:18.545062 [SQL] [667fb9d132fbde4f979a] SELECT `id`, `created_at` FROM `user_created2` LIMIT 1 [] - 812.991µs
user2 2020-10-26 21:08:19 +0800 CST
--- FAIL: TestTimeUserCreatedDiffLoc (0.05s)
    --- PASS: TestTimeUserCreatedDiffLoc/user_created2 (0.02s)
    time_test.go:147: 
        	Error Trace:	time_test.go:147
        	Error:      	Not equal: 
        	            	expected: 1603717698
        	            	actual  : 1603717699
        	Test:       	TestTimeUserCreatedDiffLoc
    time_test.go:148: 
        	Error Trace:	time_test.go:148
        	Error:      	Not equal: 
        	            	expected: "2020-10-26 21:08:18"
        	            	actual  : "2020-10-26 21:08:19"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-2020-10-26 21:08:18
        	            	+2020-10-26 21:08:19
        	Test:       	TestTimeUserCreatedDiffLoc
=== RUN   TestTimeUserUpdated
@lunny There some tests is failed. I think the cause is microsecond was rounded up. Should xorm truncated it? ``` === RUN TestTimeUserCreatedDiffLoc/user_created2 [xorm] [info] 2020/10/26 13:08:18.520898 [SQL] [8e58f4d0ce65eb6973eb] BEGIN TRANSACTION [] - 697.361µs [xorm] [info] 2020/10/26 13:08:18.523099 [SQL] [8e58f4d0ce65eb6973eb] DROP TABLE IF EXISTS `user_created2` [] - 2.073194ms [xorm] [info] 2020/10/26 13:08:18.523590 [SQL] [8e58f4d0ce65eb6973eb] COMMIT [] - 318.735µs [xorm] [info] 2020/10/26 13:08:18.525052 [SQL] [95a791cab8081e329ba8] SELECT `TABLE_NAME`, `ENGINE`, `AUTO_INCREMENT`, `TABLE_COMMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB') [xorm_test] - 1.239027ms [xorm] [info] 2020/10/26 13:08:18.538621 [SQL] [95a791cab8081e329ba8] CREATE TABLE IF NOT EXISTS `user_created2` (`id` VARCHAR(255) NULL, `created_at` DATETIME NULL) DEFAULT CHARSET utf8 [] - 13.073981ms user 0001-01-01 00:00:00 +0000 UTC [xorm] [info] 2020/10/26 13:08:18.543861 [SQL] [31f8497df6446966dbd4] INSERT INTO `user_created2` (`id`,`created_at`) VALUES (?,?) [lunny 2020-10-26T09:08:18.539184] - 4.485798ms [xorm] [info] 2020/10/26 13:08:18.545062 [SQL] [667fb9d132fbde4f979a] SELECT `id`, `created_at` FROM `user_created2` LIMIT 1 [] - 812.991µs user2 2020-10-26 21:08:19 +0800 CST --- FAIL: TestTimeUserCreatedDiffLoc (0.05s) --- PASS: TestTimeUserCreatedDiffLoc/user_created2 (0.02s) time_test.go:147: Error Trace: time_test.go:147 Error: Not equal: expected: 1603717698 actual : 1603717699 Test: TestTimeUserCreatedDiffLoc time_test.go:148: Error Trace: time_test.go:148 Error: Not equal: expected: "2020-10-26 21:08:18" actual : "2020-10-26 21:08:19" Diff: --- Expected +++ Actual @@ -1 +1 @@ -2020-10-26 21:08:18 +2020-10-26 21:08:19 Test: TestTimeUserCreatedDiffLoc === RUN TestTimeUserUpdated ```
skanehira force-pushed master from c4c9199278 to 965ff217e3 2020-12-14 12:40:55 +00:00 Compare
Author
First-time contributor

@lunny I fixed some tests but CI doesn't works fine.
It looks like CI resources is not enough.
How can I solve this?

# xorm.io/xorm
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0xe60e57, 0x16)
	/usr/local/go/src/runtime/panic.go:617 +0x72 fp=0x7ffd725e3980 

https://drone.gitea.com/xorm/xorm/42/1/18

@lunny I fixed some tests but CI doesn't works fine. It looks like CI resources is not enough. How can I solve this? ``` # xorm.io/xorm fatal error: runtime: out of memory runtime stack: runtime.throw(0xe60e57, 0x16) /usr/local/go/src/runtime/panic.go:617 +0x72 fp=0x7ffd725e3980 ``` https://drone.gitea.com/xorm/xorm/42/1/18
Owner

I will test it locally and merge with administrator permissions.

I will test it locally and merge with administrator permissions.
Author
First-time contributor

@lunny
Is this inprogress?

I will test it locally and merge with administrator permissions.

@lunny Is this inprogress? > I will test it locally and merge with administrator permissions.
Author
First-time contributor

@lunny How about this?
#1815 (comment)

@lunny How about this? https://gitea.com/xorm/xorm/issues/1815#issuecomment-122163
skanehira added 1 commit 2021-03-06 14:01:13 +00:00
change module path
Some checks failed
continuous-integration/drone/pr Build is failing
855bd926d8
Author
First-time contributor

Close this PR.
I'll use forked xorm

Close this PR. I'll use forked xorm
skanehira closed this pull request 2021-04-02 06:34:06 +00:00
Some checks failed
continuous-integration/drone/pr Build is failing

Pull request closed

Sign in to join this conversation.
No description provided.