Skip to content

Commit

Permalink
Merge b4c341e into bbb4abe
Browse files Browse the repository at this point in the history
  • Loading branch information
OmniaGM committed Oct 19, 2016
2 parents bbb4abe + b4c341e commit dc13ef5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions troy-schema/src/main/scala/troy/schema/ColumnOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ object ColumnOps {
import Operator._
import DataType._

// TODO: Add NotEquals, In
// TODO: Add In
def operandType(operator: Operator): Result[DataType] = operator match {
case Equals | LessThan | GreaterThan | LessThanOrEqual | GreaterThanOrEqual =>
case Equals | LessThan | GreaterThan | LessThanOrEqual | GreaterThanOrEqual | NotEquals =>
V.Success(column.dataType).collect(operatorNotSupported(operator)) {
case n: Native => n
}
Expand Down
8 changes: 8 additions & 0 deletions troy-schema/src/test/scala/troy/schema/UpdateSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ class UpdateSpec extends FlatSpec with Matchers {
variableTypes.isEmpty shouldBe true
}

it should "support simple update statement with NotEquals ops" in {
val statement = parse("UPDATE test.post_details SET title = 'Testing' WHERE author_id != ?;")
val (rowType, variableTypes) = schema(statement).get
rowType.asInstanceOf[SchemaEngine.Columns].types.isEmpty shouldBe true
variableTypes.size shouldBe 1
variableTypes(0) shouldBe DataType.Uuid
}

it should "update statement with variables" in {
val statement = parse("UPDATE test.posts SET post_title = 'Testing' WHERE author_id = ?; ")
val (rowType, variableTypes) = schema(statement).get
Expand Down

0 comments on commit dc13ef5

Please sign in to comment.