[Csvtosql-cvs] csvtosql/src/net/sf/csv2sql/frontends/console ConsoleMain.java, 1.13, 1.14 ExtendedC
Brought to you by:
davideconsonni
From: Vano <jj...@us...> - 2006-11-16 16:29:41
|
Update of /cvsroot/csvtosql/csvtosql/src/net/sf/csv2sql/frontends/console In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28390/src/net/sf/csv2sql/frontends/console Modified Files: ConsoleMain.java ExtendedConsoleMain.java Log Message: Index: ExtendedConsoleMain.java =================================================================== RCS file: /cvsroot/csvtosql/csvtosql/src/net/sf/csv2sql/frontends/console/ExtendedConsoleMain.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExtendedConsoleMain.java 12 Oct 2006 15:43:31 -0000 1.2 --- ExtendedConsoleMain.java 16 Nov 2006 16:29:31 -0000 1.3 *************** *** 2,6 **** Copyright (C) 2006 Ivan Ryndin <jj...@us...> ! LGPL terms */ package net.sf.csv2sql.frontends.console; --- 2,18 ---- Copyright (C) 2006 Ivan Ryndin <jj...@us...> ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Lesser General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Lesser General Public License for more details. ! ! You should have received a copy of the GNU Lesser General Public ! License along with this library; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.sf.csv2sql.frontends.console; *************** *** 55,58 **** --- 67,71 ---- return " Usage: csv2sql -d filename [-b]\n\n"+ " --descriptor [-d] file containing conversion descriptor\n"+ + " --showeachfile [-s] show each file processing\n" + " --help [-h] display this help\n"; } *************** *** 107,110 **** --- 120,124 ---- options.addOption( "d", "descriptor", true, "descriptor file"); options.addOption( "h", "help", false, "display help" ); + options.addOption( "s", "showeachfile", false, "show each file processing" ); CommandLine line = parser.parse( options, args ); *************** *** 130,135 **** try { String fileName = line.getOptionValue("d"); ! pathPart = fileName.substring(0,fileName.lastIndexOf(File.separator))+File.separator; ! BufferedReader in = new BufferedReader(new FileReader(fileName)); String s; while((s = in.readLine())!= null) { --- 144,154 ---- try { String fileName = line.getOptionValue("d"); ! int idx = fileName.lastIndexOf("\\"); ! if (idx==-1) idx = fileName.lastIndexOf("/"); ! if (idx!=-1) ! pathPart = fileName.substring(0,idx)+File.separator; ! File f = new File(fileName); ! System.out.println(f.getAbsolutePath()); ! BufferedReader in = new BufferedReader(new FileReader(f)); String s; while((s = in.readLine())!= null) { *************** *** 150,154 **** System.out.println("ERROR: option --descriptor is mandatory.\n"); System.exit(1); ! } // connect to database --- 169,176 ---- System.out.println("ERROR: option --descriptor is mandatory.\n"); System.exit(1); ! } ! boolean showEachFileProcessing = false; ! if(line.hasOption("s")) ! showEachFileProcessing = true; // connect to database *************** *** 160,173 **** String dbUser = System.getProperty("db.user"); String dbPassword = System.getProperty("db.password"); ! String dbDriverClass = System.getProperty("db.driver.class"); connection = DBUtils.openConnection(dbDriverClass,dbUrl,dbUser,dbPassword); for (int i=0; i<files.size(); i++) { String fileName = pathPart + (String)files.get(i); ! System.out.print("Processing file: " + fileName); File descriptor = new File(fileName); ExtendedConsoleMain.getInstance().run(descriptor,connection); ! System.out.println(" ............ OK"); } ! System.out.println("\nCsv converted in: "+String.valueOf(System.currentTimeMillis()-start)+" ms"); } finally { DBUtils.closeConnection(connection); --- 182,199 ---- String dbUser = System.getProperty("db.user"); String dbPassword = System.getProperty("db.password"); ! String dbDriverClass = System.getProperty("db.driver"); connection = DBUtils.openConnection(dbDriverClass,dbUrl,dbUser,dbPassword); for (int i=0; i<files.size(); i++) { String fileName = pathPart + (String)files.get(i); ! if (showEachFileProcessing) { ! System.out.print("Processing file: " + fileName); ! } File descriptor = new File(fileName); ExtendedConsoleMain.getInstance().run(descriptor,connection); ! if (showEachFileProcessing) { ! System.out.println(" ............ OK"); ! } } ! System.out.println("" + files.size()+" csv files imported in database during "+String.valueOf(System.currentTimeMillis()-start)+" ms"); } finally { DBUtils.closeConnection(connection); Index: ConsoleMain.java =================================================================== RCS file: /cvsroot/csvtosql/csvtosql/src/net/sf/csv2sql/frontends/console/ConsoleMain.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ConsoleMain.java 21 Mar 2005 17:24:40 -0000 1.13 --- ConsoleMain.java 16 Nov 2006 16:29:31 -0000 1.14 *************** *** 2,18 **** Copyright (C) 2004 Davide Consonni <dco...@en...> ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package net.sf.csv2sql.frontends.console; --- 2,18 ---- Copyright (C) 2004 Davide Consonni <dco...@en...> ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Lesser General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public ! License along with this library; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.sf.csv2sql.frontends.console; |