Quick example on where i got this issue..( My product is to build Common UI for
all datasource to be browsed on web). And i dynamically generate queries based
on metadata.
Query q = dataContext.parseQuery("SELECT * FROM [Aqu Fall 2015 Comp
Dates.xlsx.Sheet2]”);
Regards
Ashwin
> On Nov 8, 2015, at 11:52 AM, Ashwin Rayaprolu <[email protected]>
> wrote:
>
> 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;
> }
>
>
>
> <UpdateFromItemParserToParseTablesWithSpace.patch>
>
>
>
> Regards
> Ashwin