Revision 109
Added by bojilova about 24 years ago
DBSAXElement.java | ||
---|---|---|
57 | 57 |
// Bind the values to the query |
58 | 58 |
pstmt.setString(1, "ELEMENT"); |
59 | 59 |
pstmt.setString(2, getTagName()); |
60 |
//pstmt.setInt(4, null); |
|
61 | 60 |
if (getParentID() != 0) { |
62 | 61 |
pstmt.setLong(3, getParentID()); |
63 | 62 |
pstmt.setInt(4, getNodeIndex()); |
64 |
} |
|
63 |
} else |
|
64 |
pstmt.setString(1, "DOCUMENT"); |
|
65 | 65 |
// Do the insertion |
66 | 66 |
pstmt.execute(); |
67 | 67 |
pstmt.close(); |
... | ... | |
84 | 84 |
// Bind the values to the query |
85 | 85 |
pstmt.setString(1, "COMMENT"); |
86 | 86 |
pstmt.setLong(2, getElementID()); |
87 |
//System.out.println(data.length()); |
|
87 | 88 |
pstmt.setString(3, data); |
88 | 89 |
pstmt.setInt(4, nodeIndex); |
89 | 90 |
// Do the insertion |
90 | 91 |
pstmt.execute(); |
91 | 92 |
pstmt.close(); |
92 | 93 |
} catch (SQLException e) { |
94 |
System.out.println("Long Comment: " + e.getMessage()); |
|
95 |
} |
|
96 |
} |
|
97 |
|
|
98 |
/** creates SQL code and inserts PI into DB connection */ |
|
99 |
void writePIToDB(String target, String data, int nodeIndex) { |
|
100 |
try { |
|
101 |
PreparedStatement pstmt; |
|
102 |
pstmt = conn.prepareStatement( |
|
103 |
"INSERT INTO xml_nodes (nodeid, nodetype, " + |
|
104 |
"nodename, parentnodeid, nodedata, nodeindex) VALUES (null, ?, ?, ?, ?, ?)"); |
|
105 |
|
|
106 |
// Bind the values to the query |
|
107 |
pstmt.setString(1, "PI"); |
|
108 |
pstmt.setString(2, target); |
|
109 |
pstmt.setLong(3, getElementID()); |
|
110 |
pstmt.setString(4, data); |
|
111 |
pstmt.setInt(5, nodeIndex); |
|
112 |
// Do the insertion |
|
113 |
pstmt.execute(); |
|
114 |
pstmt.close(); |
|
115 |
} catch (SQLException e) { |
|
93 | 116 |
System.out.println(e.getMessage()); |
94 | 117 |
} |
95 | 118 |
} |
Also available in: Unified diff
document root node, doctype changes