public String getDatabaseName() { return _database.getDBname(); }
public String[] getSysDatabaseNames(DatabaseIdentifier identifier) { if (identifier != null) { return new String[] { identifier.getDBname() } ; } return null; }
public String getDatabaseName() { return _databaseIdentifier.getDBname(); }
/** * Constructs a runnable to execute a group of SQL statements. * * @param request the plan request * @param databaseIdentifier the database identifier * @param postRun the runnable which will be invoked at last */ public GroupPlanSupportRunnable(PlanRequest request, DatabaseIdentifier databaseIdentifier, Runnable postRun) { super(request, databaseIdentifier.getProfileName(), databaseIdentifier.getDBname()); this._postRun = postRun; }
public String encode() { // TODO: currently this method is hard coded. Need to be more extendable. StringBuffer buffer = new StringBuffer(); Map temp = new HashMap(); temp.put(PROP_PROFILE, _database.getProfileName()); temp.put(PROP_DBNAME, _database.getDBname()); temp.put(PROP_TYPE, String.valueOf(_type)); encodeMap(buffer, temp); encodeMap(buffer, propertyMap); return buffer.toString(); }
/** * Closes the connection object. Subclasses may need to do further log or cleanup jobs. * @param connection * @param connId * @param databaseIdentifier * @throws SQLException */ public void closeConnection(Connection connection, int connId, DatabaseIdentifier databaseIdentifier) throws SQLException { ProfileUtil.closeConnection(databaseIdentifier.getProfileName(), databaseIdentifier.getDBname(), connection); }
/** * Returns a connection for caller to use. By default there's no connection pool associated with a connection * profile and this method just ignore the usePool parameter and delegates to {@link #createConnection(String, String)}. * Vendors who has the requirement to use connection pool may override this method. * @param databaseIdentifier the database identifier * @param usePool whether to retrieve the connection from connection pool. * @return a <code>Connection</code> instance * @throws SQLException if database error occurs */ public Connection createConnection(DatabaseIdentifier databaseIdentifier, boolean usePool) throws SQLException, NoSuchProfileException { return createConnection(databaseIdentifier.getProfileName(), databaseIdentifier.getDBname()); } /**
public OperationCommand getOperationCommand() { if (_operationCommand == null) { String parentDspName = _parentDisplayName == null ? Messages.GroupSQLResultRunnable_group_exec : _parentDisplayName; _operationCommand = new OperationCommand(getActionType(), parentDspName, getConsumerName(), //$NON-NLS-2$ _databaseIdentifier.getProfileName(), _databaseIdentifier.getDBname()); } return _operationCommand; } }
ArrayList procs = new ArrayList(); if (db != null) { EList schemas = ModelUtil.getSchemas(db, _databaseIdentifier.getDBname()); Iterator i = schemas.iterator(); for (; i.hasNext();) {
protected OperationCommand createDefaultOperationCommand() { return new OperationCommand(getActionType(), _sql, getConsumerName(), _databaseIdentifier.getProfileName(), _databaseIdentifier.getDBname()); }
protected OperationCommand createDefaultOperationCommand() { return new OperationCommand(getActionType(), _detailSql, getConsumerName(), _databaseIdentifier.getProfileName(), _databaseIdentifier.getDBname()); }
protected void handleEnd(Connection connection, Statement stmt) { try { if (stmt != null) { stmt.close(); } //Hui Cao: since terminating is a separate thread, even though connection is not closed during the evaluation, it will be later. //so as long as user gestures to terminate, we won't do the cleaning job again here. if (connection != null && !isTerminated() && !isCanceled()) { if (_closeCon) { ProfileUtil.closeConnection(this._databaseIdentifier.getProfileName(), this._databaseIdentifier.getDBname(), connection); } } } catch (Exception e) { // ignore } if (_closeCon) { if (_tracker != null) { _tracker.connectionClosed(); } } }
/** * Creates a launch configuration that can be used to launch a ILaunch that debug an external client connection. * * @param sd * @param connid * @return */ public static ILaunchConfigurationWorkingCopy createExternalClientConfiguration(DatabaseIdentifier databaseIdentifier, String connid) throws CoreException { ILaunchConfigurationWorkingCopy wc = null; ILaunchConfigurationType configType = getLaunchConfigType(); wc = configType.newInstance(null, "externalCon" + connid); wc.setAttribute(ROUTINE_LAUNCH_PROFILENAME, databaseIdentifier.getProfileName()); wc.setAttribute(ROUTINE_LAUNCH_DATABASENAME, databaseIdentifier.getDBname()); wc.setAttribute(ROUTINE_LAUNCH_EXTERNALID, connid); return wc; }
String db = _database.getDBname(); db = SQLDevToolsUtil.quoteWhenNecessary(db, new DatabaseIdentifier(_database.getProfileName(), db)); if (quoted_id)
public Connection createConnection(String[] connId) throws SQLException, CoreException, NoSuchProfileException { // using connection pool for debugging may produce unexpected results SQLDevToolsConfiguration f = SQLToolsFacade .getConfigurationByProfileName(getDatabaseIdentifier() .getProfileName()); ConnectionService conService = f.getConnectionService(); Connection con = conService.createConnection(getDatabaseIdentifier() .getProfileName(), getDatabaseIdentifier().getDBname()); if (connId != null && connId.length == 1) { connId[0] = "0"; } return con; }
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); }
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); }
public static void saveSPUDF(ILaunchConfigurationWorkingCopy configuration, ProcIdentifier proc, List parameters, 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); saveParameterList(configuration, parameters); setConnectionLevelOptions(configuration); }
/** * 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); }