MacroPackage: dbi.mysqlToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version