Documentation Index

Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt

Use this file to discover all available pages before exploring further.

select into list()

Prev Next

This function runs an SQL select statement a on the database represented by alias b. Placeholders in the form &parameterNumber in the statement are replaced by the values of parameters c to j. Characters required for valid syntax (for example, quotes around strings) must already be part of the statement. You can limit the number of returned result rows with l. The value 0 returns an unlimited result set.

The function creates a list for each column of the result set. The list name follows the pattern k:COLUMN_NAME, all in uppercase (see examples). If a list with this name already exists, the function deletes its values.

The function returns the number of received records.

If the result set contains columns of type BLOB, parameter m controls the encoding. Set m to true to write the binary data Base64-encoded to the result lists. Otherwise, the data remains unchanged. If there are no such columns in the result set, the parameter value has no effect.

NOTE:

In addition to the &parameterNumber notation, you can also use the notation for prepared statements in the form @parameterNumber:parameterType@. Prefer prepared statements, because they prevent SQL injection attacks. Within prepared statements, parameters replace only single values. You cannot use them to pass value lists for IN, table or column names, operators, sort orders, or complete SQL fragments.

Parameters

Parameter

Description

a

SQL statement to run.

b

The database alias.

c

(optional) Parameter &1 in the statement.

d

(optional) Parameter &2 in the statement.

e

(optional) Parameter &3 in the statement.

f

(optional) Parameter &4 in the statement.

g

(optional) Parameter &5 in the statement.

h

(optional) Parameter &6 in the statement.

i

(optional) Parameter &7 in the statement.

j

(optional) Parameter &8 in the statement.

k

Prefix for the result lists to create.

l

(optional) The maximum number of rows to read. Default: 0.

m

(optional) true if data from a column of type BLOB should be added to the result lists Base64-encoded. Default: false.

n

(optional) true for read-only mode. Default: false.

o

(optional) true if the list names should use the column display name instead of the column name for the extension (see examples). Default: false.

p

(optional) If true, the function ignores SQL errors reported by the database. Default: <empty> (== false).

Examples

Assume a table zipcodes that contains the ZIP codes of Germany (an imaginary 20000 entries).

Parameter a

b

c

d-j

k

l

m

n

o

p

Result

select zipcode as zip, city as town from zipcodes

testdb

ZIPS

0

20000

select zipcode as zip, city as town from zipcodes

testdb

ZIPS

0

true

20000

After running example 1, the function created the list ZIPS:ZIPCODE with the values from column zipcode and the list ZIPS:CITY with the values from column city. For example 2, the list names are ZIPS:ZIP and ZIPS:TOWN.

Parameter a

b

c

d-j

k

l

m

n

o

p

Result

select zipcode, city from zipcodes where zipcode = &1

testdb

80689

ZIPS

0

1

select zipcode, city from zipcodes where zipcode = @1:i@

testdb

80689

ZIPS

0

1

Creates the previously mentioned lists from example 1, each with one element: 80689 and Munich.

Parameter a

b

c

d-j

k

l

m

n

o

p

Result

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

testdb

Bavaria

ZIPS

0

1500

select zipcode, city from zipcodes where county = @1:s@

testdb

Bavaria

ZIPS

0

1500

select zipcode, city from zipcodes where county = &1

testdb

Bavaria

ZIPS

0

Error, because text literals must be enclosed in quotes.

In the first two cases, creates the previously mentioned lists with the ZIP codes of Bavaria.