/*** @return执行sql语句(Insertpdatedelete)*/public void execMySQL(String inSQL) throws SQLException {sql = inSQL;util = new DBManager();conn = utilgetConn();connsetAutoCommit(false); // setAutoCommit(false);try {utilgetStmt()execute(sql);mit();} catch (SQLException e) {// TODO Autogenerated catch blockconnrollback();eprintStackTrace();}utilclose();}/*** @return执行sql语句(select)*/
public MyTable execMySQLSelect(String inSQL) {MyFunc func = new MyFunc();sql = inSQL;//list = new ArrayList();util = new DBManager();MyTable kfse = new MyTable();String s;int type;int iValue;List rows = new ArrayList();Integer itg = new Integer();BigDecimal ftg = new BigDecimal();javasqlDate date;try {rs = utilgetStmt()executeQuery(sql);ResultSetMetaData rsmd = rsgetMetaData();//可用于获取关于 ResultSet 对象中列的类型和属性信息的对象String[] cols = new String[rsmdgetColumnCount()];//rsmdgetColumnCount()返回此 ResultSet 对象中的列数String[] colsType = new String[rsmdgetColumnCount()];for (int i = colslength; i > ; i) {cols[i ] = rsmdgetColumnName(i);//rsmdgetColumnName(i)获取指定列的名称colsType[i ] = StringvalueOf(rsmdgetColumnType(i));//rsmdgetColumnType(i)检索指定列的 SQL 类型}if (rs != null) {while (rsnext()) {Object[] row = new Object[colslength];rowsadd(row);for (int i = colslength; i > ; i) {//row[i ] = rsgetString(cols[i ]);type = rsmdgetColumnType(i);//row[i ] = StringvalueOf(type);switch (type) {//type数值参照javasqltypescase :row[i ] = rsgetString(cols[i ]);break;case :ftg = new BigDecimal();if (rsgetBigDecimal(cols[i ]) != null)ftg = rsgetBigDecimal(cols[i ]);
row[i ] = ftg;break;case :ftg = new BigDecimal();if (rsgetBigDecimal(cols[i ]) != null)ftg = rsgetBigDecimal(cols[i ]);
row[i ] = ftg;break;case : //对u 数u 库u 段NTEGER//okitg = new Integer(rsgetInt(cols[i ]));row[i ] = itg;break;case :itg = new Integer(rsgetInt(cols[i ]));row[i ] = itg;break;case :ftg = new BigDecimal();if (rsgetBigDecimal(cols[i ]) != null)ftg = rsgetBigDecimal(cols[i ]);
row[i ] = ftg;break;case :row[i ] =new Float(rsgetFloat(cols[i ]));break;case :ftg = new BigDecimal();if (rsgetBigDecimal(cols[i ]) != null)ftg = rsgetBigDecimal(cols[i ]);
row[i ] = ftg;break;case : //对u 数u 库u 段TRING//okrow[i ] =funcCL_String(rsgetString(cols[i ]));
break;case : //对u 数u 库u 段ATE//okdate = (javasqlDate) rsgetDate(cols[i ]);row[i ] = date;break;case :javasqlTime time =(javasqlTime) rsgetTime(cols[i ]);row[i ] = time;break;case :javasqlTimestamp timestamp =(javasqlTimestamp) rsgetTimestamp(cols[i ]);row[i ] = timestamp;break;
default :
row[i ] =funcCL_String(rsgetString(cols[i ]));
break;
}}}kfsesetCols(cols);kfsesetColstype(colsType);kfsesetRows(rows);}utilclose();} catch (SQLException e) {eprintStackTrace();}return kfse;}//页面读取javautilList rows;String str = ;int ii =;Iterator iter = null;int j = ;try {int i;ExecMySql bean = new ExecMySql();String tmps;j = ;str =select DJCJD_MCDJCJD_KSRQ from EM_DJCJD_TB where DJCJD_ID=;
MyTable mytb = beanexecMySQLSelect(str);j=;rows = new javautilArrayList();rows = mytbgetRows();ii =rowssize();if (rowsisEmpty()) {return;}String mys; j=;for (iter = erator(); iterhasNext();) {Object[] sss = (Object[]) iternext();
j = ;wdContextcurrentContextElement()setString((String) sss[]);wdContextcurrentContextElement()setDate((Date) sss[]);}
} catch (Exception e) {MessageManager wdMsgMgr =(MessageManager) wdThiswdGetAPI()getComponent()getMessageManager();wdMsgMgrreportException(egetMessage() true);loggererrorT(egetMessage());}
//插入日期insert into em_djcqk_tb t (tDJCQK_IDtDJCQK_JCRQ) values(to_date( ::yyyymmdd hh:mi:ss))//插入带 的字符串String a = aaaaa ;String b = areplaceAll() insert into em_djcqk_tb (DJCQK_IDDJCQK_JCR) values (b)