|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.makumba.db.TransactionImplementation org.makumba.db.makumba.DBConnection
public abstract class DBConnection
This is the Makumba-specific implementation of a Transaction
Field Summary | |
---|---|
protected String |
dataSource
|
protected Database |
db
|
(package private) Hashtable<String,Object> |
lockRecord
|
(package private) Map<String,Pointer> |
locks
|
(package private) static String |
whereDelim
|
Fields inherited from class org.makumba.db.TransactionImplementation |
---|
ddp, qp, tp |
Constructor Summary | |
---|---|
|
DBConnection(Database database,
String dataSource,
TransactionProvider tp)
|
|
DBConnection(Database database,
TransactionProvider tp)
|
protected |
DBConnection(TransactionProvider tp)
|
Method Summary | |
---|---|
protected void |
deleteLock(String symbol)
|
Vector<Dictionary<String,Object>> |
executeQuery(String OQL,
Object args)
Execute query without limiting the results. |
Vector<Dictionary<String,Object>> |
executeQuery(String OQL,
Object args,
int offset,
int limit)
Execute a parametrized OQL query. |
protected Vector<Dictionary<String,Object>> |
executeReadQuery(Pointer p,
StringBuffer sb)
|
int |
executeUpdate(String type,
String set,
String where,
Object args)
Execute a parametrized update or delete. |
String |
getDataSource()
Returns the name of the data source to which this Transaction is connected |
Database |
getHostDatabase()
|
String |
getName()
Get the name of the database in the form host[_port]_dbprotocol_dbname |
String |
getNullConstant()
|
Query |
getQuery(String OQL)
|
Vector<Pointer> |
insert(String type,
Collection<Dictionary<String,Object>> data)
mass insert of a record |
Pointer |
insert(String type,
Dictionary<String,Object> data)
insert a record |
protected int |
insertFromQueryImpl(String type,
String OQL,
Object args)
|
void |
lock(String symbol)
Acquire a lock associated to the given application-specific symbol. |
void |
setDataSource(String dataSource)
|
protected Object[] |
treatParam(Object args)
|
void |
unlock(String symbol)
Free the lock on the given symbol, if any exists. |
protected void |
unlockAll()
|
protected StringBuffer |
writeReadQuery(Pointer p,
Enumeration<String> e)
|
Methods inherited from class org.makumba.db.TransactionImplementation |
---|
close, commit, delete, delete, delete1, extractReadFields, getParameterName, getPrimaryKeyName, getPrimaryKeyName, getSetJoinSyntax, getTransactionProvider, insert, insertFromQuery, paramsToMap, paramsToMap1, read, readCharEnumValues, readExternalSetValues, readIntEnumValues, readSetValues, rollback, setContext, transformTypeName, update, update, updateSet, updateWithValueDiff |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String dataSource
protected Database db
Map<String,Pointer> locks
Hashtable<String,Object> lockRecord
static final String whereDelim
Constructor Detail |
---|
protected DBConnection(TransactionProvider tp)
public DBConnection(Database database, TransactionProvider tp)
public DBConnection(Database database, String dataSource, TransactionProvider tp)
Method Detail |
---|
public Database getHostDatabase()
public String getName()
getName
in interface Database
getName
in interface Transaction
getName
in class TransactionImplementation
public void lock(String symbol)
Transaction
lock
in interface Database
lock
in interface Transaction
lock
in class TransactionImplementation
public void unlock(String symbol)
Transaction
unlock
in interface Database
unlock
in interface Transaction
unlock
in class TransactionImplementation
protected void deleteLock(String symbol)
protected void unlockAll()
protected StringBuffer writeReadQuery(Pointer p, Enumeration<String> e)
writeReadQuery
in class TransactionImplementation
protected Vector<Dictionary<String,Object>> executeReadQuery(Pointer p, StringBuffer sb)
executeReadQuery
in class TransactionImplementation
public Pointer insert(String type, Dictionary<String,Object> data)
insert
in interface Database
insert
in interface Transaction
insert
in class TransactionImplementation
type
- the makumba type to create a new record fordata
- the field-value mapping for the new record. public Vector<Pointer> insert(String type, Collection<Dictionary<String,Object>> data)
insert
in interface Transaction
insert
in class TransactionImplementation
type
- the makumba type to create a new record fordata
- a set of field-value mapping for the new record. public Vector<Dictionary<String,Object>> executeQuery(String OQL, Object args, int offset, int limit)
executeQuery
in interface Database
executeQuery
in interface Transaction
executeQuery
in class TransactionImplementation
OQL
- the query to execute. Refers to parameters as $1, $2 ...args
- the arguments of the queries. Should be null if there are none. If there is only one parameter, it can
be indicated directly. If there are more parameters, they can be indicated in a Object[] or a
java.util.Vector. Named parameters can be indicated in a Map.offset
- the offset of the first record to return, 0 for firstlimit
- the maximum number of records to return, -1 for all
protected int insertFromQueryImpl(String type, String OQL, Object args)
insertFromQueryImpl
in class TransactionImplementation
public Vector<Dictionary<String,Object>> executeQuery(String OQL, Object args)
Transaction
executeQuery
in interface Database
executeQuery
in interface Transaction
executeQuery
in class TransactionImplementation
Transaction.executeQuery(java.lang.String,java.lang.Object,int,int)
public int executeUpdate(String type, String set, String where, Object args)
executeUpdate
in class TransactionImplementation
type
- the type on which to perform the operationset
- the SET part of the query. if null, this performs a DELETE FROM statementwhere
- the WHERE part of the queryargs
- the query arguments
public Query getQuery(String OQL)
public String getNullConstant()
getNullConstant
in class TransactionImplementation
public String getDataSource()
Transaction
getDataSource
in interface Transaction
getDataSource
in class TransactionImplementation
public void setDataSource(String dataSource)
protected Object[] treatParam(Object args)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |