rxcms-dbms_plugin 0.3.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a5c7b2e40fce8215804e11922e889f6bc1c8ac8
4
- data.tar.gz: 90ff1466b76e644a54ce462f99ff33545feff513
3
+ metadata.gz: dbabedea576f72195e76c547edb12f7c194c0328
4
+ data.tar.gz: 16086598ff3c6fb482ea0e00bd3e96c8411ecf7a
5
5
  SHA512:
6
- metadata.gz: 62b5dc9acedd100a71c041c9b2ce62eadaa69f6d278ab81145e767492ed3b4fa6e82ee0753f55f90b0c67e083302b4f17e8aa9f6f002214bac517a8e68221f3d
7
- data.tar.gz: bbc9af329dbc6aff233b4ab81f692d543fd5a9aa4e76b629a4eb8999267c20603c2bde1440224c1d3e87ab1ee550f4c884b02de28d822fc758b7a4d536df9b87
6
+ metadata.gz: 6ceed5163a57f11c3e7fb5db9eda654e6b5f2a9037ac066087b50694e98a0fc6cc0dc5a830739e34386c9bec86e25992f29e0c8d60e166e734a8bcae2165c3b5
7
+ data.tar.gz: e44001f960e722807798476136b2331b4d608326e1583aed12df99652c776aa259361bfa29c53d5ed3242bec5c0ea2357b4c03291073124ea621a8aa872bf7bc
@@ -200,6 +200,10 @@ class DbmsConnectionController < ApplicationController
200
200
  # raise "key is duplicated"
201
201
  # end
202
202
 
203
+ if (!Metadata.first({ :conditions => ['key = ?', params[:key]]}).nil?)
204
+ raise "key is duplicated"
205
+ end
206
+
203
207
  # Check for value duplications
204
208
  storedQueryValues = Metadata.all(:conditions => ["cat = ? and sites_id = ?", APP_CONFIG[:DBMS_CAT_STORED_QUERY], session[:accessible_appid]])
205
209
  storedQueryValues.each do |t|
@@ -2,6 +2,7 @@ module DbmsEngineHelper
2
2
 
3
3
  def persist_connection
4
4
  SymmetricEncryption.load!
5
+ dbms_config = HashWithIndifferentAccess.new(YAML.load(File.read(File.expand_path('../../../config/dbms/dbms_config.yml', __FILE__))))
5
6
 
6
7
  if (ActiveRecord::Base.connection == Database.connection)
7
8
  adapter = !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_ADAPTER], session[:accessible_appid]] }).nil? ? Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_ADAPTER], session[:accessible_appid]] }).value : nil
@@ -13,18 +13,18 @@ module RxcmsDbmsPlugin
13
13
  if attrs['configs']['type'] == 'stored-query'
14
14
 
15
15
  if (ActiveRecord::Base.connection == Database.connection)
16
- if (!Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_HOST], ext[:appid]] }).nil? &&
17
- !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_PORT], ext[:appid]] }).nil? &&
18
- !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_DATABASE], ext[:appid]] }).nil? &&
19
- !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_USER], ext[:appid]] }).nil? &&
20
- !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_PASSWORD], ext[:appid]] }).nil?)
21
-
22
- connectionResult = Database.connect_sql(Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_ADAPTER], ext[:appid]] }).value,
23
- Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_HOST], ext[:appid]] }).value,
24
- Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_PORT], ext[:appid]] }).value,
25
- Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_USER], ext[:appid]] }).value,
26
- Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_PASSWORD], ext[:appid]] }).value,
27
- Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_DATABASE], ext[:appid]] }).value)
16
+ if (!Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_HOST], exts[:appid]] }).nil? &&
17
+ !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_PORT], exts[:appid]] }).nil? &&
18
+ !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_DATABASE], exts[:appid]] }).nil? &&
19
+ !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_USER], exts[:appid]] }).nil? &&
20
+ !Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_PASSWORD], exts[:appid]] }).nil?)
21
+
22
+ connectionResult = Database.connect_sql(Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_ADAPTER], exts[:appid]] }).value,
23
+ Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_HOST], exts[:appid]] }).value,
24
+ Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_PORT], exts[:appid]] }).value,
25
+ Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_USER], exts[:appid]] }).value,
26
+ Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_PASSWORD], exts[:appid]] }).value,
27
+ Metadata.first({ :conditions => ['key = ? and sites_id = ?', dbms_config[:DBMS_CURRENT_DATABASE], exts[:appid]] }).value)
28
28
  if (!connectionResult)
29
29
  return "{{[alliance_dbms - #{placeholder.key}] Unable to establish connection to database}}"
30
30
  end
@@ -34,8 +34,8 @@ module RxcmsDbmsPlugin
34
34
  end
35
35
 
36
36
  if attrs['configs'].has_key?('data')
37
- tQueryItem = Metadata.all({ :conditions => ['key = ? and sites_id = ?', attrs['configs']['data'], ext[:appid]] })
38
- languageSwitchable = Metadata.first({ :conditions => ['key = ? and sites_id = ?', 'autoLanguageSwitch'. ext[:appid]] })
37
+ tQueryItem = Metadata.all({ :conditions => ['key = ? and sites_id = ?', attrs['configs']['data'], exts[:appid]] })
38
+ languageSwitchable = Metadata.first({ :conditions => ['key = ? and sites_id = ?', 'autoLanguageSwitch', exts[:appid]] })
39
39
  queryItem = nil
40
40
 
41
41
  tQueryItem.each do |query|
@@ -1,3 +1,3 @@
1
1
  module RxcmsDbmsPlugin
2
- VERSION = "0.3.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rxcms-dbms_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anh Nguyen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-21 00:00:00.000000000 Z
12
+ date: 2013-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails