1
FirstExampleは、次の構文で挿入したバッチの例を提供します。scalaquery:<a href="https://github.com/szeiger/scalaquery-examples" rel="nofollow">scalaquery-examples project</a> でダイナミックBatchInsert
それは、このためにことを考えるとInsertAll方法でタプルの動的に構築リストを渡すことができますどのようにCoffees.insertAll(
("Colombian", 101, 7.99, 0, 0),
("French_Roast",49, 8.99, 0, 0),
("Espresso",150, 9.99, 0, 0),
("Colombian_Decaf",101, 8.99, 0, 0),
("French_Roast_Decaf", 49, 9.99, 0, 0)
)
例えば、関数の定義は次のとおりです。
def insertAll(values: (String, Int, Double, Int, Int)*)(implicit session: org.scalaquery.session.Session): Option[Int]
Cool Thks!魅力のように動作します – krishnen
+1実際には、ケースクラスインスタンスのリストでもうまく動作します;-) – virtualeyes