📖
Rulecube documentation
v2.4
v2.4
  • Overview
  • Quick Start
  • Tutorial
    • Getting started
    • Create and Run Your First Ruleset
    • Use Constants and Methods
    • Create and Call Functions
    • Adding Testcases
    • Using Lookup Tables
    • Using Entities
    • Using Forms
  • How-to Guides
    • Logging in and Authorization
      • Activate Your Account From an Invitation
      • Log in to Rulecube
      • Change Your Password
      • Recover Your Password
      • Two-factor authentication (2FA)
      • Invite Other Users to Rulecube
      • Edit a User's Role
      • Delete a User
    • Ruleset Development
      • Create a Ruleset
      • Set the Input for a Ruleset
      • Create a Rule
      • Generate Alerts
      • Try out a Ruleset
      • Call a Ruleset from Your Software
      • Entities
        • Create an Entity
        • Drag and Drop a JSON Schema or XSD to create entities
        • Entity instantiation
        • Persisted Entities
      • Constants
        • Constant Tables
      • Functions
      • Built-in Functions
      • Create and Run a Testcase
      • Delete a Ruleset or Components
      • Debugging your Ruleset
    • Create a Workflow
      • Workflow step types
      • Working with documents in a workflow
    • Work with (Environment) Variables
    • Call a Ruleset via Its API From Postman
    • Creating input from JSON Schema
    • Use a Ruleset from Your Software
    • Ruleset Productivity Tips
    • Create an Ockto workflow
    • Alert aggregation
    • Forms
      • Introduction and overview
      • Create a Data table
  • Language Reference
    • Global
    • Array
    • Compression
    • Crypto
    • Date
    • Encryption (deprecated)
    • Finance
    • Http
    • Mail
    • MongoDB
    • Ockto
    • PDF
    • SQL
    • Statistics
    • System
    • UserStore
    • Workflow
Powered by GitBook
On this page
  1. Language Reference

SQL

Collection of SQL functions.

Methods

execute

execute(connectionString: string | {
                                    server: string,
                                    authenticationType?: string,
                                    userName: string,
                                    password: string,
                                    database: string,
                                    port?: Number,
                                    encrypt?: Boolean,
                                }, query: string, params?: { name: string, value: any, type: SQL.TYPES }[])

Executes a T-SQL query. Returns an array of rows with columns as key/value pairs.

Parameters

connectionString string | { server: string, authenticationType?: string, userName: string, password: string, database: string, port?: Number, encrypt?: Boolean, }

The connection string or object to the SQL database.

query string

The SQL statement to be executed.

params { name: string, value: any, type: SQL.TYPES }[]

Return type

{ [key: string]: any; }[]

Examples

// Calculates the average of the field 'age' for all users in the table 'Persons':
SQL.execute(connectionString, "SELECT AVG(age) as avg FROM Persons")     // [ { avg: 30 } ]

// Gets all persons with first name 'Joe' from  able 'Persons', using a parameter:
SQL.execute(connectionString, "SELECT * FROM Persons WHERE firstname = @firstname", { name: "firstname", value: "Joe", type: SQL.TYPES.NVarChar })

executeStoredProcedure

executeStoredProcedure(connectionString: string | {
                                    server: string,
                                    authenticationType: string,
                                    userName: string,
                                    password: string,
                                    database: string,
                                    port: Number,
                                    encrypt: Boolean,
                                }, query: string, params?: { name: string, value: any, type: SQL.TYPES }[])

Parameters

connectionString string | { server: string, authenticationType: string, userName: string, password: string, database: string, port: Number, encrypt: Boolean, }

The connection string or object to the SQL database.

query string

The SQL statement to be executed.

params { name: string, value: any, type: SQL.TYPES }[]

Return type

{ [key: string]: any; }[]

Examples

// Execute the Stored Procedure / Stored Function / SQL Function with the name 'GetAllCustomers'
SQL.executeStoredProcedure(connectionString, "GetAllCustomers")
PreviousPDFNextStatistics

Last updated 1 month ago

(optional) Parameters to be used within the query. Use parameters to avoid SQL injection. See .

Executes a SQL Stored Procedure. Use parameters to avoid SQL injection. .

(optional) Parameters to be used within the query. Use parameters to avoid SQL injection. See .

OWASP SQL Injection cheat sheet
OWASP SQL Injection cheat sheet
OWASP SQL Injection cheat sheet