1 18 19 package sync4j.syncclient.sps.pocketpc.util; 20 21 import sync4j.syncclient.sps.pocketpc.RapiDB; 22 23 30 public class CEDatabaseExport { 31 32 33 38 public static void main(String [] args) throws Exception { 39 if (args.length != 4) { 40 syntax(args); 41 System.exit(-1); 42 } 43 44 RapiDB db = new RapiDB(args[0], args[1]); 45 int keyField = 1; 46 int statusField = 2; 47 48 keyField = Integer.parseInt(args[2]); 49 statusField = Integer.parseInt(args[3]); 50 51 if (db.openDB(keyField, statusField, keyField) == false) { 52 System.out.println("Error opening the database!"); 53 System.exit(-1); 54 } 55 56 Object [][] data = db.getAllRecords(); 57 58 for(int i=0; i<data.length; ++i) { 59 System.out.print(data[i][keyField-1]); 60 for (int j=0; j<data[i].length; ++j) { 61 System.out.print(" , " + data[i][j]); 62 } 63 System.out.println(""); 64 } 65 } 66 67 private static void syntax(String [] args) { 68 System.out.println("Wrong syntax."); 69 System.out.println("Syntax:"); 70 System.out.println("sync4j.syncclient.sps.common.util.CEDatabaseExport volume database key_field status_field\n"); 71 System.out.println("Provided args:"); 72 for (int i=0; i< args.length; ++i) { 73 System.out.println(args[i]); 74 } 75 } 76 77 } | Popular Tags |