diff options
author | michelou <michelou@epfl.ch> | 2005-11-16 09:47:10 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2005-11-16 09:47:10 +0000 |
commit | 26d7ba2f85429c791c87f6bc2e47a3156523e2b0 (patch) | |
tree | c15a457645cf5a80e37685b5c1dd4e317d94c163 | |
parent | 7d38b7501cb0287b9b0911863edaf3d2e9757011 (diff) | |
download | scala-26d7ba2f85429c791c87f6bc2e47a3156523e2b0.tar.gz scala-26d7ba2f85429c791c87f6bc2e47a3156523e2b0.tar.bz2 scala-26d7ba2f85429c791c87f6bc2e47a3156523e2b0.zip |
- removed leading tabs
-rw-r--r-- | sources/scala/dbc/datatype/ApproximateNumeric.scala | 70 | ||||
-rw-r--r-- | sources/scala/dbc/datatype/Character.scala | 39 | ||||
-rw-r--r-- | sources/scala/dbc/datatype/CharacterVarying.scala | 40 | ||||
-rw-r--r-- | sources/scala/dbc/datatype/ExactNumeric.scala | 84 | ||||
-rw-r--r-- | sources/scala/dbc/datatype/Numeric.scala | 23 | ||||
-rw-r--r-- | sources/scala/dbc/datatype/String.scala | 12 |
6 files changed, 137 insertions, 131 deletions
diff --git a/sources/scala/dbc/datatype/ApproximateNumeric.scala b/sources/scala/dbc/datatype/ApproximateNumeric.scala index e0d855ffef..cef65a6ab8 100644 --- a/sources/scala/dbc/datatype/ApproximateNumeric.scala +++ b/sources/scala/dbc/datatype/ApproximateNumeric.scala @@ -9,43 +9,45 @@ package scala.dbc.datatype; /** A type category for all SQL types that store varying-precision - * numbers. */ -abstract class ApproximateNumeric [Type] ( - override val nativeTypeId: DataType.Id + * numbers. + */ +abstract class ApproximateNumeric[Type] ( + override val nativeTypeId: DataType.Id ) extends datatype.Numeric[Type](nativeTypeId) { - def isEquivalent (datatype:DataType) = datatype match { - case dt:ApproximateNumeric[Type] => { - nativeTypeId == dt.nativeTypeId && - precisionRadix == dt.precisionRadix && - precision == dt.precision && - signed == dt.signed - } - case _ => false - } + def isEquivalent(datatype: DataType) = datatype match { + case dt: ApproximateNumeric[Type] => + nativeTypeId == dt.nativeTypeId && + precisionRadix == dt.precisionRadix && + precision == dt.precision && + signed == dt.signed + case _ => + false + } - def isSubtypeOf (datatype:DataType) = datatype match { - case dt:ApproximateNumeric[Type] => { - nativeTypeId == dt.nativeTypeId && - precisionRadix == dt.precisionRadix && - precision <= dt.precision && - signed == dt.signed - } - case _ => false - } + def isSubtypeOf (datatype:DataType) = datatype match { + case dt:ApproximateNumeric[Type] => + nativeTypeId == dt.nativeTypeId && + precisionRadix == dt.precisionRadix && + precision <= dt.precision && + signed == dt.signed + case _ => + false + } - /** A SQL-99 compliant string representation of the type. - * <h3>Compatibility notice</h3> This method assumes that a real - * uses 32 bits and a double 64. This is not defined in the - * standard but is usually the case. */ - override def sqlString: java.lang.String = Tuple2(precisionRadix,precision) match { - case Tuple2(2,64) => "REAL" - case Tuple2(2,128) => "DOUBLE PRECISION" - case Tuple2(2,p) => - throw exception.UnsupportedFeature("SQL-99 does not support an approximate numeric type with a binary defined precision other than 16, 32 and 64 bits"); - case Tuple2(10,p) => "FLOAT (" + p.toString + ")" - case Tuple2(pr,_) => - throw exception.UnsupportedFeature("SQL-99 does not support the precision of an approximate numeric type to be defined in a radix other than 2 or 10"); - } + /** A SQL-99 compliant string representation of the type. + * <h3>Compatibility notice</h3> This method assumes that a real + * uses 32 bits and a double 64. This is not defined in the + * standard but is usually the case. + */ + override def sqlString: java.lang.String = Tuple2(precisionRadix,precision) match { + case Tuple2(2,64) => "REAL" + case Tuple2(2,128) => "DOUBLE PRECISION" + case Tuple2(2,p) => + throw exception.UnsupportedFeature("SQL-99 does not support an approximate numeric type with a binary defined precision other than 16, 32 and 64 bits"); + case Tuple2(10,p) => "FLOAT (" + p.toString + ")" + case Tuple2(pr,_) => + throw exception.UnsupportedFeature("SQL-99 does not support the precision of an approximate numeric type to be defined in a radix other than 2 or 10"); + } } diff --git a/sources/scala/dbc/datatype/Character.scala b/sources/scala/dbc/datatype/Character.scala index 4e2c461bc6..ded08c5602 100644 --- a/sources/scala/dbc/datatype/Character.scala +++ b/sources/scala/dbc/datatype/Character.scala @@ -9,29 +9,28 @@ package scala.dbc.datatype; /** A SQL type for a string of characters of arbitrary length with - * arbitrary character set. */ + * arbitrary character set. + */ abstract class Character extends CharacterString { - def isEquivalent (datatype:DataType) = datatype match { - case dt:Character => { - length == dt.length && - encoding == dt.encoding - } - case _ => false - } + def isEquivalent(datatype: DataType) = datatype match { + case dt: Character => + length == dt.length && encoding == dt.encoding + case _ => + false + } - def isSubtypeOf (datatype:DataType) = datatype match { - case dt:Character => { - length >= dt.length && - encoding == dt.encoding - } - case _ => false - } + def isSubtypeOf(datatype: DataType) = datatype match { + case dt: Character => + length >= dt.length && encoding == dt.encoding + case _ => + false + } - /** The length of the string defined in characters. */ - def length: Int; + /** The length of the string defined in characters. */ + def length: Int; - /** A SQL-99 compliant string representation of the type. */ - override def sqlString: java.lang.String = "CHARACTER (" + length.toString() + ")"; + /** A SQL-99 compliant string representation of the type. */ + override def sqlString: java.lang.String = "CHARACTER (" + length.toString() + ")"; -}
\ No newline at end of file +} diff --git a/sources/scala/dbc/datatype/CharacterVarying.scala b/sources/scala/dbc/datatype/CharacterVarying.scala index f39eab9b79..b7f743ce0b 100644 --- a/sources/scala/dbc/datatype/CharacterVarying.scala +++ b/sources/scala/dbc/datatype/CharacterVarying.scala @@ -9,29 +9,29 @@ package scala.dbc.datatype; /** A SQL type for a varying length string of characters with arbitrary - * maximal length and arbitrary character set. */ + * maximal length and arbitrary character set. + */ abstract class CharacterVarying extends CharacterString { - def isEquivalent (datatype:DataType) = datatype match { - case dt:CharacterVarying => { - length == dt.length && - encoding == dt.encoding - } - case _ => false - } + def isEquivalent(datatype: DataType) = datatype match { + case dt: CharacterVarying => + length == dt.length && encoding == dt.encoding + case _ => + false + } - def isSubtypeOf (datatype:DataType) = datatype match { - case dt:CharacterVarying => { - length >= dt.length && - encoding == dt.encoding - } - case _ => false - } + def isSubtypeOf(datatype: DataType) = datatype match { + case dt: CharacterVarying => + length >= dt.length && encoding == dt.encoding + case _ => + false + } - /** The maximal length of the string defined in characters. */ - def length: Int; + /** The maximal length of the string defined in characters. */ + def length: Int; - /** A SQL-99 compliant string representation of the type. */ - override def sqlString: java.lang.String = "CHARACTER VARYING (" + length.toString() + ")"; + /** A SQL-99 compliant string representation of the type. */ + override def sqlString: java.lang.String = + "CHARACTER VARYING (" + length.toString() + ")"; -}
\ No newline at end of file +} diff --git a/sources/scala/dbc/datatype/ExactNumeric.scala b/sources/scala/dbc/datatype/ExactNumeric.scala index e3e936d5cf..00cada5fec 100644 --- a/sources/scala/dbc/datatype/ExactNumeric.scala +++ b/sources/scala/dbc/datatype/ExactNumeric.scala @@ -9,51 +9,53 @@ package scala.dbc.datatype; /** A type category for all SQL types that store constant-precision - * numbers. */ -abstract class ExactNumeric [Type] ( - override val nativeTypeId: DataType.Id + * numbers. + */ +abstract class ExactNumeric[Type]( + override val nativeTypeId: DataType.Id ) extends datatype.Numeric[Type](nativeTypeId) { - def isEquivalent (datatype:DataType) = datatype match { - case dt:ExactNumeric[Type] => { - nativeTypeId == dt.nativeTypeId && - precisionRadix == dt.precisionRadix && - precision == dt.precision && - scale == dt.scale && - signed == dt.signed - } - case _ => false - } + def isEquivalent(datatype: DataType) = datatype match { + case dt: ExactNumeric[Type] => + nativeTypeId == dt.nativeTypeId && + precisionRadix == dt.precisionRadix && + precision == dt.precision && + scale == dt.scale && + signed == dt.signed + case _ => + false + } - def isSubtypeOf (datatype:DataType) = datatype match { - case dt:ExactNumeric[Type] => { - nativeTypeId == dt.nativeTypeId && - precisionRadix == dt.precisionRadix && - precision <= dt.precision && - scale <= dt.scale && - signed == dt.signed - } - case _ => false - } + def isSubtypeOf(datatype: DataType) = datatype match { + case dt: ExactNumeric[Type] => + nativeTypeId == dt.nativeTypeId && + precisionRadix == dt.precisionRadix && + precision <= dt.precision && + scale <= dt.scale && + signed == dt.signed + case _ => + false + } - /** The number of digits used after the decimal point. */ - def scale: Int; + /** The number of digits used after the decimal point. */ + def scale: Int; - /** A SQL-99 compliant string representation of the type. - * <h3>Compatibility notice</h3> This method assumes that an integer - * uses 32 bits, a small 16 and a big 64. This is not defined in the - * standard but is usually the case. */ - override def sqlString: java.lang.String = Tuple3(precisionRadix,precision,scale) match { - case Tuple3(2,16,0) => "SMALLINT" - case Tuple3(2,32,0) => "INTEGER" - case Tuple3(2,64,0) => "BIGINT" - case Tuple3(2,java.lang.Integer.MAX_VALUE,0) => "BIGINT" - case Tuple3(2,p,s) => - throw exception.UnsupportedFeature("SQL-99 does not support an exact numeric type with a binary defined precision other than 16, 32 and 64 bits"); - case Tuple3(10,p,0) => "NUMERIC (" + p.toString() + ")" - case Tuple3(10,p,s) => "NUMERIC (" + p.toString() + ", " + s.toString() + ")" - case Tuple3(pr,_,_) => - throw exception.UnsupportedFeature("SQL-99 does not support the precision of an exact numeric type to be defined in a radix other than 2 or 10"); - } + /** A SQL-99 compliant string representation of the type. + * <h3>Compatibility notice</h3> This method assumes that an integer + * uses 32 bits, a small 16 and a big 64. This is not defined in the + * standard but is usually the case. + */ + override def sqlString: java.lang.String = Tuple3(precisionRadix,precision,scale) match { + case Tuple3(2,16,0) => "SMALLINT" + case Tuple3(2,32,0) => "INTEGER" + case Tuple3(2,64,0) => "BIGINT" + case Tuple3(2,java.lang.Integer.MAX_VALUE,0) => "BIGINT" + case Tuple3(2,p,s) => + throw exception.UnsupportedFeature("SQL-99 does not support an exact numeric type with a binary defined precision other than 16, 32 and 64 bits"); + case Tuple3(10,p,0) => "NUMERIC (" + p.toString() + ")" + case Tuple3(10,p,s) => "NUMERIC (" + p.toString() + ", " + s.toString() + ")" + case Tuple3(pr,_,_) => + throw exception.UnsupportedFeature("SQL-99 does not support the precision of an exact numeric type to be defined in a radix other than 2 or 10"); + } } diff --git a/sources/scala/dbc/datatype/Numeric.scala b/sources/scala/dbc/datatype/Numeric.scala index b75bfe8b15..ef3eee1f32 100644 --- a/sources/scala/dbc/datatype/Numeric.scala +++ b/sources/scala/dbc/datatype/Numeric.scala @@ -9,19 +9,20 @@ package scala.dbc.datatype; /** A type category for all SQL types that store numbers. */ -abstract class Numeric [Type] (_nativeTypeId: DataType.Id) extends DataType { +abstract class Numeric[Type](_nativeTypeId: DataType.Id) extends DataType { - type NativeType = Type; - val nativeTypeId = _nativeTypeId; + type NativeType = Type; + val nativeTypeId = _nativeTypeId; - /** The radix in which the precision (and scale when appliable) is defined. - * ISO-9075 only allows 2 and 10 for this value. */ - def precisionRadix: Int; + /** The radix in which the precision (and scale when appliable) is defined. + * ISO-9075 only allows 2 and 10 for this value. + */ + def precisionRadix: Int; - /** The number of significant digits for that number. */ - def precision: Int; + /** The number of significant digits for that number. */ + def precision: Int; - /** Whether the number is signed or not. */ - def signed: scala.Boolean; + /** Whether the number is signed or not. */ + def signed: scala.Boolean; -}
\ No newline at end of file +} diff --git a/sources/scala/dbc/datatype/String.scala b/sources/scala/dbc/datatype/String.scala index b499a104b6..7d409e6c2d 100644 --- a/sources/scala/dbc/datatype/String.scala +++ b/sources/scala/dbc/datatype/String.scala @@ -8,11 +8,13 @@ package scala.dbc.datatype; -/** A type category for all SQL types that store strings of elements. */ +/** A type category for all SQL types that store strings of elements. + */ abstract class String extends DataType { - /** The maximal possible length of the string defined in characters. - * This is an implementation-specific value. */ - def maxLength: Option[Int] = None; + /** The maximal possible length of the string defined in characters. + * This is an implementation-specific value. + */ + def maxLength: Option[Int] = None; -}
\ No newline at end of file +} |