public class DATranscxt
extends io.odysz.transact.sql.Transcxt
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.
loadSemantics(String)
. instancontxt(String, IUser)
.Modifier and Type | Class and Description |
---|---|
static class |
DATranscxt.SemanticsMap
Semantics handler's map manager.
|
static interface |
DATranscxt.SmapFactory<M extends DATranscxt.SemanticsMap>
Callback for buiding a connection's semantics map, with map-key = table.
|
Modifier and Type | Field and Description |
---|---|
protected static String |
cfgroot |
protected static io.odysz.semantics.IUser |
dummy |
protected static String |
runtimepath |
protected static HashMap<String,DATranscxt.SemanticsMap> |
smtMaps
{ conn: map{table: DASemantics[handlers]} }
|
Modifier | Constructor and Description |
---|---|
protected |
DATranscxt(DASemantext stxt) |
|
DATranscxt(String conn)
Create a transact builder with basic DASemantext instance.
|
Modifier and Type | Method and Description |
---|---|
static void |
configRoot(String cfgRoot,
String absRuntimeRoot)
Configuration's root
|
io.odysz.transact.sql.Delete |
delete(String tabl,
io.odysz.semantics.IUser usr)
Create a delete statement that will report affected rows as data entry "total".
|
static io.odysz.semantics.IUser |
dummyUser() |
boolean |
exists(String conn,
String tbl,
String id) |
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) |
String |
getSysConnId() |
static boolean |
hasSemantics(String conn,
String tabl,
DASemantics.smtype sm) |
static <M extends DATranscxt.SemanticsMap,S extends DASemantics> |
initConfigs(String conn,
XMLTable xcfg,
DATranscxt.SmapFactory<M> smFactory) |
io.odysz.transact.sql.Insert |
insert(String tabl,
io.odysz.semantics.IUser usr)
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 |
key(String name)
Load a configuration item.
|
static void |
key(String name,
String value)
Set a key (configuration item).
|
static XMLTable |
loadSemantics(String connId)
Load semantics configuration, x-table, from file path.
|
Date |
now(String conn) |
io.odysz.transact.sql.parts.AbsPart |
quotation(Object v,
String conn,
String tabl,
String col) |
io.odysz.transact.sql.Query |
select(String tabl,
String... alias)
Create a select statement.
|
io.odysz.semantics.meta.TableMeta |
tableMeta(String conn,
String tabl) |
io.odysz.transact.sql.Update |
update(String tabl,
io.odysz.semantics.IUser usr)
Create an update statement that will report affected rows as data entry "total".
|
protected static String cfgroot
protected static String runtimepath
protected static io.odysz.semantics.IUser dummy
protected static HashMap<String,DATranscxt.SemanticsMap> smtMaps
public DATranscxt(String conn) throws SQLException, SAXException, IOException, SemanticException
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.conn
- connection IdSQLException
IOException
- load semantics configuration failedSAXException
- load semantics configuration failedSemanticException
protected DATranscxt(DASemantext stxt)
public static void configRoot(String cfgRoot, String absRuntimeRoot)
cfgRoot
- absRuntimeRoot
- absolute path to current dir (test) or container root (web app)public io.odysz.semantics.meta.TableMeta tableMeta(String conn, String tabl) throws SemanticException
tableMeta
in class io.odysz.transact.sql.Transcxt
SemanticException
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.DASemantics
handling must use this to create a new context instance.instancontxt
in class io.odysz.transact.sql.Transcxt
connId
- connection id usually mapped with client function uri, like: Connects.uri2conn(req.uri())usr
- io.odysz.transact.x.TransException
ISemantext
public io.odysz.transact.sql.Query select(String tabl, String... alias)
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.
select
in class io.odysz.transact.sql.Transcxt
Transcxt.select(java.lang.String, java.lang.String[])
public io.odysz.transact.sql.Insert insert(String tabl, io.odysz.semantics.IUser usr)
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.
tabl
- usr
- public static String findResulved(io.odysz.semantics.SemanticObject rslt, String tabl, String pk)
public io.odysz.transact.sql.Update update(String tabl, io.odysz.semantics.IUser usr)
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.
tabl
- usr
- public io.odysz.transact.sql.Delete delete(String tabl, io.odysz.semantics.IUser usr)
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.
tabl
- usr
- public String getSysConnId()
public static XMLTable loadSemantics(String connId) throws SAXException, IOException, SemanticException
Connects
.connId
- SAXException
IOException
SQLException
SemanticException
public static <M extends DATranscxt.SemanticsMap,S extends DASemantics> M initConfigs(String conn, XMLTable xcfg, DATranscxt.SmapFactory<M> smFactory) throws SAXException, IOException, SQLException, SemanticException
public static boolean hasSemantics(String conn, String tabl, DASemantics.smtype sm)
public static DASemantics.SemanticHandler getHandler(String conn, String tabl, DASemantics.smtype sm)
public static io.odysz.transact.sql.Transcxt getBasicTrans(String conn) throws SQLException, SAXException, IOException, SemanticException
conn
- SQLException
IOException
SAXException
SemanticException
public static void key(String name, String value)
name
- e.g. connection's root-key is set here with name = "user-pswd".value
- public static String key(String name)
name
- configuration key, e.g. "user-pswd"public Date now(String conn) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public static io.odysz.semantics.IUser dummyUser()
public boolean exists(String conn, String tbl, String id) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
Copyright © 2024. All rights reserved.