FunctionPackage: dbi.mysqlToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version


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

insert-db is a macro that creates an sql statement to insert a row into a table.

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 into which the new row will be inserted. 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.

cols-and-vals specifies the columns and values. It looks like a let binding list:

cl-user(62): (insert-db ((val 20) 
                         (sq 400)) 
                        :table "square" 
                        :showsql t)
sql: (format nil "insert into square(val,sq) values(~a,~a)" 20 400)

If you are inserting a string or blob value you should specify a third value of :text in the cols-and-vals list.

cl-user(63): (sql "create table atext(ttt text)")
cl-user(64): (insert-db ((ttt "foo" :text)) :table "atext")

If you do not specify :text and and the value to be stored in the column is a string then the string is put in the sql statement verbatim. This is useful to store the value of mysql built-in functions.

cl-user(67): (insert-db ((val "now()") 
                         (sq "now()*now()")) 
                        :table "square")

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

Copyright (c) 1998-2012, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 9.0. This page was not revised from the 8.2 page.
Created 2012.5.30.

Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version