-1
가장 간단한 시나리오를 작성했다고 생각합니다. 난 그냥 모든 사람들이 정신 건강 검사를 받기를 원합니다.ColdFusion과 Railo 모두에서 저장된 proc을 실행하는 일반적인 방법
<cfscript>
response = new ErrorCodes().WhereXXX(); // ACF or Railo, doesn't matter
</cfscript>
ErrorCodes.cfc :
function WhereXXX() {
return new sproc().exec('app.GetErrorCodes'); // All my functions will do this instead of executing the sproc themselves.
}
sproc.cfc :
component {
function exec(procedure) {
local.result = {};
if (server.ColdFusion.productname == 'Railo') {
return new Railo().exec(arguments.procedure); // Has to be outside of sproc.cfc because ColdFusion throws a syntax error otherwise.
}
local.svc = new storedProc();
local.svc.setProcedure(arguments.procedure);
local.svc.addProcResult(name='qry');
try {
local.obj = local.svc.execute();
local.result.Prefix = local.obj.getPrefix();
local.result.qry = local.obj.getProcResultSets().qry;
} catch(any Exception) {
request.msg = Exception.Detail;
}
return local.result;
}
Railo.cfc :
GetErrorCodes.cfm는 다음을 수행 : 여기에 아이디어
component {
function exec(procedure) {
local.result = {};
try {
storedproc procedure=arguments.procedure result="local.result.Prefix" returncode="yes" {
procresult name="local.result.qry";
}
} catch(any Exception) {
request.msg = Exception.Message;
}
return local.result;
}
}
저는 하루 종일 작업 해 왔지만, ColdFusion 서버 나 Railo 서버에서 실행되는 경우 소스 코드를 동일하게 유지하는 것이 합당한 방법이라고 말해주십시오.
오. 나는 내 머리가 cfscript까지 올라간다는 것을 되돌아 볼 수 없다고 생각합니다 ... 음 ... 어? 나는 그것을 조사해야 할 것이다. 감사! –
아마도 설치 과정의 일부로 sproc.cfc를 ACF 버전이나 Railo 버전으로 사용할 수 있으며 함수가 호출 될 때마다 if/then을 수행 할 필요가 없습니다. –
당신이 옳다고 생각합니다. 놀랍지도 않습니다. 필자는 스크립트 된 구성 요소 대신 태그를 사용하는 방법으로 되돌아 가야합니다. 적어도 저장 프로 시저의 경우. –