Changeset 320

Show
Ignore:
Timestamp:
02/27/10 20:02:04 (5 months ago)
Author:
martijn
Message:

Tweaked rdb.construct package for coming HMDB update

Location:
trunk/org.bridgedb.rdb.construct/src/org/bridgedb/rdb/construct
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/org.bridgedb.rdb.construct/src/org/bridgedb/rdb/construct/GdbConstruct.java

    r317 r320  
    3232         * @return 1 if addition was successful, 0 otherwise.  
    3333         */ 
    34         public int addGene(Xref ref, String bpText);  
     34        public int addGene(Xref ref); 
    3535 
    3636        /** 
     
    6767        /** 
    6868         * Excecutes several SQL statements to create the tables and indexes in the database the given 
    69          * connection is connected to 
    70          * Note: Official GDB's are created by Alex Pico's script, not with this code. 
    71          * This is just here for testing purposes. 
     69         * connection is connected to. 
    7270         */ 
    73         abstract public void createGdbTables();  
     71        abstract public void createGdbTables() throws IDMapperException;         
    7472 
     73        abstract public void commit() throws IDMapperException; 
     74         
     75        abstract public void finalize() throws IDMapperException; 
    7576} 
  • trunk/org.bridgedb.rdb.construct/src/org/bridgedb/rdb/construct/GdbConstructImpl3.java

    r317 r320  
    5151 
    5252        /** {@inheritDoc} */ 
    53         public int addGene(Xref ref, String bpText)  
     53        public int addGene(Xref ref) 
    5454        { 
    5555                //TODO: bpText is unused 
     
    6262                }  
    6363                catch (SQLException e)  
    64                 {  
    65 //                      Logger.log.error("" + ref, e); 
     64                { 
    6665                        return 1; 
    6766                } 
     
    7978                        pstAttr.executeUpdate(); 
    8079                } catch (SQLException e) { 
    81 //                      Logger.log.error(attr + "\t" + val + "\t" + ref, e); 
    8280                        return 1; 
    8381                } 
     
    9795                        pstLink.executeUpdate(); 
    9896                }  
    99                 catch (SQLException e) 
    100                 { 
    101 //                      Logger.log.error(left + "\t" + right , e); 
     97        catch (SQLException e)  
     98                { 
    10299                        return 1; 
    103100                } 
     
    177174         * Note: Official GDB's are created by AP, not with this code. 
    178175         * This is just here for testing purposes. 
    179          */ 
    180         public void createGdbTables()  
     176         * @throws IDMapperException  
     177         */ 
     178        public void createGdbTables() throws IDMapperException  
    181179        { 
    182180//              Logger.log.info("Info:  Creating tables"); 
     
    184182                { 
    185183                        Statement sh = con.createStatement(); 
    186                         sh.execute("DROP TABLE info"); 
    187                         sh.execute("DROP TABLE link"); 
    188                         sh.execute("DROP TABLE datanode"); 
    189                         sh.execute("DROP TABLE attribute"); 
    190                 }  
    191                 catch(SQLException e)  
    192                 { 
    193 //                      Logger.log.error("Unable to drop gdb tables (ignoring): " + e.getMessage()); 
    194                 } 
    195  
    196                 try 
    197                 { 
    198                         Statement sh = con.createStatement(); 
     184//                      sh.execute("DROP TABLE info"); 
     185//                      sh.execute("DROP TABLE link"); 
     186//                      sh.execute("DROP TABLE datanode"); 
     187//                      sh.execute("DROP TABLE attribute"); 
     188//                      sh.close(); 
     189                         
     190//                      sh = con.createStatement(); 
    199191                        sh.execute( 
    200192                                        "CREATE TABLE                                   " + 
     
    222214                                        "               datanode                                                " + 
    223215                                        " (   id VARCHAR(50),                                   " + 
    224                                         "     code VARCHAR(50)                                  " + 
     216                                        "     code VARCHAR(50),                                 " + 
    225217                                        "     PRIMARY KEY (id, code)                    " + 
    226218                                        " )                                                                             "); 
     
    238230                catch (SQLException e) 
    239231                { 
    240 //                      Logger.log.error("while creating gdb tables: " + e.getMessage(), e); 
     232                        throw new IDMapperException (e); 
    241233                } 
    242234        }