# Sql | Antville 1.4 API Reference

Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2012-4-22 10:17

# Class Sql

- Defined in: Sql.js

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| Sql(options)

Field Summary
Field Attributes | Field Name and Description
--- | ---
<static> <constant> | Sql.ARCHIVE SQL query for retrieving all story IDs in a site’s archive.
<static> <constant> | Sql.ARCHIVEORDER SQL part for applying an order to the archive query.
<static> <constant> | Sql.ARCHIVEPART SQL part filtering the archive query.
<static> <constant> | Sql.ARCHIVESIZE SQL command for retrieving the size of a site’s archive.
<static> <constant> | Sql.COUNT SQL query for retrieving the amount of records in a table.
<static> <constant> | Sql.MEMBERSEARCH SQL query for searching members.
<static> <constant> | Sql.PURGEREFERRERS SQL command for deleting all log entries older than 2 days.
<static> <constant> | Sql.REFERRERS SQL query for retrieving the referrers of a site or a story.
<static> <constant> | Sql.SEARCH SQL query for searching stories and comments.

## Method Summary

Method Attributes | Method Name and Description
--- | ---
| execute(sql) Executes an SQL command.
| retrieve() Retrieves an SQL query.
| toString()
| traverse(callback) Traverses over the results of an SQL query.

## Class Detail

Sql(options)

Parameters:
options

## Field Detail

<static> <constant> Sql.ARCHIVE
SQL query for retrieving all story IDs in a site’s archive.
<static> <constant> Sql.ARCHIVEORDER
SQL part for applying an order to the archive query.

See:
  Archive#stories_macro

<static> <constant> Sql.ARCHIVEPART
SQL part filtering the archive query.

See:
  Archive#getFilter

<static> <constant> Sql.ARCHIVESIZE
SQL command for retrieving the size of a site’s archive.
<static> <constant> Sql.COUNT
SQL query for retrieving the amount of records in a table.
<static> <constant> Sql.MEMBERSEARCH
SQL query for searching members.
<static> <constant> Sql.PURGEREFERRERS
SQL command for deleting all log entries older than 2 days.
<static> <constant> Sql.REFERRERS
SQL query for retrieving the referrers of a site or a story.
<static> <constant> Sql.SEARCH
SQL query for searching stories and comments.

## Method Detail

- {Object} execute(sql)
  Executes an SQL command.
  Parameters:
  {String} sql
    The SQL command.
  Returns:
    {Object} The result of the SQL command.
- {String} retrieve()
  Retrieves an SQL query.

      sql.retrieve('select $1 from $2 order by $1', 'date', 'foo')
      ===> 'select date from foo order by date'

  Returns:
    {String}
- {String} toString()
  Returns:
    {String}
- traverse(callback)
  Traverses over the results of an SQL query.
  Parameters:
  {Function} callback
    The callback function executed for each record.