added some sql utilities from