def tblPubs
      sql = []
      @headers = %w{PubID PrefID PubType ShortName FullName Note LastUpdate ModifiedBy Publisher PlacePublished PubRegID Status StartYear EndYear BHL}

      # Hackish should build this elsewhere, but degrades OK
      pubs = @name_collection.ref_collection.collection.collect{|r| r.publication}.compact.uniq

      pubs.each_with_index do |p, i|
        cols = {
          PubID: i + 1,
          PrefID: 0,
          PubType: 1,
          ShortName: "unknown_#{i}", # Unique constraint
          FullName: p,
          Note: @empty_quotes,
          LastUpdate: @time, 
          ModifiedBy: @authorized_user_id,
          Publisher: @empty_quotes,
          PlacePublished: @empty_quotes,
          PubRegID: 0,
          Status: 0, 
          StartYear: 0, 
          EndYear: 0, 
          BHL: 0
        }
        @pub_collection.merge!(p => i + 1)
        sql << sql_insert_statement('tblPubs', cols) 
      end
      sql.join("\n")
    end
def tblPubs
      sql = []
      @headers = %w{PubID PrefID PubType ShortName FullName Note LastUpdate ModifiedBy Publisher PlacePublished PubRegID Status StartYear EndYear BHL}

      # Hackish should build this elsewhere, but degrades OK
      pubs = @name_collection.ref_collection.collection.collect{|r| r.publication}.compact.uniq

      pubs.each_with_index do |p, i|
        cols = {
          PubID: i + 1,
          PrefID: 0,
          PubType: 1,
          ShortName: "unknown_#{i}", # Unique constraint
          FullName: p,
          Note: @empty_quotes,
          LastUpdate: @time, 
          ModifiedBy: @authorized_user_id,
          Publisher: @empty_quotes,
          PlacePublished: @empty_quotes,
          PubRegID: 0,
          Status: 0, 
          StartYear: 0, 
          EndYear: 0, 
          BHL: 0
        }
        @pub_collection.merge!(p => i + 1)
        sql << sql_insert_statement('tblPubs', cols) 
      end
      sql.join("\n")
    end
Generate tblPubs SQL