• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Internal Data Type for BOOL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Internal Data Type for BOOL


  • Subject: Re: Internal Data Type for BOOL
  • From: Art Isbell <email@hidden>
  • Date: Tue, 3 Jun 2003 15:57:08 -1000

Different databases handle boolean datatypes in different ways, some more seamlessly than others. But all databases handle integer datatypes seamlessly, so making booleans integers should work across all databases.

After struggling somewhat with boolean data, I finally decided to adopt someone's suggestion on how to store booleans as integers. Basically, model booleans as integers in your eomodel. Name the boolean attribute with something like an "Int" suffix - e.g., isActiveInt. EOModeler's generated Java class file will contain isActiveInt() and setIsActiveInt() accessors. Add 2 more accessors that you will actually use in your WO apps including in WO component bindings:

    public boolean isActive() {
        Number isActive = isActiveInt();
        return ((isActive != null) && (isActive.intValue() == 1));
    }

    public void setIsActive(boolean aFlag) {
        setIsActiveInt(new Integer(aFlag ? 1 : 0));
    }

Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Internal Data Type for BOOL
      • From: Pierre Frisch <email@hidden>
References: 
 >Re: Internal Data Type for BOOL (From: Alan Ward <email@hidden>)

  • Prev by Date: Re: Encryption Code Problem
  • Next by Date: webobjects5.2 and 3 dev books
  • Previous by thread: Re: Internal Data Type for BOOL
  • Next by thread: Re: Internal Data Type for BOOL
  • Index(es):
    • Date
    • Thread