[Biojava-dev] BioSQLSequenceDB Create Behavior

Kevin Fowler kfowler at sdsc.edu
Mon Oct 4 02:19:26 EDT 2004


Hi,

I notice that org.biojava.bio.seq.db.biosql.BioSQLSequenceDB doesn't 
set the biodatabase name on create.
for example:

	db = new BioSQLSequenceDB(myDataSource,"MyName",true);
	assert(db.getName()==null);  // true if the DB was created, false if 
it already existed.


Is this a bug or a feature?

--Kevin Fowler



     void initDb(String biodatabase, boolean create)
       ...
             PreparedStatement getID = conn.prepareStatement("select * 
from biodatabase where name = ?");
             getID.setString(1, biodatabase);
             ResultSet rs = getID.executeQuery();
             if (rs.next()) {
                 dbid = rs.getInt(1);
                 name = rs.getString(2);
                 rs.close();
                 getID.close();
                 conn.close();
                 return;
             } else {
                 rs.close();
                 getID.close();
             }

             if (create) {
                 PreparedStatement createdb = 
conn.prepareStatement("insert into biodatabase (name) values ( ? )");
                 createdb.setString(1, biodatabase);
                 createdb.executeUpdate();
                 conn.commit();
                 createdb.close();

                 dbid = getDBHelper().getInsertID(conn, "biodatabase", 
"biodatabase_id");
             } else {
  ...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2048 bytes
Desc: not available
Url : http://portal.open-bio.org/pipermail/biojava-dev/attachments/20041003/45ea0644/attachment-0001.bin


More information about the biojava-dev mailing list