/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id: Vendor.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc2
/** A database on a DBMS from a given vendor. This contains all necessary
* methods to get and close a connection to the database. */
abstract class Vendor {
protected def openConnection: java.sql.Connection
protected def initialize: Unit
/** Gets a JDBC connection to the database. */
def getConnection: java.sql.Connection
/** Closes the connection to the database. */
def closeConnection(connection: java.sql.Connection): Unit
/** Whether the database no longer accepts new connections. */
protected var closing: Boolean = false
/** Tests whether this database accepts queries. This is true between the
* moment the database is created and the moment the
* closeConnection method is called on it. */
def isAvailable: Boolean = closing
/** Closes this database, preventing any further queries on it. Any
* subsequent query to the database will throw a Closed
* exception. */
def close: Unit
}