Project

General

Profile

« Previous | Next » 

Revision 671

Added by berkley almost 24 years ago

fixed introduced problem with preparedStatements

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
222 222
            btBuf.append("%docid=").append(docid).append("'");
223 223
            //System.out.println("sql: " + btBuf.toString());
224 224
            
225
            pstmt = dbconn.prepareStatement(btBuf.toString());
226
            pstmt.execute();
227
            ResultSet btrs = pstmt.getResultSet();
225
            PreparedStatement npstmt = dbconn.prepareStatement(btBuf.toString());
226
            npstmt.execute();
227
            ResultSet btrs = npstmt.getResultSet();
228 228
            boolean hasBtRows = btrs.next();
229 229
            if(hasBtRows)
230 230
            { //there was a backtrackable document found
......
250 250
              //                   " doctitle: " + doctitle + " createdate: " +
251 251
              //                   createDate + " updatedate: " + updateDate);
252 252
            }
253
            npstmt.close();
253 254
            btrs.close();
254 255
          }
255 256
          
......
285 286
        }
286 287
        System.out.println("rs1.close");
287 288
        rs.close();
289
        //pstmt.close();
288 290
        
289 291
        if(qspec.containsExtendedSQL())
290 292
        {
src/edu/ucsb/nceas/metacat/RelationHandler.java
1 1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: A class to asyncronously build the package relation index
4
 *             in the database table xml_relation.
5
 *  Copyright: 2000 Regents of the University of California and the
6
 *             National Center for Ecological Analysis and Synthesis
7
 *    Authors: Chad Berkley
8
 *    Release: @release@
9
 *
10 2
 *   '$Author$'
11 3
 *     '$Date$'
12 4
 * '$Revision$'
......
116 108
        String object = rs.getString(3);
117 109
      
118 110
        //compare r to each relation in xml_relation
119
        pstmt.close();
111
        
120 112
        pstmt = conn.prepareStatement("select subject, subdoctype, " +
121 113
                                      "relationship, object, objdoctype " +
122 114
                                      "from xml_relation");
......
200 192
        subDoc = new DocumentImpl(conn, subDocid);
201 193
        subDoctype = subDoc.getDoctype();
202 194
        DocumentImpl objDoc = new DocumentImpl(conn, objDocid);
203
        objDoc.getDoctype();
195
        objDoctype = objDoc.getDoctype();
204 196
        
205 197
        //now that the comparisons are done, the new relation can be put
206 198
        //into xml_relation
......
214 206
        insertStmt.append(relationship).append("', '");
215 207
        insertStmt.append(object).append("', '");
216 208
        insertStmt.append(objDoctype).append("')");
209
        
217 210
        pstmt = conn.prepareStatement(insertStmt.toString());
218 211
        pstmt.execute(); 
219 212
        
......
221 214
      }
222 215
      
223 216
      conn.commit();
217
      pstmt.close();
224 218
      conn.close();
225 219
      btThread = null;
226 220

  

Also available in: Unified diff