Lasso Soft Inc. > Home

-SQL

The -SQL command tag allows a SQL statement to be executed within a compatible data source.

The data source within which the SQL statement should be executed is identified by naming a database using the -Database command tag. The SQL statement to be executed is specified as the parameter of the -SQL command tag.

The -Database parameter is used solely to identify what data source to send the SQL command to. Within the SQL statement you must always specify both the database and table names as in "SELECT * FROM Contacts.People".

Note: -SQL actions can only be performed within [Inline] tags. They cannot be performed through HTML forms or URLs.

  • Syntax
  • Parameters
[Inline: -SQL='SQL Statement',
  -Database='Database_Name', ...]
Required Parameters
SQL Statement The SQL statement which should be issued to the database.
Examples

To execute a SQL statement:

Use the -SQL command tag in an opening [Inline] tag. The following example returns a list of all available databases using the SHOW DATABASES statement.

[Inline: -Database='Site', -SQL='SHOW DATABASES;']
  [Records]
    <br>[Loop: (Field_Name: -Count)]
      [Field: (Field_Name: Loop_Count)]
    [/Loop]
  [/Records]
[/Inline]
Result:
<br>Contacts
<br>Site

To search a database using a -SQL statement:

The following example finds all records in a database using a SQL statement specified in [Inline] ... [/Inline] tags. Notice that both the database and table name are specified within the SQL statement.

The results are formatted in a table using the [Field_Name] tag to automatically retrieve the field names from the found set for the table column headers.

[Inline: -Database='Site', 
    -SQL='SELECT * FROM Contacts.People;']
<table>
  <tr>[Loop: (Field_Name: -Count)]
      <th>[Field_Name: Loop_Count]</th>
  [/Loop]</tr>
  [Records]
    <tr>[Loop: (Field_Name: -Count)]
      <td>[Field: (Field_Name: Loop_Count)]</td>
    [/Loop]</tr>
  [/Records]
</table>
[/Inline]
Result:
<table>
  <tr>
    <th>First_Name</th>
    <th>Last_Name</th>
    ...
  </tr>
  <tr>
    <td>John</td>
    <td>Doe</td>
    ...
  </tr>
  ...
</table>
Tag Link -SQL Category Action
Type Command Data Source MySQL
Support Preferred Version 5.0
Output Type None Security Database
Implementation Sets Lasso 5.0

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. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft