|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.makumba.db.TransactionImplementation
org.makumba.db.makumba.DBConnection
org.makumba.db.makumba.DBConnectionWrapper
public class DBConnectionWrapper
A wrapper for db connections, used to provide a temporary that holds a reference to a permanent DBConnection
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.makumba.db.makumba.DBConnection |
|---|
DBConnection.QueryAndArgs |
| Field Summary | |
|---|---|
(package private) Date |
created
|
(package private) Throwable |
t
|
(package private) DBConnection |
wrapped
|
| Fields inherited from class org.makumba.db.makumba.DBConnection |
|---|
dataSource, db, lockRecord, locks, queries, whereDelim |
| Fields inherited from class org.makumba.db.TransactionImplementation |
|---|
ddp, qp, tp |
| Constructor Summary | |
|---|---|
DBConnectionWrapper(DBConnection wrapped,
String dataSource,
TransactionProvider tp)
|
|
DBConnectionWrapper(TransactionProvider tp)
|
|
| Method Summary | |
|---|---|
void |
close()
Give this connection back to the system. |
void |
commit()
Commit the transaction associated with this connection. |
void |
delete(Pointer ptr)
Delete the record pointed by the given pointer. |
int |
delete(String from,
String where,
Object parameters)
Deletes in the form delete("general.Person p", "p=$1", params) NOTE that this method does not delete subsets and subrecords |
Vector<Dictionary<String,Object>> |
executeQuery(String OQL,
Object parameterValues,
int offset,
int limit)
Execute a parametrized OQL query. |
protected void |
finalize()
|
String |
getCreationStack()
|
Database |
getHostDatabase()
|
String |
getName()
Get the name of the database in the form host[_port]_dbprotocol_dbname |
DBConnection |
getWrapped()
|
Pointer |
insert(Pointer host,
String subsetField,
Dictionary<String,Object> data)
Insert a record in a subset (1-N set) or subrecord (1-1 pointer) of the given record. |
Pointer |
insert(String type,
Dictionary<String,Object> data)
insert a record |
void |
lock(String symbol)
Acquire a lock associated to the given application-specific symbol. |
Dictionary<String,Object> |
read(Pointer ptr,
Object fields)
Read fields of a record. |
void |
rollback()
Rollback the transaction associated with this connection. |
void |
setContext(Attributes a)
|
String |
toString()
|
void |
unlock(String symbol)
Free the lock on the given symbol, if any exists. |
int |
update(Pointer ptr,
Dictionary<String,Object> fieldsToChange)
change the record pointed by the given pointer. |
int |
update(String from,
String set,
String where,
Object parameters)
updates in the form update("general.Person p", "p.birthdate=$1", "p=$2", params) NOTE that this method does not delete subrecords if their pointers are nullified |
| Methods inherited from class org.makumba.db.makumba.DBConnection |
|---|
deleteLock, executeQuery, executeReadQuery, executeUpdate, getDataSource, getNullConstant, getQuery, insertFromQuery, setDataSource, unlockAll, writeReadQuery |
| Methods inherited from class org.makumba.db.TransactionImplementation |
|---|
delete1, extractReadFields, getParameterName, getPrimaryKeyName, getPrimaryKeyName, getSetJoinSyntax, getTransactionProvider, paramsToMap, paramsToMap1, transformTypeName, treatParam |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
DBConnection wrapped
Throwable t
Date created
| Constructor Detail |
|---|
DBConnectionWrapper(TransactionProvider tp)
DBConnectionWrapper(DBConnection wrapped,
String dataSource,
TransactionProvider tp)
| Method Detail |
|---|
public DBConnection getWrapped()
public String getName()
DBConnection
getName in interface DatabasegetName in interface TransactiongetName in class DBConnectionpublic Database getHostDatabase()
getHostDatabase in class DBConnection
public Dictionary<String,Object> read(Pointer ptr,
Object fields)
TransactionLogger, MakumbaSystem.setLoggingRoot(java.lang.String)) in the "db.query.compilation", "db.query.execution", "db.query.performance" loggers, with Level.INFO logging level. "db.query.execution" also logs Level.SEVERE fatal errors.
read in interface Databaseread in interface Transactionread in class TransactionImplementationptr - the pointer to the recordfields - the fields to read, or null to read all fields. Can be a String, String[], Enumeration or a Vector
public Vector<Dictionary<String,Object>> executeQuery(String OQL,
Object parameterValues,
int offset,
int limit)
DBConnection
executeQuery in interface DatabaseexecuteQuery in interface TransactionexecuteQuery in class DBConnectionOQL - the query to execute. Refers to parameters as $1, $2 ...parameterValues - 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
public Pointer insert(String type,
Dictionary<String,Object> data)
DBConnection
insert in interface Databaseinsert in interface Transactioninsert in class DBConnectiontype - the makumba type to create a new record fordata - the field-value mapping for the new record.
public Pointer insert(Pointer host,
String subsetField,
Dictionary<String,Object> data)
TransactionImplementation
insert in interface Databaseinsert in interface Transactioninsert in class TransactionImplementationhost - a pointer to the host record, to which a subrecord will be addedsubsetField - the name of the subrecord field.data - the field-value mapping for the new subrecord.
public int update(Pointer ptr,
Dictionary<String,Object> fieldsToChange)
TransactionImplementation
update in interface Databaseupdate in interface Transactionupdate in class TransactionImplementationptr - pointer to the record to updatefieldsToChange - key-value pairs for the fields to modify. Pointer.Null,
Pointer.NullInteger,
Pointer.NullString,
Pointer.NullText,
Pointer.NullDate,
Pointer.NullSet
public int update(String from,
String set,
String where,
Object parameters)
TransactionImplementation
update in interface Databaseupdate in interface Transactionupdate in class TransactionImplementationfrom - a makumba type in which update will take place, for example "general.Person p"set - the assignments made by the update, as OQL expression e.g. "p.birthdate=$1". Use "nil" for null assignments.where - the OQL conditions selecting the objects on which the update will be made, e.g. "p=$2"parameters - the parameter values. Should be null if there are no parameters. 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
public void delete(Pointer ptr)
TransactionImplementation
delete in interface Databasedelete in interface Transactiondelete in class TransactionImplementationptr - the pointer to the record to be deleted
public int delete(String from,
String where,
Object parameters)
TransactionImplementation
delete in interface Databasedelete in interface Transactiondelete in class TransactionImplementationfrom - a makumba type in which delete will take place, for example "general.Person p"where - the OQL conditions selecting the objects to be deleted, e.g. "p=$1"parameters - the parameter values. Should be null if there are no parameters. 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
public void commit()
Transaction
commit in interface Databasecommit in interface Transactioncommit in class TransactionImplementationpublic void rollback()
Transaction
rollback in interface Databaserollback in interface Transactionrollback in class TransactionImplementationpublic void lock(String symbol)
Transaction
lock in interface Databaselock in interface Transactionlock in class DBConnectionpublic void unlock(String symbol)
Transaction
unlock in interface Databaseunlock in interface Transactionunlock in class DBConnectionpublic void close()
Transaction
close in interface Databaseclose in interface Transactionclose in class TransactionImplementationprotected void finalize()
finalize in class Objectpublic void setContext(Attributes a)
setContext in class TransactionImplementationpublic String getCreationStack()
public String toString()
toString in class Object
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||