lib/arxutils_sqlite3/dbutil/dbconnect.rb in arxutils_sqlite3-0.1.61 vs lib/arxutils_sqlite3/dbutil/dbconnect.rb in arxutils_sqlite3-0.1.63

- old
+ new

@@ -1,20 +1,20 @@ #! -*- encoding : UTF-8 -*- # frozen_string_literal: true -require 'fileutils' -require 'yaml' -require 'active_record' -require 'sqlite3' -require 'ykxutils' +require "fileutils" +require "yaml" +require "active_record" +require "sqlite3" +require "ykxutils" module Arxutils_Sqlite3 module Dbutil # DB操作用ユーティリティクラス class Dbconnect def self.make_log_file_name(dbconfig, log_file_base_name) - format('%s-%s', dbconfig.to_s, log_file_base_name) + format("%s-%s", dbconfig.to_s, log_file_base_name) end def self.db_connect(config, dbconfig, env) # DB構成ファイルへのパス dbconfig_path = config.setup_for_dbconfig_path(dbconfig) @@ -42,12 +42,14 @@ # DB接続、DB用ログファイルの設定 def connect unless @connect_time begin # p "@dbconfig_dest_path=#{@dbconfig_dest_path}" - dbconfig = Ykxutils.yaml_load_file_compati(@dbconfig_dest_path) + dbconfig, _value = Ykxutils.yaml_load_file_compati(@dbconfig_dest_path) # p "dbconfig=#{dbconfig}" # p "@env=#{@env}" + # x = dbconfig[@env] + # p x ActiveRecord::Base.establish_connection(dbconfig[@env]) ActiveRecord::Base.logger = Logger.new(@log_path) @connect_time = DateTime.now.new_offset rescue StandardError => e p e.message