sql_query now returns < 0 for error. Closes #444

sqlippool_command should also indicated that it errored
Fix stupid nesting in sqlippool