mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-01 22:02:07 +03:00
example.
This commit is contained in:
parent
5b59347bf0
commit
dedfa54718
29
examples.md
29
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user