Fields Summary |
---|
public static final int | ACT_UPDATE |
public static final int | ACT_INSERT |
public static final int | ACT_DELETE |
public static final int | ACT_SELECT |
public static final int | ACT_NOOP |
protected static final int | ST_BUILT |
public ArrayList | statementsArray of Statement. |
protected com.sun.jdo.spi.persistence.support.sqlstore.model.ClassDesc | config |
protected int | statusBitmask containing one of {@link QueryPlan#ST_BUILT},
{@link SelectQueryPlan#ST_C_BUILT}, {@link SelectQueryPlan#ST_OC_BUILT},
{@link SelectQueryPlan#ST_JOINED} |
protected int | action |
protected com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager | store |
protected ArrayList | tablesArray of QueryTable. |
protected static final ResourceBundle | messagesI18N message handler. |
Methods Summary |
---|
public QueryTable | addQueryTable(com.sun.jdo.spi.persistence.support.sqlstore.model.TableDesc tableDesc)
QueryTable table = new QueryTable(tableDesc);
tables.add(table);
table.setTableIndex(new TableIndex(tables.size() - 1));
return table;
|
public QueryTable | addQueryTable(org.netbeans.modules.dbschema.TableElement tableElement, com.sun.jdo.spi.persistence.support.sqlstore.model.ClassDesc persistenceConfig)Identifies a database table which will become part of this
query plan. We will build a QueryTable object describing its
use and return it.
Note: No join is constructed at this point for the table added.
ClassDesc _config = (persistenceConfig == null) ? this.config : persistenceConfig;
TableDesc tableDesc = _config.findTableDesc(tableElement);
if (tableDesc == null) {
if (tableElement != null) {
throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
"core.configuration.classnotmappedtotable", // NOI18N
_config.getPersistenceCapableClass().getName(),
tableElement.getName().getName()));
} else {
throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
"core.configuration.classnotmapped", // NOI18N
_config.getPersistenceCapableClass().getName()));
}
}
return addQueryTable(tableDesc);
|
public void | addQueryTables(java.util.ArrayList queryTables)Add all the tables from queryTables to the current
query plan. Useful when transfering tables when joining query plans
together.
for (int i = 0; i < queryTables.size(); i++) {
QueryTable t = (QueryTable) queryTables.get(i);
if (tables.indexOf(t) == -1) {
tables.add(t);
t.getTableIndex().setValue(tables.size() - 1);
}
}
|
protected Statement | addStatement(QueryTable t)
Statement s = createStatement(t);
statements.add(s);
return s;
|
public abstract void | build()
|
protected Statement | createStatement(QueryTable t)
Statement statement = newStatement();
statement.action = action;
statement.addQueryTable(t);
return statement;
|
public QueryTable | findQueryTable(org.netbeans.modules.dbschema.TableElement tableElement)Finds the QueryTable object that this query plan is using
to describe the TableElement indicated by the tableElement parameter.
for (int i = 0; i < tables.size(); i++) {
QueryTable t = (QueryTable) tables.get(i);
if (t.getTableDesc().getTableElement() == tableElement) {
//if (t.getTableDesc().getTableElement().equals(tableElement)) {
return t;
}
}
return null;
|
public QueryTable | findQueryTable(com.sun.jdo.spi.persistence.support.sqlstore.model.TableDesc tableDesc)Finds the QueryTable object that this query plan is using
to describe the TableDesc indicated by the tableDesc parameter.
for (int i = 0; i < tables.size(); i++) {
QueryTable t = (QueryTable) tables.get(i);
if (t.getTableDesc() == tableDesc) return t;
}
return null;
|
public int | getAction()
return action;
|
public com.sun.jdo.spi.persistence.support.sqlstore.model.ClassDesc | getConfig()
return config;
|
protected Statement | getStatement(QueryTable t)
if (t == null) return null;
for (int i = 0; i < statements.size(); i++) {
Statement s = (Statement) statements.get(i);
if (s.tableList.indexOf(t) != -1)
return s;
}
return null;
|
public java.util.ArrayList | getStatements()
for (int i = 0; i < statements.size(); i++) {
Statement s = (Statement) statements.get(i);
//Initialize sql text of the statement
s.getText();
}
return statements;
|
protected abstract Statement | newStatement()
|
protected void | processStatements()This method goes through the statement list and tries to set up relationship
between statements based on secondary table keys.
for (int i = 0; i < statements.size(); i++) {
Statement s = (Statement) statements.get(i);
QueryTable qt = (QueryTable) s.getQueryTables().get(0);
ArrayList secondaryTableKeys = qt.getTableDesc().getSecondaryTableKeys();
if (secondaryTableKeys != null) {
for (int j = 0; j < secondaryTableKeys.size(); j++) {
ReferenceKeyDesc secondaryTableKey = (ReferenceKeyDesc) secondaryTableKeys.get(j);
s.addSecondaryTableStatement(getStatement(findQueryTable(secondaryTableKey.getTableDesc())));
}
}
}
|