Ejemplo n.º 1
0
        /// <summary>
        /// 設定ファイル(db.conf)からdbInfoを生成する。
        /// </summary>
        /// <param name="pConfFilePath">設定ファイルパス</param>
        /// <param name="pKindOfDB">KindOfDB</param>
        /// <returns>clsDBInfo</returns>
        public static clsDBInfo xLoadConf(string pConfFilePath, string pKindOfDB)
        {
            clsDBInfo me = new clsDBInfo();

            me._LoadConfFile(pConfFilePath, pKindOfDB);

            return(me);
        }
Ejemplo n.º 2
0
        //####################################################################
        //
        // function
        //
        //####################################################################

        /// <summary>
        /// herokuのローカルDB情報dbInfoを生成する。
        /// </summary>
        /// <param name="pConfFilePath">設定ファイルパス</param>
        /// <param name="pKindOfDB">KindOfDB</param>
        /// <returns>clsDBInfo</returns>
        public static clsDBInfo xGetHerokuDBInfo()
        {
            clsDBInfo me = new clsDBInfo();

            me._GetHerokuDBInfo();

            return(me);
        }
 internal clsPostgreSQL(clsDBInfo pDBInfo)
 {
     myDBInfo_ = pDBInfo;
 }
Ejemplo n.º 4
0
 public clsDB(clsDBInfo pDBInfo)
 {
     myDBInfo_ = pDBInfo;
     _Initialize();
 }
        //####################################################################
        //
        // function
        //
        //####################################################################

        /// <summary>
        /// DB種別を指定し、該当するclsDBInfoを返す。
        /// 該当するclsDBInfoが存在しない場合は、設定ファイルより作成したうえで返す。
        /// </summary>
        /// <param name="pKindOfDB">DB種別</param>
        /// <returns>clsDBInfo</returns>
        public clsDBInfo xGetDBInfo(string pKindOfDB)
        {
            clsDBInfo dbInfo = null;
            DataTable dt     = xGetInstance().myTBLInfo_;

            DataRow[] rows = null;
            DataRow   row  = null;

            lock (xGetInstance().myTBLInfo_)
            {
                string key = clsSystemInfo.xDomain + "_" + pKindOfDB;
                rows = dt.Select("Key=" + "'" + key + "'");
                if (rows.Length > 0)
                {
                    dbInfo = new clsDBInfo(
                        rows[0]["DBMS"].ToString(),
                        rows[0]["DBServer"].ToString(),
                        rows[0]["DBPort"].ToString(),
                        rows[0]["DBName"].ToString(),
                        rows[0]["DBUserID"].ToString(),
                        rows[0]["DBPassword"].ToString(),
                        rows[0]["DBSslMode"].ToString(),
                        Convert.ToBoolean(rows[0]["DBReadOnly"]));
                }
                else
                {
                    string DBMS       = "";
                    string DBServer   = "";
                    string DBPort     = "";
                    string DBName     = "";
                    string DBUserID   = "";
                    string DBPassword = "";
                    string DBSslMode  = "";
                    string DBReadOnly = "";

                    DBMS = xGetInstance().myDBConf_.GetSection(key)["DBMS"];
                    if (DBMS == null)
                    {
                        DBMS = "";
                    }
                    DBServer = xGetInstance().myDBConf_.GetSection(key)["DBServer"];
                    if (DBServer == null)
                    {
                        DBServer = "";
                    }
                    DBPort = xGetInstance().myDBConf_.GetSection(key)["DBPort"];
                    if (DBPort == null)
                    {
                        DBPort = "";
                    }
                    DBName = xGetInstance().myDBConf_.GetSection(key)["DBName"];
                    if (DBName == null)
                    {
                        DBName = "";
                    }
                    DBUserID = xGetInstance().myDBConf_.GetSection(key)["DBUserID"];
                    if (DBUserID == null)
                    {
                        DBUserID = "";
                    }
                    DBPassword = xGetInstance().myDBConf_.GetSection(key)["DBPassword"];
                    if (DBPassword == null)
                    {
                        DBPassword = "";
                    }
                    DBSslMode = xGetInstance().myDBConf_.GetSection(key)["DBSslMode"];
                    if (DBSslMode == null)
                    {
                        DBSslMode = "false";
                    }
                    DBReadOnly = xGetInstance().myDBConf_.GetSection(key)["DBReadOnly"];
                    if (DBReadOnly == null)
                    {
                        DBReadOnly = "false";
                    }

                    row               = dt.NewRow();
                    row["Key"]        = key;
                    row["DBMS"]       = DBMS;
                    row["DBServer"]   = DBServer;
                    row["DBPort"]     = DBPort;
                    row["DBName"]     = DBName;
                    row["DBUserID"]   = DBUserID;
                    row["DBPassword"] = DBPassword;
                    row["DBSslMode"]  = DBSslMode;
                    row["DBReadOnly"] = DBReadOnly;
                    dt.Rows.Add(row);

                    dbInfo             = new clsDBInfo();
                    dbInfo.xDBMS       = DBMS;
                    dbInfo.xDBServer   = DBServer;
                    dbInfo.xDBPort     = DBPort;
                    dbInfo.xDBName     = DBName;
                    dbInfo.xDBUserID   = DBUserID;
                    dbInfo.xDBPassword = DBPassword;
                    dbInfo.xDBSslMode  = DBSslMode;
                    dbInfo.xDBReadOnly = Convert.ToBoolean(DBReadOnly);
                }
            }

            rows = null;

            return(dbInfo);
        }
 internal clsSQLServer(clsDBInfo pDBInfo)
 {
     myDBInfo_ = pDBInfo;
 }