In I Kings 9:4 God says how Solomon will be blessed if he follows his father David’s example. You mean, the adulterer and murderer? Yes, says God. He had integrity. Huh?! The clue seems to be in I Kings 9, verses 6 and 9 in that David was never an idolater. Job makes much of not being an idolater as well (see Job 6:10). That carries lots of weight with God!