|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cycling74.max.MaxObject
net.loadbang.util.EnrichedMaxObject
net.loadbang.sql.mxj.MXJ_SQL
public abstract class MXJ_SQL
A superclass for MXJ objects which connect to databases.
Every instance of this object maintains its own database connection (via the embedded Database object); there's no complicated connection pooling (and no real need for it).
I don't know how a DB will react to scheduler-priority threads, but we synchronise access to the connection inside the connector to avoid interference between scheduler and GUI threads.
| Field Summary |
|---|
| Fields inherited from class com.cycling74.max.MaxObject |
|---|
EMPTY_STRING_ARRAY, NO_INLETS, NO_OUTLETS |
| Constructor Summary | |
|---|---|
protected |
MXJ_SQL(java.lang.Class loggerOwnerClass)
Constructor. |
| Method Summary | |
|---|---|
protected void |
dropDatabase()
Drop the database connection (closing it). |
protected Database |
getDatabase()
Return database connection, or fail. |
void |
notifyDeleted()
On object deletion, close the database connection. |
void |
query(com.cycling74.max.Atom[] sqlTokens)
Run an SQL query. |
protected void |
setDatabase(Database database)
Set the database, having attempted to open it. |
void |
update(com.cycling74.max.Atom[] sqlTokens)
Run an update, and output the number of changed rows (as a message "update <N>"). |
| Methods inherited from class net.loadbang.util.EnrichedMaxObject |
|---|
getLogger |
| Methods inherited from class com.cycling74.max.MaxObject |
|---|
anything, bail, bang, createInfoOutlet, dblclick, declareAttribute, declareAttribute, declareInlets, declareIO, declareOutlets, declareReadOnlyAttribute, declareReadOnlyAttribute, declareTypedIO, embedMessage, error, gc, getAttr, getAttrAtomArray, getAttrBool, getAttrBoolArray, getAttrByte, getAttrByteArray, getAttrChar, getAttrCharArray, getAttrDouble, getAttrDoubleArray, getAttrFloat, getAttrFloatArray, getAttributeInfo, getAttrInt, getAttrIntArray, getAttrLongArray, getAttrShort, getAttrShortArray, getAttrString, getAttrStringArray, getCodeSourcePath, getContext, getErrorStream, getInfoIdx, getInlet, getInletAssist, getInletType, getLongAttr, getMaxBox, getName, getNumInlets, getNumOutlets, getOutletAssist, getOutletType, getParentPatcher, getPostStream, inlet, inlet, list, loadbang, ouch, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outletBang, outletBangHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, post, postCodePath, save, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setInletAssist, setInletAssist, setName, setOutletAssist, setOutletAssist, showException, showException, toString, viewsource, zap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected MXJ_SQL(java.lang.Class loggerOwnerClass)
| Method Detail |
|---|
protected void setDatabase(Database database)
throws SetupException
SetupException
protected Database getDatabase()
throws OperationException
OperationExceptionprotected void dropDatabase()
public void notifyDeleted()
notifyDeleted in class com.cycling74.max.MaxObjectpublic void update(com.cycling74.max.Atom[] sqlTokens)
The database object's query and update methods are synchronised, so be careful when using loops in patchers and don't mix thread priorities.
sqlTokens - a list of tokens representing an SQL update statementpublic void query(com.cycling74.max.Atom[] sqlTokens)
sqlTokens - a list of tokens representing an SQL statement (a query
or an update).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||