| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 619 人关注过本帖
标题:谁能给翻译一下
只看楼主 加入收藏
hebei_lilei
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-4-21
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:2 
谁能给翻译一下
<cfif (NOT CompareNoCase(#opCode#,"GetProcedures"))>
    <cfquery name="ResultSet" datasource=#ConnectionString# username=#UserName# password=#Password#>
        SELECT sysobjects.name as PROCEDURE_NAME,sysusers.name as PROCEDURE_SCHEMA
        FROM sysobjects,sysusers
        WHERE sysobjects.uid=sysusers.uid AND sysobjects.type='P' ORDER BY PROCEDURE_NAME
    </cfquery>
</cfif>
<cfif (NOT CompareNoCase(#opCode#,"GetParametersOfProcedure"))>
    <cfif IsDefined("ProcName")>
        <cfquery name="ResultSet" datasource=#ConnectionString# username=#UserName# password=#Password#>
            SELECT syscolumns.name As 'PARAMETER_NAME', systypes.name As 'DATA_TYPE', syscolumns.isoutparam As 'PARAMETER_TYPE'
            FROM syscolumns, sysobjects, systypes
            WHERE syscolumns.id = sysobjects.id
            AND systypes.xtype = syscolumns.xtype
            AND sysobjects.XTYPE = 'P'
            AND sysobjects.name  = '#ProcName#'
            AND systypes.name in (select name from master.dbo.systypes) and systypes.name <> 'sysname'
            order by syscolumns.colid
        </cfquery>
    </cfif>
</cfif>
<cfif (NOT CompareNoCase(#opCode#,"ExecuteSP"))>
    <cfif IsDefined("ExecProcName")>
        <cfscript>
            dotIndex = Find("dbo.",#ExecProcName#);
            if (dotIndex GT 0)
            {
                #ExecProcName# = Mid(#ExecProcName#,dotIndex+4,Len(#ExecProcName#)-dotIndex);            
            }
        </cfscript>
        <cfquery name="ProcParams" datasource=#ConnectionString# username=#UserName# password=#Password#>
            SELECT syscolumns.name As 'PARAMETER_NAME', systypes.name As 'DATA_TYPE', syscolumns.isoutparam As 'PARAMETER_TYPE'
            FROM syscolumns, sysobjects, systypes
            WHERE syscolumns.id = sysobjects.id
            AND systypes.xtype = syscolumns.xtype
            AND sysobjects.XTYPE = 'P'
            AND sysobjects.name  = '#ExecProcName#'
            AND systypes.name in (select name from master.dbo.systypes) and systypes.name <> 'sysname'
            order by syscolumns.colid
        </cfquery>
        <cfscript>
            CallStatement = "{call ";
            CallStatement = CallStatement & #ExecProcName#;
            if (ProcParams.RecordCount GT 0)
            {
                CallStatement = CallStatement & "(";
                MM_columns = ListToArray(ProcParams.ColumnList,",");
                For (i=1; i LTE ProcParams.RecordCount ; i=i+1)
                {
                    paramdirection = ProcParams["PARAMETER_TYPE"][i];
                    paramtype       = ProcParams["DATA_TYPE"][i];
                    delimiter       = "";
                    defaultvalue   = 0;

                    switch (paramtype)
                    {
                        case "char":
                        case "nchar*":
                        case "varchar":
                        case "nvarchar*":
                        case "date":
                        case "datetime":
                        case "smalldatatime":
                        {
                            delimiter = "'";
                            defaultvalue = "";
                            break;
                        }
                        default:
                        {
                            delimiter = "";
                        }
                    }

                    if (paramdirection GT 0)
                    {
                        if(i GT 1)
                        {
                            CallStatement = CallStatement & ",";
                        }

                        CallStatement = CallStatement & delimiter & defaultvalue & delimiter;
                    }
                    else
                    {
                        if(i GT 1)
                        {
                            CallStatement = CallStatement & ",";
                        }

                        CallStatement = CallStatement & delimiter & ProcParams["PARAMETER_NAME"][i] & delimiter;
                    }
                }

                CallStatement = CallStatement & ")";
            }

            MM_params = ListToArray(#ExecProcParameters#,",");
            For (i=1; i LTE ArrayLen(MM_params); i=i+2)
            {
                MM_paramName =     MM_params[i];
                MM_paramValue = MM_params[i+1];
                if (MM_paramValue EQ "empty")
                {
                    MM_paramValue = "";
                }
                CallStatement = REReplaceNoCase(CallStatement,MM_paramName,MM_paramValue);
            }
            CallStatement = CallStatement & "}";
        </cfscript>
        <cfquery name="ResultSet" datasource=#ConnectionString# username=#UserName# password=#Password# MaxRows=#MaxRows#>
            #PreserveSingleQuotes(CallStatement)#
        </cfquery>
    </cfif>
</cfif>
搜索更多相关主题的帖子: 翻译 
2010-04-21 15:50
cnfarer
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:179
帖 子:3330
专家分:21157
注 册:2010-1-19
收藏
得分:3 
解释这种代码有意义吗?

★★★★★为人民服务★★★★★
2010-04-21 16:32
longxuanxuan
Rank: 2
来 自:河北省徐水县留村乡山东营村
等 级:论坛游民
帖 子:75
专家分:73
注 册:2010-3-10
收藏
得分:3 
这么厉害......................
2010-04-21 16:56
快速回复:谁能给翻译一下
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017709 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved