transaction.scala

来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 56 行

SCALA
56
字号
/*                     __                                               *\**     ________ ___   / /  ___     Scala API                            ****    / __/ __// _ | / /  / _ |    (c) 2003-2006, LAMP/EPFL             ****  __\ \/ /__/ __ |/ /__/ __ |                                         **** /____/\___/_/ |_/____/_/ | |                                         ****                          |/                                          **\*                                                                      */// $Id:Transaction.scala 6853 2006-03-20 16:58:47 +0100 (Mon, 20 Mar 2006) dubochet $package scala.dbc.statement;/** A statement that changes the status of the database. */case class Transaction [ResultType] (  transactionBody: (scala.dbc.Database=>ResultType),  accessMode: Option[AccessMode],  isolationLevel: Option[IsolationLevel]) extends Statement {    /** A SQL-99 compliant string representation of the statement. */  def sqlStartString: String = (    "START TRANSACTION" +    (Pair(accessMode,isolationLevel) match {      case Pair(None,None) => ""      case Pair(Some(am),None) => " " + am.sqlString      case Pair(None,Some(il)) => " " + il.sqlString      case Pair(Some(am),Some(il)) => " " + am.sqlString + ", " + il.sqlString    })  );    def sqlCommitString: String = {    "COMMIT"  }    def sqlAbortString: String = {    "ROLLBACK"  }    //def transactionBody: (()=>Unit);    //def accessMode: Option[AccessMode];    //def isolationLevel: Option[IsolationLevel];    def execute (database: scala.dbc.Database): scala.dbc.result.Status[ResultType] = {    database.executeStatement(this);  }    def execute (database: scala.dbc.Database, debug: Boolean): scala.dbc.result.Status[ResultType] = {    database.executeStatement(this,debug);  }  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?