Skip to content
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

SET TIMEZONE session parametr ignored by driver #117

Open
adranwit opened this issue Jun 4, 2018 · 2 comments
Open

SET TIMEZONE session parametr ignored by driver #117

adranwit opened this issue Jun 4, 2018 · 2 comments

Comments

@adranwit
Copy link

adranwit commented Jun 4, 2018

The session timezone parameter is ignored by the driver which always uses time.Local

https://github.com/alexbrainman/odbc/blob/master/column.go#L141

case api.SQL_C_TYPE_TIMESTAMP:
	t := (*api.SQL_TIMESTAMP_STRUCT)(p)
	r := time.Date(int(t.Year), time.Month(t.Month), int(t.Day),
		int(t.Hour), int(t.Minute), int(t.Second), int(t.Fraction),
		time.Local)

Could you please allow use custom timezone setting

@alexbrainman
Copy link
Owner

Could you please allow use custom timezone setting

What exactly do you propose I should do?

Alex

@NickTaylor-
Copy link

Sorry to necro an old issue, but I am running into this myself and think I can probably spin up a PR for it. The MySQL package achieves this by having the database timezone/location provided in the DSN:

https://github.com/go-sql-driver/mysql/blob/1fbca2aabb09915d4f1006d01b271ad7778eec4f/dsn.go#L43

https://stackoverflow.com/a/40478160

Does this make sense as an approach here? I haven't really dug into the code, however it doesn't seem like it is parsing anything out of the DSN before passing it to ODBC.

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

No branches or pull requests

3 participants