1 24 25 package com.mckoi.database.interpret; 26 27 import java.util.ArrayList ; 28 import java.util.List ; 29 import com.mckoi.database.*; 30 31 36 37 public class Compact extends Statement { 38 39 42 String table_name; 43 44 46 public void prepare() throws DatabaseException { 47 table_name = (String ) cmd.getObject("table_name"); 48 } 49 50 public Table evaluate() throws DatabaseException { 51 52 DatabaseQueryContext context = new DatabaseQueryContext(database); 53 54 TableName tname = resolveTableName(table_name, database); 57 if (!database.tableExists(tname)) { 59 throw new DatabaseException("Table '" + tname + "' does not exist."); 60 } 61 62 if (!database.getDatabase().canUserCompactTableObject(context, 64 user, tname)) { 65 throw new UserAccessException( 66 "User not permitted to compact table: " + table_name); 67 } 68 69 database.compactTable(tname); 71 72 return FunctionTable.resultTable(context, 0); 74 75 } 76 77 78 } 79 | Popular Tags |