-Prepare is a data source action which allows a SQL statement to be prepared for later execution. Prepared statements are executed using the -Exec statement within multiple nested inlines. This action does not perform a database operation itself, but sets up the data source in order to perform the same operation multiple times using -Exec very quickly.
The value for -Prepare should be a SQL statement like that which would be passed to the -SQL action, but one or more values can be replaced by question marks in order to mark them as placeholder which will be filled with values when the statement is later executed.
For example, an INSERT can be written as a prepared statement as follows. The values to be inserted are left as placeholders. When this statement is executed by the following action the placeholders are filled with their respective values.
-Prepare='INSERT INTO Contacts.People (First,Last) VALUES (?, ?)'
-Exec=(Array: 'John', 'Doe')
Prepared statements are most useful when they are prepared once and then executed many times. By preparing the statement the data source can optimize its access and perform many INSERT or UPDATE operations more quickly than they could be performed otherwise.
[Inline: -Database='Contacts', -Prepare='INSERT INTO People (First,Last) VALUES (?, ?)']
[Inline: -Exec=(Array: 'John', 'Doe')][/Inline]
[Inline: -Exec=(Array: 'Jane', 'Person')][/Inline]
[Inline: -Exec=(Array: 'Ray', 'Surname')][/Inline]
[/Inline]
See the Lasso 8 Language Guide for examples of how to use this tag.
Tag Link | -Prepare | Category | Action |
---|---|---|---|
Type | Command | Data Source | Any |
Support | Preferred | Version | 8.5 |
Output Type | None | Security | None |
Implementation | Sets | Lasso 8.5 |
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft