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.
var sqlite = new SQLite()
var result = new SQLResult()
SQLite Object Methods
open
Arguments
ram-based [Boolean]
close
exec
Arguments
SQLResult object [String]
lastinsertid
starttransaction
endtransaction
SQLResult Object Methods
numrecords
numfields
fieldname
Arguments
value
Arguments
record index [Number]
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 .
See Also
Name | Description |
---|---|
JavaScript Usage | JavaScript Usage |