Advertisement
Guest User

Untitled

a guest
May 12th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 17.49 KB | None | 0 0
  1. require 'Item'
  2. require 'Armor'
  3. require 'Weapon'
  4. require 'Wallet'
  5. require 'mysql2'
  6.  
  7. $CONFIG['SQL_HOST'] = "photons.no-ip.org"
  8. $CONFIG['SQL_USER'] = "terras"
  9. $CONFIG['SQL_PASS'] = ""
  10. $CONFIG['SQL_DB'] = "terras"
  11.  
  12. class Player
  13.     attr_accessor :id
  14.     attr_accessor :owner_name
  15.     attr_accessor :player_name
  16.    
  17.     # Player header
  18.     attr_accessor :player_class
  19.     attr_accessor :player_race
  20.     attr_accessor :player_alignment
  21.     attr_accessor :player_god
  22.  
  23.     # Vital stats
  24.     attr_accessor :level
  25.     attr_accessor :max_hp
  26.     attr_accessor :current_hp
  27.  
  28.     # Player's physical attributes
  29.     attr_accessor :gender
  30.     attr_accessor :height
  31.     attr_accessor :weight
  32.     attr_accessor :eye_color
  33.     attr_accessor :hair
  34.     attr_accessor :body_type
  35.     attr_accessor :apparent_age
  36.     attr_accessor :actual_age
  37.     attr_accessor :max_age
  38.  
  39.     # Player experience
  40.     attr_accessor :earned_xp
  41.     attr_accessor :needed_xp
  42.     attr_accessor :story_points
  43.  
  44.     # Strength stats
  45.     attr_accessor :strength
  46.     attr_accessor :stamina
  47.     attr_accessor :muscle
  48.     attr_accessor :endurance
  49.     attr_accessor :power
  50.     attr_accessor :carry_weight
  51.     attr_accessor :damage
  52.     attr_accessor :hit
  53.     attr_accessor :max_exertion
  54.     attr_accessor :max_press
  55.     attr_accessor :resist_exertion
  56.     attr_accessor :resist_grapple
  57.  
  58.     # Dexterity stats
  59.     attr_accessor :dexterity
  60.     attr_accessor :accuracy
  61.     attr_accessor :balance
  62.     attr_accessor :aim
  63.     attr_accessor :evasion
  64.     attr_accessor :missile_hit_bonus
  65.     attr_accessor :defense_value
  66.     attr_accessor :bonus_attacks
  67.     attr_accessor :base_initiative
  68.     attr_accessor :resist_distraction
  69.     attr_accessor :chance_dodge
  70.  
  71.     # Constitution stats
  72.     attr_accessor :constitution
  73.     attr_accessor :health
  74.     attr_accessor :fitness
  75.     attr_accessor :shock
  76.     attr_accessor :survival
  77.     attr_accessor :regeneration_rate
  78.     attr_accessor :hit_point_modifier
  79.     attr_accessor :rest_adjust
  80.     attr_accessor :mph_modifier
  81.     attr_accessor :resist_disease
  82.     attr_accessor :resist_toxins
  83.  
  84.     # Intelligence stats
  85.     attr_accessor :intelligence
  86.     attr_accessor :reason
  87.     attr_accessor :knowledge
  88.     attr_accessor :learn
  89.     attr_accessor :recall
  90.     attr_accessor :max_spell_level
  91.     attr_accessor :bonus_skills
  92.     attr_accessor :base_mana
  93.     attr_accessor :ask_dm_any_question
  94.     attr_accessor :resist_trickery
  95.     attr_accessor :resist_spell
  96.  
  97.     # Wisdom stats
  98.     attr_accessor :wisdom
  99.     attr_accessor :intuition
  100.     attr_accessor :willpower
  101.     attr_accessor :perception
  102.     attr_accessor :force_of_will
  103.     attr_accessor :spirit_multiplier
  104.     attr_accessor :number_of_artifacts
  105.     attr_accessor :enlightenment
  106.     attr_accessor :artifact_bonus
  107.     attr_accessor :resist_surprise
  108.     attr_accessor :resist_psychic
  109.  
  110.     # Charisma stats
  111.     attr_accessor :charisma
  112.     attr_accessor :leadership
  113.     attr_accessor :appearance
  114.     attr_accessor :inspiration
  115.     attr_accessor :persuasion
  116.     attr_accessor :max_number_of_minions
  117.     attr_accessor :comeliness
  118.     attr_accessor :number_of_minions
  119.     attr_accessor :comely_scale
  120.     attr_accessor :resist_disloyalty
  121.     attr_accessor :resist_prejudice
  122.  
  123.     # Rogue skills
  124.     attr_accessor :pick_pockets
  125.     attr_accessor :open_locks
  126.     attr_accessor :make_locks
  127.     attr_accessor :find_traps
  128.     attr_accessor :move_silently
  129.     attr_accessor :hide_in_shadows
  130.     attr_accessor :climb_walls
  131.     attr_accessor :detect_noise
  132.     attr_accessor :detect_magic
  133.     attr_accessor :read_languages
  134.     attr_accessor :bribe
  135.     attr_accessor :slip_bonus
  136.     attr_accessor :backstab_multiplier
  137.  
  138.     # Contains a wallet object
  139.     attr_accessor :wallet
  140.  
  141.     # Inventory
  142.     attr_accessor :inventory
  143.     attr_accessor :owned_weapons
  144.     attr_accessor :owned_armor
  145.  
  146.     def initialize
  147.  
  148.     end
  149.  
  150.     def load_existing_player(player_id)
  151.  
  152.     end
  153.    
  154.     def create_new_player(character_name, character_class, character_race, owner_name)
  155.         # Set the main variables based on creation parameters.
  156.         @owner_name = owner_name
  157.         @player_name = character_name
  158.         @player_class = character_class
  159.         @player_race = character_race
  160.  
  161.         # Set the default vital stats.
  162.         @level = 1
  163.         @max_hp = get_max_hitpoints
  164.         @current_hp = @max_hp
  165.  
  166.         # Set the vanity variables to default values.
  167.         @player_alignment = "Neutral"
  168.         @player_god = "Agnostic"
  169.         @gender = "Unknown"
  170.         @height = "Unknown"
  171.         @weight = 180
  172.         @eye_color = "Unknown"
  173.         @hair = "Unknown"
  174.         @body_type = "Unknown"
  175.         @apparent_age = 20
  176.         @actual_age = 20
  177.         @max_age = 80
  178.  
  179.         # Set experience variables to default values.
  180.         @earned_xp = 0
  181.         @needed_xp = get_xp_needed_for_next_level
  182.         @story_points = 0
  183.  
  184.         # Roll the player's primary stats (ie: Strength, Dexterity, etc.).
  185.         roll_primary_stats
  186.  
  187.         # Calculates and sets the player's secondary stats.
  188.         set_secondary_stats
  189.  
  190.         # Calculates and sets the player's rogue skills.
  191.         set_rogue_skills
  192.  
  193.         # Creates the player's wallet.
  194.         @wallet = Wallet.new
  195.  
  196.         # Creates the player's inventory.
  197.         @inventory = []
  198.         @owned_armor = []
  199.         @owned_weapons = []
  200.     end
  201.  
  202.     # Returns the XP needed to level up.
  203.     def get_xp_needed_for_next_level
  204.         return 1800 # PLACEHOLDER
  205.     end
  206.  
  207.     # Calculate the maximum number of hitpoints.
  208.     def get_max_hitpoints
  209.         return 17 # PLACEHOLDER
  210.     end
  211.  
  212.     # Rolls and sets the player's primary stats.
  213.     def roll_primary_stats
  214.         @strength = 1 + rand(20)
  215.         @dexterity = 1 + rand(20)
  216.         @constitution = 1 + rand(20)
  217.         @intelligence = 1 + rand(20)
  218.         @wisdom = 1 + rand(20)
  219.         @charisma = 1 + rand(20)
  220.     end
  221.  
  222.     # Calculates and sets the player's secondary stats.
  223.     def set_secondary_stats
  224.         # Strength stats
  225.         @stamina = @strength
  226.         @muscle = @strength
  227.         @endurance = 0.35 # PLACEHOLDER
  228.         @power = 0.50 # PLACEHOLDER
  229.         @carry_weight = 235 # PLACEHOLDER
  230.         @damage = 5 # PLACEHOLDER
  231.         @hit = 2 # PLACEHOLDER
  232.         @max_exertion = 4.5 # PLACEHOLDER
  233.         @max_press = 640 # PLACEHOLDER
  234.         @resist_exertion = @strength # PLACEHOLDER
  235.         @resist_grapple = @strength # PLACEHOLDER
  236.  
  237.         # Dexterity stats
  238.         @accuracy = @dexterity
  239.         @balance = @dexterity
  240.         @aim = 0.35 # PLACEHOLDER
  241.         @evasion = 0.60 # PLACEHOLDER
  242.         @missile_hit_bonus = 1 # PLACEHOLDER
  243.         @defense_value = 2 # PLACEHOLDER
  244.         @bonus_attacks = 1.10 # PLACEHOLDER
  245.         @base_initiative = 12 # PLACEHOLDER
  246.         @resist_distraction = @dexterity # PLACEHOLDER
  247.         @chance_dodge = @dexterity # PLACEHOLDER
  248.  
  249.         # Constitution stats
  250.         @health = @constitution
  251.         @fitness = @constitution
  252.         @shock = 0.50 # PLACEHOLDER
  253.         @survival = 0.65 # PLACEHOLDER
  254.         @regeneration_rate = 4 # PLACEHOLDER
  255.         @hit_point_modifier = 3 # PLACEHOLDER
  256.         @rest_adjust = 0.85 # PLACEHOLDER
  257.         @mph_modifier = 3 # PLACEHOLDER
  258.         @resist_disease = @constituion # PLACEHOLDER
  259.         @resist_toxins = @constituion # PLACEHOLDER
  260.  
  261.         # Intelligence stats
  262.         @reason = @intelligence
  263.         @knowledge = @intelligence
  264.         @learn = 0.40 # PLACEHOLDER
  265.         @recall = 0.60 # PLACEHOLDER
  266.         @max_spell_level = 6 # PLACEHOLDER
  267.         @bonus_skills = 6 # PLACEHOLDER
  268.         @base_mana = 8 # PLACEHOLDER
  269.         @ask_dm_any_question = 1 # PLACEHOLDER
  270.         @resist_trickery = @intelligence # PLACEHOLDER
  271.         @resist_spell = @intelligence # PLACEHOLDER
  272.  
  273.         # Wisdom stats
  274.         @intuition = @wisdom
  275.         @willpower = @wisdom
  276.         @perception = 0.30 # PLACEHOLDER
  277.         @force_of_will = 0.40 # PLACEHOLDER
  278.         @spirit_multiplier = 3 # PLACEHOLDER
  279.         @number_of_artifacts = 5 # PLACEHOLDER
  280.         @enlightenment = "None" # PLACEHOLDER
  281.         @artifact_bonus = 1 # PLACEHOLDER
  282.         @resist_surprise = @wisdom # PLACEHOLDER
  283.         @resist_psychic = @wisdom # PLACEHOLDER
  284.  
  285.         # Charisma stats
  286.         @leadership = @charisma
  287.         @appearance = @charisma
  288.         @inspiration = 0.40 # PLACEHOLDER
  289.         @persuasion = 0.25 # PLACEHOLDER
  290.         @max_number_of_minions = 30 # PLACEHOLDER
  291.         @comeliness = "Fine" # PLACEHOLDER
  292.         @number_of_minions = 0 # PLACEHOLDER
  293.         @comely_scale = 0 # PLACEHOLDER
  294.         @resist_disloyalty = @charisma # PLACEHOLDER
  295.         @resist_prejudice = @charisma # PLACEHOLDER
  296.     end
  297.  
  298.     # Calculates and sets the player's rogue skills.
  299.     def set_rogue_skills
  300.         @pick_pockets = 0.20 # PLACEHOLDER
  301.         @open_locks = 0.10 # PLACEHOLDER
  302.         @make_locks = 0.10 # PLACEHOLDER
  303.         @find_traps = 0.15 # PLACEHOLDER
  304.         @move_silently = 0.20 # PLACEHOLDER
  305.         @hide_in_shadows = 0.10 # PLACEHOLDER
  306.         @climb_walls = 0.50 # PLACEHOLDER
  307.         @detect_noise = 0.25 # PLACEHOLDER
  308.         @detect_magic = 0.15 # PLACEHOLDER
  309.         @read_languages = 0.10 # PLACEHOLDER
  310.         @bribe = 0.10 # PLACEHOLDER
  311.         @slip_bonus = 0.10 # PLACEHOLDER
  312.         @backstab_multiplier = 2 # PLACEHOLDER
  313.     end
  314.  
  315.     # Saves the player's state to the SQL database.
  316.     def save_player_to_database
  317.         begin
  318.             # Connect to the MySQL database.
  319.             sql = Mysql2::Client.new(:host => $CONFIG['SQL_HOST'], :username => $CONFIG['SQL_USER'], :password => $CONFIG['SQL_PASS'], :database => $CONFIG['SQL_DB'])
  320.            
  321.             # Determine if the player already exists in the database.
  322.             query = "SELECT id FROM #{$CONFIG['SQL_DB']}.Players WHERE player_name = '#{@player_name}';"
  323.             result = sql.query(query)
  324.             if result.count == 0
  325.                 # Player isn't in the database yet.
  326.  
  327.                 # Save new player stats to database.
  328.                 begin
  329.                     query = "INSERT INTO #{$CONFIG['SQL_DB']}.Players ("\
  330.                                 "owner_name, player_name, player_class, player_race, "\
  331.                                 "player_alignment, player_god, level, max_hp, current_hp, "\
  332.                                 "gender, height, weight, eye_color, hair, body_type, apparent_age, "\
  333.                                 "actual_age, max_age, earned_xp, needed_xp, story_points, strength, "\
  334.                                 "stamina, muscle, endurance, power, carry_weight, damage, hit, max_exertion, "\
  335.                                 "max_press, resist_exertion, resist_grapple, dexterity, accuracy, balance, "\
  336.                                 "aim, evasion, missile_hit_bonus, defense_value, bonus_attacks, base_initiative, "\
  337.                                 "resist_distraction, chance_dodge, constitution, health, fitness, shock, survival, "\
  338.                                 "regeneration_rate, hit_point_modifier, rest_adjust, mph_modifier, resist_disease, "\
  339.                                 "resist_toxins, intelligence, reason, knowledge, learn, recall, max_spell_level, "\
  340.                                 "bonus_skills, base_mana, ask_dm_any_question, resist_trickery, resist_spell, "\
  341.                                 "wisdom, intuition, willpower, perception, force_of_will, spirit_multiplier, "\
  342.                                 "number_of_artifacts, enlightenment, artifact_bonus, resist_surprise, resist_psychic, "\
  343.                                 "charisma, leadership, appearance, inspiration, persuasion, max_number_of_minions, "\
  344.                                 "comeliness, number_of_minions, comely_scale, resist_disloyalty, resist_prejudice, "\
  345.                                 "pick_pockets, open_locks, make_locks, find_traps, move_silently, hide_in_shadows, "\
  346.                                 "climb_walls, detect_noise, detect_magic, read_languages, bribe, slip_bonus, "\
  347.                                 "backstab_multiplier) VALUES ('#{@owner_name}', '#{@player_name}', '#{@player_class}', "\
  348.                                 "'#{@player_race}', '#{@player_alignment}', '#{@player_god}', #{@level}, #{@max_hp}, "\
  349.                                 "#{@current_hp}, '#{@gender}', '#{@height}', #{@weight}, '#{@eye_color}', '#{@hair}', "\
  350.                                 "'#{@body_type}', #{@apparent_age}, #{@actual_age}, #{@max_age}, #{@earned_xp}, "\
  351.                                 "#{@needed_xp}, #{@story_points}, #{@strength}, #{@stamina}, #{@muscle}, #{@endurance}, "\
  352.                                 "#{@power}, #{@carry_weight}, #{@damage}, #{@hit}, #{@max_exertion}, #{@max_press}, "\
  353.                                 "#{@resist_exertion}, #{@resist_grapple}, #{@dexterity}, #{@accuracy}, #{@balance}, "\
  354.                                 "#{@aim}, #{@evasion}, #{@missile_hit_bonus}, #{@defense_value}, #{@bonus_attacks}, "\
  355.                                 "#{@base_initiative}, #{@resist_distraction}, #{@chance_dodge}, #{@constitution}, "\
  356.                                 "#{@health}, #{@fitness}, #{@shock}, #{@survival}, #{@regeneration_rate}, "\
  357.                                 "#{@hit_point_modifier}, #{@rest_adjust}, #{@mph_modifier}, #{@resist_disease}, "\
  358.                                 "#{@resist_toxins}, #{@intelligence}, #{@reason}, #{@knowledge}, #{@learn}, #{@recall}, "\
  359.                                 "#{@max_spell_level}, #{@bonus_skills}, #{@base_mana}, #{@ask_dm_any_question}, "\
  360.                                 "#{@resist_trickery}, #{@resist_spell}, #{@wisdom}, #{@intuition}, #{@willpower}, "\
  361.                                 "#{@perception}, #{@force_of_will}, #{@spirit_multiplier}, #{@number_of_artifacts}, "\
  362.                                 "#{@enlightenment}, #{@artifact_bonus}, #{@resist_surprise}, #{@resist_psychic}, "\
  363.                                 "#{@charisma}, #{@leadership}, #{@appearance}, #{@inspiration}, #{@persuasion}, "\
  364.                                 "#{@max_number_of_minions}, #{@comeliness}, #{@number_of_minions}, #{@comely_scale}, "\
  365.                                 "#{@resist_disloyalty}, #{@resist_prejudice}, #{@pick_pockets}, #{@open_locks}, "\
  366.                                 "#{@make_locks}, #{@find_traps}, #{@move_silently}, #{@hide_in_shadows}, #{@climb_walls}, "\
  367.                                 "#{@detect_noise}, #{@detect_magic}, #{@read_languages}, #{@bribe}, #{@slip_bonus}, "\
  368.                                 "#{@backstab_multiplier});"
  369.  
  370.                     sql.query(query)
  371.                     sql.query("COMMIT")
  372.  
  373.                     # Get the player's ID from the database.
  374.                     query = "SELECT id FROM #{$CONFIG['SQL_DB']}.Players WHERE player_name='#{@player_name}';"
  375.                     @id = sql.query(query).fetch_hash()['id']
  376.  
  377.                     # Create the player's Wallet.
  378.                     query = "INSERT INTO #{$CONFIG['SQL_DB']}.Wallets (player_id) VALUES (#{@id});"
  379.                     sql.query("COMMIT")
  380.                 rescue => e
  381.                     puts "Unable to write Player data to database!"
  382.                     raise e
  383.                 end
  384.             else
  385.                 # Player is already in the database.
  386.  
  387.                 # Get the player's ID from the database query result.
  388.                 @id = result.fetch_hash()['id']
  389.  
  390.                 # Update Players table with the current player's state.
  391.                 query = "UPDATE #{$CONFIG['SQL_DB']}.Players SET owner_name='#{@owner_name}', "\
  392.                             "player_name='#{@player_name}', player_class='#{@player_class}', "\
  393.                             "player_race='#{@player_race}', player_alignment='#{@player_alignment}', "\
  394.                             "player_god='#{@player_god}, level=#{@level}, max_hp=#{@max_hp}, "\
  395.                             "current_hp=#{@current_hp}, gender='#{@gender}', height='#{@height}', "\
  396.                             "weight=#{@weight}, eye_color='#{@eye_color}', hair='#{@hair}', "\
  397.                             "body_type='#{@body_type}', apparent_age=#{@apparent_age}, "\
  398.                             "actual_age=#{@actual_age}, max_age=#{@max_age}, earned_xp=#{@earned_xp}, "\
  399.                             "needed_xp=#{@needed_xp}, story_points=#{@story_points}, strength=#{@strength}, "\
  400.                             "stamina=#{@stamina}, muscle=#{@muscle}, endurance=#{@endurance}, power=#{@power}, "\
  401.                             "carry_weight=#{@carry_weight}, damage=#{@damage}, hit=#{@hit}, "\
  402.                             "max_exertion=#{@max_exertion}, max_press=#{@max_press}, "\
  403.                             "resist_exertion=#{@resist_exertion}, resist_grapple=#{@resist_grapple}, "\
  404.                             "dexterity=#{@dexterity}, accuracy=#{@accuracy}, balance=#{@balance}, "\
  405.                             "aim=#{@aim}, evasion=#{@evasion}, missile_hit_bonus=#{@missile_hit_bonus}, "\
  406.                             "defense_value=#{@defense_value}, bonus_attacks=#{@bonus_attacks}, "\
  407.                             "base_initiative=#{@base_initiative}, resist_distraction=#{@resist_distraction}, "\
  408.                             "chance_dodge=#{@chance_dodge}, constitution=#{@constitution}, health=#{@health}, "\
  409.                             "fitness=#{@fitness}, shock=#{@shock}, survival=#{@survival}, "\
  410.                             "regeneration_rate=#{@regeneration_rate}, hit_point_modifier=#{@hit_point_modifier}, "\
  411.                             "rest_adjust=#{@rest_adjust}, mph_modifier=#{@mph_modifier}, "\
  412.                             "resist_disease=#{@resist_disease}, resist_toxins=#{@resist_toxins}, "\
  413.                             "intelligence=#{@intelligence}, reason=#{@reason}, knowledge=#{@knowledge}, "\
  414.                             "learn=#{@learn}, recall=#{@recall}, max_spell_level=#{@max_spell_level}, "\
  415.                             "bonus_skills=#{@bonus_skills}, base_mana=#{@base_mana}, "\
  416.                             "ask_dm_any_question=#{@ask_dm_any_question}, resist_trickery=#{@resist_trickery}, "\
  417.                             "resist_spell=#{@resist_spell}, wisdom=#{@wisdom}, intuition=#{@intuition}, "\
  418.                             "willpower=#{@willpower}, perception=#{@perception}, force_of_will=#{@force_of_will}, "\
  419.                             "spirit_multiplier=#{@spirit_multiplier}, number_of_artifacts=#{@number_of_artifacts}, "\
  420.                             "enlightenment=#{@enlightenment}, artifact_bonus=#{@artifact_bonus}, "\
  421.                             "resist_surprise=#{@resist_surprise}, resist_psychic=#{@resist_psychic}, "\
  422.                             "charisma=#{@charisma}, leadership=#{@leadership}, appearance=#{@appearance}, "\
  423.                             "inspiration=#{@inspiration}, persuasion=#{@persuasion}, "\
  424.                             "max_number_of_minions=#{@max_number_of_minions}, comeliness=#{@comeliness}, "\
  425.                             "number_of_minions=#{@number_of_minions}, comely_scale=#{@comely_scale}, "\
  426.                             "resist_disloyalty=#{@resist_disloyalty}, resist_prejudice=#{@resist_prejudice}, "\
  427.                             "pick_pockets=#{@pick_pockets}, open_locks=#{@open_locks}, make_locks=#{@make_locks}, "\
  428.                             "find_traps=#{@find_traps}, move_silently=#{@move_silently}, "\
  429.                             "hide_in_shadows=#{@hide_in_shadows}, climb_walls=#{@climb_walls}, "\
  430.                             "detect_noise=#{@detect_noise}, detect_magic=#{@detect_magic}, "\
  431.                             "read_languages=#{@read_languages}, bribe=#{@bribe}, slip_bonus=#{@slip_bonus}, "\
  432.                             "backstab_multiplier=#{@backstab_multiplier} WHERE id=#{@id};"
  433.  
  434.                 sql.query(query)
  435.                 sql.query("COMMIT")
  436.  
  437.                 # Save the player's Wallet.
  438.                 query = "UPDATE #{$CONFIG['SQL_DB']}.Wallets SET copper=#{@wallet.copper}, silver=#{@wallet.silver}, "\
  439.                             "gold=#{@wallet.gold}, platinum=#{@wallet.platinum}, celestium=#{@wallet.celestium}, "\
  440.                             "gems=#{@wallet.gems}, bank=#{@wallet.bank}, credit=#{@wallet.credit} "\
  441.                             "WHERE player_id=#{@id};"
  442.  
  443.                 sql.query(query)
  444.                 sql.query("COMMIT")
  445.  
  446.                
  447.                 ###################################################
  448.                 ###################################################
  449.                 ###################################################
  450.                 # Save the player's owned armor.
  451.                 query = "SELECT * FROM #{$CONFIG['SQL_DB']}.Owned_Armor;"
  452.                 result = sql.query(query)
  453.  
  454.                 result.each do |row|
  455.                     @owned_armor.each do |armor|
  456.  
  457.                     end
  458.                 end
  459.                 ###################################################
  460.                 ###################################################
  461.                 ###################################################
  462.             end
  463.         rescue => e
  464.             raise e
  465.         ensure
  466.             sql.close if sql
  467.         end
  468.     end
  469. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement