org.arp.javautil.sql.DriverVersion Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javautil Show documentation
Show all versions of javautil Show documentation
JavaUtil is a utility library to speed the development of
Java software. We developed it over multiple years during
our internal development efforts, and it has reached a
point of stability where we have decided to make it
available to the outside world. The JavaUtil package aims
to fill in the gaps of the Apache Commons and similar
utility libraries out there. Features include convenience
classes for string, collections, arrays, dates, iterators,
colors, logging, unit testing, a little bit of basic
statistics, database queries, caching and more.
package org.arp.javautil.sql;
/*
* #%L
* JavaUtil
* %%
* Copyright (C) 2012 - 2015 Emory University
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import org.arp.javautil.version.MajorMinorVersion;
/**
* Represents a JDBC driver's version.
*
* @author Andrew Post
*/
public class DriverVersion extends MajorMinorVersion {
/**
* Creates a version with a major and a minor number and a
* null
version string.
*
* @param major the major version number.
* @param minor the minor version number.
*/
public DriverVersion(int major, int minor) {
super(major, minor);
}
/**
* Creates a version with a major number, a minor number and a version
* string.
*
* @param major the major version number.
* @param minor the minor version number.
* @param versionString the version string. While the version string should
* represent a version with the major and minor numbers specified, that is
* not assumed in this implementation.
*/
public DriverVersion(int major, int minor, String versionString) {
super(major, minor, versionString);
}
/**
* Extracts the driver version from database metadata.
*
* @param metaData database metadata.
* @throws java.sql.SQLException if there was an error fetching metadata
* from the driver.
*/
public DriverVersion(DatabaseMetaData metaData) throws SQLException {
super(metaData.getDriverMajorVersion(), metaData.getDriverMinorVersion(), metaData.getDriverVersion());
}
}