query.setDQL("SELECT r_object_id, object_name, title FROM dm_cabinet");
IDfCollection queryRsult = query.execute(session,DfQuery.READ_QUERY);
while (queryRsult.next())
{
// Spin through the attributes
for (int i = 0; i < queryRsult.getAttrCount(); i++)
{
IDfTypedObject typedObj = queryRsult.getTypedObject();
IDfAttr attr = queryRsult.getAttr(i);
System.out.println("Attribute Name: " + attr.getName()
+ "Attribute Value: " + typedObj.getString(attr.getName()));
}
}
queryRsult.close();
//get sql
IDfCollection coll;
String sqlResult = "";
coll = session.apply(null, "GET_LAST_SQL", null, null, null);
if(coll.next())
{
sqlResult = coll.getString("result");
}
coll.close();
System.out.println(sqlResult);
if (session != null)
{
sessionMgr.release(session);
}
} catch (DfException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
详细解决方案
运用dfc运行DQL并取得相应sql的代码
热度:60 发布时间:2016-05-05 15:16:10.0
相关解决方案