first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
74
rus/WEB-INF/lib/abliaDbCom_src/TestExport.java
Normal file
74
rus/WEB-INF/lib/abliaDbCom_src/TestExport.java
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import com.ablia.common.DescTxtLang;
|
||||
import com.ablia.db.ApplParm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.util.DbConsole;
|
||||
import java.sql.Time;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class TestExport extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
TestExport bean = new TestExport();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "guidoreni";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
String dbTarget = "gaias";
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apSource = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root",
|
||||
"root", 1, 10, 300));
|
||||
apSource.setDebug(false);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + dbTarget,
|
||||
"root", "root", 1, 10, 300));
|
||||
apSource.setDebug(false);
|
||||
try {
|
||||
DescTxtLang bean = new DescTxtLang(apSource);
|
||||
DescTxtLang beant = new DescTxtLang(apTarget);
|
||||
ResParm rp = beant.xmlImport("/Users/acolzi/test.xml");
|
||||
System.out.println(rp.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Time getTimeFromString(String theTime) {
|
||||
try {
|
||||
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
|
||||
theTime = String.valueOf(theTime.substring(0, 2)) + ":" +
|
||||
theTime.substring(2, 4);
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(
|
||||
st.nextToken()) : 0;
|
||||
return new Time(
|
||||
(long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(
|
||||
st.nextToken()) : 0;
|
||||
return new Time(
|
||||
(long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue