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
Modifier and TypeClassDescriptionstatic class
Semantics handler's map manager.static interface
Callback for buiding a connection's semantics map, with map-key = table. -
Field Summary
Modifier and TypeFieldDescriptionprotected static String
protected static io.odysz.semantics.IUser
protected static String
protected static HashMap<String,
DATranscxt.SemanticsMap> { conn: map{table: DASemantics[handlers]} }Fields inherited from class io.odysz.transact.sql.Transcxt
basictx
-
Constructor Summary
ModifierConstructorDescriptionCreate a stub transaction helper without depending on a database connection, typically for initialization.protected
DATranscxt
(DASemantext stxt) DATranscxt
(String conn) Create a transact builder with basic DASemantext instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
configRoot
(String cfgRoot, String absRuntimeRoot) Configuration's rootio.odysz.transact.sql.Delete
Create a delete statement that will report affected rows as data entry "total".static io.odysz.semantics.IUser
boolean
static String
findResulved
(io.odysz.semantics.SemanticObject rslt, String tabl, String pk) static io.odysz.transact.sql.Transcxt
getBasicTrans
(String conn) Get a basic transact builder (without semantics handling)static DASemantics.SemanticHandler
getHandler
(String conn, String tabl, DASemantics.smtype sm) static boolean
hasSemantics
(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.Insert
Create an insert statement that will report affected rows as data entry "total".io.odysz.semantics.ISemantext
instancontxt
(String connId, io.odysz.semantics.IUser usr) Create a new semantext instance with the static resources.static String
Load a configuration item.static void
Set a key (configuration item).static XMLTable
loadSemanticsXml
(String connId) Load semantics configuration, x-table, from file path.io.odysz.transact.sql.parts.AbsPart
io.odysz.transact.sql.Query
Create a select statement.io.odysz.semantics.meta.TableMeta
io.odysz.transact.sql.Update
Create 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:
tableMeta
in 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.
DATranscxt
use a basic context (without semantics handler) for basic sql building.
Every context used forDASemantics
handling must use this to create a new context instance.- Overrides:
instancontxt
in 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:
select
in 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:
SAXException
IOException
SQLException
SemanticException
-
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:
SQLException
IOException
SAXException
SemanticException
-
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.TransException
SQLException
-
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.TransException
SQLException
-
quotation
public io.odysz.transact.sql.parts.AbsPart quotation(Object v, String conn, String tabl, String col) - Overrides:
quotation
in classio.odysz.transact.sql.Transcxt
-