exists db-row()

This function executes an SQL statement a on the database that is represented by alias b. Parameters that are represented in the statement with a placeholder of the form &paramNumber, are defined with the remaining parameters starting with c. Characters around parameters needed to produce a valid syntax must be part of the statement already. Is there no result being returned by the database the result value of the function is false. If there is a result true is returned.

Important note: In addition to the use of &paramNumber for parameters it is possible to use the naming scheme @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 called.

b

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

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

l

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


Examples


A table zipcodes containing all zip codes of Germany is given.


Parameter a

b

c

d

e…j

k

l

Result

select * from zipcodes

testdb






true

select * from zipcodes where zipcode = &1

testdb

80336





true

select * from zipcodes where city = '&2'

testdb


Munich




true

select * from zipcodes where zipcode = &1 and city = '&2'

testdb

12345

Munich




false

Remarks


  • The call is set up that way that the database is returning one row at maximum independent of how many there actually are. Because of this, it is not necessary to add a LIMIT clause to the statement.

  • If in addition to the information if there are results, the values of this result are needed later, it is better to actually get these values using one of the select functions and check for the existence the returned value to achieve the functionality of this function.