$db_link should be passed as a string ('db_link') not as a variable - as the default connection as being referenced, no link should be passed in the function call so the default connection link is used. (#629)