Revision 93 trunk/org.gvsig.postgresql/org.gvsig.postgresql.provider/src/main/java/org/gvsig/fmap/dal/store/postgresql/PostgreSQLServerExplorer.java

View differences:

PostgreSQLServerExplorer.java
35 35
import java.util.ArrayList;
36 36
import java.util.Iterator;
37 37
import java.util.List;
38
import java.util.logging.Level;
38 39

  
39 40
import org.gvsig.fmap.dal.DataStoreParameters;
40 41
import org.gvsig.fmap.dal.NewDataStoreParameters;
......
42 43
import org.gvsig.fmap.dal.exception.InitializeException;
43 44
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
44 45
import org.gvsig.fmap.dal.exception.RemoveException;
46
import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
45 47
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
46 48
import org.gvsig.fmap.dal.store.jdbc.JDBCHelper;
47 49
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorer;
......
230 232
        return x;
231 233
    }
232 234

  
233
    public void updateTableStatistics(String tableName) {
234
        final String sql;
235
    
236
        if( tableName.startsWith("\"") ) {
237
            sql = "VACCUM ANALYZE " + tableName ;
238
        } else {
239
            sql = "VACCUM ANALYZE \"" + tableName + "\"";
240
        }
241
        
242
        TransactionalAction action = new TransactionalAction() {
243
            public boolean continueTransactionAllowed() {
244
                return false;
245
            }
246
            public Object action(Connection conn) throws DataException {
247
                try {
248
                    Statement st = conn.createStatement();
249
                    JDBCHelper.executeQuery(st, sql);
250
                    return Boolean.TRUE;
251
                } catch (SQLException e1) {
252
                        throw new JDBCSQLException(e1);
253
                }                
254
            }
255
        };
256

  
235
    public void updateTableStatistics(String tableName) throws JDBCExecuteSQLException {
236
        String sql="";
257 237
        try {
258
            helper.doConnectionAction(action);
259
        } catch (Exception e) {
260
            throw new RuntimeException(e);
238
            
239
            if( tableName.startsWith("\"") ) {
240
                sql = "VACUUM ANALYZE " + tableName ;
241
            } else {
242
                sql = "VACUUM ANALYZE \"" + tableName + "\"";
243
            }
244
            Connection conn = this.getHelper().getConnection();
245
            Statement st = conn.createStatement();
246
            JDBCHelper.execute(st, sql);
247
        } catch (Exception ex) {
248
            throw new JDBCExecuteSQLException(sql, ex);
261 249
        }
262 250

  
263 251
    }

Also available in: Unified diff