Code Monkey home page Code Monkey logo

Comments (5)

tanner0101 avatar tanner0101 commented on August 25, 2024

IMO this should be done at a higher level But I'd be interested to see the argument for including in this package. Do other low-level MySQL libraries do this?

from mysql-nio.

t-ae avatar t-ae commented on August 25, 2024

This library handles time zone.
This approach is like option 1 in the other issue and we encounter the QueryBuilder.filter problem.

from mysql-nio.

tanner0101 avatar tanner0101 commented on August 25, 2024

I'd be interested to know how libmysql is getting the timezone information (that's what the library you linked is using).

screen shot 2018-06-21 at 4 01 39 pm

MySQL gives back a MYSQL_TIME struct which is formatted as shown above. As you can see, no timezone information is supplied as a part of that struct. Perhaps it's sent somewhere else in the binary return data or there is some sort of flag to opt-in to retrieving it?

from mysql-nio.

tanner0101 avatar tanner0101 commented on August 25, 2024

Ah, after looking into this more I see that MySQL is not capable of storing time zones alongside the data (PostgreSQL is, which is what confused me). The server has a global time zone and that is it.

I also looked into novi/mysql-swift more and it seems like they are not actually fetching the MySQL Server's time zone. You set the time zone when you create a connection, and all Date's created thereafter will use that timezone.

I think to add proper timezone support in this package, MySQLConnection should gain a new property timeZone: TimeZone? and a new method determineTimeZone() -> Future<Void>. This method would ask the server for its time zone, and set that time zone on the connection. You could also set the property manually.

Once set, all Dates retrieved from MySQL would have the appropriate time zone set. This should not affect dates sent to MySQL as I believe they are sent as UTC anyway (but that should be looked into as well).

from mysql-nio.

gwynne avatar gwynne commented on August 25, 2024

Closing this out as not relevant at this point.

from mysql-nio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.