Why there is no DOUBLE type in Database Type Map?

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
usernick
Registered User
Posts: 7
Joined: Tue Jan 16, 2018 2:35 pm

Why there is no DOUBLE type in Database Type Map?

Post by usernick » Mon Aug 27, 2018 12:45 pm

Why there is no DOUBLE type in Database Type Map?

How do I specify field with DOUBLE type in update_schema() when creating extension?
Last edited by kinerity on Mon Aug 27, 2018 11:24 pm, edited 1 time in total.
Reason: Moved to Extension Writers Discussion

User avatar
david63
Jr. Extension Validator
Posts: 14720
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Why there is no DOUBLE type in Database Type Map?

Post by david63 » Mon Aug 27, 2018 12:55 pm

usernick wrote:
Mon Aug 27, 2018 12:45 pm
Why there is no DOUBLE type in Database Type Map?
Probably because it is not supported by all dbms
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

usernick
Registered User
Posts: 7
Joined: Tue Jan 16, 2018 2:35 pm

Re: Why there is no DOUBLE type in Database Type Map?

Post by usernick » Mon Aug 27, 2018 1:18 pm

No floating-point type except decimal? I thought FLOAT and DOUBLE are the most common.

Then what type should be used for auto-rounding? (Not displaying digits after decimal point if they are not specified, and not limiting the number of digits, maybe?)
10.00 -> 10, not "10.00"
10.01 -> 10.01
10.001 - 10.001

User avatar
canonknipser
Registered User
Posts: 1622
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Why there is no DOUBLE type in Database Type Map?

Post by canonknipser » Mon Aug 27, 2018 4:21 pm

usernick wrote:
Mon Aug 27, 2018 1:18 pm
No floating-point type except decimal?
Decimal is no floating point, but a fixed point data type.
usernick wrote:
Mon Aug 27, 2018 1:18 pm
I thought FLOAT and DOUBLE are the most common.
If you really need a special numeric data type, you can always use a string type field in the database and do all the computing in the php code which is imho the safer way because different database engines (or database engine settings) handle floating numeric types different.
See https://dev.mysql.com/doc/refman/8.0/en ... types.html and https://dev.mysql.com/doc/refman/8.0/en ... float.html for MySQL and I'm sure you can find other examples for other DBMS.


BTW: I doubt this is a topic for the support forum, maybe for custom coding or extension writers discussion.
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB

User avatar
3Di
Registered User
Posts: 12939
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Why there is no DOUBLE type in Database Type Map?

Post by 3Di » Mon Aug 27, 2018 4:51 pm

usernick wrote:
Mon Aug 27, 2018 1:18 pm
How do I specify field with DOUBLE type in update_schema() when creating extension?
See: viewtopic.php?p=14595616#p14595616
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: Exabot [Bot], Noomcat and 19 guests