public class ConnDbCom
extends java.lang.Object
implements java.io.Serializable
Title: ConnDbCom
Description: 資料庫連結介面, jsp 中的 bean 名稱為 myQuery
Copyright: Copyright (c) 2005
Company:
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
errMesg |
static java.lang.String |
KEY_DATABASE_DB2 |
static java.lang.String |
KEY_DATABASE_MYSQL |
static java.lang.String |
KEY_DATABASE_ORACLE |
static java.lang.String |
KEY_DATABASE_PostgreSQL |
static java.lang.String |
KEY_DATABASE_SQLite |
static java.lang.String |
KEY_DATABASE_SQLSERVER |
static java.lang.String |
KEY_DATABASE_SYBASE |
static java.lang.String |
KEY_DATABASE_UCANAccess |
static java.util.Hashtable |
vtableFieldlist |
| Constructor and Description |
|---|
ConnDbCom() |
ConnDbCom(javax.servlet.http.HttpServletRequest req) |
ConnDbCom(MaliConfig Asmyconfig)
Deprecated.
|
ConnDbCom(maliConnection inconnection) |
ConnDbCom(MaliContext incontext) |
ConnDbCom(MaliContext incontext,
java.lang.String indatabase_type) |
ConnDbCom(java.lang.String cursysid)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
CheckColumnType(java.lang.String tablename,
java.lang.String columnname) |
BaseTable[] |
convertBaseTable(java.util.Vector qryrows) |
java.util.Vector |
convertRsToVector(java.sql.ResultSet inrs)
將 ResultSet convert to Vector
|
java.sql.PreparedStatement |
DataPreparedByQuery(java.sql.Connection inconn,
java.lang.String sqltext)
提供給查詢用,只有Read不可異資料庫,可進行資料的 First & Last處理
|
java.sql.PreparedStatement |
DataPreparSt(java.sql.Connection inConn,
java.lang.String sqltext) |
java.sql.PreparedStatement |
DataPreparSt(java.lang.String sqltext) |
java.sql.ResultSet |
DataResultSet(java.sql.Connection conn,
java.lang.String sqltext) |
boolean |
DBFExecSQL(java.lang.String sql)
提供給DBF 使用EXECSQL
|
void |
delete(BaseTable inobj) |
void |
delete(java.sql.Connection Conn,
java.lang.String tablename,
java.util.Vector Rowdata)
刪除資料by para Connection
|
void |
delete(java.lang.String tablename,
java.util.Vector Rowdata)
刪除資料
|
boolean |
ExecSQL(java.lang.String sql) |
boolean |
ExecSQL(java.lang.String[] sql) |
boolean |
ExecSQL(java.lang.String[] sql,
boolean writelog) |
boolean |
ExecSQL(java.lang.String sql,
boolean writelog) |
void |
execute(BaseTable[] objs)
同時執行insert.update.delete 且同步transaction
|
int |
executeSQL(java.lang.String sql,
java.util.Vector inKeyVector,
java.lang.String intable) |
int |
getAllrowcount() |
BaseTable[] |
getBaseTableDataContent(java.lang.String sqltext) |
BaseTable[] |
getBaseTableDataContent(java.lang.String sqltext,
java.lang.String databasetype) |
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String sysid,
java.lang.String indbtype) |
java.util.Vector |
getConvertDBFieldDataType(java.lang.String tablename,
java.util.Vector allRow)
Convert data field 取得datatype
|
java.lang.String |
getDatabasetype() |
java.util.Vector |
GetDataContent_byKey(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable) |
java.util.Vector |
GetDataContent_byKey(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable,
int rowstart,
int rowend) |
java.util.ArrayList |
GetDataContent() |
java.util.ArrayList |
GetDataContent(java.sql.ResultSet rs,
int startRow,
int endRow)
由 Rs 取符合筆數之資料
|
java.util.ArrayList |
GetDataContent(java.lang.String insql)
取得 SQL 指令資料內容
|
java.util.ArrayList |
GetDataContent(java.lang.String insql,
int startRow,
int endRow) |
java.util.ArrayList |
GetDataContent(java.lang.String insql,
java.lang.String databasetype)
取得 SQL 指令資料內容
|
BaseTable[] |
GetDataContent(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable) |
BaseTable[] |
GetDataContent(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable,
int rowstart,
int rowend) |
java.util.Vector |
GetDataContentVector()
取 Vector 型態的 DataContent
|
java.util.Vector |
GetDataContentVector(java.lang.String insql)
取 Vector 型態的 DataContent
|
BaseTable[] |
GetDatatent(java.lang.String sqltext)
取得 SQL 指令資料內容,可直接給 SQL 指令
|
java.util.Vector |
getDBFieldDataType(java.lang.String tablename,
java.util.Vector allRow,
java.sql.Connection Conn) |
java.lang.String |
getDbmergString(java.lang.String[] args) |
java.lang.String |
getDBType() |
java.lang.String |
getDBType(java.sql.Connection inconn) |
java.lang.String |
getDsname() |
int |
getExecSQL_Rowcount()
執行ExecSQL 後的執行筆數 0 則表示沒有異動成功任何筆數
|
BaseTable |
getExistsData(BaseTable inobj)
檢查table資料是否存在
|
BaseTable |
getFirstRecordDataContent(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable) |
java.lang.String |
getIdentity(java.sql.Connection inConn,
java.lang.String astable,
java.lang.String ascolumn) |
BaseTable |
getLastRecordDataContent(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable)
取依條件最後一筆資料
|
java.util.ArrayList |
getPrimary(java.sql.Connection inConn,
java.lang.String astable) |
int |
getRecordCount(java.lang.String sqltext) |
int |
getRecordCount(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable)
產生RECORDCOUNT 不需另外轉換,直接顯示筆數
|
clsRequestData |
getRequestvalue(java.util.ArrayList Ary_request,
int idx) |
static java.lang.String |
getRequestvalue(java.util.ArrayList Ary_request,
java.lang.String para) |
void |
GetRSDataContent(java.lang.String insql) |
static java.lang.String |
getSessionvalue(java.util.ArrayList Ary_request,
java.lang.String para) |
static java.lang.String |
getSQLname(java.util.ArrayList asList,
int asParameter) |
java.lang.String |
getSqltext() |
static java.lang.String |
getSQLvalue(java.util.ArrayList asList,
int asParameter) |
static java.lang.String |
getSQLvalue(java.util.ArrayList asList,
java.lang.String asParameter)
取 sql value
|
java.lang.String |
getSysid() |
java.util.Vector |
getTableAllFieldList(java.lang.String astable)
取 table 全部 field list
|
java.util.ArrayList |
getTablePrimaryKey(java.lang.String astable) |
int |
getupdateRecordCount() |
void |
insert(BaseTable intable) |
void |
insert(java.sql.Connection conn,
BaseTable intable)
標準 insert by basetable
|
void |
insert(java.sql.Connection Conn,
java.lang.String tablename,
java.util.Vector Rowdata) |
void |
insert(java.lang.String tablename,
java.util.Vector Rowdata)
insert 資料
|
void |
insertTableValue(java.lang.String tablename,
java.util.Vector values) |
boolean |
isCheckExistsData(java.lang.String insql,
java.util.Vector inKeyVector) |
boolean |
isExistsDatas(java.lang.String sql,
java.util.Vector inKeyVector)
檢查是否資料, 只取一筆資料判斷
|
boolean |
processRequest(javax.servlet.http.HttpServletRequest req) |
ProcessRequest |
processRequest(javax.servlet.http.HttpServletRequest req,
java.lang.String invalue) |
void |
processSession(javax.servlet.http.HttpSession ses) |
void |
setAllrowcount(int value) |
void |
setContext(MaliContext incontext) |
void |
setDatabasetype(java.lang.String value) |
void |
setds(java.lang.String inds) |
void |
setDsname(java.lang.String value) |
void |
setExecSQL_Rowcount(int value) |
void |
setRequestdata(javax.servlet.http.HttpServletRequest req) |
void |
setSqltext(Sqlbean theSqlbean) |
void |
setSqltext(java.lang.String value) |
void |
setSysid(java.lang.String value) |
java.sql.PreparedStatement |
setWhereKeyPreparedStatement(java.sql.PreparedStatement inps,
java.util.Vector rowdata) |
java.util.ArrayList |
SortSQLDataArray(java.util.ArrayList Ary_ArrayList,
java.lang.String[] args) |
BaseTable[] |
SortSQLDataBaseTable(BaseTable[] Ary_BaseTable,
java.lang.String[] args) |
java.util.Vector |
SortSQLDataVector(java.util.Vector Ary_ArrayList,
java.lang.String[] args) |
java.lang.String[] |
toencodings(java.lang.String[] value) |
void |
update(BaseTable intable,
boolean isupdateprimarykey) |
void |
update(java.sql.Connection conn,
BaseTable intable,
boolean isupdateprimarykey)
標準 update by basetable
|
void |
update(java.sql.Connection Conn,
java.lang.String tablename,
java.util.Vector Rowdata,
java.lang.String[] checkprimarykey,
boolean isupdateprimarykey)
update by connection
|
void |
update(java.lang.String tablename,
java.util.Vector Rowdata,
java.lang.String[] checkprimarykey,
boolean isupdateprimarykey)
執行 update 指令
|
void |
WriteSysLog(java.lang.String log_kind,
java.lang.String log_type,
java.lang.String str) |
java.lang.String |
ws_equal_field(java.lang.String key,
java.lang.String varvalue)
for 如果 oracle and sybase 的 where 條件 is null 不等於 = ''
|
public java.lang.String errMesg
public static java.lang.String KEY_DATABASE_SYBASE
public static java.lang.String KEY_DATABASE_ORACLE
public static java.lang.String KEY_DATABASE_SQLSERVER
public static java.lang.String KEY_DATABASE_MYSQL
public static java.lang.String KEY_DATABASE_DB2
public static java.lang.String KEY_DATABASE_SQLite
public static java.lang.String KEY_DATABASE_PostgreSQL
public static java.lang.String KEY_DATABASE_UCANAccess
public static java.util.Hashtable vtableFieldlist
public ConnDbCom(maliConnection inconnection)
public ConnDbCom(javax.servlet.http.HttpServletRequest req)
public ConnDbCom(MaliContext incontext, java.lang.String indatabase_type)
public ConnDbCom(MaliContext incontext)
public ConnDbCom(java.lang.String cursysid)
cursysid - public ConnDbCom(MaliConfig Asmyconfig)
Asmyconfig - public ConnDbCom()
public java.sql.Connection getConnection()
throws java.lang.Exception
java.lang.Exceptionpublic java.sql.Connection getConnection(java.lang.String sysid,
java.lang.String indbtype)
public void setContext(MaliContext incontext)
public void setAllrowcount(int value)
public int getAllrowcount()
public void setExecSQL_Rowcount(int value)
public int getExecSQL_Rowcount()
public void setSqltext(java.lang.String value)
throws java.lang.Exception
java.lang.Exceptionpublic void setSqltext(Sqlbean theSqlbean) throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getSqltext()
throws java.lang.Exception
java.lang.Exceptionpublic void setDsname(java.lang.String value)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getDsname()
throws java.lang.Exception
java.lang.Exceptionpublic void setSysid(java.lang.String value)
public java.lang.String getSysid()
public void setDatabasetype(java.lang.String value)
public java.lang.String getDatabasetype()
throws java.lang.Exception
java.lang.Exceptionpublic java.util.ArrayList GetDataContent(java.lang.String insql)
throws java.lang.Exception,
MaliException
sqltext - SQL 指令java.lang.ExceptionMaliExceptionpublic java.util.ArrayList GetDataContent(java.lang.String insql,
java.lang.String databasetype)
throws MaliException,
java.lang.Exception
insql - databasetype - //設定資料庫java.lang.ExceptionMaliExceptionpublic BaseTable[] GetDataContent(java.lang.String sqltext, java.util.Vector inWhereKeyVector, java.lang.String intable, int rowstart, int rowend) throws java.lang.Exception
java.lang.Exceptionpublic BaseTable getLastRecordDataContent(java.lang.String sqltext, java.util.Vector inWhereKeyVector, java.lang.String intable) throws java.lang.Exception
sqltext - inWhereKeyVector - intable - java.lang.Exceptionpublic BaseTable getFirstRecordDataContent(java.lang.String sqltext, java.util.Vector inWhereKeyVector, java.lang.String intable) throws java.lang.Exception
java.lang.Exceptionpublic java.util.Vector convertRsToVector(java.sql.ResultSet inrs)
throws java.sql.SQLException
inrs - java.sql.SQLExceptionpublic BaseTable[] convertBaseTable(java.util.Vector qryrows)
public BaseTable[] GetDataContent(java.lang.String sqltext, java.util.Vector inWhereKeyVector, java.lang.String intable) throws java.lang.Exception
java.lang.Exceptionpublic java.sql.PreparedStatement setWhereKeyPreparedStatement(java.sql.PreparedStatement inps,
java.util.Vector rowdata)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.util.Vector getConvertDBFieldDataType(java.lang.String tablename,
java.util.Vector allRow)
throws java.sql.SQLException
inconn - tablename - allRow - java.sql.SQLExceptionpublic java.sql.PreparedStatement DataPreparedByQuery(java.sql.Connection inconn,
java.lang.String sqltext)
public java.sql.PreparedStatement DataPreparSt(java.sql.Connection inConn,
java.lang.String sqltext)
public java.util.Vector GetDataContent_byKey(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable,
int rowstart,
int rowend)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Vector GetDataContent_byKey(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable)
throws java.lang.Exception
java.lang.Exceptionpublic BaseTable[] getBaseTableDataContent(java.lang.String sqltext, java.lang.String databasetype) throws java.lang.Exception, MaliException
java.lang.ExceptionMaliExceptionpublic BaseTable[] getBaseTableDataContent(java.lang.String sqltext) throws java.lang.Exception, MaliException
java.lang.ExceptionMaliExceptionpublic BaseTable[] GetDatatent(java.lang.String sqltext) throws java.lang.Exception, MaliException
sqltext - java.lang.ExceptionMaliExceptionpublic java.util.ArrayList GetDataContent(java.lang.String insql,
int startRow,
int endRow)
throws java.lang.Exception,
MaliException
insql - startRow - 取資料內容 開始第幾筆endRow - 取資料內容 結束至第幾筆java.lang.Exception - startRow = 0 & endRow = 0 則 表示取全部的資料MaliExceptionpublic java.util.ArrayList GetDataContent()
throws java.lang.Exception,
MaliException
java.lang.ExceptionMaliExceptionpublic java.util.Vector GetDataContentVector(java.lang.String insql)
throws java.lang.Exception,
MaliException
insql - String sql 指令java.lang.ExceptionMaliExceptionpublic java.util.Vector GetDataContentVector()
throws java.lang.Exception,
MaliException
java.lang.ExceptionMaliExceptionpublic void GetRSDataContent(java.lang.String insql)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.ArrayList GetDataContent(java.sql.ResultSet rs,
int startRow,
int endRow)
rs - startRow - endRow - public java.util.ArrayList getTablePrimaryKey(java.lang.String astable)
throws java.lang.Exception,
java.sql.SQLException
java.lang.Exceptionjava.sql.SQLExceptionpublic java.util.ArrayList getPrimary(java.sql.Connection inConn,
java.lang.String astable)
throws java.lang.Exception,
java.sql.SQLException
java.lang.Exceptionjava.sql.SQLExceptionpublic java.lang.String getIdentity(java.sql.Connection inConn,
java.lang.String astable,
java.lang.String ascolumn)
throws java.lang.Exception,
java.sql.SQLException
java.lang.Exceptionjava.sql.SQLExceptionpublic void processSession(javax.servlet.http.HttpSession ses)
throws java.lang.Exception
java.lang.Exceptionpublic ProcessRequest processRequest(javax.servlet.http.HttpServletRequest req, java.lang.String invalue) throws java.lang.Exception
java.lang.Exceptionpublic boolean processRequest(javax.servlet.http.HttpServletRequest req)
throws java.lang.Exception
java.lang.Exceptionpublic boolean DBFExecSQL(java.lang.String sql)
throws java.lang.Exception,
java.sql.SQLException
sql - java.lang.Exceptionjava.sql.SQLExceptionpublic boolean ExecSQL(java.lang.String sql)
throws java.lang.Exception,
java.sql.SQLException
java.lang.Exceptionjava.sql.SQLExceptionpublic boolean ExecSQL(java.lang.String[] sql)
throws java.lang.Exception,
java.sql.SQLException
java.lang.Exceptionjava.sql.SQLExceptionpublic boolean ExecSQL(java.lang.String[] sql,
boolean writelog)
throws java.lang.Exception,
java.sql.SQLException
java.lang.Exceptionjava.sql.SQLExceptionpublic boolean ExecSQL(java.lang.String sql,
boolean writelog)
throws java.lang.Exception,
java.sql.SQLException
java.lang.Exceptionjava.sql.SQLExceptionpublic static java.lang.String getSQLvalue(java.util.ArrayList asList,
java.lang.String asParameter)
asList - 取出的ArrayList 必須是SQLD 的 ArrayList,否則會解析錯誤asParameter - 給欄位名稱public static java.lang.String getSQLvalue(java.util.ArrayList asList,
int asParameter)
public static java.lang.String getSQLname(java.util.ArrayList asList,
int asParameter)
public java.sql.ResultSet DataResultSet(java.sql.Connection conn,
java.lang.String sqltext)
throws java.lang.Exception
java.lang.Exceptionpublic BaseTable[] SortSQLDataBaseTable(BaseTable[] Ary_BaseTable, java.lang.String[] args)
public java.util.Vector SortSQLDataVector(java.util.Vector Ary_ArrayList,
java.lang.String[] args)
public java.util.ArrayList SortSQLDataArray(java.util.ArrayList Ary_ArrayList,
java.lang.String[] args)
public void WriteSysLog(java.lang.String log_kind,
java.lang.String log_type,
java.lang.String str)
throws java.lang.Exception,
java.sql.SQLException
java.lang.Exceptionjava.sql.SQLExceptionpublic java.lang.String ws_equal_field(java.lang.String key,
java.lang.String varvalue)
key - table 的欄位varvalue - 變數值public static java.lang.String getRequestvalue(java.util.ArrayList Ary_request,
java.lang.String para)
public clsRequestData getRequestvalue(java.util.ArrayList Ary_request, int idx)
public static java.lang.String getSessionvalue(java.util.ArrayList Ary_request,
java.lang.String para)
Ary_request - para - public void setRequestdata(javax.servlet.http.HttpServletRequest req)
public void insert(java.sql.Connection Conn,
java.lang.String tablename,
java.util.Vector Rowdata)
throws java.lang.Exception
java.lang.Exceptionpublic void insert(java.lang.String tablename,
java.util.Vector Rowdata)
throws java.lang.Exception
tablename - Rowdata - java.lang.Exceptionpublic void insert(java.sql.Connection conn,
BaseTable intable)
throws java.lang.Exception
intable - java.lang.Exceptionpublic void insert(BaseTable intable) throws java.lang.Exception
java.lang.Exceptionpublic void update(java.sql.Connection conn,
BaseTable intable,
boolean isupdateprimarykey)
throws java.lang.Exception
intable - isupdateprimarykey - java.lang.Exceptionpublic void update(BaseTable intable, boolean isupdateprimarykey) throws java.lang.Exception
java.lang.Exceptionpublic void update(java.sql.Connection Conn,
java.lang.String tablename,
java.util.Vector Rowdata,
java.lang.String[] checkprimarykey,
boolean isupdateprimarykey)
throws java.sql.SQLException,
java.lang.Exception
Conn - tablename - Rowdata - checkprimarykey - isupdateprimarykey - java.sql.SQLExceptionjava.lang.Exceptionpublic void update(java.lang.String tablename,
java.util.Vector Rowdata,
java.lang.String[] checkprimarykey,
boolean isupdateprimarykey)
throws java.sql.SQLException,
java.lang.Exception
tablename - Rowdata - checkprimarykey - isupdateprimarykey - boolean 是否update 實際 primarykey true 是要做update , false
是不做updatejava.sql.SQLExceptionjava.lang.Exceptionpublic void execute(BaseTable[] objs) throws java.lang.Exception
objs - java.lang.Exceptionpublic void delete(java.sql.Connection Conn,
java.lang.String tablename,
java.util.Vector Rowdata)
throws java.lang.Exception
Conn - tablename - Rowdata - java.lang.Exceptionpublic void delete(java.lang.String tablename,
java.util.Vector Rowdata)
throws java.lang.Exception
tablename - Rowdata - Vector 是指刪除的where 欄位java.lang.Exceptionpublic void delete(BaseTable inobj) throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String CheckColumnType(java.lang.String tablename,
java.lang.String columnname)
public java.sql.PreparedStatement DataPreparSt(java.lang.String sqltext)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String[] toencodings(java.lang.String[] value)
public java.lang.String getDBType(java.sql.Connection inconn)
public java.lang.String getDBType()
public void insertTableValue(java.lang.String tablename,
java.util.Vector values)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Vector getDBFieldDataType(java.lang.String tablename,
java.util.Vector allRow,
java.sql.Connection Conn)
throws java.lang.Exception
java.lang.Exceptionpublic int getRecordCount(java.lang.String sqltext)
public int getRecordCount(java.lang.String sqltext,
java.util.Vector inWhereKeyVector,
java.lang.String intable)
throws java.rmi.RemoteException,
java.lang.Exception
sqltext - inWhereKeyVector - intable - java.rmi.RemoteExceptionjava.lang.Exceptionpublic void setds(java.lang.String inds)
public java.lang.String getDbmergString(java.lang.String[] args)
public BaseTable getExistsData(BaseTable inobj) throws java.sql.SQLException, java.lang.Exception
inobj - java.sql.SQLExceptionjava.lang.Exceptionpublic int executeSQL(java.lang.String sql,
java.util.Vector inKeyVector,
java.lang.String intable)
throws java.lang.Exception
java.lang.Exceptionpublic boolean isCheckExistsData(java.lang.String insql,
java.util.Vector inKeyVector)
throws java.lang.Exception
java.lang.Exceptionpublic boolean isExistsDatas(java.lang.String sql,
java.util.Vector inKeyVector)
throws java.lang.Exception
java.lang.Exceptionpublic int getupdateRecordCount()
throws java.rmi.RemoteException,
java.lang.Exception
java.rmi.RemoteExceptionjava.lang.Exceptionpublic java.util.Vector getTableAllFieldList(java.lang.String astable)
throws java.lang.Exception
astable - java.lang.Exception