Geeks With Blogs

News
Tim Murphy

Tim is a Solutions Architect for PSC Group, LLC. He has been an IT consultant since 1999 specializing in Microsoft technologies. Along with running the Chicago Information Technology Architects Group and speaking on Microsoft and architecture topics he was also contributing author on "The Definitive Guide to the Microsoft Enterprise Library".



I review for the O'Reilly Blogger Review Program



Technorati Profile

www.flickr.com

Archives
Tim Murphy's .NET Software Architecture Blog Adventures in Architecting and Developing .NET

While converting some MySql databases to SQL Server I ran across this function.  Confused by the lack of hints to its purpose in the name I did what any red-blooded IT person would do…  look it up.  It turns out that this function turns the string representation of an IP address into a long integer.  What good that does I am still not sure, but here is the jist of the operation.

(octet1 * 256^3) + (octet2 * 256^2) + (octet3 * 256) + octet4

Simple enough, right?  Now for the real question.  What the heck is this function doing in the database?  My only thought is that it is faster to search an integer than a string, but to my way of thought this function has nothing to do with normal database operations and doesn’t belong.  A value like this should be converted to an integer by your business logic and passed into the database.  Your DBMS should not be concerned with IP infrastructure.  Of course that is jus my opinion and I would love to hear what others think.

del.icio.us Tags: ,,,,
Posted on Tuesday, March 22, 2011 12:18 AM | Back to top


Comments on this post: What Is INET_ATON And Why Is It In A Database

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Tim Murphy | Powered by: GeeksWithBlogs.net | Join free