update db.inc n lib.inc

remove db function in lib.inc and transfer to db.inc