private static void LogQueryName([NotNull] IQueryName2 queryName) { IQueryDef queryDef = queryName.QueryDef; _msg.DebugFormat("query table name: {0}", ((IDatasetName)queryName).Name); _msg.DebugFormat("copy locally: {0}", queryName.CopyLocally); _msg.DebugFormat("primary key: [{0}]", queryName.PrimaryKey); _msg.DebugFormat("query:"); _msg.DebugFormat("SELECT {0} FROM {1} WHERE {2}", queryDef.SubFields, queryDef.Tables, queryDef.WhereClause); }
/// <summary> /// 创建查询表 /// </summary> /// <param name="queryDef"></param> /// <param name="str_pk"></param> /// <param name="workspaceName"></param> /// <param name="tableName"></param> /// <returns></returns> private ITable CreateQueryTable(IQueryDef queryDef, string str_pk, IWorkspaceName workspaceName, string tableName) { IQueryName2 queryName2 = (IQueryName2) new TableQueryNameClass(); queryName2.QueryDef = queryDef; //queryName2.PrimaryKey = "streets.StreetID"; queryName2.PrimaryKey = str_pk; queryName2.CopyLocally = true; // Set the workspace and name of the new QueryTable. IDatasetName datasetName = (IDatasetName)queryName2; datasetName.WorkspaceName = workspaceName; datasetName.Name = tableName; // Open the virtual table. IName name = (IName)queryName2; ITable table = (ITable)name.Open(); return(table); }