Package io.odysz.semantic.DA
Class Connects
java.lang.Object
io.odysz.semantic.DA.Connects
Connection configurations and DB table meta data manager.
- Author:
- odys-z@github.com
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose()static int[]static int[]Commit to default connection.static int[]static int[]static int[]connIds()static Stringstatic io.odysz.common.dbtypedriverType(String conn) static booleanstatic io.odysz.semantics.meta.TableMetastatic StringgetSmtcsPath(String conn) Get the smtcs file path configured in connects.xml.static voidparse connects.xml, setup connections configured in table "drvmnger", for JDBC DriverManger, and "dbcp", for JDBC connection-pooled connection managed by container.static booleanBuild database tables' meta.protected static XMLTableloadMetaCfgs(String connId) static Stringstatic Stringcompose paged sql, e.g.static io.odysz.common.dbtypeparseDrvType(String type) Convert names like "sqlit" todbtype.static AnResultsetstatic AnResultsetstatic voidstatic voidSet table meta (providing a chance of extending table's semantics and keep a single copy for DB's meta).static StringMapping client function id to data connection according to configuration.
-
Field Details
-
metas
-
-
Constructor Details
-
Connects
public Connects()
-
-
Method Details
-
parseDrvType
Convert names like "sqlit" todbtype.- Parameters:
type-- Returns:
- db type
- Throws:
SemanticException
-
getAllConnIds
-
defltConn
-
init
parse connects.xml, setup connections configured in table "drvmnger", for JDBC DriverManger, and "dbcp", for JDBC connection-pooled connection managed by container.- Parameters:
xmlDir- configure file folder
-
close
public static void close() -
select
- Throws:
SQLException
-
select
- Throws:
SQLException
-
pagingSql
public static String pagingSql(String conn, String sql, int page, int size) throws io.odysz.transact.x.TransException compose paged sql, e.g. for Oracle:
select * from (sql) t where rownum > 0 and row num < 14- Parameters:
sql-page-size-- Returns:
- sql
- Throws:
io.odysz.transact.x.TransException
-
pagingSql
public static String pagingSql(io.odysz.common.dbtype dt, String sql, int pageIx, int pgSize) throws io.odysz.transact.x.TransException - Throws:
io.odysz.transact.x.TransException
-
commit
public static int[] commit(io.odysz.semantics.IUser usr, ArrayList<String> sqls, int... flags) throws SQLException, io.odysz.transact.x.TransException Commit to default connection.- Parameters:
usr-sqls-flags-- Returns:
- affected row count
- Throws:
SQLExceptionio.odysz.transact.x.TransException
-
commit
public static int[] commit(io.odysz.semantics.IUser usr, ArrayList<String> sqls, ArrayList<Clob> lobs, int... flags) throws SQLException - Throws:
SQLException
-
commit
public static int[] commit(String conn, io.odysz.semantics.IUser usr, String sql, int... flags) throws SQLException, io.odysz.transact.x.TransException - Throws:
SQLExceptionio.odysz.transact.x.TransException
-
commit
public static int[] commit(String conn, io.odysz.semantics.IUser usr, ArrayList<String> sqls, int... flags) throws SQLException, io.odysz.transact.x.TransException - Throws:
SQLExceptionio.odysz.transact.x.TransException
-
commit
public static int[] commit(io.odysz.semantics.IUser usr, String sql) throws SQLException, io.odysz.transact.x.TransException - Throws:
SQLExceptionio.odysz.transact.x.TransException
-
driverType
-
connIds
-
loadMeta
public static HashMap<String,io.odysz.semantics.meta.TableMeta> loadMeta(String conn) throws SemanticException, SQLException Build database tables' meta.
- Parameters:
conn-- Returns:
- metas
- Throws:
IOExceptionSQLExceptionExceptionSemanticException
-
loadMetaCfgs
protected static XMLTable loadMetaCfgs(String connId) throws SAXException, IOException, SemanticException - Throws:
SAXExceptionIOExceptionSemanticException
-
getMeta
public static HashMap<String,io.odysz.semantics.meta.TableMeta> getMeta(String connId) throws SemanticException, SQLException - Throws:
SemanticExceptionSQLException
-
getMeta
public static io.odysz.semantics.meta.TableMeta getMeta(String connId, String tbl) throws SemanticException, SQLException - Parameters:
connId-tbl-- Returns:
- table meta
- Throws:
SemanticExceptionSQLExceptionIOException- Since:
- 1.4.25
-
setMeta
public static void setMeta(String connId, io.odysz.semantics.meta.TableMeta m) throws SemanticException, SQLException Set table meta (providing a chance of extending table's semantics and keep a single copy for DB's meta).- Parameters:
connId-m-- Throws:
SemanticExceptionSQLExceptionIOExceptionSAXException- Since:
- 1.4.25
-
getSmtcsPath
Get the smtcs file path configured in connects.xml.- Parameters:
conn-- Returns:
- smtcs (e.g. semantics.xml)
-
getDebug
-
setDebug
-
uri2conn
Mapping client function id to data connection according to configuration. Uri pattern is matched with prefix of strings' in db config.xml.- Parameters:
uri-- Returns:
- Throws:
SemanticException- uri is null
-
isqlite
-