0

queryConnection

To send an SQL command to a connected SQL database and returns the record data

In case you want to send a command to a connected SQL database, use this function to send your command as a string through a specified connection.

In contrast to sendCommand() the result will contain the record data only and leave out the metadata.

💡 Learn more about SQL connections.

Syntax

queryConnection(string, string)

Return

JSON

Examples

queryConnection(connectionName, command) To send a given SQL command to a connected SQL database by specifying the connection name.

do as server
   formatJSON(queryConnection("MySQLConnection", "SELECT 1"))
end

Result:

{result: [{"id":2,"name":"feature a","price":99.99,"created_at":"2021-06-02T08:00:00.000Z"}]}

See also

sendCommand which sends an SQL command to a connected SQL database.

Reply

null