/** * Return a specific GenericSQLContextType object which identifies the context type of templates used in SQL editor. * * @param dbType * @return */ public static GenericSQLContextType getSQLContextType(String dbType) { SQLService service = getSQLService(null, dbType); if (service != null) { return service.getSQLContextType(); } return null; }
/** * Return a SQLParser which is used to parse database dialect * * @param profileName * @param dbType * @return */ public static SQLParser getSQLParser(String profileName, String dbType) { SQLService s = getSQLService(new DatabaseIdentifier(profileName), dbType); if (s != null) { return s.getSQLParser(); } return null; }
/** * * Return an ISQLSyntax object which can be used to highlight sql statements in SQL editor. * * @param dbType * @return */ public static ISQLSyntax getSQLSyntax(String dbType) { SQLService s = getSQLService(null, dbType); if (s != null) { return s.getSQLSyntax(); } return null; }
SQLParser parser = getSQLParser(); if (parser == null) return splitSQLByTerminatorLine(sql, parser.getStatementTerminators());
_config = SQLToolsFacade .getConfigurationByVendorIdentifier(_databaseVendorDefinitionId); SQLParser _parser = _config.getSQLService().getSQLParser(); .getParserProposalAdvisor(); return getProposals(result, parserAdvisor);
/** * Checks the validity of the unquoted identifier and unquotes content if necessary. * * @param id original identifier * @return */ public static String unquoteWhenNecessary(String id, DatabaseIdentifier databaseIdentifier) { if (id == null || id.equals("") || databaseIdentifier == null) { return id; } String newId = SQLUtil.unquote(id); SQLDevToolsConfiguration conf = SQLToolsFacade.getConfigurationByProfileName(databaseIdentifier.getProfileName()); IIdentifierValidator validator = conf.getSQLService().getIdentifierValidator(); if (validator != null) { ValidatorMessage msg = validator.isValid(newId, IIdentifierValidator.IDENTIFIER_TYPE_UNKNOW, databaseIdentifier); if (msg == null || !ValidatorMessage.hasError(msg, ValidatorMessage.ERROR)) { return newId; } } return id; }
if (helper != null) groups = helper.splitSQL(_request.getSql());
/** * Returns the SQL service associated with this database definition */ public SQLService getSQLService() { return new SQLService(); }
IIdentifierValidator validator = conf.getSQLService().getIdentifierValidator(); if (validator != null)
if (sqlService != null) groups = sqlService.splitSQL(sql);
private void createPortabilityCheckCombo(Composite parent) { Collection dbnames = SQLToolsFacade.getSupportedDBDefinitionNames(); String[] names = (String[])dbnames.toArray(new String[dbnames.size()]); String[] nameValues = new String[names.length + 1]; nameValues[0] = PreferenceMessages.GeneralPreferencePage_portable_target; // FOR CR:403675-1 remove the portability checks option that has no parser in preference page int j = 0; for (int i = 0; i < names.length; i++) { SQLDevToolsConfiguration config = SQLToolsFacade.getConfigurationByDBDefName(names[i]); SQLParser pp = config.getSQLService().getSQLParser(); //For CR:list all supported database definitions if (pp != null && pp.isComplete()) { nameValues[j + 1] = names[i]; j++; } } String[] portNameValues = new String[j + 1]; for (int i = 0; i < j + 1; i++) { portNameValues[i] = nameValues[i]; } _portabilityCheckLabel = new Label(parent, SWT.NONE); _portabilityCheckLabel.setText(PreferenceMessages.GeneralPreferencePage_portable_check); _portabilityCheckCombo = new Combo(parent, SWT.READ_ONLY); _portabilityCheckCombo.setItems(portNameValues); }
/** * Generally this method is not encouraged to overide * * @param value * @param databaseIdentifier * @return */ protected ValidatorMessage checkReservedwords(String value, DatabaseIdentifier databaseIdentifier) { SQLDevToolsConfiguration conf = SQLToolsFacade.getConfiguration(null, databaseIdentifier); String[] reserved = conf.getSQLService().getSQLSyntax().getReservedwords(); String[] types = conf.getSQLService().getSQLSyntax().getTypes(); for (int i = 0; i < reserved.length; i++) { if (value.equalsIgnoreCase(reserved[i])) { return new ValidatorMessage(ValidatorMessage.ERROR, Messages.IdentifierValidator_invalid_reservedword); } } for (int i = 0; i < types.length; i++) { if (value.equalsIgnoreCase(types[i])) { return new ValidatorMessage(ValidatorMessage.ERROR, Messages.IdentifierValidator_invalid_reservedword); } } return null; }
/** * Return all the GenericSQLContextType objects which identify the context type of templates used in SQL editor. * * @return */ public static Collection getSQLContextTypes() { Collection c = getRegistry().getConfigurations(); int size = c.size(); SQLDevToolsConfiguration[] fs = (SQLDevToolsConfiguration[]) c.toArray(new SQLDevToolsConfiguration[size]); Collection ctxTypes = new ArrayList(); for (int i = 0; i < size; i++) { ctxTypes.add(fs[i].getSQLService().getSQLContextType()); } return ctxTypes; }
public ProceduralObjectSourceUpdater(SQLObject _object, DatabaseDefinition dbDefinition) { this._routine = _object; _dbDefinition = dbDefinition; _dbDefinitionId = new DatabaseVendorDefinitionId(_dbDefinition.getProduct(), _dbDefinition.getVersion()); SQLDevToolsConfiguration f = SQLToolsFacade.getConfigurationByVendorIdentifier(_dbDefinitionId); _parser = f.getSQLService().getSQLParser(); _parserParameters = new ParserParameters(false); _parserParameters.setProperty(ParserParameters.PARAM_HEADER_MODE, Boolean.TRUE); }
/** * Creates, configures, and returns the ContentFormatter to use. * * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentFormatter(ISourceViewer) */ public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) { ContentFormatter formatter = new ContentFormatter(); formatter.setDocumentPartitioning( SQLPartitionScanner.SQL_PARTITIONING ); SQLDevToolsConfiguration factory = SQLToolsFacade.getConfigurationByVendorIdentifier(getSQLEditor().getConnectionInfo().getDatabaseVendorDefinitionId()); IFormattingStrategy formattingStrategy = new SQLWordStrategy(factory.getSQLService().getSQLSyntax()); formatter.setFormattingStrategy( formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE ); return formatter; }
/** * Returns this plug-in's context type registry. * * @return the context type registry for this plug-in instance */ public ContextTypeRegistry getTemplateContextTypeRegistry() { if (_registry == null) { // create an configure the contexts available in the template editor _registry = new ContributionContextTypeRegistry(); _registry.addContextType(GenericSQLContextType.SQL_CONTEXT_TYPE); Collection c = SQLToolsFacade.getConfigurations(); Collection ctxTypes = new ArrayList(); for (Iterator iter = c.iterator(); iter.hasNext();) { SQLDevToolsConfiguration config = (SQLDevToolsConfiguration) iter.next(); ctxTypes.add(config.getSQLService().getSQLContextType()); } for (Iterator i = ctxTypes.iterator(); i.hasNext();) { //getId() will return null before calling addContextType _registry.addContextType(((GenericSQLContextType) i.next()).getSQLContextId()); } } return _registry; }
SQLParser p = f.getSQLService().getSQLParser(); ISourceViewer viewer = _editor.getSV(); if (viewer == null) pp = pf.getSQLService().getSQLParser(); if (pp != null && !(pp.getClass().equals(p.getClass())))
if (_fWord.startsWith(globalVariablePrefix)) //$NON-NLS-1$ ISQLSyntax syntax = _config.getSQLService().getSQLSyntax(); resultCollector.setVariableList(new ArrayList(Arrays .asList(createVarProposals(syntax
.getDatabaseVendorDefinitionId()); if (config != null) { contextType = config.getSQLService().getSQLContextType(); } else { contextType = SQLEditorPlugin.getDefault()
SQLParser p = conf.getSQLService().getSQLParser(); if (p == null || !p.isComplete())