|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
MakumbaSystem
.
Stricly speaking this class represents a database connection (later on, transaction). Obtaining more such
objects for the same database configurations will result in opening more connections. Connections must be
given back to the system using the close()
method. That will be done automatically by the
object's finalizer. In makumba business logic, connections passed to the BL methods are automatically
closed by the system after the BL operations (including eventual automatic DB acceses) were completed. To
open a "sibling" of a connection conn of this type, use
MakumbaSystem.getConnectionTo(conn.getName()). In most cases, you will have to close the sibling
yourself.
At the level of this API, data is represented as java.util.Dictionary, both for reading and writing. Most
methods throw DBError
if a fatal database error occurs. If the connection to the database is
lost, an attempt is made to reconnect before throwing a DBError
.
All methods throw subclasses of either Error or RuntimeException, so nothing needs to be caught explicitely.
@Deprecated public interface Database
TransactionProvider.getDefaultDataSourceName()
,
TransactionProvider.getConnectionTo(java.lang.String)
Method Summary | |
---|---|
void |
close()
Deprecated. Give this connection back to the system. |
void |
commit()
Deprecated. Commit the transaction associated with this connection. |
void |
delete(Pointer ptr)
Deprecated. Delete the record pointed by the given pointer. |
int |
delete(String from,
String where,
Object parameterValues)
Deprecated. Delete in the form delete("general.Person p", "p=$1", params) . |
Vector<Dictionary<String,Object>> |
executeQuery(String OQL,
Object parameterValues)
Deprecated. Execute query without limiting the results. |
Vector<Dictionary<String,Object>> |
executeQuery(String OQL,
Object parameterValues,
int offset,
int limit)
Deprecated. Execute a parametrized OQL query. |
String |
getName()
Deprecated. Get the name of the database in the form host[_port]_dbprotocol_dbname |
Pointer |
insert(Pointer host,
String subsetField,
Dictionary<String,Object> data)
Deprecated. Insert a record in a subset (1-N set) of the given record. |
Pointer |
insert(String type,
Dictionary<String,Object> data)
Deprecated. Insert a record of the given type. |
void |
lock(String symbol)
Deprecated. Acquire a lock associated to the given application-specific symbol. |
Dictionary<String,Object> |
read(Pointer ptr,
Object fields)
Deprecated. Read fields of a record. |
void |
rollback()
Deprecated. Rollback the transaction associated with this connection. |
void |
unlock(String symbol)
Deprecated. Free the lock on the given symbol, if any exists. |
int |
update(Pointer ptr,
Dictionary<String,Object> fieldsToChange)
Deprecated. Change the record pointed by the given pointer. |
int |
update(String from,
String set,
String where,
Object parameterValues)
Deprecated. Update in the form update("general.Person p", "p.birthdate=$1", "p=$2", params) . |
Method Detail |
---|
String getName()
Dictionary<String,Object> read(Pointer ptr, Object fields)
Logger
,
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.
ptr
- the pointer to the recordfields
- the fields to read, or null to read all fields. Can be an String[] or a Vector
ClassCastException
- if the fields argument is not String[] or Vector
DBError
- if a fatal database error occurs
IllegalStateException
- if the connection was already closedVector<Dictionary<String,Object>> executeQuery(String OQL, Object parameterValues, int offset, int limit)
Logger
,
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.
OQL
- 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.Vectorlimit
- the maximum number of records to return, -1 for alloffset
- the offset of the first record to return, 0 for first
DBError
- if a fatal database error occurs
OQLParseError
- if the OQL is not correct
InvalidValueException
- in case of makumba type conflict between a pointer value passed as parameter and the type expected
in the respective OQL expression
IllegalStateException
- if the connection was already closedVector<Dictionary<String,Object>> executeQuery(String OQL, Object parameterValues)
executeQuery(java.lang.String,java.lang.Object,int,int)
Pointer insert(String type, Dictionary<String,Object> data)
Logger
,
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:
type
- the makumba type to create a new record fordata
- the field-value mapping for the new record. DBError
- if a fatal database error occurs
DataDefinitionNotFoundError
- if the indicated type is not found
InvalidValueException
- if a certain field does not accept the given value
InvalidValueException
- in case of makumba type conflict between a pointer value passed and the definition of the
respective field
ClassCastException
- in case of java type conflict between a value passed and the definition of the respective field
IllegalStateException
- if the connection was already closedPointer insert(Pointer host, String subsetField, Dictionary<String,Object> data)
Logger
,
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.
host
- 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. DBError
- if a fatal database error occurs
InvalidValueException
- if a certain value is not valid for a field
InvalidValueException
- in case of makumba type conflict between a pointer value passed and the definition of the
respective field
ClassCastException
- in case of java type conflict between a value passed and the definition of the respective field
IllegalStateException
- if the connection was already closedint update(Pointer ptr, Dictionary<String,Object> fieldsToChange)
Logger
,
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:
ptr
- pointer to the record to updatefieldsToChange
- key-value pairs for the fields to modify. DBError
- if a fatal database error occurs
InvalidValueException
- if a certain value is not valid for a field
InvalidValueException
- in case of makumba type conflict between a pointer value passed and the definition of the
respective field
ClassCastException
- in case of java type conflict between a value passed and the definition of the respective field
IllegalStateException
- if the connection was already closedPointer.Null
,
Pointer.NullInteger
,
Pointer.NullString
,
Pointer.NullText
,
Pointer.NullDate
,
Pointer.NullSet
int update(String from, String set, String where, Object parameterValues)
update("general.Person p", "p.birthdate=$1", "p=$2", params)
. Logger
,
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.
from
- 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"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
IllegalStateException
- if the connection was already closed
DBError
- if a fatal database error occursvoid delete(Pointer ptr)
Logger
,
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.
ptr
- the pointer to the record to be deleted
DBError
- if a fatal database error occurs
IllegalStateException
- if the connection was already closedint delete(String from, String where, Object parameterValues)
delete("general.Person p", "p=$1", params)
. Logger
,
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.
from
- 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"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
DBError
- if a fatal database error occurs
IllegalStateException
- if the connection was already closedvoid close()
DBError
- if a fatal database error occurs
IllegalStateException
- if the connection was already closedvoid commit()
void rollback()
void lock(String symbol)
void unlock(String symbol)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |