AdaBase.Statement.Base.[STMT] function
AdaBase.Driver.Base.[DB].prepare (sql : String)

This function executes the literal SQL string it is given and returns the statement object that hasn't yet been executed. The user has the option to bind values and variables to the templated SQL prior to the query execution. This is allowed when the SQL has one or more named (:name) or question mark (?) parameters in the string, and both types can be present as the named parameters are internally converted the question marks in the same order. The named parameters can only be used in one location though.

Once the statement has been prepared, it can be executed repeatedly after updating the parameter bindings before each execution. THis is a big performance improvement over executing similar statements directly and individually. Another major benefit is that SQL injection attacks are prevented by using parameter bindings instead of passing text strings.

See prepare select for a usage example.

[DB] is "MySQL.MySQL_Driver", "PostgreSQL.PostgreSQL_Driver", or "SQLite.SQLite_Driver"

[STMT] is "MySQL.MySQL_statement", "PostgreSQL.PostgreSQL_statement", or "SQLite.SQLite_statement"

See Also

  • prepare select