Float notation (4,2) ?

0 votes
asked Aug 3, 2014 in Solved by Matt (510 points)

In MySQL I would for example use 4,2 to denote "maximum 4 digits, 2 of which after the comma".
I can set this in Skipper, but it resets itself after I save.

Reproduce:

  1. set field type 'float'
  2. set 'size' = 4,2
  3. save entity
  4. re-open entity
  5. size will now be 4 instead of expected 4,2

Same with 4.2 or any other notation I could think of.

How can I set 4,2 ?

1 Answer

0 votes
answered Aug 5, 2014 by Martin Freki Stradej Skipper developer (74,840 points)
selected Aug 5, 2014 by Matt
 
Best answer

This setting depends on the framework you use and is covered by ORM properties precision and scale. See example screenshot from Doctrine2:
enter image description here

commented Aug 5, 2014 by Matt (510 points)

Thank you, I overlooked that setting.

Unfortunately it seems Propel2 does not support this feature;
the Skipper-generated XML uses 'scale' but Propel2 ignores it...

commented Aug 5, 2014 by Martin Freki Stradej Skipper developer (74,840 points)

In the Propel2 examples I have available, the combination of properties size and scale are used. However if the SQL notation "size=4,2" is supported by Propel, we can add it to Skipper or modify the export results.

Can you please try it out and let me know which notation is properly processed by Propel?

commented Aug 5, 2014 by Matt (510 points)

My bad - I had removed the size on the float column during my testing.
Works perfectly, but you have (obviously :-) ) to add both size and scale, Skipper generates this XML:

<column name="funky_float" 
              description="Propel2 Float Test"
              type="Float" size="4" 
              required="true" scale="2"
 />

and Propel generates it correctly. So no need for changes to Skipper for this, but thank you for offering!

...