Deprecated scala.dbc. Wish there was a better way to deprecate a

package than deprecating every individual thing.  (There isn't, is
there?) Closes #4313, no review.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@24462 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
extempore 2011-03-15 05:55:38 +00:00
parent b25198b965
commit 2ea48920fd
66 changed files with 89 additions and 84 deletions

View File

@ -424,7 +424,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: PrintWriter)
*/
def loop() {
def readOneLine() = {
out.flush
out.flush()
in readLine prompt
}
// return false if repl should exit

View File

@ -14,7 +14,7 @@ package scala.dbc;
/** An ISO-9075:2003 (SQL) data type. Mappings between SQL types and
* database specific types should be provided by the database driver.
*/
abstract class DataType {
@deprecated(DbcIsDeprecated) abstract class DataType {
/** Tests whether this datatype is equivalent to another. Usually, two
* types are defined as equivalent if they are equal. Two types can be
@ -50,7 +50,7 @@ abstract class DataType {
}
object DataType {
@deprecated(DbcIsDeprecated) object DataType {
type Id = Int;

View File

@ -18,7 +18,7 @@ import java.sql._
*
* @author Gilles Dubochet
*/
case class Database(dbms: Vendor) {
@deprecated(DbcIsDeprecated) case class Database(dbms: Vendor) {
class Closed extends Exception {}

View File

@ -17,7 +17,7 @@ import java.math.{BigDecimal, BigInteger};
/** This class ..
*
*/
object Syntax {
@deprecated(DbcIsDeprecated) object Syntax {
import syntax.DataTypeUtil;

View File

@ -15,7 +15,7 @@ package scala.dbc;
* This object's members must be visible in an expression to use value
* auto-conversion.
*/
object Utilities {
@deprecated(DbcIsDeprecated) object Utilities {
implicit def constantToValue (obj: statement.expression.Constant): Value =
obj.constantValue;

View File

@ -12,7 +12,7 @@ package scala.dbc;
/** A SQL-99 value of any type. */
abstract class Value {
@deprecated(DbcIsDeprecated) abstract class Value {
/** The SQL-99 type of the value. */
val dataType: DataType;

View File

@ -16,7 +16,7 @@ import java.sql.{Connection, Driver};
/** This class ..
*/
abstract class Vendor {
@deprecated(DbcIsDeprecated) abstract class Vendor {
def nativeDriverClass: Class[_];
def uri: java.net.URI;

View File

@ -15,7 +15,7 @@ package datatype;
/** A type category for all SQL types that store varying-precision
* numbers.
*/
abstract class ApproximateNumeric[Type] (
@deprecated(DbcIsDeprecated) abstract class ApproximateNumeric[Type] (
override val nativeTypeId: DataType.Id
) extends datatype.Numeric[Type](nativeTypeId) {

View File

@ -13,7 +13,7 @@ package datatype;
/** The SQL type for a truth value. */
class Boolean extends DataType {
@deprecated(DbcIsDeprecated) class Boolean extends DataType {
def isEquivalent (datatype:DataType) = datatype match {
case dt:Boolean => true

View File

@ -15,7 +15,7 @@ package datatype;
/** A SQL type for a string of characters of arbitrary length with
* arbitrary character set.
*/
abstract class Character extends CharacterString {
@deprecated(DbcIsDeprecated) abstract class Character extends CharacterString {
def isEquivalent(datatype: DataType) = datatype match {
case dt: Character =>

View File

@ -14,7 +14,7 @@ package datatype;
/** A SQL type for an unbounded length string of characters with arbitrary
* character set. */
class CharacterLargeObject extends CharacterString {
@deprecated(DbcIsDeprecated) class CharacterLargeObject extends CharacterString {
def isEquivalent (datatype:DataType) = datatype match {
case dt:CharacterLargeObject => {

View File

@ -13,7 +13,7 @@ package datatype;
/** A type category for all SQL types that store strings of characters. */
abstract class CharacterString extends String {
@deprecated(DbcIsDeprecated) abstract class CharacterString extends String {
type NativeType = java.lang.String;
val nativeTypeId = DataType.STRING;

View File

@ -15,7 +15,7 @@ package datatype;
/** A SQL type for a varying length string of characters with arbitrary
* maximal length and arbitrary character set.
*/
abstract class CharacterVarying extends CharacterString {
@deprecated(DbcIsDeprecated) abstract class CharacterVarying extends CharacterString {
def isEquivalent(datatype: DataType) = datatype match {
case dt: CharacterVarying =>

View File

@ -15,7 +15,7 @@ package datatype;
/** A type category for all SQL types that store constant-precision
* numbers.
*/
abstract class ExactNumeric[Type](
@deprecated(DbcIsDeprecated) abstract class ExactNumeric[Type](
override val nativeTypeId: DataType.Id
) extends datatype.Numeric[Type](nativeTypeId) {

View File

@ -16,7 +16,7 @@ import java.sql.Types._;
import java.math.BigInteger;
import java.math.BigDecimal;
object Factory {
@deprecated(DbcIsDeprecated) object Factory {
final val java_lang_Integer_SIZE = 32;
final val java_lang_Long_SIZE = 64;

View File

@ -13,7 +13,7 @@ package datatype;
/** A type category for all SQL types that store numbers. */
abstract class Numeric[Type](_nativeTypeId: DataType.Id) extends DataType {
@deprecated(DbcIsDeprecated) abstract class Numeric[Type](_nativeTypeId: DataType.Id) extends DataType {
type NativeType = Type;
val nativeTypeId = _nativeTypeId;

View File

@ -14,7 +14,7 @@ package datatype;
/** A type category for all SQL types that store strings of elements.
*/
abstract class String extends DataType {
@deprecated(DbcIsDeprecated) abstract class String extends DataType {
/** The maximal possible length of the string defined in characters.
* This is an implementation-specific value.

View File

@ -13,7 +13,7 @@ package datatype;
/** The SQL type for a truth value. */
class Unknown extends DataType {
@deprecated(DbcIsDeprecated) class Unknown extends DataType {
def isEquivalent(datatype: DataType) = datatype match {
case dt: Unknown =>

View File

@ -13,7 +13,7 @@ package exception
/** A type category for all SQL types that store constant-precision numbers. */
case class IncompatibleSchema (
@deprecated(DbcIsDeprecated) case class IncompatibleSchema (
expectedSchema: List[DataType],
foundSchema: List[DataType]
) extends Exception;

View File

@ -13,4 +13,4 @@ package exception
/** A type category for all SQL types that store constant-precision numbers. */
case class UnsupportedFeature (msg: String) extends Exception;
@deprecated(DbcIsDeprecated) case class UnsupportedFeature (msg: String) extends Exception;

View File

@ -0,0 +1,6 @@
package scala
package object dbc {
final val DbcIsDeprecated =
"scala.dbc will be removed after version 2.9. Use an active sql library such as scalaquery instead."
}

View File

@ -16,7 +16,7 @@ import scala.dbc.datatype._
import scala.dbc.value._
/** An ISO-9075:2003 (SQL) table field. */
abstract class Field {
@deprecated(DbcIsDeprecated) abstract class Field {
/** The content (value) of the field. The type of this value is undefined,
* transformation into a useful type will be done by an automatic view
@ -56,7 +56,7 @@ abstract class Field {
}
object Field {
@deprecated(DbcIsDeprecated) object Field {
implicit def fieldToValue (field: Field): Value = field.content

View File

@ -15,7 +15,7 @@ package result
/** The class <code>FieldMetadata</cocde> provides informations attached to
* a field about its content and its relationship to the originating database.
*/
abstract class FieldMetadata {
@deprecated(DbcIsDeprecated) abstract class FieldMetadata {
/** The name of the field. */
def name: String

View File

@ -14,7 +14,7 @@ package result
/** An ISO-9075:2003 (SQL) table. This is equivalent to a relation in the
* relational model. */
abstract class Relation extends AnyRef with Iterable[Tuple] {
@deprecated(DbcIsDeprecated) abstract class Relation extends AnyRef with Iterable[Tuple] {
/** The statement that generated this relation. */
def statement: scala.dbc.statement.Relation

View File

@ -15,7 +15,7 @@ package result;
import scala.dbc.datatype._;
/** An object containing the status of a query */
abstract class Status[ResultType] {
@deprecated(DbcIsDeprecated) abstract class Status[ResultType] {
/** The statement that generated this status result. */
def statement: scala.dbc.statement.Statement;

View File

@ -13,7 +13,7 @@ package result;
/** An ISO-9075:2003 (SQL) table row. This is equivalent to a tuple in the relational model. */
abstract class Tuple {
@deprecated(DbcIsDeprecated) abstract class Tuple {
/** All the fields contained in the tuple. */
def fields: List[Field];

View File

@ -12,11 +12,11 @@ package scala.dbc
package statement
abstract class AccessMode {
@deprecated(DbcIsDeprecated) abstract class AccessMode {
def sqlString: String
}
object AccessMode {
@deprecated(DbcIsDeprecated) object AccessMode {
case object ReadOnly extends AccessMode {
def sqlString = "READ ONLY"
}

View File

@ -12,7 +12,7 @@ package scala.dbc
package statement
abstract class DerivedColumn {
@deprecated(DbcIsDeprecated) abstract class DerivedColumn {
/** The value for the column. This value can be of any type but must be
* calculated from fields that appear in a relation that takes part

View File

@ -13,7 +13,7 @@ package statement
/** An expression that calculates some value from fields. */
abstract class Expression extends Relation {
@deprecated(DbcIsDeprecated) abstract class Expression extends Relation {
def fieldTypes: List[DataType] = Nil

View File

@ -15,7 +15,7 @@ package statement
import scala.dbc.statement.expression._
/** An insertion of values into a table. */
case class Insert(insertionTarget: String, insertionData: InsertionData)
@deprecated(DbcIsDeprecated) case class Insert(insertionTarget: String, insertionData: InsertionData)
extends Status {
/** A SQL-99 compliant string representation of the select statement. */

View File

@ -15,17 +15,17 @@ package statement
import scala.dbc.statement.expression._
/** Data to be inserted into a table in an <code>Insert</code>. */
abstract class InsertionData {
@deprecated(DbcIsDeprecated) abstract class InsertionData {
def sqlString: String
}
object InsertionData {
@deprecated(DbcIsDeprecated) object InsertionData {
/** Insertion of data resulting from a query on the database. */
case class Subquery(query: Relation) extends InsertionData {
@deprecated(DbcIsDeprecated) case class Subquery(query: Relation) extends InsertionData {
def sqlString = query.sqlString
}
/** Insertion of data as explicitly defined values. */
case class Constructor(
@deprecated(DbcIsDeprecated) case class Constructor(
columnNames: Option[List[String]],
columnValues: List[Expression]
) extends InsertionData {

View File

@ -12,11 +12,11 @@ package scala.dbc
package statement
abstract class IsolationLevel {
@deprecated(DbcIsDeprecated) abstract class IsolationLevel {
def sqlString: String
}
object IsolationLevel {
@deprecated(DbcIsDeprecated) object IsolationLevel {
case object ReadUncommitted extends IsolationLevel {
def sqlString = "ISOLATION LEVEL READ UNCOMMITTED"
}

View File

@ -13,12 +13,12 @@ package statement
/** A join behaviour in a <code>Jointure</code>. */
abstract class JoinType {
@deprecated(DbcIsDeprecated) abstract class JoinType {
/** A SQL-99 string representation of the join behaviour. */
def sqlString: String
}
object JoinType {
@deprecated(DbcIsDeprecated) object JoinType {
/** A join behaviour where a joined tuple is created only when a
* corresponding tuple exists in both original relations.

View File

@ -13,7 +13,7 @@ package statement
/** A jointure between two relations. */
abstract class Jointure extends Relation {
@deprecated(DbcIsDeprecated) abstract class Jointure extends Relation {
/** The relation on the left part of the join. */
def leftRelation: Relation

View File

@ -13,7 +13,7 @@ package statement;
/** A statement that returns a relation. */
abstract class Relation extends Statement {
@deprecated(DbcIsDeprecated) abstract class Relation extends Statement {
def isCompatibleType: (DataType,DataType)=>Boolean =
((dt,wdt)=>dt.isSubtypeOf(wdt));

View File

@ -15,7 +15,7 @@ package statement
/** A statement that when executed on a database will return a relation.
* The returned relation will be a subset of a table in the database or
* a jointure between such subsets. */
abstract class Select extends Relation {
@deprecated(DbcIsDeprecated) abstract class Select extends Relation {
/** Defines if duplicated tuples should be removed from the returned
* relation. <h3>Compatibility notice</h3> Some DBMS (PostgreSQL) allow

View File

@ -15,7 +15,7 @@ package statement
import scala.dbc.statement.expression._
/** Data to be inserted into a table in an <code>Insert</code>. */
case class SetClause(name: String, expr: Expression) {
@deprecated(DbcIsDeprecated) case class SetClause(name: String, expr: Expression) {
val value: Pair[String,Expression] = (name, expr)
def sqlString: String = value._1 + " = " + value._2.sqlInnerString
}

View File

@ -13,12 +13,12 @@ package statement
/** A set quantifier that defines the collection type of a relation. */
abstract class SetQuantifier {
@deprecated(DbcIsDeprecated) abstract class SetQuantifier {
/** A SQL-99 compliant string representation of the set quantifier. */
def sqlString: String
}
object SetQuantifier {
@deprecated(DbcIsDeprecated) object SetQuantifier {
/** A set quantifier that defines a relation as being a bag. That means
* that duplicates are allowed.

View File

@ -13,4 +13,4 @@ package statement
/** An ISO-9075:2003 (SQL) statement. */
abstract class Statement
@deprecated(DbcIsDeprecated) abstract class Statement

View File

@ -15,7 +15,7 @@ import scala.dbc.Database
import scala.dbc.result
/** A statement that changes the status of the database. */
abstract class Status extends Statement {
@deprecated(DbcIsDeprecated) abstract class Status extends Statement {
/** A SQL-99 compliant string representation of the statement. */
def sqlString: String

View File

@ -15,7 +15,7 @@ package statement
/** A reference to a table in the database.
* @author Gilles Dubochet
* @version 1.0 */
abstract class Table extends Relation {
@deprecated(DbcIsDeprecated) abstract class Table extends Relation {
/** The name of the table in the database. */
def tableName: String

View File

@ -13,7 +13,7 @@ package statement;
/** A statement that changes the status of the database. */
case class Transaction [ResultType] (
@deprecated(DbcIsDeprecated) case class Transaction [ResultType] (
transactionBody: (scala.dbc.Database=>ResultType),
accessMode: Option[AccessMode],
isolationLevel: Option[IsolationLevel]

View File

@ -15,7 +15,7 @@ package statement;
import scala.dbc.statement.expression._;
/** An update of the state of a table. */
case class Update (
@deprecated(DbcIsDeprecated) case class Update (
updateTarget: String,
setClauses: List[SetClause],
whereClause: Option[Expression]

View File

@ -13,7 +13,7 @@ package statement
package expression
abstract class Aggregate extends Expression {
@deprecated(DbcIsDeprecated) abstract class Aggregate extends Expression {
def aggregateName: String;

View File

@ -13,7 +13,7 @@ package statement
package expression;
abstract class BinaryOperator extends Expression {
@deprecated(DbcIsDeprecated) abstract class BinaryOperator extends Expression {
/** The name of the operator. */
def operator: String;

View File

@ -13,7 +13,7 @@ package statement
package expression;
abstract class Constant extends Expression {
@deprecated(DbcIsDeprecated) abstract class Constant extends Expression {
/** A SQL-99 compliant string representation of the relation sub-
* statement. This only has a meaning inside another statement. */
def sqlInnerString: String = constantValue.sqlString;

View File

@ -13,7 +13,7 @@ package statement
package expression;
abstract class Field extends Expression {
@deprecated(DbcIsDeprecated) abstract class Field extends Expression {
/** The name of the schema in the database where the field is located. */
def schemaName: Option[String] = None;

View File

@ -13,7 +13,7 @@ package statement
package expression;
case class FunctionCall (
@deprecated(DbcIsDeprecated) case class FunctionCall (
functionName: String,
arguments: List[Expression]
) extends Expression {

View File

@ -13,7 +13,7 @@ package statement
package expression;
abstract class Select extends Expression {
@deprecated(DbcIsDeprecated) abstract class Select extends Expression {
/** The actual select statement */
def selectStatement: statement.Select;

View File

@ -13,12 +13,12 @@ package statement
package expression;
abstract class SetFunction {
@deprecated(DbcIsDeprecated) abstract class SetFunction {
/** A SQL-99 compliant string representation of the set quantifier. */
def sqlString: String;
}
object SetFunction {
@deprecated(DbcIsDeprecated) object SetFunction {
abstract class Asterisk extends SetFunction {
def sqlString = "(*)";
}

View File

@ -13,7 +13,7 @@ package statement
package expression;
case class TypeCast (
@deprecated(DbcIsDeprecated) case class TypeCast (
expression: Expression,
castType: DataType
) extends Expression {

View File

@ -13,7 +13,7 @@ package statement
package expression;
abstract class UnaryOperator extends Expression {
@deprecated(DbcIsDeprecated) abstract class UnaryOperator extends Expression {
/** The name of the operator */
def operator: String;

View File

@ -15,7 +15,7 @@ package syntax;
import java.math.BigDecimal;
import java.math.BigInteger;
object DataTypeUtil {
@deprecated(DbcIsDeprecated) object DataTypeUtil {
final val java_lang_Integer_SIZE = 32;
final val java_lang_Long_SIZE = 64;

View File

@ -14,7 +14,7 @@ package syntax;
import java.net.URI;
object Database {
@deprecated(DbcIsDeprecated) object Database {
def database (server:String, username:String, password:String): dbc.Database = {
val uri = new URI(server);

View File

@ -31,7 +31,7 @@ FIXED:
*/
object Statement {
@deprecated(DbcIsDeprecated) object Statement {
// SELECT ZYGOTE ...

View File

@ -15,7 +15,7 @@ package syntax;
import java.math.BigDecimal;
import java.math.BigInteger;
abstract class StatementExpression {
@deprecated(DbcIsDeprecated) abstract class StatementExpression {
def toStatement: statement.Expression;
@ -171,7 +171,7 @@ abstract class StatementExpression {
}
object StatementExpression {
@deprecated(DbcIsDeprecated) object StatementExpression {
def not (se:StatementExpression): StatementExpression = new StatementExpression {
val toStatement = new statement.expression.UnaryOperator {

View File

@ -12,7 +12,7 @@ package scala.dbc
package value;
abstract class ApproximateNumeric [Type] extends Value {
@deprecated(DbcIsDeprecated) abstract class ApproximateNumeric [Type] extends Value {
val dataType: datatype.ApproximateNumeric[Type];
@ -20,7 +20,7 @@ abstract class ApproximateNumeric [Type] extends Value {
}
object ApproximateNumeric {
@deprecated(DbcIsDeprecated) object ApproximateNumeric {
implicit def approximateNumericToFloar (obj:value.ApproximateNumeric[Float]): Float = obj.nativeValue;
implicit def approximateNumericToDouble (obj:value.ApproximateNumeric[Double]): Double = obj.nativeValue;

View File

@ -12,7 +12,7 @@ package scala.dbc
package value;
abstract class Boolean extends Value {
@deprecated(DbcIsDeprecated) abstract class Boolean extends Value {
val dataType: datatype.Boolean;
@ -20,7 +20,7 @@ abstract class Boolean extends Value {
}
object Boolean {
@deprecated(DbcIsDeprecated) object Boolean {
implicit def booleanToBoolean (obj:value.Boolean): scala.Boolean = obj.nativeValue;

View File

@ -13,7 +13,7 @@ package value;
/** A SQL-99 value of type character string. */
abstract class Character extends Value {
@deprecated(DbcIsDeprecated) abstract class Character extends Value {
override val dataType: datatype.Character;
@ -27,7 +27,7 @@ abstract class Character extends Value {
/** An object offering transformation methods (views) on the value.
* This object must be visible in an expression to use value auto-
* conversion. */
object Character {
@deprecated(DbcIsDeprecated) object Character {
/** A character string value as a native string. */
implicit def characterToString (obj:value.Character): String = obj.nativeValue;

View File

@ -13,7 +13,7 @@ package value;
/** A SQL-99 value of type character large object. */
abstract class CharacterLargeObject extends Value {
@deprecated(DbcIsDeprecated) abstract class CharacterLargeObject extends Value {
override val dataType: datatype.CharacterLargeObject;
@ -27,7 +27,7 @@ abstract class CharacterLargeObject extends Value {
/** An object offering transformation methods (views) on the value.
* This object must be visible in an expression to use value auto-
* conversion. */
object CharacterLargeObject {
@deprecated(DbcIsDeprecated) object CharacterLargeObject {
/** A character large object value as a native string. */
implicit def characterLargeObjectToString (obj:value.CharacterLargeObject): String = obj.nativeValue;

View File

@ -13,7 +13,7 @@ package value;
/** A SQL-99 value of type character varying string. */
abstract class CharacterVarying extends Value {
@deprecated(DbcIsDeprecated) abstract class CharacterVarying extends Value {
override val dataType: datatype.CharacterVarying;
@ -27,7 +27,7 @@ abstract class CharacterVarying extends Value {
/** An object offering transformation methods (views) on the value.
* This object must be visible in an expression to use value auto-
* conversion. */
object CharacterVarying {
@deprecated(DbcIsDeprecated) object CharacterVarying {
/** A character varying string value as a native string. */
implicit def characterVaryingToString (obj:value.CharacterVarying): String = obj.nativeValue;

View File

@ -11,10 +11,9 @@
package scala.dbc
package value;
import java.math._;
object Conversion {
@deprecated(DbcIsDeprecated) object Conversion {
class Illegal (msg:String) extends Exception(msg);

View File

@ -15,7 +15,7 @@ package value;
import java.math.BigInteger;
import java.math.BigDecimal;
abstract class ExactNumeric [Type] extends Value {
@deprecated(DbcIsDeprecated) abstract class ExactNumeric [Type] extends Value {
val dataType: datatype.ExactNumeric[Type];
@ -23,7 +23,7 @@ abstract class ExactNumeric [Type] extends Value {
}
object ExactNumeric {
@deprecated(DbcIsDeprecated) object ExactNumeric {
implicit def exactNumericToByte (obj:value.ExactNumeric[Byte]): Byte = obj.nativeValue;
implicit def exactNumericToShort (obj:value.ExactNumeric[Short]): Short = obj.nativeValue;

View File

@ -15,7 +15,7 @@ package value;
import java.math.BigInteger;
import java.math.BigDecimal;
object Factory {
@deprecated(DbcIsDeprecated) object Factory {
def create (result: java.sql.ResultSet, index: Int, expectedDataType: DataType): Value = {
expectedDataType.nativeTypeId match {

View File

@ -12,7 +12,7 @@ package scala.dbc
package value;
abstract class Unknown extends Value {
@deprecated(DbcIsDeprecated) abstract class Unknown extends Value {
val dataType: datatype.Unknown;
@ -20,7 +20,7 @@ abstract class Unknown extends Value {
}
object UnknownType {
@deprecated(DbcIsDeprecated) object UnknownType {
def view (obj:value.Unknown): AnyRef = obj.nativeValue;

View File

@ -14,7 +14,7 @@ package vendor;
import compat.Platform
abstract class PostgreSQL extends Vendor {
@deprecated(DbcIsDeprecated) abstract class PostgreSQL extends Vendor {
def uri:java.net.URI;
def user:String;