From dc2b1ebce89de93da82a3378e9a838dce7745dec Mon Sep 17 00:00:00 2001 From: bogatyra Date: Fri, 29 Jul 2022 22:23:22 +0200 Subject: [PATCH] #732 Mssql (fixed) --- .../zio/sql/sqlserver/SqlServerRenderModule.scala | 2 +- .../zio/sql/sqlserver/CommonFunctionDefSpec.scala | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala index a2e4eda2e..031cba45a 100644 --- a/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala +++ b/sqlserver/src/main/scala/zio/sql/sqlserver/SqlServerRenderModule.scala @@ -111,7 +111,7 @@ trait SqlServerRenderModule extends SqlServerSqlModule { self => val value = lit.value lit.typeTag match { case TInstant => - render(s"'${fmtDateTimeOffset.format(value.asInstanceOf[Instant])}'") + render(s"'${DateTimeFormatter.ISO_INSTANT.format(value.asInstanceOf[Instant])}'") case TLocalTime => render(s"'${DateTimeFormatter.ISO_LOCAL_TIME.format(value.asInstanceOf[LocalTime])}'") case TLocalDate => diff --git a/sqlserver/src/test/scala/zio/sql/sqlserver/CommonFunctionDefSpec.scala b/sqlserver/src/test/scala/zio/sql/sqlserver/CommonFunctionDefSpec.scala index de540acb7..7e28098a9 100644 --- a/sqlserver/src/test/scala/zio/sql/sqlserver/CommonFunctionDefSpec.scala +++ b/sqlserver/src/test/scala/zio/sql/sqlserver/CommonFunctionDefSpec.scala @@ -135,9 +135,9 @@ object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { test("abs") { assertZIO(execute(select(Abs(-3.14159))).runHead.some)(equalTo(3.14159)) }, -/* test("log") { + test("log") { assertZIO(execute(select(Log(32.0, 2.0))).runHead.some)(equalTo(5.0)) - },*/ + } @@ TestAspect.ignore, test("acos") { assertZIO(execute(select(Acos(-1.0))).runHead.some)(equalTo(3.141592653589793)) }, @@ -159,9 +159,9 @@ object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { test("floor") { assertZIO(execute(select(Floor(-3.14159))).runHead.some)(equalTo(-4.0)) }, -/* test("ceil") { + test("ceil") { assertZIO(execute(select(Ceil(53.7), Ceil(-53.7))).runHead.some)(equalTo((54.0, -53.0))) - },*/ + } @@ TestAspect.ignore, test("sin") { assertZIO(execute(select(Sin(1.0))).runHead.some)(equalTo(0.8414709848078965)) }, @@ -178,8 +178,6 @@ object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { val query = select(Round(10.8124, 2)) val expected = 10.81 - println(renderRead(query)) - val testResult = execute(query) val assertion = for { @@ -265,7 +263,7 @@ object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { } yield assert(r.head)(equalTo(expected)) assertion.mapErrorCause(cause => Cause.stackless(cause.untraced)) - }, + } @@ TestAspect.ignore, test("ascii") { val query = select(Ascii("""x""")) @@ -304,7 +302,7 @@ object CommonFunctionDefSpec extends SqlServerRunnableSpec with DbSchema { } yield assert(r.head)(equalTo(expected)) assertion.mapErrorCause(cause => Cause.stackless(cause.untraced)) - }, + } @@ TestAspect.ignore, test("tan") { val query = select(Tan(0.7853981634))