/** * */ public ProcEditorInput(ProcIdentifier procid) { super(procid.getDisplayString(), ""); this._procIdentifier = procid; String code = ""; try { IControlConnection controlConnection = EditorCorePlugin.getControlConnectionManager().getOrCreateControlConnection(procid.getDatabaseIdentifier()); code = controlConnection.getProcSource(procid); } catch(Exception e) { RoutineEditorActivator.getDefault().log(e); } setStorage(new SQLEditorStorage(_procIdentifier.getDisplayString(), code)); setConnectionInfo(new SQLEditorConnectionInfo(ProfileUtil.getDatabaseVendorDefinitionId(procid.getProfileName()), procid.getProfileName(), procid.getDatabaseName(), procid.getOwnerName())); }
int type = proc == null ? ProcIdentifier.TYPE_SP : proc.getType(); SQLDevToolsConfiguration config = SQLToolsFacade.getConfigurationByProfileName(proc.getDatabaseIdentifier().getProfileName()); buffer.append(config.getExecutionService().getCallableStatementPrefix(proc.getType())); String procName = null; buffer.append(proc.getCallableString(quoted_id)); procName = proc.getProcName();
if (_currentProc != null && _currentProc.getType() == ProcIdentifier.TYPE_TRIGGER) String ownerName = _currentProc.getOwnerName(); tableName = _currentProc.getTableName(); if (ownerName != null && ownerName.length() > 0)
protected ProcIdentifier findSPUDF(String owner, String name) { for (Iterator iter = _procInfoCache.keySet().iterator(); iter.hasNext();) { ProcIdentifier proc = (ProcIdentifier) iter.next(); if (proc.getType() == ProcIdentifier.TYPE_SP || proc.getType() == ProcIdentifier.TYPE_UDF) { if (proc.getOwnerName().equals(owner) && proc.getProcName().equals(name)) return proc; } } return null; }
/** * Tells whether the procedural object is "ADHOC", meaning we don't need to * show stack frame and open editor for it. Usually this is the statement * used to trigger the to-be-debugged routine. * * @param procid * the routine identifier * @return true if it is "ADHOC" */ public boolean isAdHocProc(ProcIdentifier procid){ if ("ADHOC".equals(procid.getProcName()) && "".equals(procid.getOwnerName())) { return true; } if ("".equals(procid.getProcName())) { return true; } return false; }
String quotedName = SQLDevToolsUtil.quoteWhenNecessary(proc.getProcName(), proc.getDatabaseIdentifier(), "\"", IIdentifierValidator.IDENTIFIER_TYPE_EVENT); sb.append(quotedName); sb.append(proc.getProcName()); String quotedName = SQLDevToolsUtil.quoteWhenNecessary(name, proc.getDatabaseIdentifier(), "\"", IIdentifierValidator.IDENTIFIER_TYPE_PARAMETER); sb.append(quotedName).append("=").append(SQLUtil.quote(value, '\'')).append(",");
public String getCode() throws SQLException { String code = ""; DDLGenerator ddlg = ProfileUtil.getDatabaseDefinition( _proc.getProfileName()).getDDLGenerator(); if (ddlg != null) { SQLObject[] sqlElements = new SQLObject[] { _routine }; EngineeringOption[] opts = ddlg.getOptions(sqlElements); boolean quotedId = SQLDevToolsUtil.getQuotedIdentifier(_proc.getDatabaseIdentifier()); EngineeringOptionID.setOptionValueByID(EngineeringOptionID.GENERATE_QUOTED_IDENTIFIER,opts,quotedId); String[] ddl = ddlg.generateDDL(sqlElements, null); if (ddl != null && ddl.length > 0) { code = ddl[0]; } } return code; }
public static void saveEvent(ILaunchConfigurationWorkingCopy configuration, ProcIdentifier proc, Map eventparams, String sql) { configuration.setAttribute(ROUTINE_LAUNCH_PROFILENAME, proc == null ? "" : proc.getProfileName()); configuration.setAttribute(ROUTINE_LAUNCH_DATABASENAME, proc == null ? "" : proc.getDatabaseIdentifier().getDBname()); configuration.setAttribute(ROUTINE_LAUNCH_PROCID, proc == null ? "" : proc.encode()); configuration.setAttribute(ROUTINE_LAUNCH_TYPE, 0); configuration.setAttribute(ROUTINE_LAUNCH_SQL, sql); saveEventParameter(configuration, eventparams); }
/** * Return whether objstr and proc represent the same database object. * If db name or owner name is omitted int objstr, defDB or defOwner will be used. * @param objstr * @param proc * @return */ public static boolean equals(int parserType, int procType, String objstr, String defDB, String defOwner, ProcIdentifier proc, boolean caseSensitive) { if (!isSameType(parserType, procType)) { return false; } String[] tokens = SQLUtil.parseDatabaseObject(objstr); int count = tokens.length; if (count == 0 || count > 3) { return false; } //user can't use owner name for event definition, so don't check it if (parserType == SQLParserConstants.TYPE_SQL_ALTER_EVENT || parserType == SQLParserConstants.TYPE_SQL_CREATE_EVENT) { defOwner = proc.getOwnerName(); } String db = count == 3? tokens[2]:defDB; String owner = count >= 2? tokens[1]:proc.getOwnerName(); String objname = count >= 1? tokens[0]:objstr; return SQLUtil.equalsIgnoreQuote(proc.getDatabaseIdentifier().getDBname(), db, caseSensitive) && SQLUtil.equalsIgnoreQuote(proc.getOwnerName(), owner, caseSensitive) && SQLUtil.equalsIgnoreQuote(proc.getProcName(), objname, caseSensitive); }
String owner = proc.getOwnerName(); if (proc.getType() == ProcIdentifier.TYPE_TRIGGER && proc.getTableOwnerName() != null) owner = proc.getTableOwnerName(); if (proc.getType() == ProcIdentifier.TYPE_TRIGGER) if (ignoreTableName || equals(table.getName(), proc.getTableName(), caseSensitive)) if ((ignoreTableName || equals(table.getName(), proc.getTableName(), caseSensitive)) && equals(trigger.getName(), proc.getProcName(), caseSensitive)) else if (proc.getType() == ProcIdentifier.TYPE_UDF || proc.getType() == ProcIdentifier.TYPE_SP) if (equals(routine.getName(), proc.getProcName(), caseSensitive))
Database db = ProfileUtil.getDatabase(proc.getDatabaseIdentifier()); if (db != null) if (proc.getType() == ProcIdentifier.TYPE_EVENT) if (equals(routine.getName(), proc.getProcName(), caseSensitive)) EList schemas = getSchemas(db, proc.getDatabaseName()); object = findProceduralObjectFromSchema(schemas, proc, caseSensitive, refresh, ignoreTableName);
/** * @param configuration * @param proc */ public static boolean readQuotedIDConfig(ILaunchConfiguration configuration, ProcIdentifier proc) { boolean quoted_id = false; SQLDevToolsConfiguration factory = SQLToolsFacade.getConfiguration(null, proc.getDatabaseIdentifier()); IDatabaseSetting config = factory.getDatabaseSetting(proc.getDatabaseIdentifier()); if (config != null) { try { Boolean value = (Boolean)config.getLaunchConfigProperty(configuration, IDatabaseSetting.C_QUOTED_IDENTIFIER); quoted_id = value.booleanValue(); } catch (NotSupportedSettingException e) { RoutineEditorActivator.getDefault().log(NLS.bind(Messages.NotSupportedSettingException_cause, (new Object[]{IDatabaseSetting.C_QUOTED_IDENTIFIER}))); } } return quoted_id; }
String name1 = proc.getProcName(); String name2 = lConfigProc.getProcName(); String ownerName1 = proc.getOwnerName(); String ownerName2 = lConfigProc.getOwnerName(); int type1 = proc.getType(); int type2 = lConfigProc.getType(); String dbName1 = proc.getDatabaseName(); String dbName2 = lConfigProc.getDatabaseName();
return; if (_currentProc.getType()==getCurrentTypeSelection() && _configuration != null)
int type = proc == null ? ProcIdentifier.TYPE_SP : proc.getType(); SQLDevToolsConfiguration config = SQLToolsFacade.getConfigurationByProfileName(proc.getDatabaseIdentifier().getProfileName()); buffer.append(config.getExecutionService().getDirectInvocationPrefix(proc.getType())); buffer.append(proc.getCallableString(quoted_id)); buffer.append(" "); if (type == ProcIdentifier.TYPE_UDF)
if (s.equals(_currentProc.getProfileName())&&_currentProc.getType()==ProcIdentifier.TYPE_SP) _txtObjname.setText(_currentProc.getLongDisplayString()); if (s.equals(_currentProc.getProfileName())&&_currentProc.getType()==ProcIdentifier.TYPE_UDF) _txtObjname.setText(_currentProc.getLongDisplayString()); if (_currentProc!=null &&_currentProc.getType()==ProcIdentifier.TYPE_EVENT) if (s.equals(_currentProc.getProfileName())) _txtObjname.setText(_currentProc.getLongDisplayString()); _txtPreview.setEnabled(true); _pbConfigParameter.setEnabled(true); if (_currentProc!=null &&_currentProc.getType()==ProcIdentifier.TYPE_TRIGGER) if (s.equals(_currentProc.getProfileName())) _txtObjname.setText(_currentProc.getLongDisplayString());
public Object getAdapter(Class adapter) { if (adapter == ProcIdentifier.class) { return this._procIdentifier; } else if (adapter == IConnectionProfile.class) { try { return ProfileUtil.getProfile(_procIdentifier.getProfileName()); } catch (NoSuchProfileException e) { return null; } } return null; }
public static void saveTrigger(ILaunchConfigurationWorkingCopy configuration, ProcIdentifier proc, String sql) { configuration.setAttribute(ROUTINE_LAUNCH_PROFILENAME, proc == null ? "" : proc.getDatabaseIdentifier().getProfileName()); configuration.setAttribute(ROUTINE_LAUNCH_DATABASENAME, proc == null ? "" : proc.getDatabaseIdentifier().getDBname()); configuration.setAttribute(ROUTINE_LAUNCH_PROCID, proc == null ? "" : proc.encode()); configuration.setAttribute(ROUTINE_LAUNCH_TYPE, 0); configuration.setAttribute(ROUTINE_LAUNCH_SQL, sql); }
.getLaunchManager() .generateUniqueLaunchConfigurationNameFrom( proc.getProcName())); } catch (CoreException exception) { if (proc.getType() == ProcIdentifier.TYPE_EVENT || proc.getType() == ProcIdentifier.TYPE_SP || proc.getType() == ProcIdentifier.TYPE_UDF) {
this._txtObjname.setText(_currentProc.getLongDisplayString()); switch(_currentProc.getType()) if (_currentProc != null && _currentProc.getType() == getCurrentTypeSelection() && configuration != null)