|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.datatools.sqltools.sqlbuilder.model.SQLDomainModel
public class SQLDomainModel
This class provides a central access point for state and environment information for a SQL statement being edited by the SQL Builder. It also provides access to services such as parsing.
| Constructor Summary | |
|---|---|
SQLDomainModel()
Constructs an instance of this class. |
|
SQLDomainModel(QueryStatement aStatement,
Database aDatabase)
Constructs an instance of this class with the given initial query statement and database. |
|
| Method Summary | |
|---|---|
void |
clearStatementToTemplate()
Clears the current statement to its template form. |
org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider |
createContentProvider()
Creates and returns a content provider for this statement, based on the current adapter factory. |
org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider |
createLabelProvider()
Creates and returns a label provider for this statement, based on the current adapter factory. |
org.eclipse.emf.common.notify.AdapterFactory |
getAdapterFactory()
Gets the adapter factory for this statement. |
java.sql.Connection |
getConnection()
Gets a JDBC Connection object for the connection to the database. |
ISQLEditorConnectionInfo |
getConnectionInfo()
Gets the ISQLEditorConnectionInfo object associated with this statement. |
java.lang.String |
getCurrentSchema()
Gets the current schema. |
Database |
getDatabase()
Gets the Database object that corresponds to this SQL statement. |
DatabaseDefinition |
getDatabaseDefinition()
Gets the current DatabaseDefinition object. |
org.eclipse.datatools.sqltools.core.DatabaseIdentifier |
getDatabaseIdentifier()
|
java.lang.String |
getDefaultSchema()
Gets the default schema for the current connection profile. |
QueryStatement |
getDefaultStatementFromSQL(java.lang.String sql,
java.lang.String statementName)
Gets a default SQL statement object based on the given SQL string. |
QueryStatement |
getDefaultStatementFromStatementType(int statementType,
java.lang.String statementName)
Gets a default SQL statement object based on the given statement type. |
org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain |
getEditingDomain()
Gets the editing domain for this statement. |
org.eclipse.core.resources.IFile |
getIFile()
Gets the file resource associated with this statement, if any. |
java.lang.String |
getImproperStatement()
Gets the current "improper" (failed to parse) statement, if there is one. |
java.lang.String |
getInitialSource()
Gets the initial source contained in the IFile |
boolean |
getIsStatementTypeSupported(int stmtType)
Gets whether or not the given SQL statement type is supported in the SQL Query Builder. |
IOmitSchemaInfo |
getOmitSchemaInfo()
Gets the OmitSchemaInfo object associated with this statement |
PostParseProcessorConfiguration |
getPostParseProcessorConfiguration()
Gets the configuration object to configure list of PostParseProcessor objects for the parser. |
java.util.List |
getPostParseProcessorList()
Gets the current list of PostParseProcessor objects. |
org.eclipse.core.resources.IProject |
getProject()
Gets the project associated with this statement. |
java.lang.String |
getSQLForExecution()
Gets the source of a statement for execution (schema qaulified). |
SQLQuerySourceFormat |
getSqlSourceFormat()
Gets the current SQLQuerySourceFormat object. |
QueryStatement |
getSQLStatement()
Gets the current query statement. |
java.lang.String |
getTemplateSQL(int type)
Gets template SQL for the given statement type. |
java.lang.String |
getTemplateSQLForCurrentStatement()
Gets the template SQL for the current statement. |
java.lang.String |
getUserName()
Gets the user name for the current connection profile |
VendorHelper |
getVendor()
Gets the current vendor information object for this database. |
boolean |
initializeFromString(java.lang.String strSQL,
java.lang.String statementName)
Initializes the SQL statement in the SQL Builder from the content of the given string. |
boolean |
initializeFromType(int statementType)
Initializes the SQL statement in the SQL Builder from the statement type. |
boolean |
isConnected()
|
boolean |
isDirty()
Gets whether or not this statement is "dirty" (that is, has unsaved changes). |
boolean |
isProper()
Gets whether or not there is currently an "improper" (failed to parse) statement. |
boolean |
isUnmatchedSource()
Gets whether or not the source and the SQL model matches |
boolean |
openFileResource(org.eclipse.core.resources.IFile fileResource)
Initializes the SQL statement in the SQL Builder from the content of the given file. |
boolean |
openStorageResource(org.eclipse.core.resources.IStorage storageResource)
Initializes the SQL statement in the SQL Builder from the contents of the given storage (non-file) resource object. |
QueryStatement |
parse(java.lang.String sqlStr)
Parses string SQL statement passed and returns the QueryStatement object. |
QueryStatement |
parse(java.lang.String sqlStr,
boolean createObjectTree)
Parses string SQL statement passed and returns the QueryStatement object.If createObjectTree is false then parser is called for only a syntax check and only the toplevel statement object is constructed If parse fails it returns null. |
QueryStatement |
parse(java.lang.String sqlStr,
java.util.List errorList)
Parses string SQL statement passed and returns the QueryStatement object. |
void |
replaceStatementContents(QueryStatement newStmt)
Replaces the content of the current statement with the content of the given statement without replacing the current statement object itself. |
void |
resetOmitSchemaToCurrentSchema()
Sets the omit schema field of the source format to the current schema |
VendorHelper |
resetVendor(Database db)
Resets the VendorHelper to associate with a new database. |
boolean |
save()
Saves the current statement in the file resource associated with this editor. |
void |
setConnectionInfo(ISQLEditorConnectionInfo info)
Sets the ISQLEditorConnectionInfo object associated with this statement to
the given object. |
void |
setCurrentSchema()
Sets the current schema |
void |
setDatabase(Database database)
Sets the Database object associated with this statement to the
given object. |
void |
setDirty(boolean dirty)
Marks this statement as "dirty" (that is, has unsaved changes). |
void |
setEditingDomain(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain anEditingDomain)
Sets the editing domain for this statement. |
void |
setEditorText(java.lang.String text)
Sets the text to be used to save to project |
void |
setIFile(org.eclipse.core.resources.IFile aFileResource)
Sets the file resource for this statement to the given object. |
void |
setImproperStatement(java.lang.String improperStmt)
Sets the given string as the "improper" (failed to parser) statement. |
void |
setInitialSource(java.lang.String strSQL)
|
void |
setOmitSchemaInfo(IOmitSchemaInfo info)
Sets the OmitSchemaInfo object associated with this statement to
the given object. |
void |
setProject(org.eclipse.core.resources.IProject proj)
Sets the project associated with this statement to the given project. |
void |
setSqlSourceFormat(SQLQuerySourceFormat sqlSourceFormat)
Sets the current SQLQuerySourceFormat object. |
void |
setSQLStatement(QueryStatement query)
Sets the current query statement. |
void |
setUnmatchedSource(boolean unmatched)
Sets whether or not the source is un-matched |
static void |
showParseErrors(java.lang.Exception exception)
Shows the current parse errors for this statement in an error dialog. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SQLDomainModel()
public SQLDomainModel(QueryStatement aStatement,
Database aDatabase)
aStatement - the query statement to useaDatabase - the database to use| Method Detail |
|---|
public org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain getEditingDomain()
public void setEditingDomain(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain anEditingDomain)
anEditingDomain - the editing domain to usepublic org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory()
public org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider createContentProvider()
public org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider createLabelProvider()
public QueryStatement getSQLStatement()
public void setSQLStatement(QueryStatement query)
query - the query statement to setpublic java.lang.String getTemplateSQL(int type)
type - the type of the statement as defined in StatementHelper
- Returns:
- the template SQL or null if the type is not defined
public java.lang.String getTemplateSQLForCurrentStatement()
public void replaceStatementContents(QueryStatement newStmt)
newStmt - the statement with the new contentpublic void clearStatementToTemplate()
public void setDirty(boolean dirty)
dirty - true when there are unsaved changes, otherwise falsepublic boolean isDirty()
public org.eclipse.core.resources.IFile getIFile()
public void setIFile(org.eclipse.core.resources.IFile aFileResource)
resource - the file resource to setpublic static void showParseErrors(java.lang.Exception exception)
exception - an exception indicating the errorpublic boolean openFileResource(org.eclipse.core.resources.IFile fileResource)
fileResource - the IFile containing the source SQL
java.lang.Exception - when error occurs reading the content of the file resource
public boolean openStorageResource(org.eclipse.core.resources.IStorage storageResource)
throws java.lang.Exception
storageResource - the IStorage resource containing the source SQL
java.lang.Exception - when an error occurs obtaining the content of the storage resource
public boolean initializeFromString(java.lang.String strSQL,
java.lang.String statementName)
strSQL - the source SQL string
public boolean initializeFromType(int statementType)
statement - type Statement type is used for creating new statements. The value must be
one of StatementHelper's
STATEMENT_TYPE constants.
public java.sql.Connection getConnection()
public Database getDatabase()
public void setDatabase(Database database)
Database object associated with this statement to the
given object.
database - the database object to setpublic DatabaseDefinition getDatabaseDefinition()
DatabaseDefinition object.
public org.eclipse.core.resources.IProject getProject()
public void setProject(org.eclipse.core.resources.IProject proj)
proj - the project to setpublic ISQLEditorConnectionInfo getConnectionInfo()
ISQLEditorConnectionInfo object associated with this statement.
public void setConnectionInfo(ISQLEditorConnectionInfo info)
ISQLEditorConnectionInfo object associated with this statement to
the given object.
info - the connection info object to setpublic void setOmitSchemaInfo(IOmitSchemaInfo info)
OmitSchemaInfo object associated with this statement to
the given object.
info - the OmitSchemaInfo object to setpublic IOmitSchemaInfo getOmitSchemaInfo()
OmitSchemaInfo object associated with this statement
public boolean save()
public void setEditorText(java.lang.String text)
text - the text to be used for saving to projectpublic VendorHelper getVendor()
public VendorHelper resetVendor(Database db)
db - the new database to create the VendorHelper with
public boolean isProper()
public void setImproperStatement(java.lang.String improperStmt)
improperStmt - the statement string to setpublic java.lang.String getImproperStatement()
public void setCurrentSchema()
the - current schema to setpublic java.lang.String getCurrentSchema()
public QueryStatement getDefaultStatementFromSQL(java.lang.String sql,
java.lang.String statementName)
sql - the SQL string to use to determine the statement typestatementName - a name for the new statement
public QueryStatement getDefaultStatementFromStatementType(int statementType,
java.lang.String statementName)
statementType - the statement typestatementName - a name for the new statement. The value should be
one of StatementHelper's
STATEMENT_TYPE constants.
public QueryStatement parse(java.lang.String sqlStr)
throws SQLParserException,
SQLParserInternalException
sqlStr - the String sql statement
SQLParserException - if the parse was not successful
SQLParserInternalException
public QueryStatement parse(java.lang.String sqlStr,
java.util.List errorList)
throws SQLParserException,
SQLParserInternalException
sqlStr - the String sql statementerrorList - the List to hold the errorList object from parseResult.
Can not be null.
SQLParserException - if the parse was not successful
SQLParserInternalException
public QueryStatement parse(java.lang.String sqlStr,
boolean createObjectTree)
throws SQLParserException,
SQLParserInternalException
sqlStr - the String sql statementcreateObjectTree -
SQLParserException - if the parse was not successful
SQLParserInternalExceptionpublic SQLQuerySourceFormat getSqlSourceFormat()
public void setSqlSourceFormat(SQLQuerySourceFormat sqlSourceFormat)
sqlSourceFormat - the SQLQuerySourceFormat object to usepublic java.lang.String getSQLForExecution()
public void resetOmitSchemaToCurrentSchema()
public java.util.List getPostParseProcessorList()
public java.lang.String getInitialSource()
public boolean isUnmatchedSource()
public void setUnmatchedSource(boolean unmatched)
whether - or not the source and the sql model is unmatchedpublic java.lang.String getDefaultSchema()
public java.lang.String getUserName()
public PostParseProcessorConfiguration getPostParseProcessorConfiguration()
public org.eclipse.datatools.sqltools.core.DatabaseIdentifier getDatabaseIdentifier()
public boolean isConnected()
public void setInitialSource(java.lang.String strSQL)
public boolean getIsStatementTypeSupported(int stmtType)
StatementHelper class.
stmtType - the statement type to check
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||