Last modified: 2012-12-5
Class SQLResult
Max contains an implementation of the SQLite database engine (more info available @
http://sqlite.org).
This database engine is accessible through both the C-API and directly in Max through the JavaScript
interface. A tutorial on the Javascript interface written by Andrew Benson has been published on the
Cycling '74 website.
The Javascript interface is composed of two objects: SQLite and SQLResult. A SQLResult object is used
to represent the data returned by queries to the SQLite object. These objects are created in the same
manner as any object in Javascript, as shown below.
SQLResult in Cycling '74 Reference
Constructor Attributes | Constructor Name and Description |
---|---|
Representation of a SQLite result set.
|
Method Attributes | Method Name and Description |
---|---|
String |
fieldname(column_index)
Field name of given column
|
Integer |
Count of columns in result
|
Integer |
Count of records in result
|
String |
value(column_index, record_index)
Value of field defined by column_index and record_index.
|
Class Detail
SQLResult
()
Representation of a SQLite result set.
All records returned by the SQLResult object are returned as strings. Thus, a numeric value such as 1
is actually returned as the string "1". SQLite only uses datatypes as recommendations. It does not enforce
data types and in fact always returns a string. More information about this and other SQLite-specific topics
can be found in a Google Talk given by Richard Hipp (the author of the SQLite library) @
video.google.com.
- Example:
var sqlite = new SQLite; var result = new SQLResult;
Method Detail
{String}
fieldname
(column_index)
Field name of given column
- Parameters:
- {Integer} column_index
{Integer}
numfields
()
Count of columns in result
{Integer}
numrecords
()
Count of records in result
{String}
value
(column_index, record_index)
Value of field defined by column_index and record_index. All records returned by the SQLResult object are
returned as strings. Thus, a numeric value such as 1 is actually returned as the string "1". SQLite only
uses datatypes as recommendations. It does not enforce data types and in fact always returns a string.
- Parameters:
- {Integer} column_index
- {Integer} record_index