Class DATranscxt
- Direct Known Subclasses:
DBSyntableBuilder,DBSynTransBuilder
Statement builder that can providing
statements handling callback methods.Those statements are the starting points to build a sql transact for querying,
updating, etc.
For how to use the created statements, see the testing class:
DASemantextTest.
loadSemanticsXml(String). Every sql building needing semantics handling must use a context instance created by
instancontxt(String, IUser).- Author:
- odys-z@github.com
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSemantics handler's map manager.static interfaceCallback for buiding a connection's semantics map, with map-key = table. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static Stringprotected static io.odysz.semantics.IUserprotected static Stringprotected static HashMap<String,DATranscxt.SemanticsMap> { conn: map{table: DASemantics[handlers]} }Fields inherited from class io.odysz.transact.sql.Transcxt
basictx -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a stub transaction helper without depending on a database connection, typically for initialization.protectedDATranscxt(DASemantext stxt) DATranscxt(String conn) Create a transact builder with basic DASemantext instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigRoot(String cfgRoot, String absRuntimeRoot) Configuration's rootio.odysz.transact.sql.DeleteCreate a delete statement that will report affected rows as data entry "total".static io.odysz.semantics.IUserbooleanstatic StringfindResulved(io.odysz.semantics.SemanticObject rslt, String tabl, String pk) static io.odysz.transact.sql.TranscxtgetBasicTrans(String conn) Get a basic transact builder (without semantics handling)static DASemantics.SemanticHandlergetHandler(String conn, String tabl, DASemantics.smtype sm) static booleanhasSemantics(String conn, String tabl, DASemantics.smtype sm) static <M extends DATranscxt.SemanticsMap,S extends DASemantics>
MinitConfigs(String conn, XMLTable xcfg, DATranscxt.SmapFactory<M> smFactory) LoadsmtMaps.io.odysz.transact.sql.InsertCreate an insert statement that will report affected rows as data entry "total".io.odysz.semantics.ISemantextinstancontxt(String connId, io.odysz.semantics.IUser usr) Create a new semantext instance with the static resources.static StringLoad a configuration item.static voidSet a key (configuration item).static XMLTableloadSemanticsXml(String connId) Load semantics configuration, x-table, from file path.io.odysz.transact.sql.parts.AbsPartio.odysz.transact.sql.QueryCreate a select statement.io.odysz.semantics.meta.TableMetaio.odysz.transact.sql.UpdateCreate an update statement that will report affected rows as data entry "total".Methods inherited from class io.odysz.transact.sql.Transcxt
basictx, delete, insert, insertExp, select, selectPage, selectPage, tableMeta, update, with, with
-
Field Details
-
cfgroot
-
runtimepath
-
dummy
protected static io.odysz.semantics.IUser dummy -
smtMaps
{ conn: map{table: DASemantics[handlers]} }
-
-
Constructor Details
-
DATranscxt
Create a transact builder with basic DASemantext instance.
If it's a null configuration, the semantics can not be used to resulving semantics between records, but can be used to do basic sql operation. (resulving is a special concept of semantic-*, see docs)
When creating DATranscxt, db metas can not be null.- Parameters:
conn- connection Id- Throws:
Exception
-
DATranscxt
Create a stub transaction helper without depending on a database connection, typically for initialization.- Throws:
Exception- Since:
- 2.0.0
-
DATranscxt
-
-
Method Details
-
configRoot
Configuration's root- Parameters:
cfgRoot-absRuntimeRoot- absolute path to current dir (test) or container root (web app)- Since:
- 1.4.25 will using EnvPath for this.
-
tableMeta
public io.odysz.semantics.meta.TableMeta tableMeta(String conn, String tabl) throws SemanticException - Overrides:
tableMetain classio.odysz.transact.sql.Transcxt- Throws:
SemanticException
-
instancontxt
public io.odysz.semantics.ISemantext instancontxt(String connId, io.odysz.semantics.IUser usr) throws io.odysz.transact.x.TransException Create a new semantext instance with the static resources.
DATranscxtuse a basic context (without semantics handler) for basic sql building.
Every context used forDASemanticshandling must use this to create a new context instance.- Overrides:
instancontxtin classio.odysz.transact.sql.Transcxt- Parameters:
connId- connection id usually mapped with client function uri, like: Connects.uri2conn(req.uri())usr-- Returns:
- semantext
- Throws:
io.odysz.transact.x.TransException- See Also:
-
ISemantext
-
select
Create a select statement.This statement is the starting points to build a sql transact for querying.
For how to use the created statements, see the testing class: DASemantextTest.- Overrides:
selectin classio.odysz.transact.sql.Transcxt- See Also:
-
Transcxt.select(java.lang.String, java.lang.String[])
-
insert
Create an insert statement that will report affected rows as data entry "total".Those statements are the starting points to build a sql transact for querying, updating, etc.
For how to use the created statements, see the testing class: DASemantextTest.- Parameters:
tabl-usr-- Returns:
- the starting statement
-
findResulved
-
update
Create an update statement that will report affected rows as data entry "total".Those statements are the starting points to build a sql transact for querying, updating, etc.
For how to use the created statements, see the testing class: DASemantextTest.- Parameters:
tabl-usr-- Returns:
- the starting statement
-
delete
Create a delete statement that will report affected rows as data entry "total".Those statements are the starting points to build a sql transact for querying, updating, etc.
For how to use the created statements, see the testing class: DASemantextTest.- Parameters:
tabl-usr-- Returns:
- the starting statement
-
loadSemanticsXml
public static XMLTable loadSemanticsXml(String connId) throws SAXException, IOException, SemanticException Load semantics configuration, x-table, from file path. This method also initialize table meta by callingConnects.- Parameters:
connId-- Returns:
- configurations
- Throws:
SAXExceptionIOExceptionSQLExceptionSemanticException
-
initConfigs
public static <M extends DATranscxt.SemanticsMap,S extends DASemantics> M initConfigs(String conn, XMLTable xcfg, DATranscxt.SmapFactory<M> smFactory) throws Exception LoadsmtMaps.- Type Parameters:
M- semantics map typeS- semantics- Parameters:
conn-xcfg-smFactory-- Returns:
- map per
conn - Throws:
Exception
-
hasSemantics
-
getHandler
public static DASemantics.SemanticHandler getHandler(String conn, String tabl, DASemantics.smtype sm) -
getBasicTrans
public static io.odysz.transact.sql.Transcxt getBasicTrans(String conn) throws SQLException, SAXException, IOException, SemanticException Get a basic transact builder (without semantics handling)- Parameters:
conn-- Returns:
- the basic transact builder
- Throws:
SQLExceptionIOExceptionSAXExceptionSemanticException
-
key
Set a key (configuration item).- Parameters:
name- e.g. connection's root-key is set here with name = "user-pswd".value-
-
key
Load a configuration item.- Parameters:
name- configuration key, e.g. "user-pswd"- Returns:
- the value
-
now
- Throws:
io.odysz.transact.x.TransExceptionSQLException
-
dummyUser
public static io.odysz.semantics.IUser dummyUser() -
exists
public boolean exists(String conn, String tbl, String id) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransExceptionSQLException
-
quotation
public io.odysz.transact.sql.parts.AbsPart quotation(Object v, String conn, String tabl, String col) - Overrides:
quotationin classio.odysz.transact.sql.Transcxt
-