|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.mapped.scostore.BaseElementContainerStoreSpecialization
org.datanucleus.store.rdbms.scostore.RDBMSJoinListStoreSpecialization
public class RDBMSJoinListStoreSpecialization
RDBMS-specific implementation of a JoinListStoreSpecialization.
| Field Summary | |
|---|---|
protected java.lang.String |
addStmt
Statement for adding an element to the container. |
protected java.lang.String |
clearStmt
Statement for clearing the container. |
protected java.lang.String |
indexOfStmt
|
protected java.lang.String |
lastIndexOfStmt
|
protected java.lang.String |
removeAtStmt
|
protected java.lang.String |
removeStmt
Statement for removing an element from the container. |
protected java.lang.String |
setStmt
|
protected java.lang.String |
shiftStmt
|
protected java.lang.String |
sizeStmt
Statement for getting the size of the container. |
protected RDBMSManager |
storeMgr
|
protected boolean |
usingDiscriminatorInSizeStmt
Whether we are using a discriminator in the "size" statement. |
| Fields inherited from class org.datanucleus.store.mapped.scostore.BaseElementContainerStoreSpecialization |
|---|
clr, localiser |
| Method Summary | |
|---|---|
boolean |
contains(org.datanucleus.StateManager sm,
java.lang.Object element,
org.datanucleus.store.mapped.scostore.AbstractCollectionStore acs)
|
void |
executeClear(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
protected java.lang.String |
getAddStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generates the statement for adding items. |
protected java.lang.String |
getClearStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generate statement for clearing the container. |
protected java.lang.String |
getIndexOfStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generate statement for getting the index of an item. |
int[] |
getIndicesOf(org.datanucleus.StateManager sm,
java.util.Collection elements,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
protected java.lang.String |
getIndicesOfStmt(java.util.Collection elements,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generates the statement for getting the indices of a collection of element. |
protected java.lang.String |
getLastIndexOfStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generates the statement for getting the index of the last item. |
protected java.lang.String |
getRemoveAllStmt(java.util.Collection elements,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generate statement for removing a collection of items from the List. |
protected java.lang.String |
getRemoveAtStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generates the statement for removing an item. |
protected java.lang.String |
getRemoveStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generate statement for removing an element from the Collection. |
protected java.lang.String |
getSetStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generates the statement for setting an item. |
protected java.lang.String |
getShiftStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generates the statement for shifting items. |
int |
getSize(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
protected java.lang.String |
getSizeStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generate statement for getting the size of thecontainer. |
protected java.lang.String |
getUpdateEmbeddedElementStmt(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
org.datanucleus.store.mapped.scostore.ElementContainerStore acs)
Generate statement for update the field of an embedded element. |
int |
indexOf(org.datanucleus.StateManager sm,
java.lang.Object element,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
boolean |
internalAdd(org.datanucleus.StateManager sm,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs,
int start,
boolean atEnd,
java.util.Collection c,
int currentListSize,
int shift)
|
protected int |
internalIndexOf(org.datanucleus.StateManager sm,
java.lang.Object element,
java.lang.String stmt,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Internal method to find the index of an element. |
int[] |
internalRemove(org.datanucleus.StateManager ownerSM,
org.datanucleus.ManagedConnection conn,
boolean batched,
java.lang.Object element,
boolean executeNow,
org.datanucleus.store.mapped.scostore.AbstractCollectionStore acs)
|
protected void |
internalRemoveAt(org.datanucleus.StateManager sm,
int index,
java.lang.String stmt,
int size,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Internal method to remove an object at a location in the List. |
int[] |
internalShift(org.datanucleus.StateManager ownerSM,
org.datanucleus.ManagedConnection conn,
boolean batched,
int oldIndex,
int amount,
boolean executeNow,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Method to process a "shift" statement, updating the index in the list of the specified index. |
protected void |
invalidateAddStmt()
Method to remove any stored statement for addition of an element. |
int |
lastIndexOf(org.datanucleus.StateManager sm,
java.lang.Object element,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
protected void |
prepareIndicesOfStmt(org.datanucleus.StateManager sm,
java.sql.PreparedStatement ps,
java.util.Collection elements,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Method to prepare the indicesOf statement for use. |
boolean |
removeAll(int currentListSize,
int[] indices,
java.util.Collection elements,
org.datanucleus.StateManager sm,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
void |
removeAt(org.datanucleus.StateManager sm,
int index,
int size,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
void |
set(java.lang.Object element,
int index,
org.datanucleus.StateManager sm,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
boolean |
updateEmbeddedElement(org.datanucleus.StateManager sm,
java.lang.Object element,
int fieldNumber,
java.lang.Object value,
org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.datanucleus.store.mapped.scostore.AbstractListStoreSpecialization |
|---|
getIndicesOf, indexOf, internalShift, lastIndexOf |
| Methods inherited from interface org.datanucleus.store.mapped.scostore.AbstractCollectionStoreSpecialization |
|---|
contains, internalRemove, updateEmbeddedElement |
| Methods inherited from interface org.datanucleus.store.mapped.scostore.ElementContainerStoreSpecialization |
|---|
executeClear, getSize |
| Field Detail |
|---|
protected java.lang.String removeAtStmt
protected java.lang.String setStmt
protected java.lang.String shiftStmt
protected java.lang.String indexOfStmt
protected java.lang.String lastIndexOfStmt
protected final RDBMSManager storeMgr
protected java.lang.String sizeStmt
protected java.lang.String clearStmt
protected java.lang.String addStmt
protected java.lang.String removeStmt
protected boolean usingDiscriminatorInSizeStmt
| Method Detail |
|---|
protected java.lang.String getRemoveAllStmt(java.util.Collection elements,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
DELETE FROM LISTTABLE WHERE (OWNERCOL=? AND ELEMENTCOL=?) OR (OWNERCOL=? AND ELEMENTCOL=?) OR (OWNERCOL=? AND ELEMENTCOL=?)
elements - Collection of elements to remove
public void removeAt(org.datanucleus.StateManager sm,
int index,
int size,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
removeAt in interface org.datanucleus.store.mapped.scostore.JoinListStoreSpecialization
public boolean removeAll(int currentListSize,
int[] indices,
java.util.Collection elements,
org.datanucleus.StateManager sm,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
removeAll in interface org.datanucleus.store.mapped.scostore.JoinListStoreSpecializationprotected java.lang.String getSetStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
UPDATE LISTTABLE SET [ELEMENTCOL = ?] [EMBEDDEDFIELD1=?, EMBEDDEDFIELD2=?, ...] WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
public void set(java.lang.Object element,
int index,
org.datanucleus.StateManager sm,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
set in interface org.datanucleus.store.mapped.scostore.JoinListStoreSpecialization
public boolean internalAdd(org.datanucleus.StateManager sm,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs,
int start,
boolean atEnd,
java.util.Collection c,
int currentListSize,
int shift)
internalAdd in interface org.datanucleus.store.mapped.scostore.JoinListStoreSpecializationprotected java.lang.String getIndexOfStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
SELECT INDEXCOL FROM LISTTABLE WHERE OWNERCOL=? AND ELEMENTCOL=? [AND EMBEDDEDFIELD1=? AND EMBEDDEDFIELD2=? AND ...] [AND DISTINGUISHER=?] ORDER BY INDEXCOL
protected java.lang.String getLastIndexOfStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
SELECT INDEXCOL FROM LISTTABLE WHERE OWNERCOL=? AND ELEMENTCOL=? [AND EMBEDDEDFIELD1=? AND EMBEDDEDFIELD2=? AND ...] [AND DISTINGUISHER=?] ORDER BY INDEXCOL DESC
protected java.lang.String getRemoveAtStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
DELETE FROM LISTTABLE WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
protected java.lang.String getShiftStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
UPDATE LISTTABLE SET INDEXCOL = ? WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
protected java.lang.String getIndicesOfStmt(java.util.Collection elements,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
SELECT INDEXCOL FROM LISTTABLE
WHERE (OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?]) OR
(OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?]) OR
(OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?])
ORDER BY INDEXCOL DESC
elements - The elements to retrieve the indices for.
protected void prepareIndicesOfStmt(org.datanucleus.StateManager sm,
java.sql.PreparedStatement ps,
java.util.Collection elements,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
sm - State Manager of the container.ps - The Prepared Statementelements - Collection of elements
protected int internalIndexOf(org.datanucleus.StateManager sm,
java.lang.Object element,
java.lang.String stmt,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
sm - The state manager.element - The elementstmt - The statement to find the element.
public int indexOf(org.datanucleus.StateManager sm,
java.lang.Object element,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
indexOf in interface org.datanucleus.store.mapped.scostore.AbstractListStoreSpecialization
public int lastIndexOf(org.datanucleus.StateManager sm,
java.lang.Object element,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
lastIndexOf in interface org.datanucleus.store.mapped.scostore.AbstractListStoreSpecialization
public int[] getIndicesOf(org.datanucleus.StateManager sm,
java.util.Collection elements,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
getIndicesOf in interface org.datanucleus.store.mapped.scostore.AbstractListStoreSpecialization
protected void internalRemoveAt(org.datanucleus.StateManager sm,
int index,
java.lang.String stmt,
int size,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
sm - The state manager.index - The locationstmt - The statement to remove the element from the Listsize - Current list size (if known). -1 if not known
public int[] internalShift(org.datanucleus.StateManager ownerSM,
org.datanucleus.ManagedConnection conn,
boolean batched,
int oldIndex,
int amount,
boolean executeNow,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
internalShift in interface org.datanucleus.store.mapped.scostore.AbstractListStoreSpecializationownerSM - StateManager of the ownerconn - The connectionbatched - Whether the statement is batchedoldIndex - The old indexamount - Amount to shift by (negative means shift down)executeNow - Whether to execute the statement now (or wait for batching)
org.datanucleus.store.mapped.exceptions.MappedDatastoreException - Thrown if an error occurs
protected java.lang.String getUpdateEmbeddedElementStmt(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
org.datanucleus.store.mapped.scostore.ElementContainerStore acs)
UPDATE SETTABLE SET EMBEDDEDFIELD1 = ? WHERE OWNERCOL=? AND ELEMENTCOL = ?
fieldMapping - The mapping for the field within the embedded object to be updated
public boolean updateEmbeddedElement(org.datanucleus.StateManager sm,
java.lang.Object element,
int fieldNumber,
java.lang.Object value,
org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
updateEmbeddedElement in interface org.datanucleus.store.mapped.scostore.AbstractCollectionStoreSpecialization
public boolean contains(org.datanucleus.StateManager sm,
java.lang.Object element,
org.datanucleus.store.mapped.scostore.AbstractCollectionStore acs)
contains in interface org.datanucleus.store.mapped.scostore.AbstractCollectionStoreSpecialization
public int[] internalRemove(org.datanucleus.StateManager ownerSM,
org.datanucleus.ManagedConnection conn,
boolean batched,
java.lang.Object element,
boolean executeNow,
org.datanucleus.store.mapped.scostore.AbstractCollectionStore acs)
throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
internalRemove in interface org.datanucleus.store.mapped.scostore.AbstractCollectionStoreSpecializationorg.datanucleus.store.mapped.exceptions.MappedDatastoreExceptionprotected java.lang.String getRemoveStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
DELETE FROM COLLTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ? [AND DISCRIM = ?]
ecs - Element container store
protected void invalidateAddStmt()
protected java.lang.String getAddStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
INSERT INTO COLLTABLE (OWNERCOL,[ELEMENTCOL],[EMBEDDEDFIELD1, EMBEDDEDFIELD2,...],[ORDERCOL])
VALUES (?,?,?)
public void executeClear(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
protected java.lang.String getClearStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
DELETE FROM CONTAINERTABLE WHERE OWNERCOL = ? [AND RELATION_DISCRIM=?]TODO Add a discriminator restriction on this statement so we only clear ones with a valid discriminator value
public int getSize(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
protected java.lang.String getSizeStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
SELECT COUNT(*) FROM TBL THIS [INNER JOIN ELEM_TBL ELEM ON TBL.COL = ELEM.ID] - when no null [LEFT OUTER JOIN ELEM_TBL ELEM ON TBL.COL = ELEM.ID] - when allows null WHERE THIS.OWNERCOL=? [AND THIS.ORDERCOL IS NOT NULL] [AND (DISCRIMINATOR=? OR DISCRMINATOR=? OR DISCRIMINATOR=? [OR DISCRIMINATOR IS NULL])] [AND RELATION_DISCRIM=?]The discriminator part includes all subclasses of the element type. If the element is in a different table to the container then an INNER JOIN will be present to link the two tables, and table aliases will be present also. TODO Update this to allow for getting the size when more than 1 element table.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||