动态执行x++代码
public void countRecords() { XppCompiler compiler; ExecutePermission perm; str sqlcmd; str name; str condition; str ret; ; name = StringEdit_TableName.text(); condition = StringEdit_Condition.text(); if(name == "") { StringEdit_Result.text("请输入表名!"); return; } sqlcmd = " str runsql(str parm) "; sqlcmd += " { "; sqlcmd += name; sqlcmd += " t; "; sqlcmd += " select count(recid) from t "; if(condition) { sqlcmd += " where " + condition; } sqlcmd += " ; "; sqlcmd += " return int642str(t.recid); "; sqlcmd += " }"; perm = new ExecutePermission(); if (perm == null) { return; } perm.assert(); compiler = new XppCompiler(); if (sqlcmd) { if (compiler.compile(sqlcmd)) { ret = compiler.execute(0); } else { ret = compiler.errorText(); } } CodeAccessPermission::revertAssert(); StringEdit_Result.text(ret); }