|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dftproject.genesis.core.data.DataConnection
public class DataConnection
DataConnection wraps a JDBC connection to the underlying database.
| Constructor Summary | |
|---|---|
DataConnection(java.sql.Connection conn,
java.lang.String store)
Creates a wrapper for the JDBC connection which can manipulate the given store. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the underlying JDBC connection. |
void |
createStore()
Creates the current store. |
void |
delete(INode graph,
INode subject,
INode predicate,
INode object)
Deletes the given statement from the current store. |
protected void |
deleteStatement(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
Internal method which deletes the raw values of a statement from the current store. |
void |
deleteStore()
Drops all tables, indexes, procedures, and triggers related to the current store from the database. |
protected java.lang.String |
escape(java.lang.String str)
Escapes the given string for use in database queries. |
protected void |
executeNoErrorHandling(java.lang.String sql)
Executes the given SQL statement. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Executes the given SQL query. |
int |
executeUpdate(java.lang.String sql)
Executes the given SQL update statement. |
protected long |
getLongLiteralID(java.lang.String value,
boolean add)
Returns the ID of the given long literal. |
java.lang.String |
getLongLiteralTableName()
Returns the name of the long literal table for the current store. |
protected java.lang.String |
getLongLiteralValue(long id)
Returns the raw long literal value associated with the ID. |
java.lang.String |
getStatementTableName()
Returns the name of the statement table for the current store. |
protected java.lang.String |
getWhereClause(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
Returns a SQL WHERE clause that matches the given raw statement values (non-null parameters). |
static void |
handleDelete(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
Called by the statement table deletion trigger to notify listeners. |
static void |
handleInsert(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
Called by the statement table insertion trigger to notify listeners. |
protected void |
initEscape()
Initializes the regular expression pattern and replacement string used for escaping database strings. |
void |
insert(INode graph,
INode subject,
INode predicate,
INode object)
Inserts the given statement into the current store. |
protected void |
insertStatement(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
Internal method which inserts the raw values of a statement into the current store. |
java.lang.String |
nodeToString(INode node,
boolean addIfLong)
Returns the raw database representation of the given node. |
boolean |
storeExists()
Returns whether or not the current store exists. |
INode |
stringToNode(java.lang.String value,
DataView view)
Instantiates the node given by the raw database representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DataConnection(java.sql.Connection conn,
java.lang.String store)
conn - an open JDBC connectionstore - the store that this connection manipulates| Method Detail |
|---|
public void close()
protected void initEscape()
protected java.lang.String escape(java.lang.String str)
str - the string to escape
public java.lang.String getStatementTableName()
public java.lang.String getLongLiteralTableName()
The long literal table is used for storing literals whose raw database representation is too large to fit in the statement table.
public boolean storeExists()
throws java.sql.SQLException
java.sql.SQLException
public void createStore()
throws java.sql.SQLException
The name of the store will be used as a table prefix.
java.sql.SQLException
public void deleteStore()
throws java.sql.SQLException
java.sql.SQLException
public void insert(INode graph,
INode subject,
INode predicate,
INode object)
graph - the graphsubject - the subjectpredicate - the predicateobject - the object
protected void insertStatement(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
graph - the graphsubject - the subjectpredicate - the predicateobject - the object
public void delete(INode graph,
INode subject,
INode predicate,
INode object)
throws java.sql.SQLException
graph - the graphsubject - the subjectpredicate - the predicateobject - the object
java.sql.SQLException
protected void deleteStatement(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
throws java.sql.SQLException
graph - the graphsubject - the subjectpredicate - the predicateobject - the object
java.sql.SQLExceptionprotected java.lang.String getLongLiteralValue(long id)
id - the id of the long literal to look up
protected long getLongLiteralID(java.lang.String value,
boolean add)
value - the long literaladd - whether or not to add the long literal if it does not already
exist
protected java.lang.String getWhereClause(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
graph - the graph, or null for any graphsubject - the subject, or null for any subjectpredicate - the predicate, or null for any predicateobject - the object, or null for any object
protected void executeNoErrorHandling(java.lang.String sql)
throws java.sql.SQLException
sql - the SQL statement
java.sql.SQLException
public java.sql.ResultSet executeQuery(java.lang.String sql)
throws java.sql.SQLException
sql - the SQL query
java.sql.SQLException
public int executeUpdate(java.lang.String sql)
throws java.sql.SQLException
sql - the SQL query
java.sql.SQLException
public static void handleInsert(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
graph - the graphsubject - the subjectpredicate - the predicateobject - the object
public static void handleDelete(java.lang.String graph,
java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
graph - the graphsubject - the subjectpredicate - the predicateobject - the object
public java.lang.String nodeToString(INode node,
boolean addIfLong)
If the node is a long literal, this method can optionally add it to the long literals table of the current store. This is neccessary when the result of this method will be used to add the node to the current store.
node - the nodeaddIfLong - whether or not to add long literals to the current store
public INode stringToNode(java.lang.String value,
DataView view)
value - the raw database representationview - the view to use as a resource cache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||