Minor code style fixes and changes

We need not connect to database in library function as most of libraries have dependency on db library. We assume that these libraries are used in such a way that db is connected prior to any function call made by member of class or any static member function call to the class! In case of db not connected we can throw an exception from here so that we take care of things while development stage only!! :)
Also I have made minor changes to the code like using tabspace to keep code indentation proper in place of spaces. lil formality will makes code look sexier :p