How do I initialize a postgres(bytea) and scala (Array[Byte]) for mt tests

134 views
Skip to first unread message

Abhijit Deb

unread,
May 19, 2015, 12:11:33 PM5/19/15
to scala...@googlegroups.com
Complains:

image is of type Array[Byte]

I have this:

    def insertCustomerImage(ci: CustomerImage) = {
        val fmt: DateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd");
        (Q.u +"insert into cust_images (id, customer_id, image, created) values (" +? ci.id +
         "," +? ci.customer_id +"," +? ci.image +", timestamp with time zone '" + fmt.print(new DateTime()) +"')").execute
      }
     
      Seq(
        CustomerImage("CIM1", "customer_1", Array (128.toByte)),
        CustomerImage("CIM2", "customer_2", Array  (213356546.toByte)),
        CustomerImage("CIM3", "customer_3", Array (156546546.toByte))
      ).foreach(insertCustomerImage)
    }

1\it-classes...
[error] C:\Code\smart-check\services\src\it\scala\CustomerIntegrationTest.scala:
56: could not find implicit value for parameter p: scala.slick.jdbc.SetParameter
[Array[Byte]]
[error]          "," +? ci.customer_id +"," +? ci.image +", timestamp with time
zone '" + fmt.print(new DateTime()) +"')").execute
[error]                                     ^
[error] one error found

Christopher Vogt

unread,
May 28, 2015, 2:11:37 PM5/28/15
to scala...@googlegroups.com
Maybe the slick-pg project has answers? Try to their issue tracker. Chris

On 19.05.15 12:11, Abhijit Deb wrote:
> Complains:
>
> image is of type Array[Byte]
>
> I have this:
>
> def insertCustomerImage(ci: CustomerImage) = {
> val fmt: DateTimeFormatter =
> DateTimeFormat.forPattern("yyyy-MM-dd");
> (Q.u +"insert into cust_images (id, customer_id, image, created)
> values (" +? ci.id +
> "," +? ci.customer_id +"," +? *ci.image* +", timestamp with
> time zone '" + fmt.print(new DateTime()) +"')").execute
> }
>
> Seq(
> CustomerImage("CIM1", "customer_1", Array (128.toByte)),
> CustomerImage("CIM2", "customer_2", Array (213356546.toByte)),
> CustomerImage("CIM3", "customer_3", Array (156546546.toByte))
> ).foreach(insertCustomerImage)
> }
>
> 1\it-classes...
> [error]
> C:\Code\smart-check\services\src\it\scala\CustomerIntegrationTest.scala:
> 56: could not find implicit value for parameter p:
> scala.slick.jdbc.SetParameter
> [Array[Byte]]
> [error] "," +? ci.customer_id +"," +? ci.image +", timestamp
> with time
> zone '" + fmt.print(new DateTime()) +"')").execute
> [error] ^
> [error] one error found
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Slick / ScalaQuery" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to scalaquery+...@googlegroups.com
> <mailto:scalaquery+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/scalaquery/a1c99fee-2f5f-4c78-bde0-f42650c76a4d%40googlegroups.com
> <https://groups.google.com/d/msgid/scalaquery/a1c99fee-2f5f-4c78-bde0-f42650c76a4d%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages