1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is it possible to specify TYPE_UDECIMAL

Discussion in 'XenForo Development Discussions' started by Sadik B, Mar 2, 2012.

  1. Sadik B

    Sadik B Well-Known Member

    I am creating a custom DataWriter for an addon I am making and I need that one of the fields in the table in which I hold decimal values. My field is defined as DECIMAL(10,2) in mysql table. So in the _getFields() function can I use 'type' => self::TYPE_UDECIMAL(10,2)

    I am guessing not. So what's the best way of writing fixed precision data (not floating point numbers) to the database through a datawriter?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That is not one of the available types (XenForo_DataWriter).

    http://help.scibit.com/mascon/masconMySQL_Field_Types.html

    Since it is stored as a string perhaps you can use a string type.
     
  3. Sadik B

    Sadik B Well-Known Member

    Hmmm very good suggestion Jake, let me try that out...
     
  4. Sadik B

    Sadik B Well-Known Member

    Brilliant Jake, it worked! You just saved me an hour workaround coding! Thanks mate... :)
     

Share This Page