summaryrefslogtreecommitdiff
path: root/src/dbc
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2006-03-31 09:38:36 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2006-03-31 09:38:36 +0000
commita2647adc11452bc15df87b2635bb7097436b1dd7 (patch)
tree3a49305ba45a8a27713f9bc7ca91c5c563042bd7 /src/dbc
parentd5fd750f81f0dc572f34aba997dbb0d5574d45ef (diff)
downloadscala-a2647adc11452bc15df87b2635bb7097436b1dd7.tar.gz
scala-a2647adc11452bc15df87b2635bb7097436b1dd7.tar.bz2
scala-a2647adc11452bc15df87b2635bb7097436b1dd7.zip
Removed all tabs in DBC library source.
Diffstat (limited to 'src/dbc')
-rw-r--r--src/dbc/scala/dbc/Database.scala17
-rw-r--r--src/dbc/scala/dbc/datatype/Boolean.scala20
-rw-r--r--src/dbc/scala/dbc/datatype/CharacterLargeObject.scala22
-rw-r--r--src/dbc/scala/dbc/datatype/CharacterString.scala2
-rw-r--r--src/dbc/scala/dbc/datatype/Factory.scala286
-rw-r--r--src/dbc/scala/dbc/exception/IncompatibleSchema.scala6
-rw-r--r--src/dbc/scala/dbc/result/Field.scala18
-rw-r--r--src/dbc/scala/dbc/result/FieldMetadata.scala26
-rw-r--r--src/dbc/scala/dbc/result/Relation.scala34
-rw-r--r--src/dbc/scala/dbc/result/Status.scala12
-rw-r--r--src/dbc/scala/dbc/result/Tuple.scala8
-rw-r--r--src/dbc/scala/dbc/statement/AccessMode.scala16
-rw-r--r--src/dbc/scala/dbc/statement/Insert.scala26
-rw-r--r--src/dbc/scala/dbc/statement/InsertionData.scala40
-rw-r--r--src/dbc/scala/dbc/statement/IsolationLevel.scala28
-rw-r--r--src/dbc/scala/dbc/statement/Jointure.scala58
-rw-r--r--src/dbc/scala/dbc/statement/Relation.scala10
-rw-r--r--src/dbc/scala/dbc/statement/Select.scala6
-rw-r--r--src/dbc/scala/dbc/statement/SetClause.scala8
-rw-r--r--src/dbc/scala/dbc/statement/SetQuantifier.scala30
-rw-r--r--src/dbc/scala/dbc/statement/Statement.scala2
-rw-r--r--src/dbc/scala/dbc/statement/Status.scala20
-rw-r--r--src/dbc/scala/dbc/statement/Table.scala46
-rw-r--r--src/dbc/scala/dbc/statement/Transaction.scala58
-rw-r--r--src/dbc/scala/dbc/statement/Update.scala44
-rw-r--r--src/dbc/scala/dbc/statement/expression/Constant.scala12
-rw-r--r--src/dbc/scala/dbc/statement/expression/Default.scala8
-rw-r--r--src/dbc/scala/dbc/statement/expression/FunctionCall.scala24
-rw-r--r--src/dbc/scala/dbc/statement/expression/SetFunction.scala6
-rw-r--r--src/dbc/scala/dbc/statement/expression/TypeCast.scala24
-rw-r--r--src/dbc/scala/dbc/syntax/DataTypeUtil.scala150
-rw-r--r--src/dbc/scala/dbc/syntax/Database.scala26
-rw-r--r--src/dbc/scala/dbc/syntax/Statement.scala60
-rw-r--r--src/dbc/scala/dbc/syntax/StatementExpression.scala6
-rw-r--r--src/dbc/scala/dbc/value/Boolean.scala8
-rw-r--r--src/dbc/scala/dbc/value/Character.scala20
-rw-r--r--src/dbc/scala/dbc/value/CharacterLargeObject.scala20
-rw-r--r--src/dbc/scala/dbc/value/CharacterVarying.scala20
-rw-r--r--src/dbc/scala/dbc/value/Conversion.scala274
-rw-r--r--src/dbc/scala/dbc/value/ExactNumeric.scala2
-rw-r--r--src/dbc/scala/dbc/value/Factory.scala116
-rw-r--r--src/dbc/scala/dbc/value/Unknown.scala8
-rw-r--r--src/dbc/scala/dbc/vendor/PostgreSQL.scala14
43 files changed, 819 insertions, 822 deletions
diff --git a/src/dbc/scala/dbc/Database.scala b/src/dbc/scala/dbc/Database.scala
index 3dd27c8481..3167c30c71 100644
--- a/src/dbc/scala/dbc/Database.scala
+++ b/src/dbc/scala/dbc/Database.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Database.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc;
@@ -15,9 +15,8 @@ package scala.dbc;
import java.sql._;
/** A link to a database. The <code>Database</code> abstract class must
- * be specialised for every different DBMS.
- * @author Gilles Dubochet
- **/
+ * be specialised for every different DBMS.
+ * @author Gilles Dubochet **/
case class Database(dbms: Vendor) {
class Closed extends Exception {}
@@ -61,7 +60,7 @@ case class Database(dbms: Vendor) {
usedConnections = connection :: usedConnections;
lock.release;
connection;
- }
+ }
}
}
}
@@ -115,13 +114,11 @@ case class Database(dbms: Vendor) {
val sqlResult = connection.createStatement().executeQuery(statement.sqlString);
closeConnection(connection);
statement.typeCheck(this);
- }
+ }
/** Executes a statement that updates the state of the database.
- *
- * @param statusStatement The statement to execute.
- * @return The status of the database after the statement has been executed.
- */
+ * @param statusStatement The statement to execute.
+ * @return The status of the database after the statement has been executed. */
def executeStatement(statusStatement: statement.Status): result.Status[Unit] =
executeStatement(statusStatement, false);
diff --git a/src/dbc/scala/dbc/datatype/Boolean.scala b/src/dbc/scala/dbc/datatype/Boolean.scala
index c4a880885e..5a767251fa 100644
--- a/src/dbc/scala/dbc/datatype/Boolean.scala
+++ b/src/dbc/scala/dbc/datatype/Boolean.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Boolean.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.datatype;
@@ -15,17 +15,17 @@ package scala.dbc.datatype;
/** The SQL type for a truth value. */
class Boolean extends DataType {
- def isEquivalent (datatype:DataType) = datatype match {
- case dt:Boolean => true
- case _ => false
- }
+ def isEquivalent (datatype:DataType) = datatype match {
+ case dt:Boolean => true
+ case _ => false
+ }
- def isSubtypeOf (datatype:DataType) = isEquivalent(datatype);
+ def isSubtypeOf (datatype:DataType) = isEquivalent(datatype);
- type NativeType = scala.Boolean;
- val nativeTypeId = DataType.BOOLEAN;
+ type NativeType = scala.Boolean;
+ val nativeTypeId = DataType.BOOLEAN;
- /** A SQL-99 compliant string representation of the type. */
- override def sqlString: java.lang.String = "BOOLEAN";
+ /** A SQL-99 compliant string representation of the type. */
+ override def sqlString: java.lang.String = "BOOLEAN";
}
diff --git a/src/dbc/scala/dbc/datatype/CharacterLargeObject.scala b/src/dbc/scala/dbc/datatype/CharacterLargeObject.scala
index c84bb4bae9..c7afda76a5 100644
--- a/src/dbc/scala/dbc/datatype/CharacterLargeObject.scala
+++ b/src/dbc/scala/dbc/datatype/CharacterLargeObject.scala
@@ -6,26 +6,26 @@
** |/ **
\* */
-// $Id$
+// $Id:CharacterLargeObject.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.datatype;
/** A SQL type for an unbounded length string of characters with arbitrary
- * character set. */
+ * character set. */
class CharacterLargeObject extends CharacterString {
- def isEquivalent (datatype:DataType) = datatype match {
- case dt:CharacterLargeObject => {
- encoding == dt.encoding
- }
- case _ => false
- }
+ def isEquivalent (datatype:DataType) = datatype match {
+ case dt:CharacterLargeObject => {
+ encoding == dt.encoding
+ }
+ case _ => false
+ }
- def isSubtypeOf (datatype:DataType) = isEquivalent(datatype);
+ def isSubtypeOf (datatype:DataType) = isEquivalent(datatype);
- /** A SQL-99 compliant string representation of the type. */
- override def sqlString: java.lang.String = "CHARACTER LARGE OBJECT";
+ /** A SQL-99 compliant string representation of the type. */
+ override def sqlString: java.lang.String = "CHARACTER LARGE OBJECT";
}
diff --git a/src/dbc/scala/dbc/datatype/CharacterString.scala b/src/dbc/scala/dbc/datatype/CharacterString.scala
index 1f250475b3..7d58000059 100644
--- a/src/dbc/scala/dbc/datatype/CharacterString.scala
+++ b/src/dbc/scala/dbc/datatype/CharacterString.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:CharacterString.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.datatype;
diff --git a/src/dbc/scala/dbc/datatype/Factory.scala b/src/dbc/scala/dbc/datatype/Factory.scala
index a4a9672184..1487c5852c 100644
--- a/src/dbc/scala/dbc/datatype/Factory.scala
+++ b/src/dbc/scala/dbc/datatype/Factory.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Factory.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.datatype;
@@ -65,184 +65,184 @@ object Factory {
metadata.getColumnType(index) match {
/* Boolean data types. */
case BOOLEAN => new datatype.Boolean {
- override val nullable = isNullable(metadata,index);
+ override val nullable = isNullable(metadata,index);
}
case BIT => new datatype.Boolean {
- override val nullable = isNullable(metadata,index);
+ override val nullable = isNullable(metadata,index);
}
/* Fixed precision numeric data types. */
case DECIMAL => {
- Pair(bytePrecision(metadata.getPrecision(index),metadata.isSigned(index),true),metadata.getScale(index) == 0) match {
- case Pair(bp,true) if (bp <= java_lang_Integer_SIZE) =>
- new datatype.ExactNumeric[Int](DataType.INT) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 10;
- val precision = metadata.getPrecision(index);
- val signed = metadata.isSigned(index);
- val scale = metadata.getScale(index);
- }
- case Pair(bp,true) if (bp <= java_lang_Long_SIZE) =>
- new datatype.ExactNumeric[Long](DataType.LONG) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 10;
- val precision = metadata.getPrecision(index);
- val signed = metadata.isSigned(index);
- val scale = metadata.getScale(index);
- }
- case Pair(_,true) =>
- new datatype.ExactNumeric[BigInteger](DataType.BIG_INTEGER) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 10;
- val precision = metadata.getPrecision(index);
- val signed = metadata.isSigned(index);
- val scale = metadata.getScale(index);
- }
- case Pair(_,false) =>
- new datatype.ExactNumeric[BigDecimal](DataType.BIG_DECIMAL) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 10;
- val precision = metadata.getPrecision(index);
- val signed = metadata.isSigned(index);
- val scale = metadata.getScale(index);
- }
- }
+ Pair(bytePrecision(metadata.getPrecision(index),metadata.isSigned(index),true),metadata.getScale(index) == 0) match {
+ case Pair(bp,true) if (bp <= java_lang_Integer_SIZE) =>
+ new datatype.ExactNumeric[Int](DataType.INT) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 10;
+ val precision = metadata.getPrecision(index);
+ val signed = metadata.isSigned(index);
+ val scale = metadata.getScale(index);
+ }
+ case Pair(bp,true) if (bp <= java_lang_Long_SIZE) =>
+ new datatype.ExactNumeric[Long](DataType.LONG) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 10;
+ val precision = metadata.getPrecision(index);
+ val signed = metadata.isSigned(index);
+ val scale = metadata.getScale(index);
+ }
+ case Pair(_,true) =>
+ new datatype.ExactNumeric[BigInteger](DataType.BIG_INTEGER) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 10;
+ val precision = metadata.getPrecision(index);
+ val signed = metadata.isSigned(index);
+ val scale = metadata.getScale(index);
+ }
+ case Pair(_,false) =>
+ new datatype.ExactNumeric[BigDecimal](DataType.BIG_DECIMAL) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 10;
+ val precision = metadata.getPrecision(index);
+ val signed = metadata.isSigned(index);
+ val scale = metadata.getScale(index);
+ }
+ }
}
case NUMERIC => {
- Pair(bytePrecision(metadata.getPrecision(index),metadata.isSigned(index),true),metadata.getScale(index) == 0) match {
- case Pair(bp,true) if (bp <= java_lang_Integer_SIZE) =>
- new datatype.ExactNumeric[Int](DataType.INT) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 10;
- val precision = metadata.getPrecision(index);
- val signed = metadata.isSigned(index);
- val scale = metadata.getScale(index);
- }
- case Pair(bp,true) if (bp <= java_lang_Long_SIZE) =>
- new datatype.ExactNumeric[Long](DataType.LONG) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 10;
- val precision = metadata.getPrecision(index);
- val signed = metadata.isSigned(index);
- val scale = metadata.getScale(index);
- }
- case Pair(_,true) =>
- new datatype.ExactNumeric[BigInteger](DataType.BIG_INTEGER) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 10;
- val precision = metadata.getPrecision(index);
- val signed = metadata.isSigned(index);
- val scale = metadata.getScale(index);
- }
- case Pair(_,false) =>
- new datatype.ExactNumeric[BigDecimal](DataType.BIG_DECIMAL) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 10;
- val precision = metadata.getPrecision(index);
- val signed = metadata.isSigned(index);
- val scale = metadata.getScale(index);
- }
- }
+ Pair(bytePrecision(metadata.getPrecision(index),metadata.isSigned(index),true),metadata.getScale(index) == 0) match {
+ case Pair(bp,true) if (bp <= java_lang_Integer_SIZE) =>
+ new datatype.ExactNumeric[Int](DataType.INT) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 10;
+ val precision = metadata.getPrecision(index);
+ val signed = metadata.isSigned(index);
+ val scale = metadata.getScale(index);
+ }
+ case Pair(bp,true) if (bp <= java_lang_Long_SIZE) =>
+ new datatype.ExactNumeric[Long](DataType.LONG) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 10;
+ val precision = metadata.getPrecision(index);
+ val signed = metadata.isSigned(index);
+ val scale = metadata.getScale(index);
+ }
+ case Pair(_,true) =>
+ new datatype.ExactNumeric[BigInteger](DataType.BIG_INTEGER) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 10;
+ val precision = metadata.getPrecision(index);
+ val signed = metadata.isSigned(index);
+ val scale = metadata.getScale(index);
+ }
+ case Pair(_,false) =>
+ new datatype.ExactNumeric[BigDecimal](DataType.BIG_DECIMAL) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 10;
+ val precision = metadata.getPrecision(index);
+ val signed = metadata.isSigned(index);
+ val scale = metadata.getScale(index);
+ }
+ }
}
/* Fixed precision integer data types. */
case BIGINT =>
- new datatype.ExactNumeric[Long](DataType.LONG) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 2;
- val precision = 64;
- val signed = metadata.isSigned(index);
- val scale = 0;
- }
+ new datatype.ExactNumeric[Long](DataType.LONG) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 2;
+ val precision = 64;
+ val signed = metadata.isSigned(index);
+ val scale = 0;
+ }
case INTEGER =>
- new datatype.ExactNumeric[Int](DataType.INT) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 2;
- val precision = 32;
- val signed = metadata.isSigned(index);
- val scale = 0;
- }
+ new datatype.ExactNumeric[Int](DataType.INT) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 2;
+ val precision = 32;
+ val signed = metadata.isSigned(index);
+ val scale = 0;
+ }
case SMALLINT =>
- new datatype.ExactNumeric[Short](DataType.SHORT) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 2;
- val precision = 16;
- val signed = metadata.isSigned(index);
- val scale = 0;
- }
+ new datatype.ExactNumeric[Short](DataType.SHORT) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 2;
+ val precision = 16;
+ val signed = metadata.isSigned(index);
+ val scale = 0;
+ }
case TINYINT =>
- new datatype.ExactNumeric[Byte](DataType.BYTE) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 2;
- val precision = 8;
- val signed = metadata.isSigned(index);
- val scale = 0;
- }
+ new datatype.ExactNumeric[Byte](DataType.BYTE) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 2;
+ val precision = 8;
+ val signed = metadata.isSigned(index);
+ val scale = 0;
+ }
/* Floating point numeric data types. */
case REAL =>
- new datatype.ApproximateNumeric[Float](DataType.FLOAT) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 2;
- val precision = 64;
- val signed = metadata.isSigned(index);
- }
+ new datatype.ApproximateNumeric[Float](DataType.FLOAT) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 2;
+ val precision = 64;
+ val signed = metadata.isSigned(index);
+ }
case DOUBLE =>
- new datatype.ApproximateNumeric[Double](DataType.DOUBLE) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 2;
- val precision = 128;
- val signed = metadata.isSigned(index);
- }
+ new datatype.ApproximateNumeric[Double](DataType.DOUBLE) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 2;
+ val precision = 128;
+ val signed = metadata.isSigned(index);
+ }
case FLOAT =>
- new datatype.ApproximateNumeric[Double](DataType.DOUBLE) {
- override val nullable = isNullable(metadata,index);
- val precisionRadix = 2;
- val precision = 128;
- val signed = metadata.isSigned(index);
- }
+ new datatype.ApproximateNumeric[Double](DataType.DOUBLE) {
+ override val nullable = isNullable(metadata,index);
+ val precisionRadix = 2;
+ val precision = 128;
+ val signed = metadata.isSigned(index);
+ }
/* Character string data types. */
case CHAR => new datatype.Character {
- override val nullable = isNullable(metadata,index);
- val length = metadata.getColumnDisplaySize(index);
+ override val nullable = isNullable(metadata,index);
+ val length = metadata.getColumnDisplaySize(index);
}
case CLOB => new datatype.CharacterLargeObject {
- override val nullable = isNullable(metadata,index);
+ override val nullable = isNullable(metadata,index);
}
case LONGVARCHAR => {
- if (metadata.getColumnDisplaySize(index) >= 0)
- new datatype.CharacterVarying {
- override val nullable = isNullable(metadata,index);
- def length = metadata.getColumnDisplaySize(index);
- }
- else // A PostgreSQL Hack
- new datatype.CharacterLargeObject {
- override val nullable = isNullable(metadata,index);
- }
+ if (metadata.getColumnDisplaySize(index) >= 0)
+ new datatype.CharacterVarying {
+ override val nullable = isNullable(metadata,index);
+ def length = metadata.getColumnDisplaySize(index);
+ }
+ else // A PostgreSQL Hack
+ new datatype.CharacterLargeObject {
+ override val nullable = isNullable(metadata,index);
+ }
}
case VARCHAR => {
- if (metadata.getColumnDisplaySize(index) >= 0)
- new datatype.CharacterVarying {
- override val nullable = isNullable(metadata,index);
- def length = metadata.getColumnDisplaySize(index);
- }
- else // A PostgreSQL Hack
- new datatype.CharacterLargeObject {
- override val nullable = isNullable(metadata,index);
- }
+ if (metadata.getColumnDisplaySize(index) >= 0)
+ new datatype.CharacterVarying {
+ override val nullable = isNullable(metadata,index);
+ def length = metadata.getColumnDisplaySize(index);
+ }
+ else // A PostgreSQL Hack
+ new datatype.CharacterLargeObject {
+ override val nullable = isNullable(metadata,index);
+ }
}
/* Undefined cases. */
case OTHER => new datatype.Unknown {
- override val nullable = isNullable(metadata, index);
+ override val nullable = isNullable(metadata, index);
}
/* Unsupported data types. */
case REF | ARRAY | STRUCT =>
- error ("I don't support composite data types yet.");
+ error ("I don't support composite data types yet.");
case DATALINK | DISTINCT | JAVA_OBJECT | NULL =>
- error ("I won't support strange data types.");
+ error ("I won't support strange data types.");
/* Unsupported binary string data types. */
case BINARY | BLOB | LONGVARBINARY | VARBINARY =>
- error ("I don't support binary string data types yet.");
+ error ("I don't support binary string data types yet.");
/* Unsupported date and time data types. */
case DATE | TIME | TIMESTAMP =>
- error ("I don't support date and time data types yet.");
+ error ("I don't support date and time data types yet.");
/* Default case */
case x => error ("I don't know about this ("+metadata.getColumnTypeName(index)+") JDBC type.")
}
diff --git a/src/dbc/scala/dbc/exception/IncompatibleSchema.scala b/src/dbc/scala/dbc/exception/IncompatibleSchema.scala
index bb566ff6f2..8e167b2699 100644
--- a/src/dbc/scala/dbc/exception/IncompatibleSchema.scala
+++ b/src/dbc/scala/dbc/exception/IncompatibleSchema.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:IncompatibleSchema.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.exception;
@@ -14,6 +14,6 @@ package scala.dbc.exception;
/** A type category for all SQL types that store constant-precision numbers. */
case class IncompatibleSchema (
- expectedSchema: List[DataType],
- foundSchema: List[DataType]
+ expectedSchema: List[DataType],
+ foundSchema: List[DataType]
) extends Exception;
diff --git a/src/dbc/scala/dbc/result/Field.scala b/src/dbc/scala/dbc/result/Field.scala
index 75c9898076..5fc8be17ea 100644
--- a/src/dbc/scala/dbc/result/Field.scala
+++ b/src/dbc/scala/dbc/result/Field.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Field.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.result;
@@ -24,28 +24,28 @@ abstract class Field {
def content: Value;
final def value[Type <: Value]: Type =
- content.asInstanceOf[Type];
+ content.asInstanceOf[Type];
final def exactNumericValue[NativeType] =
- content.asInstanceOf[dbc.value.ExactNumeric[NativeType]];
+ content.asInstanceOf[dbc.value.ExactNumeric[NativeType]];
final def approximateNumericValue[NativeType] =
- content.asInstanceOf[dbc.value.ApproximateNumeric[NativeType]];
+ content.asInstanceOf[dbc.value.ApproximateNumeric[NativeType]];
final def booleanValue =
- content.asInstanceOf[dbc.value.Boolean];
+ content.asInstanceOf[dbc.value.Boolean];
final def characterValue =
- content.asInstanceOf[dbc.value.Character];
+ content.asInstanceOf[dbc.value.Character];
final def characterLargeObjectValue =
- content.asInstanceOf[dbc.value.CharacterLargeObject];
+ content.asInstanceOf[dbc.value.CharacterLargeObject];
final def characterVaryingValue =
- content.asInstanceOf[dbc.value.CharacterVarying];
+ content.asInstanceOf[dbc.value.CharacterVarying];
final def unknownValue =
- content.asInstanceOf[dbc.value.Unknown];
+ content.asInstanceOf[dbc.value.Unknown];
/** The tuple that contains this field. */
def originatingTuple: Tuple;
diff --git a/src/dbc/scala/dbc/result/FieldMetadata.scala b/src/dbc/scala/dbc/result/FieldMetadata.scala
index a3117a262c..a3420eb7d6 100644
--- a/src/dbc/scala/dbc/result/FieldMetadata.scala
+++ b/src/dbc/scala/dbc/result/FieldMetadata.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:FieldMetadata.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.result;
@@ -15,22 +15,22 @@ package scala.dbc.result;
/** Informations attached to a field about its content and its relationship to the originating database. */
abstract class FieldMetadata {
- /** The name of the field. */
- def name: String;
+ /** The name of the field. */
+ def name: String;
- /** The index of the field in the tuple. */
- def index: Int;
+ /** The index of the field in the tuple. */
+ def index: Int;
- /** The expected type of the field. This information is used for automatic transformation of the field value into a usable type. */
- def datatype: DataType;
+ /** The expected type of the field. This information is used for automatic transformation of the field value into a usable type. */
+ def datatype: DataType;
- /** The name of the catalog in the database from which the field originates */
- def catalog: String;
+ /** The name of the catalog in the database from which the field originates */
+ def catalog: String;
- /** The name of the schema in the database from which the field originates */
- def schema: String;
+ /** The name of the schema in the database from which the field originates */
+ def schema: String;
- /** The name of the table in the database from which the field originates */
- def table: String;
+ /** The name of the table in the database from which the field originates */
+ def table: String;
}
diff --git a/src/dbc/scala/dbc/result/Relation.scala b/src/dbc/scala/dbc/result/Relation.scala
index 218f8ff825..aaefdf095c 100644
--- a/src/dbc/scala/dbc/result/Relation.scala
+++ b/src/dbc/scala/dbc/result/Relation.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Relation.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.result;
@@ -29,12 +29,12 @@ abstract class Relation extends Object with Iterable[Tuple] {
def metadata: List[FieldMetadata] =
for (val count <- List.range(1, sqlMetadata.getColumnCount()+1)) yield
new FieldMetadata {
- val name: String = sqlMetadata.getColumnName(count);
- val index: Int = count;
- val datatype: DataType = dbc.datatype.Factory.create(sqlMetadata,count);
- val catalog: String = sqlMetadata.getCatalogName(count);
- val schema: String = sqlMetadata.getSchemaName(count);
- val table: String = sqlMetadata.getTableName(count);
+ val name: String = sqlMetadata.getColumnName(count);
+ val index: Int = count;
+ val datatype: DataType = dbc.datatype.Factory.create(sqlMetadata,count);
+ val catalog: String = sqlMetadata.getCatalogName(count);
+ val schema: String = sqlMetadata.getSchemaName(count);
+ val table: String = sqlMetadata.getTableName(count);
}
/** Metadata about the field at the given index. If there is no such
@@ -56,16 +56,16 @@ abstract class Relation extends Object with Iterable[Tuple] {
def hasNext: Boolean = !(result.isLast());
def next: Tuple = {
if (result.next()) {
- new Tuple {
- val me = this;
- val originatingRelation = Relation.this;
- val fields: List[Field] = for (val fieldMetadata <- metadata) yield
- new Field {
- val metadata = fieldMetadata;
- val content = dbc.value.Factory.create(result,metadata.index,metadata.datatype);
- val originatingTuple = me;
- }
- }
+ new Tuple {
+ val me = this;
+ val originatingRelation = Relation.this;
+ val fields: List[Field] = for (val fieldMetadata <- metadata) yield
+ new Field {
+ val metadata = fieldMetadata;
+ val content = dbc.value.Factory.create(result,metadata.index,metadata.datatype);
+ val originatingTuple = me;
+ }
+ }
} else error("next on empty iterator")
}
}
diff --git a/src/dbc/scala/dbc/result/Status.scala b/src/dbc/scala/dbc/result/Status.scala
index c8a2370819..c59bc2813c 100644
--- a/src/dbc/scala/dbc/result/Status.scala
+++ b/src/dbc/scala/dbc/result/Status.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Status.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.result;
@@ -17,12 +17,12 @@ import scala.dbc.datatype._;
/** An object containing the status of a query */
abstract class Status[ResultType] {
- /** The statement that generated this status result. */
- def statement: scala.dbc.statement.Statement;
+ /** The statement that generated this status result. */
+ def statement: scala.dbc.statement.Statement;
- /** The number of elements modified or added by this statement. */
- def touchedCount: Option[Int];
+ /** The number of elements modified or added by this statement. */
+ def touchedCount: Option[Int];
- def result: ResultType;
+ def result: ResultType;
}
diff --git a/src/dbc/scala/dbc/result/Tuple.scala b/src/dbc/scala/dbc/result/Tuple.scala
index 6ed8955951..985df83624 100644
--- a/src/dbc/scala/dbc/result/Tuple.scala
+++ b/src/dbc/scala/dbc/result/Tuple.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Tuple.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.result;
@@ -24,10 +24,10 @@ abstract class Tuple {
/** The field at the given index. If there is no such field (that is the index is out of bounds), <code>None</code> is returned instead. */
def apply (index:Int): Field =
try {
- fields(index)
+ fields(index)
} catch {
- case e =>
- throw new java.lang.IndexOutOfBoundsException("Field at index "+index+" does not exist in relation");
+ case e =>
+ throw new java.lang.IndexOutOfBoundsException("Field at index "+index+" does not exist in relation");
}
/** The field with the given column name. If there is no such field, <code>None</code> is returned instead. */
diff --git a/src/dbc/scala/dbc/statement/AccessMode.scala b/src/dbc/scala/dbc/statement/AccessMode.scala
index 16f778b35e..d6b45ea9bc 100644
--- a/src/dbc/scala/dbc/statement/AccessMode.scala
+++ b/src/dbc/scala/dbc/statement/AccessMode.scala
@@ -6,21 +6,21 @@
** |/ **
\* */
-// $Id$
+// $Id:AccessMode.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
abstract class AccessMode {
- def sqlString: String;
+ def sqlString: String;
}
object AccessMode {
- case object ReadOnly extends AccessMode {
- def sqlString = "READ ONLY";
- }
- case object ReadWrite extends AccessMode {
- def sqlString = "READ WRITE"
- }
+ case object ReadOnly extends AccessMode {
+ def sqlString = "READ ONLY";
+ }
+ case object ReadWrite extends AccessMode {
+ def sqlString = "READ WRITE"
+ }
}
diff --git a/src/dbc/scala/dbc/statement/Insert.scala b/src/dbc/scala/dbc/statement/Insert.scala
index 19d236d2fb..7e5ce777d8 100644
--- a/src/dbc/scala/dbc/statement/Insert.scala
+++ b/src/dbc/scala/dbc/statement/Insert.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Insert.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -16,21 +16,21 @@ import scala.dbc.statement.expression._;
/** An insertion of values into a table. */
case class Insert (
- insertionTarget: String,
- insertionData: InsertionData
+ insertionTarget: String,
+ insertionData: InsertionData
) extends Status {
- /** A SQL-99 compliant string representation of the select statement. */
- def sqlString: String = (
- "INSERT INTO " +
- insertionTarget +
- " " + insertionData.sqlString
- );
+ /** A SQL-99 compliant string representation of the select statement. */
+ def sqlString: String = (
+ "INSERT INTO " +
+ insertionTarget +
+ " " + insertionData.sqlString
+ );
- /** The name of the table where the data should be added. */
- //def insertionTarget: String;
+ /** The name of the table where the data should be added. */
+ //def insertionTarget: String;
- /** The data that will be added tot he table. */
- //def insertionData: InsertionData;
+ /** The data that will be added tot he table. */
+ //def insertionData: InsertionData;
}
diff --git a/src/dbc/scala/dbc/statement/InsertionData.scala b/src/dbc/scala/dbc/statement/InsertionData.scala
index c36dde0fb7..cc9a225ad2 100644
--- a/src/dbc/scala/dbc/statement/InsertionData.scala
+++ b/src/dbc/scala/dbc/statement/InsertionData.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:InsertionData.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -16,26 +16,26 @@ import scala.dbc.statement.expression._;
/** Data to be inserted into a table in an <code>Insert</code>. */
abstract class InsertionData {
- def sqlString: String;
+ def sqlString: String;
}
object InsertionData {
- /** Insertion of data resulting from a query on the database. */
- case class Subquery (query:Relation) extends InsertionData {
- def sqlString = query.sqlString;
- }
- /** Insertion of data as explicitly defined values. */
- case class Constructor (
- columnNames:Option[List[String]],
- columnValues:List[Expression]
- ) extends InsertionData {
- def sqlString = (
- (columnNames match {
- case None => ""
- case Some(cn) => cn.mkString(" (",", ",")")
- }) +
- " VALUES" +
- columnValues.map(e=>e.sqlInnerString).mkString(" (",", ",")")
- )
- }
+ /** Insertion of data resulting from a query on the database. */
+ case class Subquery (query:Relation) extends InsertionData {
+ def sqlString = query.sqlString;
+ }
+ /** Insertion of data as explicitly defined values. */
+ case class Constructor (
+ columnNames:Option[List[String]],
+ columnValues:List[Expression]
+ ) extends InsertionData {
+ def sqlString = (
+ (columnNames match {
+ case None => ""
+ case Some(cn) => cn.mkString(" (",", ",")")
+ }) +
+ " VALUES" +
+ columnValues.map(e=>e.sqlInnerString).mkString(" (",", ",")")
+ )
+ }
}
diff --git a/src/dbc/scala/dbc/statement/IsolationLevel.scala b/src/dbc/scala/dbc/statement/IsolationLevel.scala
index 4d1d2ef2de..92cead7c51 100644
--- a/src/dbc/scala/dbc/statement/IsolationLevel.scala
+++ b/src/dbc/scala/dbc/statement/IsolationLevel.scala
@@ -6,27 +6,27 @@
** |/ **
\* */
-// $Id$
+// $Id:IsolationLevel.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
abstract class IsolationLevel {
- def sqlString: String;
+ def sqlString: String;
}
object IsolationLevel {
- case object ReadUncommitted extends IsolationLevel {
- def sqlString = "ISOLATION LEVEL READ UNCOMMITTED"
- }
- case object ReadCommitted extends IsolationLevel {
- def sqlString = "ISOLATION LEVEL READ COMMITTED"
- }
- case object RepeatableRead extends IsolationLevel {
- def sqlString = "ISOLATION LEVEL REPEATABLE READ"
- }
- case object Serializable extends IsolationLevel {
- def sqlString = "ISOLATION LEVEL SERIALIZABLE"
- }
+ case object ReadUncommitted extends IsolationLevel {
+ def sqlString = "ISOLATION LEVEL READ UNCOMMITTED"
+ }
+ case object ReadCommitted extends IsolationLevel {
+ def sqlString = "ISOLATION LEVEL READ COMMITTED"
+ }
+ case object RepeatableRead extends IsolationLevel {
+ def sqlString = "ISOLATION LEVEL REPEATABLE READ"
+ }
+ case object Serializable extends IsolationLevel {
+ def sqlString = "ISOLATION LEVEL SERIALIZABLE"
+ }
}
diff --git a/src/dbc/scala/dbc/statement/Jointure.scala b/src/dbc/scala/dbc/statement/Jointure.scala
index 471626ab05..71fc610dcb 100644
--- a/src/dbc/scala/dbc/statement/Jointure.scala
+++ b/src/dbc/scala/dbc/statement/Jointure.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Jointure.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -15,33 +15,33 @@ package scala.dbc.statement;
/** A jointure between two relations. */
abstract class Jointure extends Relation {
- /** The relation on the left part of the join. */
- def leftRelation: Relation;
-
- /** The relation on the right part of the join. */
- def rightRelation: Relation;
-
- /** The type of the jointure. */
- def joinType: JoinType;
-
- /** The condition on which the jointure needs be done. */
- def joinCondition: Option[Expression];
-
- /** A SQL-99 compliant string representation of the relation statement. */
- def sqlString: String = {
- "SELECT * FROM " + sqlInnerString
- }
-
- /** A SQL-99 compliant string representation of the relation sub-
- * statement. This only has a meaning inside a query. */
- def sqlInnerString: String = (
- leftRelation.sqlInnerString + " " +
- joinType.sqlString + " " +
- rightRelation.sqlInnerString +
- (joinCondition match {
- case Some(jc) => jc.sqlString
- case None => ""
- })
- )
+ /** The relation on the left part of the join. */
+ def leftRelation: Relation;
+
+ /** The relation on the right part of the join. */
+ def rightRelation: Relation;
+
+ /** The type of the jointure. */
+ def joinType: JoinType;
+
+ /** The condition on which the jointure needs be done. */
+ def joinCondition: Option[Expression];
+
+ /** A SQL-99 compliant string representation of the relation statement. */
+ def sqlString: String = {
+ "SELECT * FROM " + sqlInnerString
+ }
+
+ /** A SQL-99 compliant string representation of the relation sub-
+ * statement. This only has a meaning inside a query. */
+ def sqlInnerString: String = (
+ leftRelation.sqlInnerString + " " +
+ joinType.sqlString + " " +
+ rightRelation.sqlInnerString +
+ (joinCondition match {
+ case Some(jc) => jc.sqlString
+ case None => ""
+ })
+ )
}
diff --git a/src/dbc/scala/dbc/statement/Relation.scala b/src/dbc/scala/dbc/statement/Relation.scala
index d6e86b39a5..31f745abc3 100644
--- a/src/dbc/scala/dbc/statement/Relation.scala
+++ b/src/dbc/scala/dbc/statement/Relation.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Relation.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -20,12 +20,12 @@ abstract class Relation extends Statement {
def typeCheck (relation: result.Relation): Unit = {
val sameType: Boolean = (
- relation.metadata.length == fieldTypes.length &&
- (relation.metadata.zip(fieldTypes).forall({case Pair(field,expectedType) =>
- isCompatibleType(field.datatype, expectedType)}))
+ relation.metadata.length == fieldTypes.length &&
+ (relation.metadata.zip(fieldTypes).forall({case Pair(field,expectedType) =>
+ isCompatibleType(field.datatype, expectedType)}))
);
if (!sameType)
- throw new exception.IncompatibleSchema(fieldTypes,relation.metadata.map(field=>field.datatype));
+ throw new exception.IncompatibleSchema(fieldTypes,relation.metadata.map(field=>field.datatype));
}
def fieldTypes: List[DataType];
diff --git a/src/dbc/scala/dbc/statement/Select.scala b/src/dbc/scala/dbc/statement/Select.scala
index 4da6b9e571..1d1fa64233 100644
--- a/src/dbc/scala/dbc/statement/Select.scala
+++ b/src/dbc/scala/dbc/statement/Select.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Select.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -75,8 +75,8 @@ abstract class Select extends Relation {
(groupByClause match {
case None => ""
case Some(gbl) => gbl match {
- case Nil => error("Empty group by clause is not allowed")
- case _ =>
+ case Nil => error("Empty group by clause is not allowed")
+ case _ =>
(" GROUP BY " +
gbl.tail.foldLeft(gbl.head.sqlInnerString)
((name:String, gb) => name + ", " + gb.sqlInnerString))
diff --git a/src/dbc/scala/dbc/statement/SetClause.scala b/src/dbc/scala/dbc/statement/SetClause.scala
index e6a55ae846..dd25d2fef9 100644
--- a/src/dbc/scala/dbc/statement/SetClause.scala
+++ b/src/dbc/scala/dbc/statement/SetClause.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:SetClause.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -16,7 +16,7 @@ import scala.dbc.statement.expression._;
/** Data to be inserted into a table in an <code>Insert</code>. */
case class SetClause (name:String, expr:Expression) {
- val value: Pair[String,Expression] = Pair(name,expr);
- def sqlString: String =
- value._1 + " = " + value._2.sqlInnerString;
+ val value: Pair[String,Expression] = Pair(name,expr);
+ def sqlString: String =
+ value._1 + " = " + value._2.sqlInnerString;
}
diff --git a/src/dbc/scala/dbc/statement/SetQuantifier.scala b/src/dbc/scala/dbc/statement/SetQuantifier.scala
index ad7c2238c8..d1a9cfb7a2 100644
--- a/src/dbc/scala/dbc/statement/SetQuantifier.scala
+++ b/src/dbc/scala/dbc/statement/SetQuantifier.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:SetQuantifier.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -14,21 +14,21 @@ package scala.dbc.statement;
/** A set quantifier that defines the collection type of a relation. */
abstract class SetQuantifier {
- /** A SQL-99 compliant string representation of the set quantifier. */
- def sqlString: String;
+ /** A SQL-99 compliant string representation of the set quantifier. */
+ def sqlString: String;
}
object SetQuantifier {
- /** A set quantifier that defines a relation as being a bag. That means
- * that duplicates are allowed. */
- case object AllTuples extends SetQuantifier {
- /** A SQL-99 compliant string representation of the set quantifier. */
- def sqlString: String = "ALL";
- }
- /** A set quantifier that defines a relation as being a set. That means
- * that duplicates are not allowed and will be pruned. */
- case object DistinctTuples extends SetQuantifier {
- /** A SQL-99 compliant string representation of the set quantifier. */
- def sqlString: String = "DISTINCT";
- }
+ /** A set quantifier that defines a relation as being a bag. That means
+ * that duplicates are allowed. */
+ case object AllTuples extends SetQuantifier {
+ /** A SQL-99 compliant string representation of the set quantifier. */
+ def sqlString: String = "ALL";
+ }
+ /** A set quantifier that defines a relation as being a set. That means
+ * that duplicates are not allowed and will be pruned. */
+ case object DistinctTuples extends SetQuantifier {
+ /** A SQL-99 compliant string representation of the set quantifier. */
+ def sqlString: String = "DISTINCT";
+ }
}
diff --git a/src/dbc/scala/dbc/statement/Statement.scala b/src/dbc/scala/dbc/statement/Statement.scala
index 5c78b075b7..f26e9b8654 100644
--- a/src/dbc/scala/dbc/statement/Statement.scala
+++ b/src/dbc/scala/dbc/statement/Statement.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Statement.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
diff --git a/src/dbc/scala/dbc/statement/Status.scala b/src/dbc/scala/dbc/statement/Status.scala
index 3065ec5f7a..9835b29e7f 100644
--- a/src/dbc/scala/dbc/statement/Status.scala
+++ b/src/dbc/scala/dbc/statement/Status.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Status.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -15,16 +15,16 @@ package scala.dbc.statement;
/** A statement that changes the status of the database. */
abstract class Status extends Statement {
- /** A SQL-99 compliant string representation of the statement. */
- def sqlString: String;
+ /** A SQL-99 compliant string representation of the statement. */
+ def sqlString: String;
- /** Executes the statement on the given database. */
- def execute (database: scala.dbc.Database): scala.dbc.result.Status[Unit] = {
- database.executeStatement(this);
- }
+ /** Executes the statement on the given database. */
+ def execute (database: scala.dbc.Database): scala.dbc.result.Status[Unit] = {
+ database.executeStatement(this);
+ }
- def execute (database: scala.dbc.Database, debug: Boolean): scala.dbc.result.Status[Unit] = {
- database.executeStatement(this,debug);
- }
+ def execute (database: scala.dbc.Database, debug: Boolean): scala.dbc.result.Status[Unit] = {
+ database.executeStatement(this,debug);
+ }
}
diff --git a/src/dbc/scala/dbc/statement/Table.scala b/src/dbc/scala/dbc/statement/Table.scala
index 17015a6c73..9c09eec1bd 100644
--- a/src/dbc/scala/dbc/statement/Table.scala
+++ b/src/dbc/scala/dbc/statement/Table.scala
@@ -6,35 +6,35 @@
** |/ **
\* */
-// $Id$
+// $Id:Table.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
/** A reference to a table in the database.
- * @author Gilles Dubochet
- * @version 1.0 */
+ * @author Gilles Dubochet
+ * @version 1.0 */
abstract class Table extends Relation {
- /** The name of the table in the database. */
- def tableName: String;
-
- /** The name that the table will be called in the enclosing statement. */
- def tableRename: Option[String];
-
- /** A SQL-99 compliant string representation of the relation statement. */
- def sqlString: String = {
- "SELECT * FROM " + tableName
- }
-
- /** A SQL-99 compliant string representation of the relation sub-
- * statement. This only has a meaning inside a query. */
- def sqlInnerString: String = (
- tableName +
- (tableRename match {
- case None => ""
- case Some(rename) => " AS " + rename
- })
- )
+ /** The name of the table in the database. */
+ def tableName: String;
+
+ /** The name that the table will be called in the enclosing statement. */
+ def tableRename: Option[String];
+
+ /** A SQL-99 compliant string representation of the relation statement. */
+ def sqlString: String = {
+ "SELECT * FROM " + tableName
+ }
+
+ /** A SQL-99 compliant string representation of the relation sub-
+ * statement. This only has a meaning inside a query. */
+ def sqlInnerString: String = (
+ tableName +
+ (tableRename match {
+ case None => ""
+ case Some(rename) => " AS " + rename
+ })
+ )
}
diff --git a/src/dbc/scala/dbc/statement/Transaction.scala b/src/dbc/scala/dbc/statement/Transaction.scala
index a802aa82fa..9006d38204 100644
--- a/src/dbc/scala/dbc/statement/Transaction.scala
+++ b/src/dbc/scala/dbc/statement/Transaction.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Transaction.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -14,42 +14,42 @@ package scala.dbc.statement;
/** A statement that changes the status of the database. */
case class Transaction [ResultType] (
- transactionBody: (scala.dbc.Database=>ResultType),
- accessMode: Option[AccessMode],
- isolationLevel: Option[IsolationLevel]
+ transactionBody: (scala.dbc.Database=>ResultType),
+ accessMode: Option[AccessMode],
+ isolationLevel: Option[IsolationLevel]
) extends Statement {
- /** A SQL-99 compliant string representation of the statement. */
- def sqlStartString: String = (
- "START TRANSACTION" +
- (Pair(accessMode,isolationLevel) match {
- case Pair(None,None) => ""
- case Pair(Some(am),None) => " " + am.sqlString
- case Pair(None,Some(il)) => " " + il.sqlString
- case Pair(Some(am),Some(il)) => " " + am.sqlString + ", " + il.sqlString
- })
- );
+ /** A SQL-99 compliant string representation of the statement. */
+ def sqlStartString: String = (
+ "START TRANSACTION" +
+ (Pair(accessMode,isolationLevel) match {
+ case Pair(None,None) => ""
+ case Pair(Some(am),None) => " " + am.sqlString
+ case Pair(None,Some(il)) => " " + il.sqlString
+ case Pair(Some(am),Some(il)) => " " + am.sqlString + ", " + il.sqlString
+ })
+ );
- def sqlCommitString: String = {
- "COMMIT"
- }
+ def sqlCommitString: String = {
+ "COMMIT"
+ }
- def sqlAbortString: String = {
- "ROLLBACK"
- }
+ def sqlAbortString: String = {
+ "ROLLBACK"
+ }
- //def transactionBody: (()=>Unit);
+ //def transactionBody: (()=>Unit);
- //def accessMode: Option[AccessMode];
+ //def accessMode: Option[AccessMode];
- //def isolationLevel: Option[IsolationLevel];
+ //def isolationLevel: Option[IsolationLevel];
- def execute (database: scala.dbc.Database): scala.dbc.result.Status[ResultType] = {
- database.executeStatement(this);
- }
+ def execute (database: scala.dbc.Database): scala.dbc.result.Status[ResultType] = {
+ database.executeStatement(this);
+ }
- def execute (database: scala.dbc.Database, debug: Boolean): scala.dbc.result.Status[ResultType] = {
- database.executeStatement(this,debug);
- }
+ def execute (database: scala.dbc.Database, debug: Boolean): scala.dbc.result.Status[ResultType] = {
+ database.executeStatement(this,debug);
+ }
}
diff --git a/src/dbc/scala/dbc/statement/Update.scala b/src/dbc/scala/dbc/statement/Update.scala
index cf8a3c9b6f..ecf2b12261 100644
--- a/src/dbc/scala/dbc/statement/Update.scala
+++ b/src/dbc/scala/dbc/statement/Update.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Update.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement;
@@ -16,32 +16,32 @@ import scala.dbc.statement.expression._;
/** An update of the state of a table. */
case class Update (
- updateTarget: String,
- setClauses: List[SetClause],
- whereClause: Option[Expression]
+ updateTarget: String,
+ setClauses: List[SetClause],
+ whereClause: Option[Expression]
) extends Status {
- /** A SQL-99 compliant string representation of the select statement. */
- def sqlString: String = (
- "UPDATE " +
- updateTarget +
- " SET " + setClauses.map(sc=>sc.sqlString).mkString("",", ","") +
- (whereClause match {
- case None => ""
- case Some(expr) => " WHERE " + expr.sqlString
- })
- );
+ /** A SQL-99 compliant string representation of the select statement. */
+ def sqlString: String = (
+ "UPDATE " +
+ updateTarget +
+ " SET " + setClauses.map(sc=>sc.sqlString).mkString("",", ","") +
+ (whereClause match {
+ case None => ""
+ case Some(expr) => " WHERE " + expr.sqlString
+ })
+ );
- /** The name of the table that should be updated. */
- //def updateTarget: String;
+ /** The name of the table that should be updated. */
+ //def updateTarget: String;
- /** The data that will be added tot he table. */
- //def setClauses: List[SetClause];
+ /** The data that will be added tot he table. */
+ //def setClauses: List[SetClause];
- /** Defines condition that must be true in the tuples that will be updated.
- * This value expression must return a boolean or boolean-compatible
- * value. */
- //def whereClause: Option[scala.dbc.statement.expression.Expression];
+ /** Defines condition that must be true in the tuples that will be updated.
+ * This value expression must return a boolean or boolean-compatible
+ * value. */
+ //def whereClause: Option[scala.dbc.statement.expression.Expression];
}
diff --git a/src/dbc/scala/dbc/statement/expression/Constant.scala b/src/dbc/scala/dbc/statement/expression/Constant.scala
index 6ee665c97d..b2f13cc7e8 100644
--- a/src/dbc/scala/dbc/statement/expression/Constant.scala
+++ b/src/dbc/scala/dbc/statement/expression/Constant.scala
@@ -6,17 +6,17 @@
** |/ **
\* */
-// $Id$
+// $Id:Constant.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement.expression;
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;
+ /** A SQL-99 compliant string representation of the relation sub-
+ * statement. This only has a meaning inside another statement. */
+ def sqlInnerString: String = constantValue.sqlString;
- /** The value of the constant. */
- def constantValue: Value;
+ /** The value of the constant. */
+ def constantValue: Value;
}
diff --git a/src/dbc/scala/dbc/statement/expression/Default.scala b/src/dbc/scala/dbc/statement/expression/Default.scala
index 7d03872ab5..d72712eb9e 100644
--- a/src/dbc/scala/dbc/statement/expression/Default.scala
+++ b/src/dbc/scala/dbc/statement/expression/Default.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Default.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement.expression;
@@ -14,8 +14,8 @@ package scala.dbc.statement.expression;
case object Default extends Expression {
- /** A SQL-99 compliant string representation of the relation sub-
- * statement. This only has a meaning inside another statement. */
- def sqlInnerString: String = "DEFAULT";
+ /** A SQL-99 compliant string representation of the relation sub-
+ * statement. This only has a meaning inside another statement. */
+ def sqlInnerString: String = "DEFAULT";
}
diff --git a/src/dbc/scala/dbc/statement/expression/FunctionCall.scala b/src/dbc/scala/dbc/statement/expression/FunctionCall.scala
index bfee8701dd..80556e1af9 100644
--- a/src/dbc/scala/dbc/statement/expression/FunctionCall.scala
+++ b/src/dbc/scala/dbc/statement/expression/FunctionCall.scala
@@ -6,27 +6,27 @@
** |/ **
\* */
-// $Id$
+// $Id:FunctionCall.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement.expression;
case class FunctionCall (
- functionName: String,
- arguments: List[Expression]
+ functionName: String,
+ arguments: List[Expression]
) extends Expression {
- /** A SQL-99 compliant string representation of the relation sub-
- * statement. This only has a meaning inside another statement. */
- def sqlInnerString: String = {
- functionName + "(" + arguments.mkString("",", ","") + ")"
- }
+ /** A SQL-99 compliant string representation of the relation sub-
+ * statement. This only has a meaning inside another statement. */
+ def sqlInnerString: String = {
+ functionName + "(" + arguments.mkString("",", ","") + ")"
+ }
- /** The name of the function to call. */
- //def functionName: String;
+ /** The name of the function to call. */
+ //def functionName: String;
- /** A list of all argument expressions to pass to the function, in order. */
- //def arguments: List[Expression];
+ /** A list of all argument expressions to pass to the function, in order. */
+ //def arguments: List[Expression];
}
diff --git a/src/dbc/scala/dbc/statement/expression/SetFunction.scala b/src/dbc/scala/dbc/statement/expression/SetFunction.scala
index b58850df12..0674c4107d 100644
--- a/src/dbc/scala/dbc/statement/expression/SetFunction.scala
+++ b/src/dbc/scala/dbc/statement/expression/SetFunction.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:SetFunction.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement.expression;
@@ -27,8 +27,8 @@ object SetFunction {
def sqlString = (
"(" +
(setQuantifier match {
- case None => ""
- case Some(sq) => sq.sqlString + " "
+ case None => ""
+ case Some(sq) => sq.sqlString + " "
}) +
valueExpression.sqlString + ")"
);
diff --git a/src/dbc/scala/dbc/statement/expression/TypeCast.scala b/src/dbc/scala/dbc/statement/expression/TypeCast.scala
index 5c9cbddebe..3e699a4871 100644
--- a/src/dbc/scala/dbc/statement/expression/TypeCast.scala
+++ b/src/dbc/scala/dbc/statement/expression/TypeCast.scala
@@ -6,26 +6,26 @@
** |/ **
\* */
-// $Id$
+// $Id:TypeCast.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.statement.expression;
case class TypeCast (
- expression: Expression,
- castType: DataType
+ expression: Expression,
+ castType: DataType
) extends Expression {
- /** A SQL-99 compliant string representation of the relation sub-
- * statement. This only has a meaning inside another statement. */
- def sqlInnerString: String = {
- "CAST (" + expression.sqlInnerString + " AS " + castType.sqlString + ")";
- }
+ /** A SQL-99 compliant string representation of the relation sub-
+ * statement. This only has a meaning inside another statement. */
+ def sqlInnerString: String = {
+ "CAST (" + expression.sqlInnerString + " AS " + castType.sqlString + ")";
+ }
- /** The expression that will be casted. */
- //def expression: Expression;
+ /** The expression that will be casted. */
+ //def expression: Expression;
- /** The type to which to cast. */
- //def castType: scala.dbc.datatype.DataType;
+ /** The type to which to cast. */
+ //def castType: scala.dbc.datatype.DataType;
}
diff --git a/src/dbc/scala/dbc/syntax/DataTypeUtil.scala b/src/dbc/scala/dbc/syntax/DataTypeUtil.scala
index c42efb082f..65b6f12692 100644
--- a/src/dbc/scala/dbc/syntax/DataTypeUtil.scala
+++ b/src/dbc/scala/dbc/syntax/DataTypeUtil.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:DataTypeUtil.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.syntax;
@@ -20,79 +20,79 @@ object DataTypeUtil {
final val java_lang_Integer_SIZE = 32;
final val java_lang_Long_SIZE = 64;
- def boolean = new datatype.Boolean;
- def tinyint = new datatype.ExactNumeric[Byte](dbc.DataType.BYTE) {
- val precisionRadix = 2;
- val precision = 8;
- val signed = true;
- val scale = 0;
- }
- def smallint = new datatype.ExactNumeric[Short](dbc.DataType.SHORT) {
- val precisionRadix = 2;
- val precision = 16;
- val signed = true;
- val scale = 0;
- }
- def integer = new datatype.ExactNumeric[Int](dbc.DataType.INT) {
- val precisionRadix = 2;
- val precision = 32;
- val signed = true;
- val scale = 0;
- }
- def bigint = new datatype.ExactNumeric[Long](dbc.DataType.LONG) {
- val precisionRadix = 2;
- val precision = 64;
- val signed = true;
- val scale = 0;
- }
- def numeric (_precision:Int): DataType = numeric(_precision,0);
- def numeric (_precision:Int, _scale:Int): DataType =
- Pair(datatype.Factory.bytePrecision(_precision,true,true),_scale == 0) match {
- case Pair(bp,true) if (bp <= java_lang_Integer_SIZE) =>
- new datatype.ExactNumeric[Int](DataType.INT) {
- val precisionRadix = 10;
- val precision = _precision;
- val signed = true;
- val scale = 0;
- }
- case Pair(bp,true) if (bp <= java_lang_Long_SIZE) =>
- new datatype.ExactNumeric[Long](DataType.LONG) {
- val precisionRadix = 10;
- val precision = _precision;
- val signed = true;
- val scale = 0;
- }
- case Pair(_,true) =>
- new datatype.ExactNumeric[BigInteger](DataType.BIG_INTEGER) {
- val precisionRadix = 10;
- val precision = _precision;
- val signed = true;
- val scale = 0;
- }
- case Pair(_,false) =>
- new datatype.ExactNumeric[BigDecimal](DataType.BIG_DECIMAL) {
- val precisionRadix = 10;
- val precision = _precision;
- val signed = true;
- val scale = _scale;
- }
- }
- def real = new datatype.ApproximateNumeric[Float](DataType.FLOAT) {
- val precisionRadix = 2;
- val precision = 64;
- val signed = true;
- }
- def doublePrecision = new datatype.ApproximateNumeric[Double](DataType.DOUBLE) {
- val precisionRadix = 2;
- val precision = 128;
- val signed = true;
- }
- def character (_length: Int) = new datatype.Character {
- val length = _length;
- }
- def characterVarying (_length: Int) = new datatype.CharacterVarying {
- def length = _length;
- }
- def characterLargeObject = new datatype.CharacterLargeObject;
+ def boolean = new datatype.Boolean;
+ def tinyint = new datatype.ExactNumeric[Byte](dbc.DataType.BYTE) {
+ val precisionRadix = 2;
+ val precision = 8;
+ val signed = true;
+ val scale = 0;
+ }
+ def smallint = new datatype.ExactNumeric[Short](dbc.DataType.SHORT) {
+ val precisionRadix = 2;
+ val precision = 16;
+ val signed = true;
+ val scale = 0;
+ }
+ def integer = new datatype.ExactNumeric[Int](dbc.DataType.INT) {
+ val precisionRadix = 2;
+ val precision = 32;
+ val signed = true;
+ val scale = 0;
+ }
+ def bigint = new datatype.ExactNumeric[Long](dbc.DataType.LONG) {
+ val precisionRadix = 2;
+ val precision = 64;
+ val signed = true;
+ val scale = 0;
+ }
+ def numeric (_precision:Int): DataType = numeric(_precision,0);
+ def numeric (_precision:Int, _scale:Int): DataType =
+ Pair(datatype.Factory.bytePrecision(_precision,true,true),_scale == 0) match {
+ case Pair(bp,true) if (bp <= java_lang_Integer_SIZE) =>
+ new datatype.ExactNumeric[Int](DataType.INT) {
+ val precisionRadix = 10;
+ val precision = _precision;
+ val signed = true;
+ val scale = 0;
+ }
+ case Pair(bp,true) if (bp <= java_lang_Long_SIZE) =>
+ new datatype.ExactNumeric[Long](DataType.LONG) {
+ val precisionRadix = 10;
+ val precision = _precision;
+ val signed = true;
+ val scale = 0;
+ }
+ case Pair(_,true) =>
+ new datatype.ExactNumeric[BigInteger](DataType.BIG_INTEGER) {
+ val precisionRadix = 10;
+ val precision = _precision;
+ val signed = true;
+ val scale = 0;
+ }
+ case Pair(_,false) =>
+ new datatype.ExactNumeric[BigDecimal](DataType.BIG_DECIMAL) {
+ val precisionRadix = 10;
+ val precision = _precision;
+ val signed = true;
+ val scale = _scale;
+ }
+ }
+ def real = new datatype.ApproximateNumeric[Float](DataType.FLOAT) {
+ val precisionRadix = 2;
+ val precision = 64;
+ val signed = true;
+ }
+ def doublePrecision = new datatype.ApproximateNumeric[Double](DataType.DOUBLE) {
+ val precisionRadix = 2;
+ val precision = 128;
+ val signed = true;
+ }
+ def character (_length: Int) = new datatype.Character {
+ val length = _length;
+ }
+ def characterVarying (_length: Int) = new datatype.CharacterVarying {
+ def length = _length;
+ }
+ def characterLargeObject = new datatype.CharacterLargeObject;
}
diff --git a/src/dbc/scala/dbc/syntax/Database.scala b/src/dbc/scala/dbc/syntax/Database.scala
index 31a04b1129..a9e1a75427 100644
--- a/src/dbc/scala/dbc/syntax/Database.scala
+++ b/src/dbc/scala/dbc/syntax/Database.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Database.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.syntax;
@@ -16,18 +16,18 @@ import java.net.URI;
object Database {
- def database (server:String, username:String, password:String): dbc.Database = {
- val uri = new URI(server);
- // Java 1.5 if (uri.toString().contains("postgres")) {
+ def database (server:String, username:String, password:String): dbc.Database = {
+ val uri = new URI(server);
+ // Java 1.5 if (uri.toString().contains("postgres")) {
if (uri.toString().indexOf("postgres") != -1) {
- new dbc.Database(new vendor.PostgreSQL {
- val uri = new URI(server);
- val user = username;
- val pass = password;
- })
- } else {
- throw new Exception("No DBMS vendor support could be found for the given URI");
- }
- }
+ new dbc.Database(new vendor.PostgreSQL {
+ val uri = new URI(server);
+ val user = username;
+ val pass = password;
+ })
+ } else {
+ throw new Exception("No DBMS vendor support could be found for the given URI");
+ }
+ }
}
diff --git a/src/dbc/scala/dbc/syntax/Statement.scala b/src/dbc/scala/dbc/syntax/Statement.scala
index 027a05b8fc..26b2a3dfa9 100644
--- a/src/dbc/scala/dbc/syntax/Statement.scala
+++ b/src/dbc/scala/dbc/syntax/Statement.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Statement.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.syntax;
@@ -84,10 +84,10 @@ object Statement {
def and (sdc:SelectDerivedColumns): SelectDerivedColumns = new SelectDerivedColumns {
val selectList = SelectDerivedColumns.this.selectList ::: sdc.selectList;
val selectTypes =
- if (SelectDerivedColumns.this.selectTypes.isEmpty | sdc.selectTypes.isEmpty)
- Nil
- else
- SelectDerivedColumns.this.selectTypes ::: sdc.selectTypes;
+ if (SelectDerivedColumns.this.selectTypes.isEmpty | sdc.selectTypes.isEmpty)
+ Nil
+ else
+ SelectDerivedColumns.this.selectTypes ::: sdc.selectTypes;
}
}
@@ -125,38 +125,38 @@ object Statement {
def fromRelation: statement.Relation;
def innerJoin (sst: SelectSourceTable): SelectSourceTable = new SelectSourceTable {
val fromRelation = new statement.Jointure {
- val leftRelation = SelectSourceTable.this.fromRelation;
- val rightRelation = sst.fromRelation;
- val joinType = statement.JoinType.Inner;
- val joinCondition = None;
- val fieldTypes = leftRelation.fieldTypes ::: rightRelation.fieldTypes;
+ val leftRelation = SelectSourceTable.this.fromRelation;
+ val rightRelation = sst.fromRelation;
+ val joinType = statement.JoinType.Inner;
+ val joinCondition = None;
+ val fieldTypes = leftRelation.fieldTypes ::: rightRelation.fieldTypes;
}
}
def leftOuterJoin (sst: SelectSourceTable): SelectSourceTable = new SelectSourceTable {
val fromRelation = new statement.Jointure {
- val leftRelation = SelectSourceTable.this.fromRelation;
- val rightRelation = sst.fromRelation;
- val joinType = statement.JoinType.Outer.Left;
- val joinCondition = None;
- val fieldTypes = leftRelation.fieldTypes ::: rightRelation.fieldTypes;
+ val leftRelation = SelectSourceTable.this.fromRelation;
+ val rightRelation = sst.fromRelation;
+ val joinType = statement.JoinType.Outer.Left;
+ val joinCondition = None;
+ val fieldTypes = leftRelation.fieldTypes ::: rightRelation.fieldTypes;
}
}
def rightOuterJoin (sst: SelectSourceTable): SelectSourceTable = new SelectSourceTable {
val fromRelation = new statement.Jointure {
- val leftRelation = SelectSourceTable.this.fromRelation;
- val rightRelation = sst.fromRelation;
- val joinType = statement.JoinType.Outer.Right;
- val joinCondition = None;
- val fieldTypes = leftRelation.fieldTypes ::: rightRelation.fieldTypes;
+ val leftRelation = SelectSourceTable.this.fromRelation;
+ val rightRelation = sst.fromRelation;
+ val joinType = statement.JoinType.Outer.Right;
+ val joinCondition = None;
+ val fieldTypes = leftRelation.fieldTypes ::: rightRelation.fieldTypes;
}
}
def fullOuterJoin (sst: SelectSourceTable): SelectSourceTable = new SelectSourceTable {
val fromRelation = new statement.Jointure {
- val leftRelation = SelectSourceTable.this.fromRelation;
- val rightRelation = sst.fromRelation;
- val joinType = statement.JoinType.Outer.Full;
- val joinCondition = None;
- val fieldTypes = leftRelation.fieldTypes ::: rightRelation.fieldTypes;
+ val leftRelation = SelectSourceTable.this.fromRelation;
+ val rightRelation = sst.fromRelation;
+ val joinType = statement.JoinType.Outer.Full;
+ val joinCondition = None;
+ val fieldTypes = leftRelation.fieldTypes ::: rightRelation.fieldTypes;
}
}
}
@@ -249,14 +249,14 @@ object Statement {
def groupByClause: List[statement.Expression];
def then (se:StatementExpression): SelectGroupBy = new SelectGroupBy {
val groupByClause =
- SelectGroupBy.this.groupByClause ::: List(se.toStatement);
+ SelectGroupBy.this.groupByClause ::: List(se.toStatement);
}
def then (se:String): SelectGroupBy = new SelectGroupBy {
val groupByClause =
- SelectGroupBy.this.groupByClause ::: List(new statement.expression.Field {
- val tableName = None;
- val fieldName = se;
- });
+ SelectGroupBy.this.groupByClause ::: List(new statement.expression.Field {
+ val tableName = None;
+ val fieldName = se;
+ });
}
}
diff --git a/src/dbc/scala/dbc/syntax/StatementExpression.scala b/src/dbc/scala/dbc/syntax/StatementExpression.scala
index 78c75ae174..fa25867726 100644
--- a/src/dbc/scala/dbc/syntax/StatementExpression.scala
+++ b/src/dbc/scala/dbc/syntax/StatementExpression.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:StatementExpression.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.syntax;
@@ -164,7 +164,7 @@ abstract class StatementExpression {
val operator = "IN";
val leftOperand = StatementExpression.this.toStatement;
val rightOperand = new statement.expression.Select {
- val selectStatement = se;
+ val selectStatement = se;
};
}
}
@@ -192,7 +192,7 @@ object StatementExpression {
val operator = "EXISTS";
val operatorIsLeft = true;
val operand = new statement.expression.Select {
- val selectStatement = se;
+ val selectStatement = se;
};
}
}
diff --git a/src/dbc/scala/dbc/value/Boolean.scala b/src/dbc/scala/dbc/value/Boolean.scala
index fba78dcfd1..35d7180d47 100644
--- a/src/dbc/scala/dbc/value/Boolean.scala
+++ b/src/dbc/scala/dbc/value/Boolean.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Boolean.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.value;
@@ -14,14 +14,14 @@ package scala.dbc.value;
abstract class Boolean extends Value {
- val dataType: datatype.Boolean;
+ val dataType: datatype.Boolean;
- def sqlString = if (nativeValue) "TRUE" else "FALSE";
+ def sqlString = if (nativeValue) "TRUE" else "FALSE";
}
object Boolean {
- implicit def booleanToBoolean (obj:value.Boolean): scala.Boolean = obj.nativeValue;
+ implicit def booleanToBoolean (obj:value.Boolean): scala.Boolean = obj.nativeValue;
}
diff --git a/src/dbc/scala/dbc/value/Character.scala b/src/dbc/scala/dbc/value/Character.scala
index c02a21b28e..1de123624d 100644
--- a/src/dbc/scala/dbc/value/Character.scala
+++ b/src/dbc/scala/dbc/value/Character.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Character.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.value;
@@ -15,21 +15,21 @@ package scala.dbc.value;
/** A SQL-99 value of type character string. */
abstract class Character extends Value {
- override val dataType: datatype.Character;
+ override val dataType: datatype.Character;
- /** An SQL-99 compliant string representation of the value. */
- def sqlString: String = {
- "'" + nativeValue + "'"
- }
+ /** An SQL-99 compliant string representation of the value. */
+ def sqlString: String = {
+ "'" + nativeValue + "'"
+ }
}
/** An object offering transformation methods (views) on the value.
- * This object must be visible in an expression to use value auto-
- * conversion. */
+ * This object must be visible in an expression to use value auto-
+ * conversion. */
object Character {
- /** A character string value as a native string. */
- implicit def characterToString (obj:value.Character): String = obj.nativeValue;
+ /** A character string value as a native string. */
+ implicit def characterToString (obj:value.Character): String = obj.nativeValue;
}
diff --git a/src/dbc/scala/dbc/value/CharacterLargeObject.scala b/src/dbc/scala/dbc/value/CharacterLargeObject.scala
index 61f55f868a..05e186c873 100644
--- a/src/dbc/scala/dbc/value/CharacterLargeObject.scala
+++ b/src/dbc/scala/dbc/value/CharacterLargeObject.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:CharacterLargeObject.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.value;
@@ -15,21 +15,21 @@ package scala.dbc.value;
/** A SQL-99 value of type character large object. */
abstract class CharacterLargeObject extends Value {
- override val dataType: datatype.CharacterLargeObject;
+ override val dataType: datatype.CharacterLargeObject;
- /** An SQL-99 compliant string representation of the value. */
- def sqlString: String = {
- "'" + nativeValue + "'"
- }
+ /** An SQL-99 compliant string representation of the value. */
+ def sqlString: String = {
+ "'" + nativeValue + "'"
+ }
}
/** An object offering transformation methods (views) on the value.
- * This object must be visible in an expression to use value auto-
- * conversion. */
+ * This object must be visible in an expression to use value auto-
+ * conversion. */
object CharacterLargeObject {
- /** A character large object value as a native string. */
- implicit def characterLargeObjectToString (obj:value.CharacterLargeObject): String = obj.nativeValue;
+ /** A character large object value as a native string. */
+ implicit def characterLargeObjectToString (obj:value.CharacterLargeObject): String = obj.nativeValue;
}
diff --git a/src/dbc/scala/dbc/value/CharacterVarying.scala b/src/dbc/scala/dbc/value/CharacterVarying.scala
index 177dbdba5b..e5a9675882 100644
--- a/src/dbc/scala/dbc/value/CharacterVarying.scala
+++ b/src/dbc/scala/dbc/value/CharacterVarying.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:CharacterVarying.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.value;
@@ -15,21 +15,21 @@ package scala.dbc.value;
/** A SQL-99 value of type character varying string. */
abstract class CharacterVarying extends Value {
- override val dataType: datatype.CharacterVarying;
+ override val dataType: datatype.CharacterVarying;
- /** An SQL-99 compliant string representation of the value. */
- def sqlString: String = {
- "'" + nativeValue + "'"
- }
+ /** An SQL-99 compliant string representation of the value. */
+ def sqlString: String = {
+ "'" + nativeValue + "'"
+ }
}
/** An object offering transformation methods (views) on the value.
- * This object must be visible in an expression to use value auto-
- * conversion. */
+ * This object must be visible in an expression to use value auto-
+ * conversion. */
object CharacterVarying {
- /** A character varying string value as a native string. */
- implicit def characterVaryingToString (obj:value.CharacterVarying): String = obj.nativeValue;
+ /** A character varying string value as a native string. */
+ implicit def characterVaryingToString (obj:value.CharacterVarying): String = obj.nativeValue;
}
diff --git a/src/dbc/scala/dbc/value/Conversion.scala b/src/dbc/scala/dbc/value/Conversion.scala
index 86df903cdc..e95e9e35a6 100644
--- a/src/dbc/scala/dbc/value/Conversion.scala
+++ b/src/dbc/scala/dbc/value/Conversion.scala
@@ -16,142 +16,142 @@ import java.math._;
object Conversion {
- class Illegal (msg:String) extends Exception(msg);
-
- implicit def view1 (value:Value): Byte = {
- if (value.dataType.nativeTypeId == DataType.BYTE) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to byte: "+value)
- }
- }
-
- implicit def view2 (value:Value): Short = {
- if (value.dataType.nativeTypeId == DataType.BYTE) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
- v.nativeValue.toShort
- } else if (value.dataType.nativeTypeId == DataType.SHORT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to short: "+value)
- }
- }
-
- implicit def view3 (value:Value): Int = {
- if (value.dataType.nativeTypeId == DataType.BYTE) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
- v.nativeValue.toInt
- } else if (value.dataType.nativeTypeId == DataType.SHORT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
- v.nativeValue.toInt
- } else if (value.dataType.nativeTypeId == DataType.INT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Int]];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to int: "+value)
- }
- }
-
- implicit def view4 (value:Value): Long = {
- if (value.dataType.nativeTypeId == DataType.BYTE) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
- v.nativeValue.toLong
- } else if (value.dataType.nativeTypeId == DataType.SHORT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
- v.nativeValue.toLong
- } else if (value.dataType.nativeTypeId == DataType.INT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Int]];
- v.nativeValue.toLong
- } else if (value.dataType.nativeTypeId == DataType.LONG) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Long]];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to long: "+value)
- }
- }
-
- implicit def view5 (value:Value): BigInteger = {
- if (value.dataType.nativeTypeId == DataType.BYTE) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
- new BigInteger(v.nativeValue.toString(),10)
- } else if (value.dataType.nativeTypeId == DataType.SHORT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
- new BigInteger(v.nativeValue.toString(),10)
- } else if (value.dataType.nativeTypeId == DataType.INT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Int]];
- new BigInteger(v.nativeValue.toString(),10)
- } else if (value.dataType.nativeTypeId == DataType.LONG) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Long]];
- new BigInteger(v.nativeValue.toString(),10)
- } else if (value.dataType.nativeTypeId == DataType.BIG_INTEGER) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[BigInteger]];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to big integer: "+value)
- }
- }
-
- implicit def view6 (value:Value): BigDecimal = {
- if (value.dataType.nativeTypeId == DataType.BYTE) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
- new BigDecimal(v.nativeValue.toString())
- } else if (value.dataType.nativeTypeId == DataType.SHORT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
- new BigDecimal(v.nativeValue.toString())
- } else if (value.dataType.nativeTypeId == DataType.INT) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Int]];
- new BigDecimal(v.nativeValue.toString())
- } else if (value.dataType.nativeTypeId == DataType.LONG) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[Long]];
- new BigDecimal(v.nativeValue.toString())
- } else if (value.dataType.nativeTypeId == DataType.BIG_INTEGER) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[BigInteger]];
- new BigDecimal(v.nativeValue)
- } else if (value.dataType.nativeTypeId == DataType.BIG_DECIMAL) {
- val v = value.asInstanceOf[dbc.value.ExactNumeric[BigDecimal]];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to big decimal: "+value)
- }
- }
-
- implicit def view7 (value:Value): Float = {
- if (value.dataType.nativeTypeId == DataType.FLOAT) {
- val v = value.asInstanceOf[dbc.value.ApproximateNumeric[Float]];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to float: "+value)
- }
- }
-
- implicit def view8 (value:Value): Double = {
- if (value.dataType.nativeTypeId == DataType.FLOAT) {
- val v = value.asInstanceOf[dbc.value.ApproximateNumeric[Float]];
- v.nativeValue.toFloat
- } else if (value.dataType.nativeTypeId == DataType.DOUBLE) {
- val v = value.asInstanceOf[dbc.value.ApproximateNumeric[Double]];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to double: "+value)
- }
- }
-
- implicit def view9 (value:Value): scala.Boolean = {
- if (value.dataType.nativeTypeId == DataType.BOOLEAN) {
- val v = value.asInstanceOf[dbc.value.Boolean];
- v.nativeValue
- } else {
- throw new Illegal("Cannot convert value to boolean: "+value)
- }
- }
-
- implicit def view10 (value:Value): String = value match {
- case v:dbc.value.Character => v.nativeValue;
- case v:dbc.value.CharacterLargeObject => v.nativeValue;
- case v:dbc.value.CharacterVarying => v.nativeValue;
- case _ => throw new Illegal("Cannot convert value to string")
- }
+ class Illegal (msg:String) extends Exception(msg);
+
+ implicit def view1 (value:Value): Byte = {
+ if (value.dataType.nativeTypeId == DataType.BYTE) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to byte: "+value)
+ }
+ }
+
+ implicit def view2 (value:Value): Short = {
+ if (value.dataType.nativeTypeId == DataType.BYTE) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
+ v.nativeValue.toShort
+ } else if (value.dataType.nativeTypeId == DataType.SHORT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to short: "+value)
+ }
+ }
+
+ implicit def view3 (value:Value): Int = {
+ if (value.dataType.nativeTypeId == DataType.BYTE) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
+ v.nativeValue.toInt
+ } else if (value.dataType.nativeTypeId == DataType.SHORT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
+ v.nativeValue.toInt
+ } else if (value.dataType.nativeTypeId == DataType.INT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Int]];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to int: "+value)
+ }
+ }
+
+ implicit def view4 (value:Value): Long = {
+ if (value.dataType.nativeTypeId == DataType.BYTE) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
+ v.nativeValue.toLong
+ } else if (value.dataType.nativeTypeId == DataType.SHORT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
+ v.nativeValue.toLong
+ } else if (value.dataType.nativeTypeId == DataType.INT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Int]];
+ v.nativeValue.toLong
+ } else if (value.dataType.nativeTypeId == DataType.LONG) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Long]];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to long: "+value)
+ }
+ }
+
+ implicit def view5 (value:Value): BigInteger = {
+ if (value.dataType.nativeTypeId == DataType.BYTE) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
+ new BigInteger(v.nativeValue.toString(),10)
+ } else if (value.dataType.nativeTypeId == DataType.SHORT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
+ new BigInteger(v.nativeValue.toString(),10)
+ } else if (value.dataType.nativeTypeId == DataType.INT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Int]];
+ new BigInteger(v.nativeValue.toString(),10)
+ } else if (value.dataType.nativeTypeId == DataType.LONG) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Long]];
+ new BigInteger(v.nativeValue.toString(),10)
+ } else if (value.dataType.nativeTypeId == DataType.BIG_INTEGER) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[BigInteger]];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to big integer: "+value)
+ }
+ }
+
+ implicit def view6 (value:Value): BigDecimal = {
+ if (value.dataType.nativeTypeId == DataType.BYTE) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Byte]];
+ new BigDecimal(v.nativeValue.toString())
+ } else if (value.dataType.nativeTypeId == DataType.SHORT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Short]];
+ new BigDecimal(v.nativeValue.toString())
+ } else if (value.dataType.nativeTypeId == DataType.INT) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Int]];
+ new BigDecimal(v.nativeValue.toString())
+ } else if (value.dataType.nativeTypeId == DataType.LONG) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[Long]];
+ new BigDecimal(v.nativeValue.toString())
+ } else if (value.dataType.nativeTypeId == DataType.BIG_INTEGER) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[BigInteger]];
+ new BigDecimal(v.nativeValue)
+ } else if (value.dataType.nativeTypeId == DataType.BIG_DECIMAL) {
+ val v = value.asInstanceOf[dbc.value.ExactNumeric[BigDecimal]];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to big decimal: "+value)
+ }
+ }
+
+ implicit def view7 (value:Value): Float = {
+ if (value.dataType.nativeTypeId == DataType.FLOAT) {
+ val v = value.asInstanceOf[dbc.value.ApproximateNumeric[Float]];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to float: "+value)
+ }
+ }
+
+ implicit def view8 (value:Value): Double = {
+ if (value.dataType.nativeTypeId == DataType.FLOAT) {
+ val v = value.asInstanceOf[dbc.value.ApproximateNumeric[Float]];
+ v.nativeValue.toFloat
+ } else if (value.dataType.nativeTypeId == DataType.DOUBLE) {
+ val v = value.asInstanceOf[dbc.value.ApproximateNumeric[Double]];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to double: "+value)
+ }
+ }
+
+ implicit def view9 (value:Value): scala.Boolean = {
+ if (value.dataType.nativeTypeId == DataType.BOOLEAN) {
+ val v = value.asInstanceOf[dbc.value.Boolean];
+ v.nativeValue
+ } else {
+ throw new Illegal("Cannot convert value to boolean: "+value)
+ }
+ }
+
+ implicit def view10 (value:Value): String = value match {
+ case v:dbc.value.Character => v.nativeValue;
+ case v:dbc.value.CharacterLargeObject => v.nativeValue;
+ case v:dbc.value.CharacterVarying => v.nativeValue;
+ case _ => throw new Illegal("Cannot convert value to string")
+ }
}
diff --git a/src/dbc/scala/dbc/value/ExactNumeric.scala b/src/dbc/scala/dbc/value/ExactNumeric.scala
index 1c30c89c29..bbd9671891 100644
--- a/src/dbc/scala/dbc/value/ExactNumeric.scala
+++ b/src/dbc/scala/dbc/value/ExactNumeric.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:ExactNumeric.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.value;
diff --git a/src/dbc/scala/dbc/value/Factory.scala b/src/dbc/scala/dbc/value/Factory.scala
index 34975937e7..b0d8c22570 100644
--- a/src/dbc/scala/dbc/value/Factory.scala
+++ b/src/dbc/scala/dbc/value/Factory.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Factory.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.value;
@@ -20,74 +20,74 @@ object Factory {
def create (result: java.sql.ResultSet, index: Int, expectedDataType: DataType): Value = {
expectedDataType.nativeTypeId match {
case DataType.OBJECT =>
- new value.Unknown {
- val dataType = expectedDataType.asInstanceOf[datatype.Unknown];
- val nativeValue: Object = result.getObject(index);
- }
+ new value.Unknown {
+ val dataType = expectedDataType.asInstanceOf[datatype.Unknown];
+ val nativeValue: Object = result.getObject(index);
+ }
case DataType.STRING => {
- expectedDataType match {
- case t:datatype.Character =>
- new value.Character {
- val dataType = t;
- val nativeValue: String = result.getString(index);
- }
- case t:datatype.CharacterVarying =>
- new value.CharacterVarying {
- val dataType = t;
- val nativeValue: String = result.getString(index);
- }
- case t:datatype.CharacterLargeObject =>
- new value.CharacterLargeObject {
- val dataType = t;
- val nativeValue: String = result.getString(index);
- }
- }
+ expectedDataType match {
+ case t:datatype.Character =>
+ new value.Character {
+ val dataType = t;
+ val nativeValue: String = result.getString(index);
+ }
+ case t:datatype.CharacterVarying =>
+ new value.CharacterVarying {
+ val dataType = t;
+ val nativeValue: String = result.getString(index);
+ }
+ case t:datatype.CharacterLargeObject =>
+ new value.CharacterLargeObject {
+ val dataType = t;
+ val nativeValue: String = result.getString(index);
+ }
+ }
}
case DataType.BOOLEAN =>
- new value.Boolean {
- val dataType = expectedDataType.asInstanceOf[datatype.Boolean];
- val nativeValue: scala.Boolean = result.getBoolean(index);
- }
+ new value.Boolean {
+ val dataType = expectedDataType.asInstanceOf[datatype.Boolean];
+ val nativeValue: scala.Boolean = result.getBoolean(index);
+ }
case DataType.FLOAT =>
- new value.ApproximateNumeric[Float] {
- val dataType = expectedDataType.asInstanceOf[datatype.ApproximateNumeric[Float]];
- val nativeValue: Float = result.getFloat(index);
- }
+ new value.ApproximateNumeric[Float] {
+ val dataType = expectedDataType.asInstanceOf[datatype.ApproximateNumeric[Float]];
+ val nativeValue: Float = result.getFloat(index);
+ }
case DataType.DOUBLE =>
- new value.ApproximateNumeric[Double] {
- val dataType = expectedDataType.asInstanceOf[datatype.ApproximateNumeric[Double]];
- val nativeValue: Double = result.getDouble(index);
- }
+ new value.ApproximateNumeric[Double] {
+ val dataType = expectedDataType.asInstanceOf[datatype.ApproximateNumeric[Double]];
+ val nativeValue: Double = result.getDouble(index);
+ }
case DataType.BYTE =>
- new value.ExactNumeric[Byte] {
- val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[Byte]];
- val nativeValue: Byte = result.getByte(index);
- }
+ new value.ExactNumeric[Byte] {
+ val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[Byte]];
+ val nativeValue: Byte = result.getByte(index);
+ }
case DataType.SHORT =>
- new value.ExactNumeric[Short] {
- val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[Short]];
- val nativeValue: Short = result.getShort(index);
- }
+ new value.ExactNumeric[Short] {
+ val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[Short]];
+ val nativeValue: Short = result.getShort(index);
+ }
case DataType.INT =>
- new value.ExactNumeric[Int] {
- val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[Int]];
- val nativeValue: Int = result.getInt(index);
- }
+ new value.ExactNumeric[Int] {
+ val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[Int]];
+ val nativeValue: Int = result.getInt(index);
+ }
case DataType.LONG =>
- new value.ExactNumeric[Long] {
- val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[Long]];
- val nativeValue:Long = result.getLong(index);
- }
+ new value.ExactNumeric[Long] {
+ val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[Long]];
+ val nativeValue:Long = result.getLong(index);
+ }
case DataType.BIG_INTEGER =>
- new value.ExactNumeric[BigInteger] {
- val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[BigInteger]];
- val nativeValue: BigInteger = result.getBigDecimal(index).unscaledValue();
- }
+ new value.ExactNumeric[BigInteger] {
+ val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[BigInteger]];
+ val nativeValue: BigInteger = result.getBigDecimal(index).unscaledValue();
+ }
case DataType.BIG_DECIMAL =>
- new value.ExactNumeric[BigDecimal] {
- val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[BigDecimal]];
- val nativeValue: BigDecimal = result.getBigDecimal(index);
- }
+ new value.ExactNumeric[BigDecimal] {
+ val dataType = expectedDataType.asInstanceOf[datatype.ExactNumeric[BigDecimal]];
+ val nativeValue: BigDecimal = result.getBigDecimal(index);
+ }
}
}
diff --git a/src/dbc/scala/dbc/value/Unknown.scala b/src/dbc/scala/dbc/value/Unknown.scala
index b1ba51d064..6fe4773e94 100644
--- a/src/dbc/scala/dbc/value/Unknown.scala
+++ b/src/dbc/scala/dbc/value/Unknown.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:Unknown.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.value;
@@ -14,14 +14,14 @@ package scala.dbc.value;
abstract class Unknown extends Value {
- val dataType: datatype.Unknown;
+ val dataType: datatype.Unknown;
- def sqlString = error ("An 'ANY' value cannot be represented.");
+ def sqlString = error ("An 'ANY' value cannot be represented.");
}
object UnknownType {
- def view (obj:value.Unknown): Object = obj.nativeValue;
+ def view (obj:value.Unknown): Object = obj.nativeValue;
}
diff --git a/src/dbc/scala/dbc/vendor/PostgreSQL.scala b/src/dbc/scala/dbc/vendor/PostgreSQL.scala
index f637b32a82..41886aea58 100644
--- a/src/dbc/scala/dbc/vendor/PostgreSQL.scala
+++ b/src/dbc/scala/dbc/vendor/PostgreSQL.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id:PostgreSQL.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $
package scala.dbc.vendor;
@@ -14,14 +14,14 @@ package scala.dbc.vendor;
abstract class PostgreSQL extends Vendor {
- def uri:java.net.URI;
- def user:String;
- def pass:String;
+ def uri:java.net.URI;
+ def user:String;
+ def pass:String;
- val retainedConnections = 5;
+ val retainedConnections = 5;
- val nativeDriverClass = Class.forName("org.postgresql.Driver");
+ val nativeDriverClass = Class.forName("org.postgresql.Driver");
- val urlProtocolString = "jdbc:postgresql:"
+ val urlProtocolString = "jdbc:postgresql:"
}