Ignore:
Timestamp:
2005-05-16T11:02:50+12:00 (19 years ago)
Author:
kjdon
Message:

merged from branch ant-install-branch: merge 1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSFile.java

    r8742 r9874  
    1111import java.sql.ResultSet;
    1212import java.sql.SQLException;
     13import java.sql.Statement;
    1314
    1415import org.w3c.dom.Document;
     
    201202    where.add(whereItem);
    202203    select.setWhere(where);
    203     connection.execute(select.toString());
     204
     205    Statement statement = null;
    204206   
    205207    // if not, then make an insert action
    206208    try {
    207         ResultSet results = connection.getResultSet();
    208         if (results == null ||
    209         !results.first()){
     209        statement = connection.createStatement();
     210        ResultSet results = statement.executeQuery(select.toString());
     211        if (!results.first()){
    210212        GS3SQLInsert insert = new GS3SQLInsert("files");
    211213       
     
    223225    }
    224226    catch (SQLException ex){
    225         System.err.println(ex);
     227        System.err.println("METSFile.writeSQL(): "+ex);
    226228        return false;
    227229    }
     
    230232    action.addValue("MIMEType", this.MIMEType);
    231233   
    232     return connection.execute(action.toString());
     234    try {
     235        statement.execute(action.toString());
     236        statement.close();
     237       
     238    } catch (SQLException e) {
     239        System.err.println("METSFile.writeSQL():"+e);
     240        return false;
     241    }
     242    return true;
    233243    }
    234244   
     
    248258    }
    249259    catch (SQLException ex){
    250         System.out.println(ex);
     260        System.out.println("METSFile.readSQL(): "+ex);
    251261    }
    252262    catch (java.net.MalformedURLException urlEx){
    253         System.out.println(urlEx);
     263        System.out.println("METSFile.readSQL(): "+urlEx);
    254264    }
    255265    return null;
     
    309319    } catch (java.net.MalformedURLException ex) {
    310320        // TODO: raise error
    311         System.err.println(ex);
     321        System.err.println("METSFile.parse_flocateXML(): "+ex);
    312322    }
    313323    return thisFilePos;
Note: See TracChangeset for help on using the changeset viewer.