@Association public Collection<PostgreSchema> getSchemas(DBRProgressMonitor monitor) throws DBException { if (this != dataSource.getDefaultInstance()) { throw new DBException("Can't access non-default database"); } // Get all schemas return schemaCache.getAllObjects(monitor, this); }
public PostgreDataType getDataType(String typeName) { if (typeName.endsWith("[]")) { // In some cases ResultSetMetadata returns it as [] typeName = "_" + typeName.substring(0, typeName.length() - 2); } String alias = PostgreConstants.DATA_TYPE_ALIASES.get(typeName); if (alias != null) { typeName = alias; } { // First check system catalog final PostgreSchema schema = getCatalogSchema(); if (schema != null) { final PostgreDataType dataType = schema.dataTypeCache.getCachedObject(typeName); if (dataType != null) { return dataType; } } } // Check schemas in search path final List<String> searchPath = dataSource.getSearchPath(); for (String schemaName : searchPath) { final PostgreSchema schema = schemaCache.getCachedObject(schemaName); if (schema != null) { final PostgreDataType dataType = schema.dataTypeCache.getCachedObject(typeName); if (dataType != null) { return dataType; } } } // Check the rest for (PostgreSchema schema : schemaCache.getCachedObjects()) { if (searchPath.contains(schema.getName())) { continue; } final PostgreDataType dataType = schema.dataTypeCache.getCachedObject(typeName); if (dataType != null) { return dataType; } } log.debug("Data type '" + typeName + "' not found in database '" + getName() + "'"); return null; }
public PostgreSchema getSchema(DBRProgressMonitor monitor, long oid) throws DBException { if (this != dataSource.getDefaultInstance()) { throw new DBException("Can't access non-default database"); } for (PostgreSchema schema : schemaCache.getAllObjects(monitor, this)) { if (schema.getObjectId() == oid) { return schema; } } return null; }
@Override public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException { authIdCache.clearCache(); accessMethodCache.clearCache(); languageCache.clearCache(); encodingCache.clearCache(); tablespaceCache.clearCache(); schemaCache.clearCache(); cacheDataTypes(monitor); return this; }
@Nullable @Override public PostgreSchema getDefaultObject() { return schemaCache.getCachedObject(dataSource.getActiveSchemaName()); }
public PostgreSchema getSchema(DBRProgressMonitor monitor, String name) throws DBException { if (this != dataSource.getDefaultInstance()) { throw new DBException("Can't access non-default database"); } return schemaCache.getObject(monitor, this, name); }
@Nullable PostgreSchema getCatalogSchema() { return schemaCache.getCachedObject(PostgreConstants.CATALOG_SCHEMA_NAME); }