• 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: Do entities require a primary key?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do entities require a primary key?


  • Subject: Re: Do entities require a primary key?
  • From: Klaus Berkling <email@hidden>
  • Date: Wed, 09 Dec 2009 15:50:22 -0800
  • Organization: DynEd International, Inc.

On 12/9/09 3:25 PM, Johnny Miller wrote:
The table has two columns an "IP_FROM" and an "IP_TO", each contains an IP number.

According to the manual after you convert an IP address to an IP number it can only resolve to one row in the database i.e.

IP_FROM<= X<= IP_TO
Not your original question, Chuck is -of course- right :-), but how do you convert your IP address to an IP number?

This doesn't work for me for some addresses:

NSArray<String>  tempArray = NSArray.componentsSeparatedByString(clientIPAddress, ":");
clientIPAddress = new String(tempArray.objectAtIndex(0));
NSArray<String>  ipOctets = NSArray.componentsSeparatedByString(clientIPAddress, ".");

int ipOctet1 = Integer.parseInt(ipOctets.objectAtIndex(0));
int ipOctet2 = Integer.parseInt(ipOctets.objectAtIndex(1));
int ipOctet3 = Integer.parseInt(ipOctets.objectAtIndex(2));
int ipOctet4 = Integer.parseInt(ipOctets.objectAtIndex(3));

int intIPAddress = (ipOctet1 * 16777216) + (ipOctet2 * 65536) + (ipOctet3 * 256) + ipOctet4;

I'm guessing it has something to do with int not being large enough or the column type in the database.


-- Klaus Berkling Systems Administrator DynEd International, Inc. www.dyned.com | www.eskimo.com/~kiberkli <www.eskimo.com/~kiberkli> _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Do entities require a primary key? (From: Johnny Miller <email@hidden>)
 >Re: Do entities require a primary key? (From: Chuck Hill <email@hidden>)
 >Re: Do entities require a primary key? (From: Johnny Miller <email@hidden>)

  • Prev by Date: Re: Do entities require a primary key?
  • Next by Date: objectsWithQualifierFormat
  • Previous by thread: Re: Do entities require a primary key?
  • Next by thread: objectsWithQualifierFormat
  • Index(es):
    • Date
    • Thread