Giter Site home page Giter Site logo

Numeric types in DBIish about dbiish HOT 5 CLOSED

salortiz avatar salortiz commented on August 17, 2024
Numeric types in DBIish

from dbiish.

Comments (5)

Skarsnik avatar Skarsnik commented on August 17, 2024

Not all drivers support different float numeric representation like SQLite.
But yes, it's probably a good idea.

from dbiish.

abraxxa avatar abraxxa commented on August 17, 2024

My take on floats was to use the Perl 6 type which is the default when you write my $float = 4.85; which is Rat.
This has also the advantage of not having the usual float rounding errors.
Are there any downsides from your point of view which I've missed? Performance?

from dbiish.

salortiz avatar salortiz commented on August 17, 2024

@abraxxa if you write 'float' when you are thinking Rat is your business :-)

The real problem is that DBIish should support and handle well the data in a Data Base not necessarily designed to be Perl 6 specific.
If a DBA uses, for wherever reason IEEE-754 types, the program needs to handle them in a predictably way, for example if a field in my DB contains the DOUBLE 1e+287 I want to see 1e+287 and that operations with it run at native speed.

As DB systems are richer in types, the best option is to design DBIsh with plugable types conversions, not fixed ones.

from dbiish.

salortiz avatar salortiz commented on August 17, 2024

From c57a200 all drivers after prepare expose in $sth.column-types[$col], the known field types to be returned.
In the SQLite case, where the column type is dynamic (and NUMERIC don't exist), the user can set the desired type before row fetching.
See https://github.com/perl6/DBIish/blob/master/lib/DBIish/CommonTesting.pm6#L216 for an example.
This mechanism will be generalized and extended for other drivers.
So I'm closing this issue.

from dbiish.

abraxxa avatar abraxxa commented on August 17, 2024

Salvador you rock! Thanks for pushing DBIish forward!

from dbiish.

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.