<p>info.</p>

@param dbName   a {@link java.lang.String} object.
@param revision a {@link java.lang.String} object.
@return a {@link javax.ws.rs.core.Response} object.
484339
@GET
    @Path("{dbName}/{revision}")
    public Response info(@PathParam("dbName") String dbName, @PathParam("revision") String revision) {
        Flyway flyway = locator.getService(Flyway.class, dbName);
        if (flyway == null)
            throw new NotFoundException();
        Object entity = null;
        switch (revision) {
            case "current":
                entity = flyway.info().current();
                break;
            case "pending":
                entity = flyway.info().pending();
                break;
            case "applied":
                entity = flyway.info().applied();
                break;
            case "first": {
                MigrationInfo[] migrationInfos = flyway.info().all();
                if (migrationInfos.length == 0)
                    throw new NotFoundException();
                entity = migrationInfos[0];
                break;
            }
            case "resolved":
                entity = resolved(flyway.info().all());
                break;
            case "failed":
                entity = failed(flyway.info().all());
                break;
            case "future":
                entity = future(flyway.info().all());
                break;
            case "latest": {
                MigrationInfo[] migrationInfos = flyway.info().all();
                if (migrationInfos.length == 0)
                    throw new NotFoundException();
                entity = migrationInfos[migrationInfos.length - 1];
                break;
            }
            default:
                for (MigrationInfo info : flyway.info().all()) {
                    if (revision.equalsIgnoreCase(info.getVersion().getVersion())) {
                        entity = info;
                        break;
                    }
                }
        }
        if (entity == null)
            throw new NotFoundException();
        return Response.ok(entity).build();
    }
1006977
public Metadata getMetadata() throws DBException {
        if (!this.cluster.isClosed()) {
            this.metadata = cluster.getMetadata();
            return this.metadata;
        } else {
            throw new DBException("The cluster has been closed");
        }
    }
1056515
public static CathDatabase getCathDatabase(String version) {
		if (version == null) version = DEFAULT_VERSION;
		CathDatabase cath = versions.get(version);
		if (cath == null) {
			CathInstallation newCath = new CathInstallation();
			newCath.setCathVersion(version);
			cath = newCath;
		}
		return cath;
	}
756755
protected String getSql(int version){
        Dialect dialect = ((SqlManagerImpl) sqlManager).getDialect();
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        InputStream in = classLoader.getResourceAsStream(
                String.format("%s/%s_%d.sql", packageName, dialect.getName().toLowerCase(), version));

        if(in == null){
            in = classLoader.getResourceAsStream(
                    String.format("%s/%d.sql", packageName, version));

            if(in == null){
                return null;
            }
        }

        byte[] buf = IOUtil.readStream(in);
	
		return new String(buf, StandardCharsets.UTF_8);
	
	}
604296
private void updateDatabase() {
        if (getMainConfig().getInt("Database.dbVersion") == 0) {
            alertOldDbVersion(0, 1);
            //We first check if we have the DB version in the database. If we do, we have a old layout in our hands
            String value = getStorageHandler().getStorageEngine().getConfigEntry("dbVersion");
            if (value != null) {
                //We have a old database, do the whole conversion
                try {
                    new OldFormatConverter().run();
                    getMainConfig().setValue("Database.dbVersion", 1);
                    sendConsoleMessage(Level.INFO, "Updated to Revision 1!");

                } catch (SQLException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            } else {
                getMainConfig().setValue("Database.dbVersion", 1);
                sendConsoleMessage(Level.INFO, "Updated to Revision 1!");
            }
        } else if (getMainConfig().getInt("Database.dbVersion") == -1) {
            alertOldDbVersion(-1,1);
            try {
                    new OldFormatConverter().step2();
                    getMainConfig().setValue("Database.dbVersion", 1);
                    sendConsoleMessage(Level.INFO, "Updated to Revision 1!");

                } catch (SQLException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (ParseException e) {
                    e.printStackTrace();
                }
        }
    }
509270
def database_info(dbname, options = {})
      version = options.fetch(:t, '-')
      get db_url(dbname, version) + "/", :Accept => 'application/edn'
    end
1171475
public void updateDatabase(String pool) {

        Map<String, String> dbPoolData = new HashMap<String, String>(m_dbPools.get(pool));

        // display info
        System.out.println("JDBC Driver:                " + getDbDriver(pool));
        System.out.println("JDBC Connection Url:        " + getDbUrl(pool));
        System.out.println("JDBC Connection Url Params: " + getDbParams(pool));
        System.out.println("Database User:              " + getDbUser(pool));

        // get the db implementation name
        String dbName = getDbName();
        String name = null;
        if (dbName.indexOf("mysql") > -1) {
            getMySqlEngine(dbPoolData);
            name = "mysql";
        } else if (dbName.indexOf("oracle") > -1) {
            getOracleTablespaces(dbPoolData);
            name = "oracle";
        } else if (dbName.indexOf("postgresql") > -1) {
            getPostgreSqlTablespaces(dbPoolData);
            name = "postgresql";
        } else {
            System.out.println("db " + dbName + " not supported");
            return;
        }

        // execute update
        Iterator<I_CmsUpdateDBPart> it = m_plugins.iterator();
        while (it.hasNext()) {
            I_CmsUpdateDBPart updatePart = it.next();
            I_CmsUpdateDBPart dbUpdater = getInstanceForDb(updatePart, name);
            if (dbUpdater != null) {
                dbUpdater.execute(dbPoolData);
            }
        }
    }
630232
@Transactional(readOnly = true, propagation = Propagation.REQUIRED)
  public String getDatabaseSchemaVersion()
  {
    try
    {

      List<Map<String, Object>> result = getJdbcTemplate().
        queryForList(
          "SELECT \"value\" FROM repository_metadata WHERE \"name\"='schema-version'");

      String schema
        = result.size() > 0 ? (String) result.get(0).get("value") : "";
      return schema;
    }
    catch (DataAccessException ex)
    {
      String error = "Wrong database schema (too old to get the exact number), "
        + "please initialize the database.";
      log.error(error);
    }
    return "";
  }
724860
public List<Timestamp> getRevisionTimestampsBeforeRevision(final int revisionId)
        throws WikiApiException
    {
        List<Timestamp> timestamps = new LinkedList<Timestamp>();

        int articleID = getPageIdForRevisionId(revisionId); // TODO do this in the SQL query
        Timestamp ts = getRevision(revisionId).getTimeStamp(); // TODO do this in the SQL query

        try {
            PreparedStatement statement = null;
            ResultSet result = null;

            try {
                // Check if necessary index exists
                if (!indexExists("revisions")) {
                    throw new WikiInitializationException(
                            "Please create an index on revisions(ArticleID) in order to make this query feasible.");
                }

                statement = connection
                        .prepareStatement("SELECT Timestamp FROM revisions WHERE ArticleID=? AND Timestamp < ?");
                statement.setInt(1, articleID);
                statement.setLong(2, ts.getTime());
                result = statement.executeQuery();

                // Make the query
                if (result == null) {
                    throw new WikiPageNotFoundException("The article with the ID " + articleID
                            + " was not found.");
                }
                while (result.next()) {
                    timestamps.add(new Timestamp(result.getLong(1)));
                }
            }
            finally {
                if (statement != null) {
                    statement.close();
                }
                if (result != null) {
                    result.close();
                }
            }

            return timestamps;

        }
        catch (WikiApiException e) {
            throw e;
        }
        catch (Exception e) {
            throw new WikiApiException(e);
        }
    }
646807
public static RevisionInternal revisionObject(
            Document doc,
            String docID,
            String revID,
            boolean withBody) {

        boolean deleted = doc.selectedRevDeleted();
        if (revID == null)
            revID = doc.getSelectedRevID();
        RevisionInternal rev = new RevisionInternal(docID, revID, deleted);
        rev.setSequence(doc.getSelectedSequence());
        if (withBody) {
            Status status = loadBodyOfRevisionObject(rev, doc);
            if (status.isError() && status.getCode() != Status.GONE)
                return null;
        }
        return rev;
    }
1040754
public synchronized DatabaseInfo getDatabaseInfo() {
        if (databaseInfo != null) {
            return databaseInfo;
        }
        try {
            _check_mtime();
            boolean hasStructureInfo = false;
            byte[] delim = new byte[3];
            // Advance to part of file where database info is stored.
            file.seek(file.length() - 3);
            for (int i = 0; i < STRUCTURE_INFO_MAX_SIZE; i++) {
                int read = file.read(delim);
                if (read == 3 && (delim[0] & 0xFF) == 255
                        && (delim[1] & 0xFF) == 255 && (delim[2] & 0xFF) == 255) {
                    hasStructureInfo = true;
                    break;
                }
                file.seek(file.getFilePointer() - 4);

            }
            if (hasStructureInfo) {
                file.seek(file.getFilePointer() - 6);
            } else {
                // No structure info, must be pre Sep 2002 database, go back to
                // end.
                file.seek(file.length() - 3);
            }
            // Find the database info string.
            for (int i = 0; i < DATABASE_INFO_MAX_SIZE; i++) {
                file.readFully(delim);
                if (delim[0] == 0 && delim[1] == 0 && delim[2] == 0) {
                    byte[] dbInfo = new byte[i];
                    file.readFully(dbInfo);
                    // Create the database info object using the string.
                    databaseInfo = new DatabaseInfo(new String(dbInfo, charset));
                    return databaseInfo;
                }
                file.seek(file.getFilePointer() - 4);
            }
        } catch (IOException e) {
            throw new InvalidDatabaseException("Error reading database info", e);
        }
        return new DatabaseInfo("");
    }
1105954
@SuppressWarnings("unchecked")
    private List<DBParameter> parametersToIndexRevision(DocumentRevision rev,
                                                                     String indexName,
                                                                     List<FieldSort> fieldNames) {
        Misc.checkNotNull(rev, "rev");
        Misc.checkNotNull(indexName, "indexName");
        Misc.checkNotNull(fieldNames, "fieldNames");

        int arrayCount = 0;
        String arrayFieldName = null; // only record the last, as error if more than one
        for (FieldSort fieldName : fieldNames) {
            Object value = ValueExtractor.extractValueForFieldName(fieldName.field, rev.getBody());
            if (value != null && value instanceof List) {
                arrayCount = arrayCount + 1;
                arrayFieldName = fieldName.field;
            }
        }

        if (arrayCount > 1) {
            String msg = String.format("Indexing %s in index %s includes > 1 array field; " +
                            "Only one array field per index allowed.",
                    rev.getId(),
                    indexName);
            logger.log(Level.SEVERE, msg);
            return null;
        }

        List<DBParameter> parameters = new ArrayList<DBParameter>();
        List<Object> arrayFieldValues = null;
        if (arrayCount == 1) {
            arrayFieldValues = (List) ValueExtractor.extractValueForFieldName(arrayFieldName,
                    rev.getBody());
        }

        if (arrayFieldValues != null && arrayFieldValues.size() > 0) {
            for (Object value : arrayFieldValues) {
                // For each value in the list we create a row. We put this value at the start
                // of the INSERT statement along with _id and _rev, followed by the other
                // fields. _id and _rev are special fields in that they don't appear in the
                // body, so they need special-casing to get the values.
                List<FieldSort> initialIncludedFields = Arrays.asList(new FieldSort("_id"),
                        new FieldSort("_rev"),
                        new FieldSort(arrayFieldName));
                List<Object> initialArgs = Arrays.asList(rev.getId(), rev.getRevision(), value);
                DBParameter parameter = populateDBParameter(fieldNames,
                        initialIncludedFields,
                        initialArgs,
                        indexName,
                        rev);
                parameters.add(parameter);
            }
        } else {
            // We know that there is no populated list in the values that we are indexing.
            // We just need to index the fields in the index now. _id and _rev are special
            // fields because they don't appear in the document body, so they need
            // special-casing to get the values.
            List<FieldSort> initialIncludedFields = Arrays.asList(new FieldSort("_id"), new FieldSort("_rev"));
            List<Object> initialArgs = Arrays.<Object>asList(rev.getId(), rev.getRevision());
            DBParameter parameter = populateDBParameter(fieldNames,
                    initialIncludedFields,
                    initialArgs,
                    indexName,
                    rev);
            parameters.add(parameter);
        }

        return parameters;
    }
1195008
public Map<String, String[]> getAttributePropertiesFromDB(final String attributeName) throws DevFailed {
        xlogger.entry(attributeName);
        xlogger.exit();
        return DatabaseFactory.getDatabase().getAttributeProperties(deviceName, attributeName);
    }
1180496
private Status update(Database _db, String docID, Body body, boolean deleting) {
        Status status = new Status();

        if (docID != null && docID.isEmpty() == false) {
            // On PUT/DELETE, get revision ID from either ?rev= query or doc body:
            String revParam = getQuery("rev");
            String ifMatch = getRequestHeaderValue("If-Match");
            if (ifMatch != null) {
                if (revParam == null)
                    revParam = ifMatch;
                else if (!ifMatch.equals(revParam))
                    return new Status(Status.BAD_REQUEST);
            }
            if (revParam != null && body != null) {
                String revProp = (String) body.getProperties().get("_rev");
                if (revProp == null) {
                    // No _rev property in body, so use ?rev= query param instead:
                    body.getProperties().put("_rev", revParam);
                    //body = new Body(bodyDict);
                } else if (!revParam.equals(revProp)) {
                    throw new IllegalArgumentException("Mismatch between _rev and rev");
                }
            }
        }

        RevisionInternal rev = update(_db, docID, body, deleting, false, status);
        if (status.isSuccessful()) {
            cacheWithEtag(rev.getRevID());  // set ETag
            if (!deleting) {
                URL url = connection.getURL();
                String urlString = url.toExternalForm();
                if (docID != null) {
                    urlString += '/' + rev.getDocID();
                    try {
                        url = new URL(urlString);
                    } catch (MalformedURLException e) {
                        Log.w("Malformed URL", e);
                    }
                }
                setResponseLocation(url);
            }
            Map<String, Object> result = new HashMap<String, Object>();
            result.put("ok", true);
            result.put("id", rev.getDocID());
            result.put("rev", rev.getRevID());
            connection.setResponseBody(new Body(result));
        }
        return status;
    }
76104
protected Table getTableFromDB(String tableName) {
        Table table = m_db.getTables().getExact(tableName);
        return table;
    }
991537
public CoreRemoteMongoDatabaseImpl getDatabase(final String databaseName) {
    return new CoreRemoteMongoDatabaseImpl(
      databaseName,
      service,
      dataSynchronizer,
      appInfo.getNetworkMonitor()
    );
  }
1301858
public int updateObjByCondition(String tableName, String condition,String setStr) {
		//JdbcTemplate jdbcTemplate = (JdbcTemplate) MicroDbHolder.getDbSource(dbName);
		//String tableName=changeTableNameCase(otableName);
		JdbcTemplate jdbcTemplate =getMicroJdbcTemplate();
		String timeName=getTimeName();
		if(autoOperTime){
			setStr="update_time="+timeName+","+setStr;
		}
		
		String sql = "update " + tableName +" set "+setStr+ " where "+condition;
		logger.debug(sql);
		Integer retStatus=jdbcTemplate.update(sql);
		return retStatus;
	}