|
From: <tr...@us...> - 2003-10-23 04:08:50
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv4909
Modified Files:
SqlQueryPipelineStage.java
Log Message:
Catch null colmns.
Index: SqlQueryPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage/SqlQueryPipelineStage.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SqlQueryPipelineStage.java 15 Aug 2003 00:25:30 -0000 1.5
--- SqlQueryPipelineStage.java 23 Oct 2003 00:20:05 -0000 1.6
***************
*** 91,95 ****
/**
! * Make an XML document out of a SQL query
**/
public class SqlQueryPipelineStage
--- 91,100 ----
/**
! * Make an XML document out of a SQL query. This pipeline stage will execute a number
! * of queries and then encapsulate the result sets in an XML document. These documents
! * could then be operated upon using the other pipeline stages.
! *
! * @author dejank
! * @version 1.1
**/
public class SqlQueryPipelineStage
***************
*** 228,231 ****
--- 233,244 ----
}
+ /**
+ * For each result set of the query, create the rows and the columns for the row.
+ * Each row has a number attribute and each column has a number and a name attribute.
+ *
+ * @param rs resultset to iterate over
+ * @param queryElement element to add the row elements
+ * @throws SQLException Aaaaiiiiieeeee!!!
+ */
private void handleRows(ResultSet rs, Element queryElement) throws SQLException {
ResultSetMetaData metaData = rs.getMetaData();
***************
*** 240,248 ****
columnElement.addAttribute(COLUMN_NAME, name);
columnElement.addAttribute(COLUMN_NUMBER, Integer.toString(j));
! columnElement.setText(value.toString());
}
}
}
private PipelineDocument createPipelineDocument(Document document) {
OutputFormat outformat = OutputFormat.createCompactFormat();
--- 253,271 ----
columnElement.addAttribute(COLUMN_NAME, name);
columnElement.addAttribute(COLUMN_NUMBER, Integer.toString(j));
! if(value!=null) {
! columnElement.setText(value.toString());
! } else {
! columnElement.setText("");
! }
}
}
}
+ /**
+ * Create a pipeline document from the DOM4J object
+ *
+ * @param document dom4j element
+ * @return
+ */
private PipelineDocument createPipelineDocument(Document document) {
OutputFormat outformat = OutputFormat.createCompactFormat();
|