Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
In short, an ISemantext is the statement runtime context for building sql.
*
A semantic event can be for example starting an insert transaction with a data row.
* Such data may needing some processing defined by the application requirements.
*
*
For example, a "fullpath" field in a table means a deep first traveling notation of tree nodes.
* In this case, a user defined semantic event handler can compose this data (fullpath) according to it's parent's
* fullpath, then append the field into the inserting row.
*
*
Semantic-transact is designed only process SQL structure, not handling the data semantics,
* so it only fire the event to the handler, to the implementation of ISemantext.
*
*
An ISemantext instance is used as an sql composing context
* by semantic-transact when travel the AST and composing SQL(s). There must be an {@link #insert}
* event which fired at the beginning of composing an insert sql, and one event for inserting each row,
* the {@link #onInsert}.
* @author [email protected]
*
*/
public interface ISemantext {
/**Match referencing string like "RESULVE tabl.col".
* Regex.findGroups():
* [0] RESULVE
* [1] task_nodes
* [2] taskId
* replaced by {@link io.odysz.transact.sql.parts.Resulving Resulving}
String refPattern = "^\\s*(RESULVE)\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*$";
* */
/**
* @return current connId
*/
public String connId();
/**Set connId for committing statement.
* @param conn
* @return this context
*/
public ISemantext connId(String conn);
/**
*
Create a context for the insert-sql composing process.
*
Called when starting an inserting transaction's sql composing.
*
The parameter usr is optional if the semantics handler don't care about user's fingerprint.
* @param insert
* @param mainTabl
* @param usr user information used for modify sql AST
* @return the new ISemantext context instance for resolving semantics.
* @throws SQLException
*/
public ISemantext insert(Insert insert, String mainTabl, IUser usr) throws SQLException;
/**
*
Create a context for the update-sql composing process.
*
Called when starting an update transaction sql composing.
*
The parameter usr is optional if the semantics handler don't care about user's fingerprint.
* @param update
* @param mainTabl
* @param usr user information used for modify sql AST
* @return new ISemantext for update statement
* @throws SQLException
*/
public ISemantext update(Update update, String mainTabl, IUser usr) throws SQLException;
/**
*
Resolving inserting values, e.g an AUTO key is generated here.
*
Called each time an {@link Insert} statement found itself will composing a insert-sql ({@link Insert#sql(ISemantext)})
* @param insert
* @param tabl
* @param rows [ list[Object[n, v], ... ], ... ]
* @return the ISemantext context, a thread safe context for resolving semantics like FK value resolving.
* @throws SemanticException
*/
ISemantext onInsert(Insert insert, String tabl, List> rows) throws TransException;
/**
*
Resolves values for updating.
* Called each time an {@link Update} statement found itself will composing an update-sql.
* @param update
* @param tabl
* @param nvs
* @return the update context
* @throws SemanticException
*/
public ISemantext onUpdate(Update update, String tabl, ArrayList