/** this object is another type of "system" object */
static final int ALT_SYSTEM_OBJECT_FLAG = 0x02;
/** this object is hidden */
- static final int HIDDEN_OBJECT_FLAG = 0x08;
+ public static final int HIDDEN_OBJECT_FLAG = 0x08;
/** all flags which seem to indicate some type of system object */
static final int SYSTEM_OBJECT_FLAGS =
SYSTEM_OBJECT_FLAG | ALT_SYSTEM_OBJECT_FLAG;
public class AppendQueryImpl extends BaseSelectQueryImpl implements AppendQuery
{
- public AppendQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.APPEND);
+ public AppendQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.APPEND);
}
public String getTargetTable() {
implements BaseSelectQuery
{
- protected BaseSelectQueryImpl(String name, List<Row> rows, int objectId,
- Type type) {
- super(name, rows, objectId, type);
+ protected BaseSelectQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag, Type type) {
+ super(name, rows, objectId, objectFlag, type);
}
protected void toSQLSelectString(StringBuilder builder,
implements CrossTabQuery
{
- public CrossTabQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.CROSS_TAB);
+ public CrossTabQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.CROSS_TAB);
}
protected Row getTransformRow() {
implements DataDefinitionQuery
{
- public DataDefinitionQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.DATA_DEFINITION);
+ public DataDefinitionQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.DATA_DEFINITION);
}
public String getDDLString() {
public class DeleteQueryImpl extends BaseSelectQueryImpl implements DeleteQuery
{
- public DeleteQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.DELETE);
+ public DeleteQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.DELETE);
}
@Override
implements MakeTableQuery
{
- public MakeTableQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.MAKE_TABLE);
+ public MakeTableQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.MAKE_TABLE);
}
public String getTargetTable() {
public class PassthroughQueryImpl extends QueryImpl implements PassthroughQuery
{
- public PassthroughQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.PASSTHROUGH);
+ public PassthroughQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.PASSTHROUGH);
}
public String getConnectionString() {
import java.util.Map;
import com.healthmarketscience.jackcess.RowId;
-import com.healthmarketscience.jackcess.query.Query;
+import com.healthmarketscience.jackcess.impl.DatabaseImpl;
import com.healthmarketscience.jackcess.impl.RowIdImpl;
import com.healthmarketscience.jackcess.impl.RowImpl;
import static com.healthmarketscience.jackcess.impl.query.QueryFormat.*;
+import com.healthmarketscience.jackcess.query.Query;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
private final List<Row> _rows;
private final int _objectId;
private final Type _type;
+ private final int _objectFlag;
- protected QueryImpl(String name, List<Row> rows, int objectId, Type type) {
+ protected QueryImpl(String name, List<Row> rows, int objectId, int objectFlag,
+ Type type)
+ {
_name = name;
_rows = rows;
_objectId = objectId;
_type = type;
+ _objectFlag = objectFlag;
if(type != Type.UNKNOWN) {
short foundType = getShortValue(getQueryType(rows),
return _type;
}
+ public boolean isHidden() {
+ return((_objectFlag & DatabaseImpl.HIDDEN_OBJECT_FLAG) != 0);
+ }
+
/**
* Returns the unique object id of the query.
*/
}
public int getObjectFlag() {
- return getType().getObjectFlag();
+ return _objectFlag;
}
/**
try {
switch(typeFlag) {
case SELECT_QUERY_OBJECT_FLAG:
- return new SelectQueryImpl(name, rows, objectId);
+ return new SelectQueryImpl(name, rows, objectId, objectFlag);
case MAKE_TABLE_QUERY_OBJECT_FLAG:
- return new MakeTableQueryImpl(name, rows, objectId);
+ return new MakeTableQueryImpl(name, rows, objectId, objectFlag);
case APPEND_QUERY_OBJECT_FLAG:
- return new AppendQueryImpl(name, rows, objectId);
+ return new AppendQueryImpl(name, rows, objectId, objectFlag);
case UPDATE_QUERY_OBJECT_FLAG:
- return new UpdateQueryImpl(name, rows, objectId);
+ return new UpdateQueryImpl(name, rows, objectId, objectFlag);
case DELETE_QUERY_OBJECT_FLAG:
- return new DeleteQueryImpl(name, rows, objectId);
+ return new DeleteQueryImpl(name, rows, objectId, objectFlag);
case CROSS_TAB_QUERY_OBJECT_FLAG:
- return new CrossTabQueryImpl(name, rows, objectId);
+ return new CrossTabQueryImpl(name, rows, objectId, objectFlag);
case DATA_DEF_QUERY_OBJECT_FLAG:
- return new DataDefinitionQueryImpl(name, rows, objectId);
+ return new DataDefinitionQueryImpl(name, rows, objectId, objectFlag);
case PASSTHROUGH_QUERY_OBJECT_FLAG:
- return new PassthroughQueryImpl(name, rows, objectId);
+ return new PassthroughQueryImpl(name, rows, objectId, objectFlag);
case UNION_QUERY_OBJECT_FLAG:
- return new UnionQueryImpl(name, rows, objectId);
+ return new UnionQueryImpl(name, rows, objectId, objectFlag);
default:
// unknown querytype
throw new IllegalStateException(
private static final class UnknownQueryImpl extends QueryImpl
{
- private final int _objectFlag;
-
private UnknownQueryImpl(String name, List<Row> rows, int objectId,
int objectFlag)
{
- super(name, rows, objectId, Type.UNKNOWN);
- _objectFlag = objectFlag;
- }
-
- @Override
- public int getObjectFlag() {
- return _objectFlag;
+ super(name, rows, objectId, objectFlag, Type.UNKNOWN);
}
@Override
public class SelectQueryImpl extends BaseSelectQueryImpl implements SelectQuery
{
- public SelectQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.SELECT);
+ public SelectQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.SELECT);
}
@Override
*/
public class UnionQueryImpl extends QueryImpl implements UnionQuery
{
- public UnionQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.UNION);
+ public UnionQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.UNION);
}
public String getUnionType() {
public class UpdateQueryImpl extends QueryImpl implements UpdateQuery
{
- public UpdateQueryImpl(String name, List<Row> rows, int objectId) {
- super(name, rows, objectId, Type.UPDATE);
+ public UpdateQueryImpl(String name, List<Row> rows, int objectId,
+ int objectFlag) {
+ super(name, rows, objectId, objectFlag, Type.UPDATE);
}
public List<String> getTargetTables()
*/
public Type getType();
+ /**
+ * Whether or not this query has been marked as hidden.
+ * @usage _general_method_
+ */
+ public boolean isHidden();
+
/**
* Returns the unique object id of the query.
*/
}
try {
- new QueryImpl("TestQuery", rowList, 13, Query.Type.UNION) {
+ new QueryImpl("TestQuery", rowList, 13, Query.Type.UNION.getObjectFlag(),
+ Query.Type.UNION) {
@Override protected void toSQLString(StringBuilder builder) {
throw new UnsupportedOperationException();
}};