Changeset 34901 for gs2-extensions


Ignore:
Timestamp:
2021-02-19T16:06:54+13:00 (3 years ago)
Author:
su41
Message:

Added a new sql query to test. It works fine but it's not 100% complete query. Also removed the option of projectId since we'll just pull everything from all projects, and let Greenstone handle sorting that out

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/tipple-bridge/trunk/src/src/main/java/sqlCli.java

    r34900 r34901  
    4747    String dbName;
    4848
    49     //project id - it should be required right?
    50     //if they omit, the query would come up empty.
    51     @Option(names = {"--projectID"}, description = "ID number of the project")
    52     String projectID;
    53 
    5449    @Option(names = {"--host"}, description = "Type of host e.g. localhost ",
    5550            required = true, defaultValue = "localhost")
     
    7570        //else we're good to go.
    7671       // databaseConnect(userName, password, port, dbName, projectID, jsonOutputFile, host);
    77         int status = databaseConnect(userName, password, port, dbName, projectID, jsonOutputFile, host);
     72        int status = databaseConnect(userName, password, port, dbName, jsonOutputFile, host);
    7873        return status;
    7974    }
     
    8681
    8782    private static int databaseConnect(String user, String pass, int port, String dbName,
    88                                         String projectID, String fileName, String host){
     83                                        String fileName, String host){
    8984        Connection conn;
    9085        Statement stmt;
     
    122117             */
    123118
    124             String sql = "SELECT name, id, typeId, created from td_ContentItem where projectId="+projectID;
    125 /*
    126             String sql = "select td_Document.id, td_Document.content " +
    127                     "from td_Document, td_ContentItem, td_ContentItem_Document " +
    128                     "where td_ContentItem.projectId=" + projectID + " and td_ContentItem.id =
    129                     td_ContentItem_Document.ContentItemId " +
    130                     "and td_ContentItem_Document.documentId = td_Document.id;";
    131 */
     119           // String sql = "SELECT name, id, typeId, created from td_ContentItem where projectId="+projectID;
     120
     121            String sql = "SELECT  cItem.name, cItem.created, mFile.path\n" +
     122                    "FROM td_ManagedFile AS mFile, td_ContentItem AS cItem, td_ContentItem_MediaItem AS cMediaItem, td_MediaItem AS mItem\n" +
     123                    "WHERE\n" +
     124                    "cItem.id = cMediaItem.contentItemId \n" +
     125                    "and cMediaItem.mediaItemId = mItem.id\n" +
     126                    "And mItem.fileId = mFile.id\n" +
     127                    "ORDER BY mFile.projectId;\n";
    132128            ResultSet myResult = stmt.executeQuery(sql);
    133129            ResultSetMetaData resultMetaData = myResult.getMetaData();
Note: See TracChangeset for help on using the changeset viewer.