[Biojava-dev] BioSQLSequenceDB Create Behavior
Simon Foote
simon.foote at nrc-cnrc.gc.ca
Thu Oct 14 10:21:46 EDT 2004
Hi Kevin,
I think the thought behind that is, in order to create a new biodatabase
you have to provide a name, so it would be redundant. Unless it is
required lower down in the code somewhere, although I haven't seen a
case of this yet.
Also of note, one can't currently set the authority or version for a
biodatabase during a create or retrieve them for an existing
biodatabase. I do have the retrieve ability in my local copy, but
haven't committed it in yet.
Simon
--
Bioinformatics Programmer
Pathogen Genomics
Institute for Biological Sciences
National Research Council of Canada
[T] 613-990-0561 [F] 613-952-9092
simon.foote at nrc-cnrc.gc.ca
Kevin Fowler wrote:
> 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* {
>
> ...
>
>------------------------------------------------------------------------
>
>_______________________________________________
>biojava-dev mailing list
>biojava-dev at biojava.org
>http://biojava.org/mailman/listinfo/biojava-dev
>
>
--
Bioinformatics Programmer
Pathogen Genomics
Institute for Biological Sciences
National Research Council of Canada
[T] 613-990-0561 [F] 613-952-9092
simon.foote at nrc-cnrc.gc.ca
More information about the biojava-dev
mailing list