public Database getDatabase() { if (_database == null && _profileName != null ) { _database = ProfileUtil.getDatabase(new DatabaseIdentifier( _profileName, _databaseName)); } return _database; }
public static DatabaseIdentifier readDatabaseIdentifier(ILaunchConfiguration configuration) throws CoreException { String profileName = configuration.getAttribute(ROUTINE_LAUNCH_PROFILENAME, ""); String dbName = configuration.getAttribute(ROUTINE_LAUNCH_DATABASENAME, ""); if ("".equals(profileName)) { throw new CoreException(new Status(IStatus.ERROR, RoutineEditorActivator.PLUGIN_ID, 0, Messages.LaunchHelper_invalid_launch_configuration, null)); } else { return new DatabaseIdentifier(profileName, dbName); } }
Connection sharedConn = ProfileUtil.getReusableConnection(new DatabaseIdentifier(profileName, dbName));
public static String getDefaultSchemaName(ISQLEditorConnectionInfo connInfo) { DatabaseIdentifier dbid = new DatabaseIdentifier(connInfo.getConnectionProfileName()); String defaultSchemaName = ProfileUtil.getProfileUserName(dbid, false); return defaultSchemaName; }
public static ProcIdentifier decode(String encoded) throws ParseException { Map map = decodeMap(encoded); String profile = (String)map.remove(PROP_PROFILE); String dbname = (String) map.remove(PROP_DBNAME); String typestr = (String) map.remove(PROP_TYPE); if (profile == null || dbname == null || typestr == null) { throw new ParseException(Messages.ProcIdentifierImpl_invalid_identifier_string, -1); } try { int type = Integer.parseInt(typestr); SQLDevToolsConfiguration config = SQLToolsFacade.getConfigurationByProfileName(profile); if (config != null) { DBHelper h = config.getDBHelper(); return h.getProcIdentifier(new DatabaseIdentifier(profile, dbname), type, map); } return new ProcIdentifierImpl(type, new DatabaseIdentifier(profile, dbname), map); } catch(NumberFormatException ex) { throw new ParseException(Messages.ProcIdentifierImpl_invalid_identifier_string, -1); } }
return h.getProcIdentifier(new DatabaseIdentifier(profile, dbname), (String)map.get(PROP_NAME), type, (String)map.get(PROP_TABLENAME), (String)map.get(PROP_OWNER), tableOwnerName); return new ProcIdentifierImpl(type, new DatabaseIdentifier(profile, dbname), map);
/** * 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; }
public DatabaseIdentifier getDatabaseIdentifier() { if (_sqlEditor != null) { String profileName = _sqlEditor.getConnectionInfo().getConnectionProfileName(); String dbName = _sqlEditor.getConnectionInfo().getDatabaseName(); return new DatabaseIdentifier(profileName, dbName); } return null; }
public DatabaseIdentifier getDatabaseIdentifier() { if (_sqlEditor != null) { String profileName = _sqlEditor.getConnectionInfo().getConnectionProfileName(); String dbName = _sqlEditor.getConnectionInfo().getDatabaseName(); return new DatabaseIdentifier(profileName, dbName); } return null; }
/** * Returns the DatabaseIdentifier associated with the connection info. * @return might be null */ public DatabaseIdentifier getDatabaseIdentifier() { ISQLEditorConnectionInfo connInfo = getConnectionInfo(); if (connInfo != null && connInfo.getConnectionProfileName() != null) { return new DatabaseIdentifier(connInfo.getConnectionProfileName(), connInfo.getDatabaseName()); } return null; }
/** * Retrieves the sharable connection from IControlConnection, which in turn delegates to the connectivity layer. */ public Connection getSharedConnection() { if (_sharedConn == null && getConnectionProfile() != null && getConnectionProfile().isConnected()) { //we need to connect try { _sharedConn = ProfileUtil.getReusableConnection(new DatabaseIdentifier(_profileName, _databaseName)); } catch (Exception e) { //SQLEditorPlugin.getDefault().log(e); } } return _sharedConn; }
/** * Returns DatabaseIdentifier for databases that doesn't support catalog * @deprecated use #getDatabaseIdentifier(database, String) instead * @param database * @return */ public static DatabaseIdentifier getDatabaseIdentifier(Database database) { ConnectionInfo connInfo = DatabaseConnectionRegistry.getInstance() .getConnectionForDatabase(database); if (connInfo instanceof ConnectionInfoImpl) { IConnectionProfile profile = ((ConnectionInfoImpl) connInfo) .getConnectionProfile(); return new DatabaseIdentifier(profile.getName(), database.getName()); } return null; }
public void notifyChanged(ICatalogObject dmElement, int eventType) { //TODO When we can handle other sql objects than the procedrual objects, remove this evaluation if (!(dmElement instanceof Routine || dmElement instanceof Trigger || dmElement instanceof Event)) { return; } Database catalogDatabase = dmElement.getCatalogDatabase(); ConnectionInfo connInfo = DatabaseConnectionRegistry.getInstance() .getConnectionForDatabase(catalogDatabase); if (connInfo instanceof ConnectionInfoImpl) { IConnectionProfile connectionProfile = ((ConnectionInfoImpl) connInfo) .getConnectionProfile(); DatabaseIdentifier dbid = new DatabaseIdentifier(connectionProfile.getName(), catalogDatabase.getName()); ServerIdentifier serverId = ProfileUtil.getServerIdentifier(dbid); HashSet cons = getControlConnections(serverId); if (cons != null && cons.size() > 0) { ProcIdentifier procId = SQLDevToolsUtil.getProcIdentifier((SQLObject)dmElement); for (Iterator it = cons.iterator(); it.hasNext();) { IControlConnection con = (IControlConnection) it.next(); if (con != null) { con.refresh(procId); } } } } } }
_databaseIdentifier = new DatabaseIdentifier(profileName, dbName);
/** * Returns DatabaseIdentifier for the database * <p> * Caution: the database object must be the one created by DSE for this method to find the connection info * </p> * @param database * @param catalogName if null, database.getName() will be used instead * @return */ public static DatabaseIdentifier getDatabaseIdentifier(Database database, String catalogName) { ConnectionInfo connInfo = DatabaseConnectionRegistry.getInstance() .getConnectionForDatabase(database); if (connInfo instanceof ConnectionInfoImpl) { String dbName = catalogName; if (dbName == null) { dbName = database.getName(); } IConnectionProfile profile = ((ConnectionInfoImpl) connInfo) .getConnectionProfile(); return new DatabaseIdentifier(profile.getName(), dbName); } return null; }
private void registerSkippedConnection(ConnectEvent event) { final IConnectionProfile profile = event.getConnectionProfile(); String dbName = ProfileUtil.getProfileDatabaseName(profile.getName()); DatabaseIdentifier databaseIdentifier = new DatabaseIdentifier(profile.getName(), dbName); //register skiped connection int connectionId = getConnectionId(event, databaseIdentifier); if (connectionId > -1) { ServerIdentifier si = ProfileUtil.getServerIdentifier(databaseIdentifier); EditorCorePlugin.getControlConnectionManager().registerSkippedConnection(si, connectionId); } }
DatabaseIdentifier databaseIdentifier = new DatabaseIdentifier(profile.getName(), dbName);
public void run() { if (_sqlObject != null && _connectionProfile != null) { ProcIdentifier proc = SQLDevToolsUtil.getProcIdentifier( new DatabaseIdentifier(_connectionProfile.getName(), getDatabaseName()), _sqlObject); IWorkbenchPage page = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); try { page.openEditor(new ProcEditorInput(proc), RoutineEditor.EDITOR_ID); } catch (Exception e) { RoutineEditorActivator.getDefault().log(e); } } }
public void run() { if (_sqlObject != null && _connectionProfile != null) { boolean ok = MessageDialog.openConfirm(null, Messages.DropRoutineAction_label, NLS.bind(Messages.DropRoutineAction_message, _sqlObject.getName())); if (!ok) { return; } DatabaseIdentifier databaseIdentifier = new DatabaseIdentifier(_connectionProfile.getName(), getDatabaseName()); ProcIdentifier proc = SQLDevToolsUtil.getProcIdentifier( databaseIdentifier, _sqlObject); try { IControlConnection controlConnection = EditorCorePlugin.getControlConnectionManager().getOrCreateControlConnection(databaseIdentifier); IItemWithCode item = (IItemWithCode)controlConnection.getDBItem(proc); item.drop(); } catch (Exception e) { RoutineEditorActivator.getDefault().log(e); } //fix CR:379301 RoutineUtil.closeEditor(proc); DSEUtil.refreshParent(_sqlObject); deleteLaunchConfigration(proc); } }
new DatabaseIdentifier(_connectionProfile.getName(), getDatabaseName()), _sqlObject); IWorkbenchPage page = PlatformUI.getWorkbench()