From dedfa54718b5ea5d503d8d09b1637b6259848fd2 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 9 Jan 2015 12:10:18 +0900 Subject: [PATCH] example. --- examples.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/examples.md b/examples.md index feb982b5..a4fccff6 100644 --- a/examples.md +++ b/examples.md @@ -748,7 +748,34 @@ TBD ### update -TBD +#### Updating data + +SQL: + +{% highlight sql %} +UPDATE employee +SET lname = 'Bush', + dept_id = 3 +WHERE emp_id = 10; +{% endhighlight %} + +HRR: + +{% highlight haskell %} +updateEmployee_o3 :: Update () +updateEmployee_o3 = typedUpdate tableOfEmployee . updateTarget $ \proj -> do + Employee.lname' <-# value "Bush" + Employee.deptId' <-# just (value 3) + wheres $ proj ! Employee.empId' .=. value 10 +{% endhighlight %} + +Generated SQL: + +{% highlight sql %} +UPDATE MAIN.employee +SET lname = 'Bush', dept_id = 3 +WHERE (emp_id = 10) +{% endhighlight %} ### delete