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

View differences:

PostgreSQLServerExplorer.java
32 32
import java.sql.Connection;
33 33
import java.sql.SQLException;
34 34
import java.sql.Statement;
35
import java.text.MessageFormat;
35 36
import java.util.ArrayList;
36 37
import java.util.Iterator;
37 38
import java.util.List;
38 39
import java.util.logging.Level;
40
import org.apache.commons.lang3.StringUtils;
39 41

  
40 42
import org.gvsig.fmap.dal.DataStoreParameters;
41 43
import org.gvsig.fmap.dal.NewDataStoreParameters;
......
46 48
import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
47 49
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
48 50
import org.gvsig.fmap.dal.store.jdbc.JDBCHelper;
49
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorer;
51
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerBase;
50 52
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
51 53
import org.gvsig.fmap.dal.store.jdbc.TransactionalAction;
52 54
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCExecuteSQLException;
......
58 60
 * @author jmvivo
59 61
 *
60 62
 */
61
public class PostgreSQLServerExplorer extends JDBCServerExplorer {
63
public class PostgreSQLServerExplorer extends JDBCServerExplorerBase {
62 64

  
63 65
    final static private Logger logger = LoggerFactory
64 66
            .getLogger(PostgreSQLServerExplorer.class);
......
232 234
        return x;
233 235
    }
234 236

  
235
    public void updateTableStatistics(String tableName) throws JDBCExecuteSQLException {
236
        String sql="";
237
        if( tableName.startsWith("\"") ) {
238
            sql = "VACUUM ANALYZE " + tableName ;
237
    @Override
238
    public void updateTableStatistics(String database, String schema, String table) throws JDBCExecuteSQLException {
239
        String sql = null;
240
        if( StringUtils.isEmpty(database) ) {
241
            if( StringUtils.isEmpty(schema) ) {
242
                sql = MessageFormat.format("VACUUM ANALIZE \"{0}\".\"{1}\".\"{2}\"", 
243
                        database, schema, table
244
                );
245
            }
246
        } else if( StringUtils.isEmpty(schema) ) {
247
            sql = MessageFormat.format("VACUUM ANALIZE \"{0}\".\"{1}\"", 
248
                    schema, table
249
            );
239 250
        } else {
240
            sql = "VACUUM ANALYZE \"" + tableName + "\"";
251
            sql = MessageFormat.format("VACUUM ANALIZE \"{0}\"", 
252
                    table
253
            );
241 254
        }
255
        if( sql == null ) {
256
            throw new IllegalArgumentException("Can't update statistics, identifier of table incorrect (database '"+database+"', schema '"+schema+"', table '"+table+"')");
257
        }
242 258
        this.getHelper().execute(sql);
243 259
    }
244 260

  

Also available in: Unified diff