Changing the way we parse the SQL query result

Parsing the cursor using the column names instead of the index of an array
that we pass as a parameter to the query. The way we were doing caused
many trouble if we wanted to change the columns for example.