--- a/directmapping-webapp/src/main/scala/Servlet.scala Thu Feb 03 10:10:12 2011 -0500
+++ b/directmapping-webapp/src/main/scala/Servlet.scala Thu Feb 10 01:30:39 2011 +0100
@@ -148,7 +148,41 @@
Student VARCHAR(50),
Sport VARCHAR(50)
);
-INSERT INTO Student_Sport (Student,Sport) VALUES ("Venus", "Tennis");""")
+INSERT INTO Student_Sport (Student,Sport) VALUES ("Venus", "Tennis");""",
+
+ "_1table1compositeprimarykey3columns1row" ->
+"""CREATE TABLE Student (
+ ID integer,
+ Name varchar(50),
+ Sport varchar (50),
+ PRIMARY KEY (ID,Name)
+);
+INSERT INTO Student (ID, Name,Sport) VALUES(10,"Venus Williams","Tennis");""",
+
+ "_1table1primarykey1column1row" ->
+"""CREATE TABLE Student (
+Name varchar(50) PRIMARY KEY
+);
+INSERT INTO Student (Name) VALUES ("Venus");""",
+
+ "_2tables1primarykey1foreingkey" ->
+"""CREATE TABLE Student (
+ID integer,
+Name varchar(50),
+Sport integer,
+PRIMARY KEY (ID),
+FOREIGN KEY(Sport) REFERENCES Sport(ID)
+);
+
+CREATE TABLE Sport (
+ID integer,
+Name varchar (50),
+PRIMARY KEY (ID)
+);
+
+INSERT INTO Student (ID, Name, Sport) VALUES (10,"Venus Williams", 100);
+INSERT INTO Student (ID, Name, Sport) VALUES (20,"Demi Moore", NULL);
+INSERT INTO Sport (ID, Name) VALUES (100,"Tennis");""")
def format(varr:String, sql:String):String = {
val formattedSQL = sql.replaceAll("\n+$", "").replaceAll("\n", "\\\\n\\\\\n")
@@ -215,7 +249,7 @@
{ List("emp_addr", "hier_tabl_proto", "hier_table", "multi_key", "ref_no_pk") map renderVar }
</div>
<div style="float:left;">
- { List("1table0rows", "1table1row", "1table2columns1row", "1table3columns1row", "2duplicates0nulls", "varchar_varchar_1row") map renderVar }
+ { List("1table0rows", "1table1row", "1table2columns1row", "1table3columns1row", "2duplicates0nulls", "varchar_varchar_1row", "1table1compositeprimarykey3columns1row", "1table1primarykey1column1row", "2tables1primarykey1foreingkey") map renderVar }
</div>
</div>
<p><input name="hierarchy" checked="checked" type="checkbox" />Detects hierarchy relation</p>