Revision 29
Added by Matt Jones over 24 years ago
DBSAXElement.java | ||
---|---|---|
33 | 33 |
try { |
34 | 34 |
conn.setAutoCommit(false); |
35 | 35 |
PreparedStatement pstmt; |
36 |
if (parent_id != 0) {
|
|
36 |
if (getParentID() != 0) {
|
|
37 | 37 |
pstmt = conn.prepareStatement( |
38 | 38 |
"INSERT INTO xml_nodes (nodeid, nodetype, " + |
39 | 39 |
"nodename, parentnodeid) VALUES (null, ?, ?, ?)"); |
... | ... | |
46 | 46 |
// Bind the values to the query |
47 | 47 |
pstmt.setString(1, "ELEMENT"); |
48 | 48 |
pstmt.setString(2, getTagName()); |
49 |
if (parent_id != 0) {
|
|
50 |
pstmt.setLong(3, parent_id);
|
|
49 |
if (getParentID() != 0) {
|
|
50 |
pstmt.setLong(3, getParentID());
|
|
51 | 51 |
} |
52 | 52 |
// Do the insertion |
53 | 53 |
pstmt.execute(); |
54 | 54 |
pstmt.close(); |
55 |
this.element_id = getAssignedElementID();
|
|
55 |
setElementID(getAssignedElementID());
|
|
56 | 56 |
conn.commit(); |
57 | 57 |
conn.setAutoCommit(true); |
58 | 58 |
} catch (SQLException e) { |
... | ... | |
97 | 97 |
public void setAttribute(String attName, String attValue) { |
98 | 98 |
if (attName != null) { |
99 | 99 |
// Enter the attribute in the hash table |
100 |
attributes.put(attName, attValue);
|
|
100 |
super.setAttribute(attName, attValue);
|
|
101 | 101 |
|
102 | 102 |
// And enter the attribute in the database |
103 | 103 |
try { |
... | ... | |
130 | 130 |
"UPDATE xml_nodes SET nodedata = ? WHERE nodeid = ?"); |
131 | 131 |
|
132 | 132 |
// Bind the values to the query |
133 |
pstmt.setString(1, getContent());// The first ? is for NODEDATA
|
|
134 |
pstmt.setLong(2, element_id); // The second ? is for NODEID
|
|
133 |
pstmt.setString(1, getContent()); |
|
134 |
pstmt.setLong(2, getElementID());
|
|
135 | 135 |
|
136 | 136 |
// Do the update |
137 | 137 |
pstmt.execute(); |
Also available in: Unified diff
general cleanup and documentation