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/SimpleNamespace.java

    r8742 r9874  
    99
    1010import java.sql.SQLException;
     11import java.sql.Statement;
    1112import java.sql.ResultSet;
    1213
     
    281282    }
    282283   
     284    Statement statement = null;
     285    ResultSet results = null;
    283286    try {
     287        statement = connection.createStatement();
    284288        if (this.id == null) {
    285289        GS3SQLSelect select = new GS3SQLSelect("namespaces");
    286290        select.setWhere(new GS3SQLWhere(new GS3SQLWhereItem("MetadataRef", "=", Integer.toString(parentId), GS3SQLField.INTEGER_TYPE)));
    287291        select.addField("NamespaceRef");
    288         connection.execute(select.toString());
    289        
    290         ResultSet results = connection.getResultSet();
    291         results.first();
    292         sqlId = Integer.toString(results.getInt("NamespaceRef"));
     292        results = statement.executeQuery(select.toString());
     293        if (results.first()) {
     294            sqlId = Integer.toString(results.getInt("NamespaceRef"));
     295        } else {
     296            statement.close();
     297            return false;
     298        }
    293299        }
    294300        else {
     
    300306        GS3SQLWhere where = new GS3SQLWhere(new GS3SQLWhereItem("NamespaceRef", "=", sqlId, GS3SQLField.INTEGER_TYPE));
    301307        delete.setWhere(where);
    302         connection.execute(delete.toString());
     308        statement.execute(delete.toString());
    303309       
    304310        // write out the metadata for this namespace
     
    316322            insert.addValue("Label", thisKey);
    317323            insert.addValue("Value", value);
    318             connection.execute(insert.toString());
    319         }
    320         }
     324            statement.execute(insert.toString());
     325        }
     326        }
     327        statement.close();
    321328    }
    322329    catch (SQLException sql) {
    323         System.out.println(sql);
     330        System.out.println("SimpleNamespace.writeSQL(): "+sql);
    324331    }
    325332    return true;
Note: See TracChangeset for help on using the changeset viewer.