Package io.odysz.semantic.util
Class DAHelper
java.lang.Object
io.odysz.semantic.util.DAHelper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
count
(DATranscxt b, String conn, String tbl, Object... kvs) static int
Deprecated.static AnResultset
getEntityById
(DATranscxt b, io.odysz.semantics.meta.TableMeta m, String id) static Object
getExprstr
(DATranscxt trb, String connid, io.odysz.semantics.meta.TableMeta m, io.odysz.transact.sql.parts.condition.Funcall valexpr, String as, Object... kvs) static long
getValong
(DATranscxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String field, String... kvs) static String
getValstr
(io.odysz.transact.sql.Transcxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String valfield, Object... kvs) Load a field from table m.tbl.static io.odysz.semantics.SemanticObject
insert
(io.odysz.semantics.IUser usr, DATranscxt t0, String conn, io.odysz.semantics.meta.TableMeta snm, Object... nvs) static long
loadRecLong
(DATranscxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String recId, String field) Deprecated.static io.odysz.semantics.SemanticObject
updateFieldByPk
(DATranscxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String recId, String vfield, Object v, io.odysz.semantics.IUser usr) Commit to DB(conn
) as userusr
, with SQL:
update m.tbl set field = v where m.pk = recIdstatic io.odysz.semantics.SemanticObject
updateFieldsByPk
(io.odysz.semantics.IUser usr, DATranscxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String recId, Object... nvs) Commit to DB(conn
) as userusr
, with SQL:
update m.tbl set field = v where m.pk = recIdstatic io.odysz.semantics.SemanticObject
updateFieldWhereEqs
(DATranscxt trb, String conn, io.odysz.semantics.IUser usr, io.odysz.semantics.meta.TableMeta m, String field, Object v, Object... whereqs) Commit to DB(conn
) as userusr
, with SQL:
update m.tbl set field = v where whereqs[0] = whereqs[1] and whereqs[2] = whereqs[3] ...
-
Constructor Details
-
DAHelper
public DAHelper()
-
-
Method Details
-
getValstr
public static String getValstr(io.odysz.transact.sql.Transcxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String valfield, Object... kvs) throws SQLException, io.odysz.transact.x.TransException Load a field from table m.tbl.- Parameters:
trb
- transaction builderconn
-m
- the table must have a pk.valfield
-kvs
-- Returns:
- field's value in row[kvs[0] = kvs[1], kvs[1] = kvs[2], ...]
- Throws:
SQLException
io.odysz.transact.x.TransException
-
getExprstr
public static Object getExprstr(DATranscxt trb, String connid, io.odysz.semantics.meta.TableMeta m, io.odysz.transact.sql.parts.condition.Funcall valexpr, String as, Object... kvs) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
loadRecLong
public static long loadRecLong(DATranscxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String recId, String field) throws SQLException, io.odysz.transact.x.TransException Deprecated.callgetValong(DATranscxt, String, TableMeta, String, String...)
, e.g. getValong(t, m, target-field, m.pk, recId, ...).- Parameters:
trb
-conn
-m
-recId
-field
-- Returns:
- long value
- Throws:
SQLException
io.odysz.transact.x.TransException
-
getValong
public static long getValong(DATranscxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String field, String... kvs) throws SQLException, io.odysz.transact.x.TransException - Throws:
SQLException
io.odysz.transact.x.TransException
-
updateFieldByPk
public static io.odysz.semantics.SemanticObject updateFieldByPk(DATranscxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String recId, String vfield, Object v, io.odysz.semantics.IUser usr) throws io.odysz.transact.x.TransException, SQLException Commit to DB(conn
) as userusr
, with SQL:
update m.tbl set field = v where m.pk = recId- Parameters:
trb
-conn
-m
-recId
-vfield
-v
-usr
-- Returns:
- affected rows
- Throws:
io.odysz.transact.x.TransException
SQLException
-
updateFieldsByPk
public static io.odysz.semantics.SemanticObject updateFieldsByPk(io.odysz.semantics.IUser usr, DATranscxt trb, String conn, io.odysz.semantics.meta.TableMeta m, String recId, Object... nvs) throws io.odysz.transact.x.TransException, SQLException Commit to DB(conn
) as userusr
, with SQL:
update m.tbl set field = v where m.pk = recId- Parameters:
usr
-trb
-conn
-m
-recId
-nvs
- n-v pairs- Returns:
- updating result
- Throws:
io.odysz.transact.x.TransException
SQLException
-
updateFieldWhereEqs
public static io.odysz.semantics.SemanticObject updateFieldWhereEqs(DATranscxt trb, String conn, io.odysz.semantics.IUser usr, io.odysz.semantics.meta.TableMeta m, String field, Object v, Object... whereqs) throws io.odysz.transact.x.TransException, SQLException Commit to DB(conn
) as userusr
, with SQL:
update m.tbl set field = v where whereqs[0] = whereqs[1] and whereqs[2] = whereqs[3] ...- Parameters:
trb
-conn
-usr
-m
-field
-v
-whereqs
-- Returns:
- affected rows
- Throws:
io.odysz.transact.x.TransException
SQLException
- Since:
- 2.0.0
-
count_
public static int count_(DATranscxt b, String conn, String tbl, String field, String v) throws SQLException, io.odysz.transact.x.TransException Deprecated.replaced bycount(DATranscxt, String, String, Object...)
- Returns:
- count
- Throws:
SQLException
io.odysz.transact.x.TransException
-
count
public static int count(DATranscxt b, String conn, String tbl, Object... kvs) throws SQLException, io.odysz.transact.x.TransException - Throws:
SQLException
io.odysz.transact.x.TransException
-
insert
public static io.odysz.semantics.SemanticObject insert(io.odysz.semantics.IUser usr, DATranscxt t0, String conn, io.odysz.semantics.meta.TableMeta snm, Object... nvs) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
getEntityById
public static AnResultset getEntityById(DATranscxt b, io.odysz.semantics.meta.TableMeta m, String id) throws SQLException, io.odysz.transact.x.TransException - Throws:
SQLException
io.odysz.transact.x.TransException
-
count(DATranscxt, String, String, Object...)