i dont do much other than with MySQL, but having looked at the docs within 5 seconds i saw what your problem is. It always returns -1 which means that it is returning an error. Have a look further up your code and see if you can see what is wrong, you might have an illegal call or something.
If you cant find anything try posting the actual code on here and see if either myself or anyone else can spot it. quite often it helps to have someone else proof read code.