Sha256: 095f759184ca375d2f29e3a15230719fb191216daf4a2e862abfea112b4a3f40

Contents?: true

Size: 1.84 KB

Versions: 9

Compression:

Stored size: 1.84 KB

Contents

########    #######    ########    #######    ########    ########
##     / / / /    License    \ \ \ \ 
##    Copyleft culture, Copyright (C) is prohibited here
##    This work is licensed under a CC BY-SA 4.0
##    Creative Commons Attribution-ShareAlike 4.0 License
##    Refer to the http://creativecommons.org/licenses/by-sa/4.0/
########    #######    ########    #######    ########    ########
##    / / / /    Code Climate    \ \ \ \ 
##    Language = ruby
##    Indent = space;    4 chars;
########    #######    ########    #######    ########    ########
module ArchestryLookup
  module Sql
    class << self

  
      
      def preSql(state)
        state[:db] = {}

        case state[:dbtype]
        when :sqlite
          require 'sqlite3'
          db = state[:dbprop][:filepath]
          state[:db][:handler] = SQLite3::Database.new db
        when :pg
          require 'pg'
          state[:db][:handler] = PG.connect( dbname: state[:dbprop][:database])
        else
          state[:dbtype] = :sqlite
          require 'sqlite3'
          db = "/tmp/archestry.sqlite"
          state[:db][:handler] = SQLite3::Database.new db          
        end
          
        case state[:myAppName]
        when 'Dialog'
          state[:db][:relSQL] = "and relationships.class in ('AggregationRelationship', 'TriggeringRelationship', 'FlowRelationship', 'AccessRelationship', 'SpecializationRelationship', 'CompositionRelationship', 'ServingRelationship', 'RealizationRelationship')"
          state[:db][:elementsSQL] = "and (elements.class LIKE 'Application%' OR elements.class in ('DataObject', 'Grouping'))"
          state[:db][:propSQL] = "AND properties.name LIKE 'fqn'"
        when 'Archestry'
          state[:db][:relSQL] = " "
          state[:db][:elementsSQL] = ""
          state[:db][:propSQL] = ""
        end
        
      end
      
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
archestry_lookup-0.0.19 lib/sql/pre.rb
archestry_lookup-0.0.18 lib/sql/pre.rb
archestry_lookup-0.0.17 lib/sql/pre.rb
archestry_lookup-0.0.16 lib/sql/pre.rb
archestry_lookup-0.0.15 lib/sql/pre.rb
archestry_lookup-0.0.14 lib/sql/pre.rb
archestry_lookup-0.0.13 lib/sql/pre.rb
archestry_lookup-0.0.12 lib/sql/pre.rb
archestry_lookup-0.0.11 lib/sql/pre.rb