Ignore:
Timestamp:
2004-02-24T11:10:50+13:00 (20 years ago)
Author:
kjdon
Message:

sql database name is now a combination of site name and coll name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS3Search.java

    r6517 r6871  
    2828import org.w3c.dom.NodeList;
    2929
     30import java.io.File;
    3031
    3132/**
     
    115116    //}
    116117    // open the database for querying
    117     if (!database.setDatabase(this.cluster_name)) {
     118    // the database name is a combination of site name and collection name
     119
     120    // check that site_home is set
     121    if (this.site_home == null || this.site_home.equals("")) {
     122        System.err.println("GS3Search Error: site_home is not set, so cannot work out the site name and cannot determine the database name");
     123        return false;
     124    }
     125    String site_name = this.site_home.substring(this.site_home.lastIndexOf(File.separator)+1);
     126    if (site_name.equals("")) {
     127        System.err.println("GS3Search Error: Cannot extract the site name from site home: "+this.site_home);
     128        return false;
     129    }
     130    if (!database.setDatabase(site_name+"_"+this.cluster_name)) {
    118131        System.err.println("GS3Search Error: Could not open SQL database!");
    119132        return false;
Note: See TracChangeset for help on using the changeset viewer.