Posted Wednesday, December 31, 1969 @ 23:59:59
I am not sure if this is my jdbc driver or quick table,but when i do a group by i only get one record back. if i add any other statment such as set nocount off or put a begin and an end, then i get all the records back but then quick table instead of doing what normally does(bring a little, then bring some more while scrolling) brings all the records which takes a long time.any idea what is going on?
Ben I am using the quicktable jar for the application. i also bought the code and i compile it to look into this problem in the table mode i changed protected void createRowCountSql() { if( dbTable.selectSql == null) throw new RuntimeException("Select sql not set for dbtable"); String sql = dbTable.selectSql.toUpperCase(); sql = sql.trim(); if(sql.indexOf("SELECT") != -1 ) { if(sql.indexOf("ORDER BY") != -1) dbTable.rowCountSql = "SELECT COUNT(*) " + dbTable.selectSql.substring(sql.indexOf("FROM"),sql.indexOf("ORDER BY")); else dbTable.rowCountSql = "SELECT COUNT(*) " + dbTable.selectSql.substring(sql.indexOf("FROM")); } } to
protected void createRowCountSql() { if( dbTable.selectSql == null) throw new RuntimeException("Select sql not set for dbtable");
String sql = dbTable.selectSql.toUpperCase(); sql = sql.trim(); if(sql.indexOf("SELECT") != -1 ) { if(sql.indexOf("ORDER BY") != -1) dbTable.rowCountSql = "SELECT COUNT(*) " + dbTable.selectSql.substring(sql.indexOf("FROM"),sql.indexOf("ORDER BY")); if(sql.indexOf("GROUP BY") != -1) dbTable.rowCountSql = "SELECT COUNT(*) " + dbTable.selectSql.substring(sql.indexOf("FROM"),sql.indexOf("GROUP BY")); else dbTable.rowCountSql = "SELECT COUNT(*) " + dbTable.selectSql.substring(sql.indexOf("FROM")); } } obviously the count will be wrong. but now i get the all the grouped by records (plus all the extra all null records)
Ben: fyi i changed it to
protected void createRowCountSql() { if( dbTable.selectSql == null) throw new RuntimeException("Select sql not set for dbtable"); String sql = dbTable.selectSql.toUpperCase(); sql = sql.trim(); if(sql.indexOf("SELECT") != -1 ) { if(sql.indexOf("ORDER BY") != -1) dbTable.rowCountSql = "SELECT COUNT(*) " + dbTable.selectSql.substring(sql.indexOf("FROM"),sql.indexOf("ORDER BY")); if(sql.indexOf("GROUP BY") != -1) dbTable.rowCountSql = "SELECT COUNT(*) " + dbTable.selectSql.substring(sql.indexOf("FROM"),sql.indexOf("GROUP BY")); else dbTable.rowCountSql = "SELECT DISTINCT " + dbTable.selectSql.substring(sql.indexOf("FROM")); } } and now it works great on grouped by statements. this is a great product
|