📄 ora2c.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OracleClient;
using System.Data;
using log4net;
using log4net.Config;
using IDBO;
namespace MVC
{
public class ORA2C
{
private static readonly ILog iLog = LogManager.GetLogger(typeof(ORA2C));
static ORA2C()
{
XmlConfigurator.Configure(new System.IO.FileInfo("./log4j.xml"));
iLog.Debug(System.IO.Directory.GetCurrentDirectory());
}
public static int getvalue(int a)
{
string mConn = IConfiguration.getParameter("connectString");
IDBO.IDBO dbo = IDBO.IDBO.getIDBO(mConn);
try
{
dbo.openDatabase();
IPrameter[] pms = new IPrameter[2];
pms[0] = new IDBO.IPrameter("a", IDataType.Number, ParameterDirection.Input);
pms[0].Value = a;
pms[1] = new IDBO.IPrameter("result", IDataType.Number, ParameterDirection.ReturnValue);
dbo.executeFunction("TEST.getvalue", pms);
return (int)pms[1].Value;
}
catch (Exception e)
{
iLog.Error(e.Message.ToString());
throw e;
}
finally
{
dbo.closeDatabase();
}
}
public static DataSet getcursor(int a)
{
string mConn = IConfiguration.getParameter("connectString");
IDBO.IDBO dbo = IDBO.IDBO.getIDBO(mConn);
try
{
dbo.openDatabase();
IPrameter[] pms = new IPrameter[2];
pms[0] = new IDBO.IPrameter("a", IDataType.Number, ParameterDirection.Input);
pms[0].Value = a;
pms[1] = new IDBO.IPrameter("cur_rt", IDataType.Cursor, ParameterDirection.Output);
DataSet ds = dbo.executeProcedure("TEST.getcursor", pms);
return ds;
}
catch (Exception e)
{
iLog.Error(e);
throw e;
}
finally
{
dbo.closeDatabase();
}
}
public static string GETC4METHOD_BYNAME(string V_NAME,string V_PKGNAME)
{
string mConn = IConfiguration.getParameter("connectString");
IDBO.IDBO dbo = IDBO.IDBO.getIDBO(mConn);
try
{
dbo.openDatabase();
IPrameter[] pms=new IPrameter[3];
pms[0] = new IDBO.IPrameter("V_NAME", IDataType.VarChar,ParameterDirection.Input);
pms[0].Value=V_NAME;
pms[1] = new IDBO.IPrameter();
pms[1].Name="V_PKGNAME";
pms[1].DataType=IDataType.VarChar;
pms[1].Direction=System.Data.ParameterDirection.Input;
pms[1].Value=V_PKGNAME;
pms[2] = new IDBO.IPrameter();
pms[2].Name="result";
pms[2].DataType=IDataType.VarChar;
pms[2].Direction=System.Data.ParameterDirection.ReturnValue;
pms[2].Size=10240;
dbo.executeFunction("ORA2C.GETC#METHOD_BYNAME", pms);
return (string)pms[2].Value;
}
catch (Exception e)
{
iLog.Error(e.Message.ToString());
throw e;
}
finally
{
dbo.closeDatabase();
}
}
public static DataSet ExecuteSql(string v_sql)
{
string mConn = IConfiguration.getParameter("connectString");
IDBO.IDBO dbo = IDBO.IDBO.getIDBO(mConn);
try
{
dbo.openDatabase();
return dbo.executeSelectSql(v_sql);
}
catch (Exception e)
{
iLog.Error(e.Message.ToString());
throw e;
}
finally
{
dbo.closeDatabase();
}
}
public static string get_method_declare(string v_pkgname, string v_method_name, int v_overload)
{
string mConn = IConfiguration.getParameter("connectString");
IDBO.IDBO dbo = IDBO.IDBO.getIDBO(mConn);
try
{
dbo.openDatabase();
IPrameter[] pms = new IPrameter[4];
pms[0] = new IDBO.IPrameter();
pms[0].Name = "v_pkgname";
pms[0].DataType = IDataType.VarChar;
pms[0].Direction = System.Data.ParameterDirection.Input;
pms[0].Value = v_pkgname;
pms[1] = new IDBO.IPrameter();
pms[1].Name = "v_method_name";
pms[1].DataType = IDataType.VarChar;
pms[1].Direction = System.Data.ParameterDirection.Input;
pms[1].Value = v_method_name;
pms[2] = new IDBO.IPrameter();
pms[2].Name = "v_overload";
pms[2].DataType = IDataType.Number;
pms[2].Direction = System.Data.ParameterDirection.Input;
pms[2].Value = v_overload;
pms[3] = new IDBO.IPrameter();
pms[3].Name = "result";
pms[3].DataType = IDataType.VarChar;
pms[3].Direction = System.Data.ParameterDirection.ReturnValue;
pms[3].Size = 4096;
dbo.executeFunction("ORA2C.get_method_declare", pms);
return (string)pms[3].Value;
}
catch (Exception e)
{
iLog.Error(e.Message.ToString());
throw e;
}
finally
{
dbo.closeDatabase();
}
}
public static string getc4method_byname(string v_name,string v_pkgname, ref string v_rt1, ref string v_rt2, ref string v_rt3)
{
string mConn = IConfiguration.getParameter("connectString");
IDBO.IDBO dbo = IDBO.IDBO.getIDBO(mConn);
try
{
dbo.openDatabase();
IPrameter[] pms=new IPrameter[6];
pms[0] = new IPrameter("v_name",IDataType.VarChar,ParameterDirection.Input);
pms[0].Value=v_name;
pms[1] = new IPrameter("v_pkgname",IDataType.VarChar,ParameterDirection.Input);
pms[1].Value=v_pkgname;
pms[2] = new IPrameter("v_rt1",IDataType.VarChar,ParameterDirection.Output);
pms[2].Size=10240;
pms[3] = new IPrameter("v_rt2",IDataType.VarChar,ParameterDirection.Output);
pms[3].Size=10240;
pms[4] = new IPrameter("v_rt3",IDataType.VarChar,ParameterDirection.Output);
pms[4].Size=10240;
pms[5] = new IPrameter("result",IDataType.VarChar,ParameterDirection.ReturnValue);
pms[5].Size=1024;
dbo.executeFunction("ORA2C.getc4method_byname", pms);
v_rt1= pms[2].Value.ToString();
v_rt2= pms[3].Value.ToString();
v_rt3= pms[4].Value.ToString();
return (string)pms[5].Value;
}
catch (Exception e)
{
iLog.Error(e.Message.ToString());
throw e;
}
finally
{
dbo.closeDatabase();
}
}
public static DataSet getMethod(string v_pkgName)
{
string mConn = IConfiguration.getParameter("connectString");
IDBO.IDBO dbo = IDBO.IDBO.getIDBO(mConn);
try
{
dbo.openDatabase();
IPrameter[] pms = new IPrameter[2];
pms[0] = new IDBO.IPrameter();
pms[0].Name = "v_pkgName";
pms[0].DataType = IDataType.VarChar;
pms[0].Direction = System.Data.ParameterDirection.Input;
pms[0].Value = v_pkgName;
pms[1] = new IDBO.IPrameter();
pms[1].Name = "cur_rt";
pms[1].DataType = IDataType.Cursor;
pms[1].Direction = System.Data.ParameterDirection.Output;
DataSet ds = dbo.executeProcedure("ORA2C.getMethod", pms);
return ds;
}
catch (Exception e)
{
iLog.Error(e.Message.ToString());
throw e;
}
finally
{
dbo.closeDatabase();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -