MySQL: returning connection instead of cursor