query_exec 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/query_exec.rb +19 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTNiNmM3ZDhlODhkYmU5MjI3NWM1NjhiM2IxNjY4NTA2ZjhlMjA3OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWFjNjYyMjJlZjVjNTQ4Y2YwNzA5NjRjMzMzZmEyMzJhYjJhMTNmOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmFkMTM4Nzc5YjQxNWU2MjBmMmVkMGQ2MDVlZWY3MmIwZDY2NjlhZmU3ZTU5
|
10
|
+
Nzk0N2U2YTZlYzc1Zjk5ZTNjYjg0Njk3YzBhNzRiYzI3YmFmMjNmY2M2Njcz
|
11
|
+
NjcwNjMxYmJhZGQ5NTBjMDBkYTEzNzgzZDcyMGNlMDZlYTg2NWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjNmNjExNDZmNmExYTRiYWQ1MzdmNGY5MmFjMWJmY2E0MWVmZWE3NWU5YmMy
|
14
|
+
ZTQ5ZmM1Zjg2NzFjZTJjM2E3NmE5MGU5OWNjZDk0NjI4OGE2YTFlNTYzZDJm
|
15
|
+
ZjFiNTQxOTdiMWFjOWMzYmFhOTAyZTE0YWQ1ZTc0NjQ5ZTAzMmI=
|
data/lib/query_exec.rb
CHANGED
@@ -3,14 +3,28 @@ module QueryExec
|
|
3
3
|
environment= Rails.env
|
4
4
|
output =[]
|
5
5
|
connection=ActiveRecord::Base.connection#(environment.to_sym)
|
6
|
-
|
7
|
-
|
6
|
+
if query.split().first == "select"
|
7
|
+
begin
|
8
|
+
result=connection.exec_query(query)
|
9
|
+
rescue
|
10
|
+
message="Invalid Query!!"
|
11
|
+
end
|
12
|
+
else
|
13
|
+
begin
|
14
|
+
result=connection.execute(query)
|
15
|
+
message="Executed!"
|
16
|
+
rescue
|
17
|
+
message="Invalid Query!!"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if result
|
8
21
|
result.each do |r|
|
22
|
+
raise r.inspect
|
9
23
|
output << r
|
10
24
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
25
|
+
return result
|
26
|
+
else
|
27
|
+
raise message.inspect
|
14
28
|
end
|
15
29
|
end
|
16
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: query_exec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- M.Viji Kumar
|
@@ -11,7 +11,8 @@ cert_chain: []
|
|
11
11
|
date: 2014-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem is used to execute SQL queries in our rails application. Sample
|
14
|
-
syntax result=QueryExec.run('select * from users')
|
14
|
+
syntax result=QueryExec.run('select * from users'). Using this we can execute all
|
15
|
+
the commands like select,update,create,delete.,etc
|
15
16
|
email: vijikumar1955@gmail.com
|
16
17
|
executables: []
|
17
18
|
extensions: []
|