# -*- coding: utf-8 -*-
class Art15_XML_Exporter
  attr :glade
  attr :dbh

  # ACHTUNG: Die Datenbankverbindung ist anzupassen.
  def get_connection
    begin
      @dbh = DBI.connect("DBI:Pg:datenbankname:server.domain.toplevel", "user", 'parole')
      row = @dbh.select_one("SELECT VERSION()")
      puts "Server version: " + row[0]
    rescue DBI::DatabaseError => e
      puts "An error occurred"
      puts "Error code: #{e.err}"
      puts "Error message: #{e.errstr}"
    ensure
      ## disconnect from server
      #dbh.disconnect if @dbh
    end
    return @dbh
  end
end

class Art17_XML_Exporter
  attr :glade
  attr :dbh

  # ACHTUNG: Die Datenbankverbindung ist anzupassen.
  def get_connection
    begin
      @dbh = DBI.connect("DBI:Pg:datenbankname:server.domain.toplevel", "user", 'parole')
      row = @dbh.select_one("SELECT VERSION()")
      puts "Server version: " + row[0]
    rescue DBI::DatabaseError => e
      puts "An error occurred"
      puts "Error code: #{e.err}"
      puts "Error message: #{e.errstr}"
    ensure
      ## disconnect from server
      #dbh.disconnect if @dbh
    end
    return @dbh
  end
end
