CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Define a field as Tiny Int instead of Int
Pages: [1]

Author Topic: Define a field as Tiny Int instead of Int  (Read 384 times)

robinmitra

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.4
Define a field as Tiny Int instead of Int
July 25, 2014, 08:32:06 am
Hi all

I'm building a CiviCRM extension, and want to define a field as tiny int (because the number would only ever be less than around 10), instead of int in an entity's DAO.

Since CRM_Utils_Type doesn't define tiny int as a constant, is it possible to achieve this in a standard way?

I believe I can define the field as tinyint in SQL but use int in my DAO but this is a bit inconsistent, and wanted to make sure that I wasn't missing anything.

Thanks
Robin

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Define a field as Tiny Int instead of Int
July 28, 2014, 06:59:38 am
Hey there,

I think the only place we use tiny int in civicrm / with DAO is for boolean.  my suggestion would be don't worry about the fact that it will only ever be small and just use INT. I doubt in will affect performance / memory usage (though obviously depends on your use case / maybe you have a reason to think it will be a big deal).
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Define a field as Tiny Int instead of Int

This forum was archived on 2017-11-26.