Thinking about adding a decimal type to web2py.
Syntax:
Field('x','decimal',length=10,digits=2)
defaults should be based on DB back-end or just 10,2 for example
(easier)?
ideal IS_DEC_IN_RANGE validator should also be based on DB back-end,
definite values are easier but would limit values for otherwise
limitless POSTGRESQL values.
pros/cons?
Summary of DB back-end info on decimal support
p=precision, s=scale, [means optional]
---DB---- -----syntax----- --limits--- --dft--
MSSQL2005 decimal[(p[,s])] 0<=s<=p<=38 18,0
DB2/400 " 1<=s<=p<=31 5,0
MYSQL
spec: For DECIMAL(M,D), the maximum M is 65
create: CREATE TABLE foo( bar decimal(10,2) )
POSTGRESQL
spec: DECIMAL(M,D), exact, no limit
create: CREATE TABLE foo( bar decimal(10,2) )
SQLite : no
FIREBIRD
spec: For DECIMAL(P,S), Precision must be from 1 to 18. Precision >=
Scale
create: CREATE TABLE foo( bar decimal(10,4) ) i.e. This allows:
pppppp.ssss
Denes
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---