protected static final int DB_TYPE_SQLSERVER = 1;
protected static final int DB_TYPE_MYSQL = 2;
protected static final int DB_TYPE_DB2 = 3;
-// protected static final int DB_TYPE_POSTGRESQL = 4;
+ protected static final int DB_TYPE_POSTGRESQL = 4;
protected static final int DB_TYPE_UNKNOWN = -1;
- protected static final String [] DB_TYPE_NAME = {"ORACLE", "SQLSERVER", "MYSQL", "DB2"};
- protected static final String [] DB_SQL_QUOTED = {"\"", "\"", "`", "\""};
+ protected static final String [] DB_TYPE_NAME = {"ORACLE", "SQLSERVER", "MYSQL", "DB2", "POSTGRESQL"};
+ protected static final String [] DB_SQL_QUOTED = {"\"", "\"", "`", "\"", "\""};
protected static final int MASK_PTN_ALL = 0;
protected static final int MASK_PTN_ALT = 1;
protected static final int MASK_PTN_EDGE = 2;
+ " tabname "
+ " from syscat.tables "
+ " where tabschema = CURRENT_SCHEMA and ownertype = 'U' and type = 'T' "
- + " order by tabname"
+ + " order by tabname",
+ "select "
+ + " table_name "
+ + " from information_schema.TABLES "
+ + " where TABLE_TYPE = 'BASE TABLE' and TABLE_SCHEMA = current_schema() "
+ + " order by table_name"
};
protected static final String [] TK_SQL_ARRAY = {
"select "
+ " group by c.tabschema,c.tabname,c.colname,c.colseq"
+ " ) b "
+ " on a.tabschema = b.tabschema and a.tabname = b.tabname"
- + " order by a.tabname,b.colseq"
+ + " order by a.tabname,b.colseq",
+ "select "
+ + " a.table_name, "
+ + " b.column_name "
+ + " from "
+ + " ( "
+ + " select "
+ + " table_schema, "
+ + " table_name "
+ + " from "
+ + " information_schema.tables a"
+ + " where table_type = 'BASE TABLE' and table_schema = current_schema()"
+ + " ) a "
+ + " left outer join "
+ + " ("
+ + " select"
+ + " b1.table_schema,"
+ + " b1.table_name,"
+ + " b2.column_name,"
+ + " b2.ordinal_position"
+ + " from"
+ + " information_schema.table_constraints b1,"
+ + " information_schema.key_column_usage b2"
+ + " where"
+ + " b1.table_schema = current_schema() and"
+ + " b1.table_catalog = current_database() and"
+ + " b1.constraint_type = 'PRIMARY KEY' and"
+ + " b1.table_catalog = b2.table_catalog and"
+ + " b1.table_schema = b2.table_schema and"
+ + " b1.table_name = b2.table_name and"
+ + " b1.constraint_name = b2.constraint_name"
+ + " ) b"
+ + " on a.TABLE_SCHEMA = b.TABLE_SCHEMA "
+ + " and a.TABLE_NAME = b.TABLE_NAME "
+ + " order by "
+ + " a.table_name,b.ordinal_position"
};
protected String user = null;
_str.toUpperCase().equals("NTEXT") ||
_str.toUpperCase().equals("CHARACTER") ||
_str.toUpperCase().equals("CHAR") ||
+ _str.toUpperCase().equals("BPCHAR") ||
_str.toUpperCase().equals("NCHAR") ||
_str.toUpperCase().equals("VARCHAR") ||
_str.toUpperCase().equals("VARCHAR2") ||
}
}
+ protected static boolean isColBoolean(String _str) throws Exception{
+ if(
+ _str.toUpperCase().equals("BIT") ||
+ _str.toUpperCase().equals("BOOL") ||
+ _str.toUpperCase().equals("BOOLEAN")){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
protected static boolean isColDate(String _str) throws Exception{
if(
_str.toUpperCase().equals("DATE")){
_str.toUpperCase().equals("INTEGER") ||
_str.toUpperCase().equals("SMALLINT UNSIGNED") ||
_str.toUpperCase().equals("MEDIUMINT") ||
+ _str.toUpperCase().equals("SERIAL") ||
+ _str.toUpperCase().equals("INT2") ||
+ _str.toUpperCase().equals("INT4") ||
_str.toUpperCase().equals("INT")){
return true;
} else {
_str.toUpperCase().equals("MEDIUMINT UNSIGNED") ||
_str.toUpperCase().equals("BIGINT UNSIGNED") ||
_str.toUpperCase().equals("BIGINT") ||
+ _str.toUpperCase().equals("BIGSERIAL") ||
+ _str.toUpperCase().equals("SERIAL8") ||
+ _str.toUpperCase().equals("INT8") ||
_str.toUpperCase().equals("LONG")){
return true;
} else {
protected static boolean isColBlob(String _str) throws Exception{
if(
+ _str.toUpperCase().equals("BYTEA") ||
_str.toUpperCase().equals("BLOB") ||
_str.toUpperCase().equals("VARBINARY") ||
_str.toUpperCase().equals("UDT") ||
private Short colShort = null;
private Float colFloat = null;
private Double colDouble = null;
+ private Boolean colBoolean = null;
private java.sql.Timestamp colTimestamp = null;
private java.sql.Time colTime = null;
private java.sql.Date colDate = null;
colBytes = null;
colBlob = null;
colClob = null;
+ colBoolean = null;
ByteArrayOutputStream baos = null;
InputStream is = null;
if (colBigDecimal != null) {
colString = colBigDecimal.toString();
}
+ } else if (CmnUtils.isColBoolean(_colTypeName)) {
+ colBoolean = _rst.getBoolean(_rec_cnt);
+ if (colBoolean != null) {
+ colString = colBoolean.toString();
+ }
} else if (CmnUtils.isColShort(_colTypeName)) {
colShort = _rst.getShort(_rec_cnt);
if (colShort != null) {
} else {
stmt_ins.setNull(ins_col_count+1,java.sql.Types.SMALLINT);
}
+ } else if (CmnUtils.isColBoolean(colTypeName[tb_col_seq[ins_col_count]])){
+ if (!colData[fl_col_seq[ins_col_count]].equals("")){
+ stmt_ins.setBoolean(ins_col_count+1,Boolean.valueOf(colData[fl_col_seq[ins_col_count]]));
+ } else {
+ stmt_ins.setNull(ins_col_count+1,java.sql.Types.BOOLEAN);
+ }
} else if (CmnUtils.isColInt(colTypeName[tb_col_seq[ins_col_count]])){
if (!colData[fl_col_seq[ins_col_count]].equals("")){
stmt_ins.setInt(ins_col_count+1,Integer.parseInt(colData[fl_col_seq[ins_col_count]]));
if(inFiles != null) {
for(int k=0;k<inFiles.length;k++){
flName = CmnUtils.splitDot(inFiles[k].getName());
- tbName = flName[0].toUpperCase();
+ tbName = flName[0];
StringBuffer sbColumnName = null;
TABLE_LOOP:
for(int i=0;i<alData.size();i++){
} catch(SQLException se) {
try{
CmnUtils.errorPrint(se.toString());
- while (se != null) {
- System.out.println("Error Message: " + se.getMessage());
- se = se.getNextException();
- }
+ se.printStackTrace();
+ //while (se != null) {
+ // System.out.println(se.getMessage());
+ // se = se.getNextException();
+ //}
+ dao.rollback();
} catch (Exception see) {}
} catch (Exception e) {
try{
CmnUtils.infoPrint("\83f\81[\83^\83A\83\93\83\8d\81[\83h\82ð\8fI\97¹\82µ\82Ü\82µ\82½\81B");
+ } catch(SQLException se) {
+ try{
+ CmnUtils.errorPrint(se.toString());
+ se.printStackTrace();
+ //while (se != null) {
+ // System.out.println(se.getMessage());
+ // se = se.getNextException();
+ //}
+ dao.rollback();
+ } catch (Exception see) {}
} catch (Exception e) {
try{
CmnUtils.errorPrint(e.toString());