bind-parameter

$Revision: 1.1.2.2 $

Function

Package: DBI

Arguments: (param-num obj type width &key db hstmt)

This function creates a binding for a parameter for a parameterized sql statement.

A binding is the assigning of a block of memory to hold the value of a given parameter. Whenever a parameterized sql statement is executed, ODBC looks in the bindings and uses the current value found there. param-num is the index of the parameter to be bound. The first parameter is number 1 (not 0). obj is the object to bind to the parameter. If obj is nil then an object will be allocated. type is the type of the value stored in the object. It can be :long or :int (treated the same), or :float or :double (treated the same) or :char or :varchar. If the type is :char or :varchar then the width specifies the maximum number of characters in the object.

The binding is associated with a particular statement handle for a particular database connection.  If hstmt is non-nil then it is that statement handle. Otherwise if db is non-nil then its default statement handle is used. If db is nil then the value of *default-database* is the database connection whose statement handle is used.

Normally in a call to bind-parameter the value of obj is nil which calls for bind-parameter to allocate an object of the appropriate type and return it as the result of the call. If obj is non-nil then it should be an object allocated by a previous call to bind-parameter for the same type and width. The objects allocated by  bind-parameter are foreign objects of allocation type :foreign-static-gc. It is the program's responsibility to keep pointers to these bound objects so that they aren't garbage collected before they are used for the last time.

The example of using bind-parameter in 4.2 binding input parameters in aodbc_v2.htm shows what these bound objects look like from the Lisp perspective.

This symbol is associated with the Allegro CL ODBC (AODBC) interface, version 2. Version 2 is new in Allegro CL 5.0.1. It is incompatible with the earlier version 1. Not all customers will have Allegro ODBC version 2. Contact your Franz Inc. sales representative for more information.

Allegro ODBC version 2 is described in aodbc_v2.htm.

The general documentation description is in introduction.htm. The index in index.htm.

Copyright (C) 1998-1999, Franz Inc., Berkeley, CA. All Rights Reserved.