发表用户:讨论贴
收集整理:James.Liu
相关讨论:http://www.mygis.com.cn/forum/dispbbs.asp?boardID=11&ID=7449
信息原始来源:James MapInfo技术论坛

文章标题:请教空间数据库中两表联合查询结果做分析怎么做?

logcy

用sql   select A.*,B.* form table1 A,table2 B where A.id=B.id 进行两个表的关联做分析图层,我想请问一下,在mapxtreme 中应该怎么做,就是说在进行表关联之后怎么把属性表的数据列传给mapxtreme 的对象呢??有这方面的示例吗???万分感谢!!!

wtusmchen

你把查询结果加入图层就行了!

/**
   * 向MapJ插入Oracle图层
   * @param map
   * @param sql
   */
  private void InsertOraLayer(MapJ map, String region_c){
   try{
    String tempSQL = "select CODE,MI_STYLE,GEOLOC from CUSTOMER_POINT where CODE like '" + region_c + "%'";
    String[] idColumns = {"CODE"};
    
    OraSoDataProviderHelper oraDPHelper = new OraSoDataProviderHelper("jdbc:mipool:" + Config.MapXtremePool, null, null);
    OraSoTableDescHelper queryTDH = new OraSoTableDescHelper(tempSQL, idColumns, "GEOLOC",
          "MI_STYLE", RenditionType.mapbasic, null, RenditionType.none, CoordSys.longLatWGS84, 2);
    MapXtremeDataProviderRef mxtDPRef = 
   new MapXtremeDataProviderRef(oraDPHelper, m_MapxtremeURL);
    //加入MapJ
  FeatureLayer lyr = (FeatureLayer)map.getLayers().insertLayer(mxtDPRef, queryTDH, 0, "CustomerLayer");
   }
   catch(Exception e){
    e.printStackTrace();
   }
  }