You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "xgl1991714 (JIRA)" <ji...@apache.org> on 2014/11/10 10:16:33 UTC

[jira] [Updated] (METAMODEL-94) [MongoDbDataContext] The alias will be lost,unless we use FunctionType

     [ https://issues.apache.org/jira/browse/METAMODEL-94?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

xgl1991714 updated METAMODEL-94:
--------------------------------
    Description: 
here is the method 'executeQuery()' of MongoDbDataContext:
{quote}
*public* DataSet executeQuery(Query query) {
...
*boolean* allSelectItemsAreColumns = *true*;
                List<SelectItem> selectItems = query.getSelectClause().getItems();
                *for* (SelectItem selectItem : selectItems) {
&nbsp;&nbsp;*if* ({color:red}selectItem.getFunction() != *null* || selectItem.getColumn() == *null*{color}){
allSelectItemsAreColumns = *false*;
&nbsp;&nbsp;&nbsp;&nbsp;*break*; 
}
}
*if* (allSelectItemsAreColumns) {
...
&nbsp;&nbsp;*final* DataSet dataSet = materializeMainSchemaTableInternal(table, columns, whereItems, firstRow, maxRows, *false*);
&nbsp;&nbsp;*return* {color:red}dataSet{color};
}
*return* {color:red}super.executeQuery(query){color};
}
{quote}
when I run:
{quote}
mongoDbDataContext.query().from({color:blue}"dept"{color}).select({color:blue}"dname"{color}).as({color:blue}"xxx"{color})
{quote}
the +allSelectItemsAreColumns+ is *true* and the alias is lost

  was:
here is the method 'executeQuery()' of MongoDbDataContext:
{quote}
*public* DataSet executeQuery(Query query) {
...
*boolean* allSelectItemsAreColumns = *true*;
                List<SelectItem> selectItems = query.getSelectClause().getItems();
                *for* (SelectItem selectItem : selectItems) {
&nbsp;&nbsp;*if* ({color:red}selectItem.getFunction() != *null* || selectItem.getColumn() == *null*{color}){
&nbsp;&nbsp;&nbsp;&nbsp;allSelectItemsAreColumns = *false*;
&nbsp;&nbsp;&nbsp;&nbsp;*break*; 
}
}
*if* (allSelectItemsAreColumns) {
...
&nbsp;&nbsp;*final* DataSet dataSet = materializeMainSchemaTableInternal(table, columns, whereItems, firstRow, maxRows, *false*);
&nbsp;&nbsp;*return* {color:red}dataSet{color};
}
*return* {color:red}super.executeQuery(query){color};
}
{quote}
when I run:
{quote}
mongoDbDataContext.query().from({color:blue}"dept"{color}).select({color:blue}"dname"{color}).as({color:blue}"xxx"{color})
{quote}
the +allSelectItemsAreColumns+ is *true* and the alias is lost


> [MongoDbDataContext] The alias will be lost,unless we use FunctionType
> ----------------------------------------------------------------------
>
>                 Key: METAMODEL-94
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-94
>             Project: Metamodel
>          Issue Type: Bug
>    Affects Versions: 4.1.0-incubating, 4.2.0-incubating
>            Reporter: xgl1991714
>
> here is the method 'executeQuery()' of MongoDbDataContext:
> {quote}
> *public* DataSet executeQuery(Query query) {
> ...
> *boolean* allSelectItemsAreColumns = *true*;
>                 List<SelectItem> selectItems = query.getSelectClause().getItems();
>                 *for* (SelectItem selectItem : selectItems) {
> &nbsp;&nbsp;*if* ({color:red}selectItem.getFunction() != *null* || selectItem.getColumn() == *null*{color}){
> allSelectItemsAreColumns = *false*;
> &nbsp;&nbsp;&nbsp;&nbsp;*break*; 
> }
> }
> *if* (allSelectItemsAreColumns) {
> ...
> &nbsp;&nbsp;*final* DataSet dataSet = materializeMainSchemaTableInternal(table, columns, whereItems, firstRow, maxRows, *false*);
> &nbsp;&nbsp;*return* {color:red}dataSet{color};
> }
> *return* {color:red}super.executeQuery(query){color};
> }
> {quote}
> when I run:
> {quote}
> mongoDbDataContext.query().from({color:blue}"dept"{color}).select({color:blue}"dname"{color}).as({color:blue}"xxx"{color})
> {quote}
> the +allSelectItemsAreColumns+ is *true* and the alias is lost



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)