Hi,

   I’ve started using this Metamodel since today… This really impressed me.. I was building similar product for my own internal use and have come across this..This is more than what i intended to build internally.


My Current issue:

I have an excel sheet where sheet name (Table Name) has spaces in it..And from item parse is throwing Exceptions…I updated it with in local version of code…

I’ve also attached .patch file for the same.. Let me know if anyone see’s any issue in this.. I’m assuming that this part of code is only parsing one TableToken in select clause..


    private FromItem parseTableItem(String itemToken) {
    // From token can be starting with [
    String tableNameToken = "";
    String aliasToken = "";
    if(itemToken.trim().startsWith("[")){
    int endIndex = itemToken.trim().indexOf("]");
    tableNameToken = itemToken.trim().substring(1,endIndex);
    aliasToken = itemToken.trim().substring(1+endIndex).trim();
    }else{
        final String[] tokens = itemToken.split(" ");
        tableNameToken = tokens[0];
        if (tokens.length == 2) {
        aliasToken = tokens[1];
        } else if (tokens.length == 1) {
        aliasToken = null;
        } else {
            throw new QueryParserException("Not capable of parsing FROM token: " + itemToken);
        }
    }

        final Table table = _dataContext.getTableByQualifiedLabel(tableNameToken);
        if (table == null) {
            throw new QueryParserException("Not capable of parsing FROM token: " + itemToken);
        }

        final FromItem result = new FromItem(table);
        result.setAlias(aliasToken);
        result.setQuery(_query);
        return result;
    }



Attachment: UpdateFromItemParserToParseTablesWithSpace.patch
Description: Binary data




Regards
Ashwin

Reply via email to