postgreSQL.cursor.executeMultipleQueries

Syntax

postgreSQL.cursor.executeMultipleQueries (cursorRef, query, params)

Params

cursorRef is a reference to a cursor as returned by postgreSQL.cursor.create.

query is a string containing the SQL code to be executed.

params is an optional list of lists or a list of records containing parameter sets to be substituted into the query string.

Action

For each sub-list or sub-record, substitutes list or record items into the query string, and executes the query on the database server.

Returns

The number of rows in the result set of the final query, or -1 if the final query did not generate a result set.

Examples

local (rec, params = {})

new (recordType, @rec);

rec["firstname"] = "Ian"

rec["lastname"] = "O'Sullivan"

rec["age"] = 48

params[1] = rec

new (recordType, @rec);

rec["firstname"] = "Bull"

rec["lastname"] = "Mancuso"

rec["age"] = 41

params[2] = rec

postgreSQL.cursor.executeMultipleQueries (cursorRef, "INSERT INTO friend VALUES ({$first}, {$last}, {$age})", params)

« -1 //insertion does not generate a result set

Notes

This verb is equivalent to running postgreSQL.cursor.executeQuery in a loop, using the same query string but different parameter lists or records for each iteration. See that verb for a detailed description of parameter substitution, parameter conversion, and fetching query results.

See Also

postgreSQL.cursor.create

postgreSQL.cursor.executeQuery