I think that what KLS is saying is that the code you pasted above isn't the code that loads skill caps any more. Pretty sure the current code for skill caps is in shareddb.cpp in the DBLoadSkillCaps function, which does have the correct query:
Code:
"SELECT skillID,class,level,cap FROM skill_caps ORDER BY skillID,class,level"
That's not to say that the issue didn't occur, just that more information needs to be provided in order to reproduce the problem.