Queries
Table of Contents

These functions are used for executing SQL statements.


  • proc clear_params()   
  • func get_parameter( sequence param )   
  • proc init_params()   
  • func parse_sql( sequence sql )   
  • func run_query( sequence query )   
  • func run_sql( sequence sql )   
  • proc set_parameter( sequence param_name, object param_value )   

    Queries
    Table of Contents

    [proc]
    clear_params
    ()

    Category: Queries

    Deletes all parameters previously set.

    See Also: get_parameter, init_params, parse_sql, run_query, run_sql, set_parameter


    Queries
    Table of Contents

    [func]
    get_parameter
    ( sequence param )

    Category: Queries

    Returns the value of a parameter.

    See Also: clear_params, init_params, parse_sql, run_query, run_sql, set_parameter


    Queries
    Table of Contents

    [proc]
    init_params
    ()

    Category: Queries

    Initialize EuSQL parameters and store as Matheval variables.

    See Also: clear_params, get_parameter, parse_sql, run_query, run_sql, set_parameter


    Queries
    Table of Contents

    [func]
    parse_sql
    ( sequence sql )

    Category: Queries

    sql must be a string. This function will return a 'compiled' query, which can be passed to run_query. If there is an error, parse_sql will return an atom. If a query will be run multiple times (perhaps using different parameters each time), it is faster to parse the statement once, and use run_query() than to use run_sql() each time.

    See Also: clear_params, get_parameter, init_params, run_query, run_sql, set_parameter


    Queries
    Table of Contents

    [func]
    run_query
    ( sequence query )

    Category: Queries

    query must be compiled SQL returned from parse_sql(). This function returns a 3 element sequence:

    1. sequence of the field names
    2. records returned by the query
    3. datatypes of each field

    See Also: clear_params, get_parameter, init_params, parse_sql, run_sql, set_parameter


    Queries
    Table of Contents

    [func]
    run_sql
    ( sequence sql )

    Category: Queries

    sql must be a SQL statement in a string. This function calls parse_sql and run_query for you, returning the result. If there is an error in the statement, an atom will be returned, otherwise, the result is a three element sequence:

    1. sequence of the field names
    2. records returned by the query
    3. datatypes of each field

    See Also: clear_params, get_parameter, init_params, parse_sql, run_query, set_parameter


    Queries
    Table of Contents

    [proc]
    set_parameter
    ( sequence param_name, object param_value )

    Category: Queries

    Sets the value of a parameter to be used by a query. Parameters must be enclosed in square brackets ( [param1] ) when declared in a SQL statement, but the brackets must be omitted when calling set_parameter.

    See Also: clear_params, get_parameter, init_params, parse_sql, run_query, run_sql