|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.makumba.db.TransactionImplementation
public abstract class TransactionImplementation
| Nested Class Summary | |
|---|---|
(package private) static class |
TransactionImplementation.EasyMap<K,V>
|
| Field Summary | |
|---|---|
protected DataDefinitionProvider |
ddp
|
protected QueryProvider |
qp
|
protected TransactionProvider |
tp
|
| Constructor Summary | |
|---|---|
TransactionImplementation(TransactionProvider tp)
|
|
| Method Summary | |
|---|---|
abstract void |
close()
Give this connection back to the system. |
abstract 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 |
void |
delete1(Pointer ptr)
|
abstract Vector<Dictionary<String,Object>> |
executeQuery(String OQL,
Object parameterValues)
Execute query without limiting the results. |
abstract Vector<Dictionary<String,Object>> |
executeQuery(String OQL,
Object parameterValues,
int offset,
int limit)
Execute a parametrized OQL query. |
protected abstract Vector<Dictionary<String,Object>> |
executeReadQuery(Pointer p,
StringBuffer sb)
|
protected abstract int |
executeUpdate(String type,
String set,
String where,
Object args)
Executes an UPDATE statement or a DELETE FROM statement, depending on the value of set. |
protected Enumeration<String> |
extractReadFields(Pointer p,
Object flds)
|
abstract String |
getDataSource()
Returns the name of the data source to which this Transaction is connected |
abstract String |
getName()
Get the name of the database in the form host[_port]_dbprotocol_dbname |
abstract String |
getNullConstant()
|
String |
getParameterName()
|
String |
getPrimaryKeyName()
|
String |
getPrimaryKeyName(String ptrDD)
|
String |
getSetJoinSyntax()
|
TransactionProvider |
getTransactionProvider()
Returns the TransactionProvider which created this Transaction |
Pointer |
insert(Pointer base,
String field,
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 of the given type. |
abstract int |
insertFromQuery(String type,
String OQL,
Object parameterValues)
Insert the results of the query in the given type. |
abstract void |
lock(String symbol)
Acquire a lock associated to the given application-specific symbol. |
protected Map<String,Object> |
paramsToMap(Object args)
|
protected Map<String,Object> |
paramsToMap1(Object args)
|
Dictionary<String,Object> |
read(Pointer p,
Object flds)
Read fields of a record. |
abstract void |
rollback()
Rollback the transaction associated with this connection. |
void |
setContext(Attributes a)
|
String |
transformTypeName(String name)
|
protected Object[] |
treatParam(Object args)
|
abstract 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 |
protected abstract StringBuffer |
writeReadQuery(Pointer p,
Enumeration<String> e)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected DataDefinitionProvider ddp
protected QueryProvider qp
protected TransactionProvider tp
| Constructor Detail |
|---|
public TransactionImplementation(TransactionProvider tp)
| Method Detail |
|---|
public abstract void close()
Transaction
close in interface Databaseclose in interface Transactionpublic abstract void commit()
Transaction
commit in interface Databasecommit in interface Transactionpublic abstract void rollback()
Transaction
rollback in interface Databaserollback in interface Transactionpublic abstract String getName()
Transaction
getName in interface DatabasegetName in interface Transactionpublic abstract void lock(String symbol)
Transaction
lock in interface Databaselock in interface Transactionpublic abstract void unlock(String symbol)
Transaction
unlock in interface Databaseunlock in interface Transaction
protected abstract int executeUpdate(String type,
String set,
String where,
Object args)
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
INSERT, UPDATE, or DELETE
statements or (2) 0 for SQL statements that return nothingpublic void delete(Pointer ptr)
delete in interface Databasedelete in interface Transactionptr - the pointer to the record to be deleted
public int delete(String from,
String where,
Object parameters)
delete in interface Databasedelete in interface Transactionfrom - 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 abstract Vector<Dictionary<String,Object>> executeQuery(String OQL,
Object parameterValues,
int offset,
int limit)
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.
executeQuery in interface DatabaseexecuteQuery in interface TransactionOQL - 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 abstract Vector<Dictionary<String,Object>> executeQuery(String OQL,
Object parameterValues)
Transaction
executeQuery in interface DatabaseexecuteQuery in interface TransactionTransaction.executeQuery(java.lang.String,java.lang.Object,int,int)public TransactionProvider getTransactionProvider()
Transaction
getTransactionProvider in interface Transaction
public Pointer insert(String type,
Dictionary<String,Object> data)
TransactionLogger, MakumbaSystem.setLoggingRoot(java.lang.String)) in the "db.update.execution", "db.update.performance" loggers, with Level.INFO logging level. "db.update.execution" also logs Level.SEVERE fatal errors.
Special makumba fields are treated as follows:
insert in interface Databaseinsert in interface Transactiontype - the makumba type to create a new record fordata - the field-value mapping for the new record.
public Pointer insert(Pointer base,
String field,
Dictionary<String,Object> data)
insert in interface Databaseinsert in interface Transactionbase - a pointer to the host record, to which a subrecord will be addedfield - the name of the subrecord field.data - the field-value mapping for the new subrecord.
public abstract int insertFromQuery(String type,
String OQL,
Object parameterValues)
Transaction
insertFromQuery in interface Transactiontype - the type where to insertOQL - the OQL query to execute. Refers to parameters as $1, $2 ...parameterValues - 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
protected abstract StringBuffer writeReadQuery(Pointer p,
Enumeration<String> e)
public int update(Pointer ptr,
Dictionary<String,Object> fieldsToChange)
update in interface Databaseupdate in interface Transactionptr - 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)
update in interface Databaseupdate in interface Transactionfrom - 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 Dictionary<String,Object> read(Pointer p,
Object flds)
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 Transactionp - the pointer to the recordflds - the fields to read, or null to read all fields. Can be a String, String[], Enumeration or a Vector
protected Enumeration<String> extractReadFields(Pointer p,
Object flds)
throws ProgrammerError
ProgrammerError
protected abstract Vector<Dictionary<String,Object>> executeReadQuery(Pointer p,
StringBuffer sb)
public void delete1(Pointer ptr)
public String getSetJoinSyntax()
protected Map<String,Object> paramsToMap(Object args)
protected Map<String,Object> paramsToMap1(Object args)
protected Object[] treatParam(Object args)
public String transformTypeName(String name)
public String getParameterName()
public String getPrimaryKeyName()
public String getPrimaryKeyName(String ptrDD)
public abstract String getNullConstant()
public abstract String getDataSource()
Transaction
getDataSource in interface Transactionpublic void setContext(Attributes a)
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||