Big Query Made By Using Embed Function

Result (menu_JAPAN.html)(in Japanese)

DB Schema

car(id, name, price, layout, door_num, length, width, height, wheelbase, capacity, weight, engine, gear, company)
primary key : id
foreign key : engine, company

engine(id, company, name, cylinder_type, cylinder_num, type, displacement, diameter, stroke, max_output_ps, max_output_rpm, max_torque_kgm, max_torque_rpm)
primary key: id
foreign key : company

company(id, name, head_office, yearly_turnover, country)
primary key : id
foreign key : none



queries
menu.sql

FOREACH (co.country)
GENERATE HTML
{
{
   { embed(file="c:\SSQL\demo\menu1.sql")} !
   {
     { embed(file="c:\SSQL\demo\colist.sql",where="co.country=",attString=co.country)@{class=colist} },
     { embed(file="c:\SSQL\demo\attention.html")@{width=450} }
   }
}@{tablealign=center,tableborder=0,class=test}
}
FROM company co
menu1.sql

GENERATE HTML
{
{
   "Online Car Data Warehouse"@{class=title}!
   [sinvoke(co.country@{class=menu},file="http://ssql.db.ics.keio.ac.jp/DEMO/embed/menu.sql",att=co.country)],
}
}@{cssfile=demo.css,tableborder=1}
FROM company co
colist.sql

GENERATE HTML
{
{
   [sinvoke(co.name@{class=list},file="http://ssql.db.ics.keio.ac.jp/DEMO/embed/list.sql",att=co.id)],
}@{tableborder=0}
}@{cssfile=demo.css}
FROM company co;
list.sql

FOREACH (co.id)
GENERATE HTML
{
   { embed(file="c:\SSQL\demo\menu1.sql")} !
   {
      { embed(file="c:\SSQL\demo2\list1.sql",where="ca.company=",att=co.id) @{class=colist} },
      { embed(file="c:\SSQL\demo\attention.html")@{class=index} }
      
   }
}@{tablealign=center,tableborder=0}
FROM car ca,company co
list1.sql

GENERATE HTML
{
{
   [sinvoke((asc1)ca.name@{class=list},file="http://ssql.db.ics.keio.ac.jp/DEMO/embed/data.sql",att=ca.id)]!
}@{tableborder=0}
}@{cssfile=demo.css}
FROM car ca;
data.sql

FOREACH (ca.id)
GENERATE HTML
{
{  
  { 
	embed(file="c:\SSQL\demo\menu1.sql") 
  } !
  { 
	embed(file="c:\SSQL\demo2\colist.sql", where="co.country=",attString=co.country)@{class=class=colist} 
  } !
  {
    { 
		embed(file="c:\SSQL\demo\list1.sql",where="ca.company=",att=co.id,border=1) 
	},
    { 
		embed(file="c:\SSQL\demo\car.sql",where="ca.id=",att=ca.id) 
	},
    { 
		embed(file="c:\SSQL\demo\engine.sql",where="e.id=",att=ca.engine)
	}
  }
}@{tablealign=center,tableborder=0}
}@{cssfile=demo.css}
FROM car ca, company co
WHERE ca.company=co.id
data.sql

GENERATE HTML
{
{  
   {ca.name@{class=name} }!
   imagefile(ca.id,path="http://ssql.db.ics.keio.ac.jp/DEMO/embed/pic")@{class=image}!
   {"製造者"@{class=datatitle},	 co.name@{class=data} }!
   {"値段"@{class=datatitle},	 ca.price@{class=data}   }!	
   {"レイアウト"@{class=datatitle}, ca.layout@{class=data}  }!	
   {"ドア数"@{class=datatitle},	 ca.door_num@{class=data}}!	
   {"全長"@{class=datatitle},	 ca.length@{class=data}  }!	
   {"全幅"@{class=datatitle},	 ca.width@{class=data}   }!	
   {"全高"@{class=datatitle},	 ca.height@{class=data}  }!	
   {"ホイールベース"@{class=datatitle},	 ca.wheelbase@{class=data} }!	
   {"乗車可能人数"@{class=datatitle},	 ca.capacity@{class=data} }!	
   {"重量"@{class=datatitle},	 ca.weight@{class=data} }!
   {"ギア"@{class=datatitle},	 ca.gear@{class=data} }
}
}@{cssfile=demo.css}
FROM car ca, company co
WHERE ca.company=co.id
engine.sql

GENERATE HTML
{
{  
   {e.name@{class=name} }!
   {"製造者"@{class=datatitle},	 		 c.name@{class=data2} }!
   {"シリンダータイプ"@{class=datatitle},	 e.cylinder_type@{class=data2}   }!	
   {"シリンダー数"@{class=datatitle}, 		 e.cylinder_num@{class=data2}  }!	
   {"タイプ"@{class=datatitle},	 		 e.type@{class=data2}}!	
   {"排気量[l]"@{class=datatitle},	 	 e.displacement@{class=data2}  }!	
   {"ボア径[mm]"@{class=datatitle},	 	 e.diameter@{class=data2}   }!	
   {"ストローク"@{class=datatitle},	 	 e.stroke@{class=data2}  }!	
   {"最大馬力[ps]"@{class=datatitle},	 	 e.max_output_ps@{class=data2} }!	
   {"最大馬力[rpm]"@{class=datatitle},	 	 e.max_output_rpm@{class=data2} }!	
   {"最大トルク[kg]"@{class=datatitle},	 	 e.max_torque_kgm@{class=data2} }!
   {"最大トルク[rpm]"@{class=datatitle},	 e.max_torque_rpm@{class=data2} }
	
}@{tablealign=center}
}@{cssfile=demo.css}
FROM engine e,company c
WHERE e.company = c.id
attention.html
attention.html


Takehiko Kobayashi <tk@db.ics.keio.ac.jp>
Department of Information and Computer Science
Keio University, Japan