Commits

tbrugz committed 21663d9

cleanup: build.xml & SQLQueries

  • Participants
  • Parent commits d533cb7

Comments (0)

Files changed (2)

 <project name="sqldump" xmlns:ivy="antlib:org.apache.ivy.ant">
 	
 	<property name="src.dir" value="src"/>
+	<property name="src.diff.dir" value="src_diff"/>
 	<property name="src.graphml.dir" value="src_graphml"/>
-	<property name="src.diff.dir" value="src_diff"/>
+	<property name="src.mondrian.dir" value="src_mondrian"/>
 	<property name="src.run.dir" value="src_run"/>
-	<property name="src.mondrian.dir" value="src_mondrian"/>
+	<property name="src.test.dir" value="src_test"/>
 	<property name="src.xtra.dir" value="src_xtra"/>
 	
 	<property name="bin.dir"  value="bin"/>
 				<attribute name="Main-Class" value="${sqldump.mainclass}"/>
 			</manifest>
 		</jar>
+		<!--jar destfile="${dist.dir}/sqldump-jaxb.jar"
+			basedir="${src.test.dir}"
+			includes="**/jaxb.properties">
+		</jar-->
 	</target>
 
 	<target name="javadoc" depends="prepare">

File src/tbrugz/sqldump/datadump/SQLQueries.java

 			List<String> keyCols = Utils.getStringListFromProp(prop, "sqldump.query."+qid+".keycols", ",");
 
 			// adding query to model
-			Query query = new Query();
-			query.id = qid;
-			query.setName(queryName);
-			query.query = sql;
-			query.parameterValues = params;
-			if(keyCols!=null) {
-				Constraint cpk = new Constraint();
-				cpk.type = ConstraintType.PK;
-				cpk.uniqueColumns = keyCols;
-				List<Constraint> lc = query.getConstraints(); 
-				if(lc==null) {
-					lc = new ArrayList<Constraint>();
-					query.setConstraints(lc);
-				}	
-				lc.add(cpk);
+			ADD_QUERY_TO_MODEL:
+			if(addQueriesToModel) {
+				if(model==null) {
+					log.warn("can't add query [id="+qid+"; name="+queryName+"]: model is null");
+					break ADD_QUERY_TO_MODEL;
+				}
+				Query query = new Query();
+				query.id = qid;
+				query.setName(queryName);
+				query.query = sql;
+				query.parameterValues = params;
+				if(keyCols!=null) {
+					Constraint cpk = new Constraint();
+					cpk.type = ConstraintType.PK;
+					cpk.uniqueColumns = keyCols;
+					List<Constraint> lc = query.getConstraints(); 
+					if(lc==null) {
+						lc = new ArrayList<Constraint>();
+						query.setConstraints(lc);
+					}	
+					lc.add(cpk);
+				}
+				//queries.add(query);
+				model.getViews().add(query);
 			}
-			//queries.add(query);
-			if(addQueriesToModel) { model.getViews().add(query); }
-			// added query to model
+			// added query to model, or not
 			
 			if(runQueries) {
-				
-			try {
-				log.debug("running query [id="+qid+"; name="+queryName+"]: "+sql);
-				dd.runQuery(conn, sql, params, prop, qid, queryName, charset, rowlimit, syntaxList, partitionBy, keyCols);
-			} catch (Exception e) {
-				log.warn("error on query '"+qid+"'\n... sql: "+sql+"\n... exception: "+String.valueOf(e).trim());
-				log.info("error on query "+qid+": "+e.getMessage(), e);
-			}
-			
+				try {
+					log.debug("running query [id="+qid+"; name="+queryName+"]: "+sql);
+					dd.runQuery(conn, sql, params, prop, qid, queryName, charset, rowlimit, syntaxList, partitionBy, keyCols);
+				} catch (Exception e) {
+					log.warn("error on query '"+qid+"'\n... sql: "+sql+"\n... exception: "+String.valueOf(e).trim());
+					log.info("error on query "+qid+": "+e.getMessage(), e);
+				}
 			}
 			i++;
 		}