Added support for int24 (mediumint)
Changed code to throw exceptions intead of returning an error code which was hiding error details.