⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbsetupcheck.cs

📁 oracle dal gen,生成.NET ORACLE DAL层代码
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Oracle.DataAccess.Client;
using System.Resources;

namespace OracleDALGen.Classes.Database
{
    public class DBSetup
    {
        private const string selectPkgGen = "select * from user_objects where object_name = 'PKG_GEN'";
        private const string selectTableInfo = "select * from table_info where 1=2";
        private const string procPkgGenVersion = "pkg_gen.get_version";

        private OraConnection connection;

        public DBSetup(OraConnection connection)
        {
            this.connection = connection;
        }

        public string CheckPLGenPackage()  
        {
            DataSet ds = DBUtils.LoadSQL(selectPkgGen, null, connection);

            if (ds != null && ds.Tables["data"].Rows.Count == 2)
            {
                List<OracleParameter> op = new List<OracleParameter>();
                op.Add(new OracleParameter("ver", OracleDbType.Clob, ParameterDirection.ReturnValue));

                string version = (string)DBUtils.ExecuteNonQuery(procPkgGenVersion, op, connection, CommandType.StoredProcedure, OracleDbType.Clob);
                return string.Format("pkg_gen version {0} installed", version);
            } 
            else
                return "pkg_gen not installed";
        }

        public string CheckTableInfoView()
        {
            DataSet ds = null;
            try
            {
                ds = DBUtils.LoadSQL(selectTableInfo, null, connection);
            } catch {}


            if (ds != null)
                return "table_info view installed";
            else
                return "table_info view not installed";
        }

        public bool InstallPLGenPackage()
        {            
            bool result = false;

            result &= DBUtils.Execute(SQLResource.table_info, null, CommandType.Text, connection);
            result &= DBUtils.Execute(SQLResource.pkg_gen_header, null, CommandType.Text, connection);
            result &= DBUtils.Execute(SQLResource.pkg_gen_body, null, CommandType.Text, connection);

            return result;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -