Purpose
Synopsis
procedure SQLexecute(s:string)
procedure SQLexecute(s:string, a:array)
procedure SQLexecute(s:string, m:set)
Arguments
s
|
SQL command to be executed
|
a
|
An array of one of the basic types (integer, real,
string or Boolean). May be a tuple of arrays
|
m
|
A set of one of the basic types (integer, real,
string or Boolean)
|
Example
The following example contains four
SQLexecute statements performing the following tasks:
- Get all different values of the column color in
the table pricelist.
- Initialize the arrays colors and prices
with the values of the columns color and price
of the table pricelist.
- Create a new table newtab in the active database
with 2 columns, ndx and price.
- Add data entries to table newtab.
declarations
prices: array(1001..1004) of real
colors: array(1001..1004) of string
allcolors: set of string
end-declarations
SQLexecute("select color from pricelist", allcolors)
SQLexecute("select articlenum,color,price from pricelist",
[colors,prices])
SQLexecute("create table newtab (ndx integer, price double)")
SQLexecute("insert into newtab (ndx, price) values (?,?)", prices)
Further information
This procedure executes the given SQL command.
The user is referred to the documentation of the
database driver he is using for more information about
the commands that are supported by it. Note that if extended
syntax is in use (default), parameters usually noted '?' in
normal SQL queries may be numbered (like '?1','?2',...) in order
to control in which order are mapped columns of data source
table to Mosel arrays. This feature is especially useful when
writing 'update' queries for which indices must appear after values
(e.g. "update mytable set datacol=?2 where ndxcol=?1").
Related topics
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.