clarified signature: rowid is specific to SQLite;
authorwenzelm
Sun, 19 Mar 2017 14:50:37 +0100
changeset 65327 e886aed88b2c
parent 65326 cb7cb57c7ce1
child 65328 2510b0ce28da
clarified signature: rowid is specific to SQLite;
src/Pure/General/sql.scala
--- a/src/Pure/General/sql.scala	Sun Mar 19 14:43:54 2017 +0100
+++ b/src/Pure/General/sql.scala	Sun Mar 19 14:50:37 2017 +0100
@@ -117,9 +117,9 @@
       enclosure(columns.map(_.sql_decl(sql_type)) ::: primary_key)
     }
 
-    def sql_create(strict: Boolean, rowid: Boolean, sql_type: Type.Value => String): String =
+    def sql_create(strict: Boolean, sql_type: Type.Value => String): String =
       "CREATE TABLE " + (if (strict) "" else "IF NOT EXISTS ") +
-        quote_ident(name) + " " + sql_columns(sql_type) + (if (rowid) "" else " WITHOUT ROWID")
+        quote_ident(name) + " " + sql_columns(sql_type)
 
     def sql_drop(strict: Boolean): String =
       "DROP TABLE " + (if (strict) "" else "IF EXISTS ") + quote_ident(name)
@@ -255,8 +255,9 @@
     def tables: List[String] =
       iterator(connection.getMetaData.getTables(null, null, "%", null))(_.getString(3)).toList
 
-    def create_table(table: Table, strict: Boolean = false, rowid: Boolean = true): Unit =
-      using(statement(table.sql_create(strict, rowid, sql_type)))(_.execute())
+    def create_table(table: Table, strict: Boolean = false, sql: String = ""): Unit =
+      using(statement(table.sql_create(strict, sql_type) + (if (sql == "") "" else " " + sql)))(
+        _.execute())
 
     def drop_table(table: Table, strict: Boolean = false): Unit =
       using(statement(table.sql_drop(strict)))(_.execute())