select into map(a,b,[param &1 = c], d,e, f,g,h,i,j], delimiter k, map l,m,n,o,p)

This function executes an SQL statement a on the database being represented by alias b. Placeholders in the form of &parameterNumber being defined in the statement are replaced by the values of parameters c to j. Characters that are needed for a valid syntax need to be placed in the statement. There is no limit of the resultset being retrieved. If a limit is needed it has to be set using the LIMIT clause in the SQL statement.

The result set will be written to a map with name l. The value of each row's first column is used as the key, all remaining columns are concatenated together using the delimiter k and saved to the map using the key. The map will be cleared before values are added (can be suppressed with parameter o).

The return value of the function is the number of rows in the result set of the SQL query.

If there are columns of type BLOB in the result set, parameter m determines whether or not the binary data should be written to the result lists (entries in the map) in a Base64 format. If m is true, the function performs the encoding, false will leave the data unchanged. If there are no columns of type BLOB, the parameter has no effect.

Important note: In addition to the syntax &parameterNumber for parameters it is possible to use the syntax @parameterNumber:parameterType@ for prepared statements. The use of this prevents SQL Injection Attacks and should be preferred.

Parameters


Parameter

Description

a

SQL statement to be executed.

b

The database alias.

c

(optional) Parameter &1 of the statement.

d

(optional) Parameter &2 of the statement.

e

(optional) Parameter &3 of the statement.

f

(optional) Parameter &4 of the statement.

g

(optional) Parameter &5 of the statement.

h

(optional) Parameter &6 of the statement.

i

(optional) Parameter &7 of the statement.

j

(optional) Parameter &8 of the statement.

k

Delimiter.

l

Name of the map.

m

(optional) true if data in columns of type BLOB should be encoded with Base64. Default: false

n

true for read-only mode.

o

(optional) true if the map is not to be cleared before adding values. Default: false

p

(optional) If true, SQL errors coming from the database are ignored. Default: <empty> (== false).


Examples


Assume a map zipcodes containing all ZIP codes of Germany (imaginary 20000 entries).


Parameter a

b

c

d…j

k

l

m

n

o

p

Result

select zipcode, city, county from zipcodes

testdb



;

ZIPS



false


20000

The result is a map ZIPS containing 20000 entries. Each entry has the ZIP code as key and the values of the city and the county the ZIP code belongs to, e.g. {80336=Munich;Bavaria}.


Parameter a

b

c

d…j

k

l

m

n

o

p

Result

select zipcode, city, county from zipcodes where zipcode = &1

testdb

80336


;

ZIPS



false


1

Creates the same map with only one single entry.