changed all sql calls to do_sql and make them all use train database
merging