postmodern-update

Postmodern Examples Table of Contents Insert

Update

In s-sql, updates operate the way you would expect them to, given what we have seen up above.

(query (:update 'countries :set 'text '$1 :where (:= 'id 284)) "now")

Now temporarily assume that we do not have a normalized database and we have a field "region_name" in the countries table in the database and a slot accessor named region-name in the countries class.

We could update a set of the countries rows to get the regional names for a particular set of countries, given a list of countries.id as follows:

(query (:update 'countries :set 'region-name (:select 'name :from 'regions :where (:= 'countries.id 'country-id)) :where (:in 'countries.id (:set 129 139 132 128 135 134 131 137 130 133 136))))
Delete
Comments