move run sql to toolbar, fix infinite loop