Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #782 from slick/tmp/insert-or-update
Insert or Update
- Loading branch information
Showing
31 changed files
with
892 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
package scala.slick.ast | ||
|
||
/** Represents an Insert operation. */ | ||
final case class Insert(generator: Symbol, table: Node, map: Node, linear: Node) extends Node with DefNode { | ||
final case class Insert(tableSym: Symbol, table: Node, linear: Node) extends BinaryNode with DefNode { | ||
type Self = Insert | ||
def left = table | ||
def right = map | ||
override def nodeChildNames = Vector("table", "map", "linear") | ||
def nodeChildren = Vector(table, map, linear) | ||
def nodeGenerators = Vector((generator, table)) | ||
def nodeRebuild(ch: IndexedSeq[Node]) = copy(table = ch(0), map = ch(1), linear = ch(2)) | ||
def nodeRebuildWithGenerators(gen: IndexedSeq[Symbol]) = copy(generator = gen(0)) | ||
def right = linear | ||
override def nodeChildNames = Vector("table "+tableSym, "linear") | ||
def nodeGenerators = Vector((tableSym, table)) | ||
def nodeRebuild(l: Node, r: Node) = copy(table = l, linear = r) | ||
def nodeRebuildWithGenerators(gen: IndexedSeq[Symbol]) = copy(tableSym = gen(0)) | ||
def nodeWithComputedType2(scope: SymbolScope, typeChildren: Boolean, retype: Boolean): Self = { | ||
val table2 = table.nodeWithComputedType(scope, typeChildren, retype) | ||
val map2 = map.nodeWithComputedType(scope + (generator -> table2.nodeType), typeChildren, retype) | ||
nodeRebuildOrThis(Vector(table2, map2, linear)).nodeTypedOrCopy(if(!nodeHasType || retype) map2.nodeType else nodeType) | ||
val lin2 = linear.nodeWithComputedType(scope + (tableSym -> table2.nodeType), typeChildren, retype) | ||
nodeRebuildOrThis(Vector(table2, lin2)).nodeTypedOrCopy(if(!nodeHasType || retype) lin2.nodeType else nodeType) | ||
} | ||
override def toString = "Insert" | ||
} | ||
|
||
/** A column in an Insert operation. */ | ||
final case class InsertColumn(child: Node, fs: FieldSymbol) extends UnaryNode with SimplyTypedNode { | ||
final case class InsertColumn(children: IndexedSeq[Node], fs: FieldSymbol, tpe: Type) extends Node with TypedNode { | ||
def nodeChildren = children | ||
type Self = InsertColumn | ||
def nodeRebuild(ch: Node) = copy(child = ch) | ||
def buildType = child.nodeType | ||
protected[this] def nodeRebuild(ch: IndexedSeq[Node]) = copy(children = ch) | ||
override def toString = s"InsertColumn $fs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.