Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    6.1p: viewRequires resulting in "false" on an only includeFrom fields does not result in join suppression

    Hi Isomorphic,

    please see this BuiltInDS based testcase (v11.1p_2018-06-09).

    As you can see when you open the sample, the column incName is not there in the GUI. This is expected as DataSourceLaoder returns this for the incName field:
    Code:
    {canView:false,name:"incName",columnCode:"60f633f201247e9259633def4260a46f"}]}
    Nevertheless the generated SQL is (I do have customSelectExpression in employees.ds.xml):
    Code:
    SELECT LIMIT 0 75  animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture, [B]UPPER(Name) AS incName[/B]
    FROM animals
    [B]LEFT OUTER JOIN employeeTable ON animals.lifeSpan = employeeTable.EmployeeId[/B]
    WHERE ('1'='1') ORDER BY animals.scientificName
    As you can see it includes the join to employees. This is unexpected. Not having the unneeded field (plus join) would result in easier and faster SQLs.

    animals.ds.xml (join added):
    Code:
    <DataSource
        ID="animals"
        serverType="sql"
        tableName="animals"
        testFileName="animals.data.xml" useAnsiJoins="true" 
    >
        <fields>
            <field name="commonName"      title="Animal"             type="text" />
            <field name="scientificName"  title="Scientific Name"    type="text"  primaryKey="true"  required="true"/>
            <field name="lifeSpan"        title="Life Span"          type="integer"/>
            <field name="status"          title="Endangered Status"  type="text">
                <valueMap>
                    <value>Threatened</value>
                    <value>Endangered</value>
                    <value>Not Endangered</value>
                    <value>Not currently listed</value>
                    <value>May become threatened</value>
                    <value>Protected</value>
                </valueMap>
            </field>
            <field name="diet"            title="Diet"               type="text"/>
            <field name="information"     title="Interesting Facts"  type="text"  length="1000" />
            <field name="picture"         title="Picture"            type="image" detail="true"
                   imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/"/>
    [B]        <field name="incName" includeFrom="employees.Name" viewRequires="false" />
            <field foreignKey="employees.EmployeeId" name="lifeSpan" title="Life Span" type="integer" joinType="outer" />[/B]
        </fields>
    </DataSource>
    BuiltInDS.java:
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.Version;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.SortSpecifier;
    import com.smartgwt.client.types.SortDirection;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
        private VLayout mainLayout;
        private IButton recreateBtn;
    
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            mainLayout = new VLayout(20);
            mainLayout.setWidth100();
            mainLayout.setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    recreate();
                }
            });
            mainLayout.addMember(recreateBtn);
            recreate();
            mainLayout.draw();
        }
    
        private void recreate() {
            Window w = new Window();
            w.setWidth("95%");
            w.setHeight("95%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
            w.setTitle("Problem with length validation run for included field" + w.getTitle());
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            final ListGrid animalsGrid = new ListGrid(DataSource.get("animals"));
    
            animalsGrid.setHeight100();
            animalsGrid.setAutoFetchData(false);
            animalsGrid.setCanEdit(true);
    
            ListGridField scientificName = new ListGridField("scientificName");
            scientificName.setCanEdit(false);
            ListGridField commonName = new ListGridField("commonName");
            ListGridField lifeSpan = new ListGridField("lifeSpan");
            ListGridField status = new ListGridField("status");
            ListGridField incName = new ListGridField("incName");
    
            animalsGrid.setFields(scientificName, commonName, lifeSpan, status, incName);
            animalsGrid.setSort(new SortSpecifier[] { new SortSpecifier(scientificName.getName(), SortDirection.ASCENDING) });
            animalsGrid.fetchData();
            w.addItem(animalsGrid);
            w.show();
        }
    }
    Best regards
    Blama

    #2
    Hi Blama

    Comment


      #3
      Hi Isomorphic,

      could you reproduce the issue from #1?

      Best regards
      Blama

      Comment


        #4
        Yes, it is reproducible. We are working on this issue and will let you know when it will be fixed.

        Comment


          #5
          This is fixed and is available for download in nightly builds since July 10 (today).

          Comment

          Working...
          X