Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sending SET commands. #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class ConnectionStateMachine(state: State = AuthenticationRequired, val id: Int)
case (CommandComplete(DiscardAll), SimpleQuery) => (None, EmitOnReadyForQuery(CommandCompleteResponse(1)))
case (CommandComplete(Begin | Savepoint | Release | RollBack | Commit), SimpleQuery) =>
(None, EmitOnReadyForQuery(CommandCompleteResponse(1)))
case (CommandComplete(Set), SimpleQuery) => (None, EmitOnReadyForQuery(CommandCompleteResponse(1)))
case (CommandComplete(Do), SimpleQuery) => (None, EmitOnReadyForQuery(CommandCompleteResponse(1)))

case (RowDescription(fields), SimpleQuery) =>
Expand All @@ -123,6 +124,7 @@ class ConnectionStateMachine(state: State = AuthenticationRequired, val id: Int)
case (CommandComplete(Update(count)), ExecutePreparedStatement) => (Some(CommandCompleteResponse(count)), Connected)
case (CommandComplete(Delete(count)), ExecutePreparedStatement) => (Some(CommandCompleteResponse(count)), Connected)
case (CommandComplete(Begin), ExecutePreparedStatement) => (Some(CommandCompleteResponse(1)), Connected)
case (CommandComplete(Set), ExecutePreparedStatement) => (Some(CommandCompleteResponse(1)), Connected)
case (CommandComplete(Savepoint), ExecutePreparedStatement) => (Some(CommandCompleteResponse(1)), Connected)
case (CommandComplete(RollBack), ExecutePreparedStatement) => (Some(CommandCompleteResponse(1)), Connected)
case (CommandComplete(Commit), ExecutePreparedStatement) => (Some(CommandCompleteResponse(1)), Connected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class BackendMessageParser {
case "DELETE" => Delete(parts(1).toInt)
case "UPDATE" => Update(parts(1).toInt)
case "BEGIN" => Begin
case "SET" => Set
case "SAVEPOINT" => Savepoint
case "RELEASE" => Release
case "ROLLBACK" => RollBack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ case class Select(count: Int) extends CommandCompleteStatus

case object Begin extends CommandCompleteStatus

case object Set extends CommandCompleteStatus

case object Savepoint extends CommandCompleteStatus

case object Release extends CommandCompleteStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ class IntegrationSpec extends Spec {
Await.result(result)
}

"support sending SET commands" in {
val client = getClient
val result = client.query("SET TIME ZONE DEFAULT;")
Await.result(result)
}

"throw a ServerError" when {
"query has error" in {
Expand Down