• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

is it good habit to create separate methods which differs 1 or 2 columns in fetching records ?

 
Ranch Hand
Posts: 529
19
Eclipse IDE MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should I create two separate methods for fetching records from MySQL database in which one method returns same columns with same conditions but has only one or two columns more than the another one?

For example. Just to view the account information of an employee I write a method getActiveEmpInfo(String MembId) to fetch employee name, account status, balance. For updating the employee information I have to fetch its all information so I write another method getActiveEmpAllInfo(String empId) which fetches few more columns like mobile number and address than getActiveEmpInfo(String MembId) method. so for the difference of two and sometime one column I created another separate method with meaningful name which suits its functionality.

I may have to fetch the record from 4000- 5000 employee rows. Actually it's not just about fetching employee information but also what about queries where I have to fetch sales records of 5 years from 60,00,000 rows( Maximum) from different tables. so is It good practice to create such separate methods for one or two column differences ?


reply
    Bookmark Topic Watch Topic
  • New Topic