MacroPackage: dbi.mysqlToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 version


Arguments: cols-and-vals &key table where db showsql

This macro creates an sql update statement. update can alter zero or more rows in a table or tables. The syntax of update-db combines the cols-and-vals from insert-db and the where argument from with-db-rows.

db should be a mysql object returned by connect. The value of *mysql* is a suitable value (and the default).

table specifies the table in the database to update. There is no meaningful default: you must specify a string naming a table as the value.

If showsql is specified true, the generated sql statement will be printed.

A simple example to zero the order id in the customer table for a given custid (customer id):

(update-db ((orderid 0))
           :table (store-customer store)
           :where (= u_customer custid)
           :db db)

A more complex example where we use the fact that a string value to store is inserted verbatim in the sql statement:

(update-db ((quantity quantity)
             (format nil "~a*~a" quantity price))
             (format nil "~a*~a" quantity weight)))
           :table (store-items store)
           :where (and (= u_item itemnum)
                       (= cartnum cartnum))
           :db db)

See mysql.htm for information on the Allegro MySQL facility.

Copyright (c) 1998-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page was not revised from the 8.0 page.
Created 2009.7.29.

Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 version