--- a/src/Pure/General/sql.scala Wed Feb 08 22:38:08 2017 +0100
+++ b/src/Pure/General/sql.scala Wed Feb 08 23:19:10 2017 +0100
@@ -50,7 +50,9 @@
def string(name: String, strict: Boolean = true, primary_key: Boolean = false): Column[String] =
new Column_String(name, strict, primary_key)
def bytes(name: String, strict: Boolean = true, primary_key: Boolean = false): Column[Bytes] =
- new Column_Bytes(name, strict, primary_key)
+ new Column_Bytes(name, strict, primary_key, "BLOB") // SQL standard
+ def bytea(name: String, strict: Boolean = true, primary_key: Boolean = false): Column[Bytes] =
+ new Column_Bytes(name, strict, primary_key, "BYTEA") // PostgreSQL
}
abstract class Column[+A] private[SQL](
@@ -89,14 +91,14 @@
class Column_Long private[SQL](name: String, strict: Boolean, primary_key: Boolean)
extends Column[Long](name, strict, primary_key)
{
- def sql_type: String = "INTEGER"
+ def sql_type: String = "BIGINT"
def apply(rs: ResultSet): Long = rs.getLong(name)
}
class Column_Double private[SQL](name: String, strict: Boolean, primary_key: Boolean)
extends Column[Double](name, strict, primary_key)
{
- def sql_type: String = "REAL"
+ def sql_type: String = "DOUBLE PRECISION"
def apply(rs: ResultSet): Double = rs.getDouble(name)
}
@@ -111,10 +113,10 @@
}
}
- class Column_Bytes private[SQL](name: String, strict: Boolean, primary_key: Boolean)
+ class Column_Bytes private[SQL](
+ name: String, strict: Boolean, primary_key: Boolean, val sql_type: String)
extends Column[Bytes](name, strict, primary_key)
{
- def sql_type: String = "BLOB"
def apply(rs: ResultSet): Bytes =
{
val bs = rs.getBytes(name)