fluiddb 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
data/lib/FluidDb/Pgsql.rb CHANGED
@@ -18,7 +18,7 @@ module FluidDb
18
18
  hash["user"] = uri.user unless uri.user.nil?
19
19
  hash["password"] = uri.password unless uri.password.nil?
20
20
 
21
- @connection = PG.connect( dbname:uri.path.sub( "/", "" ) )
21
+ @connection = PG.connect( hash )
22
22
  end
23
23
 
24
24
  def close
@@ -1,5 +1,6 @@
1
1
  require "FluidDb"
2
2
  require "tiny_tds"
3
+ require "cgi"
3
4
 
4
5
  module FluidDb
5
6
 
@@ -20,17 +21,23 @@ module FluidDb
20
21
  if dataserver == "" ||
21
22
  database == "" then
22
23
  raise "*** You need to specify both a dataserver and a database for the tinytds driver. Expected format: tinytds://<user>:<pass>@<dataserver>/<database>\n" +
23
- "*** The specified dataserver should have an entry in /etc/freetds/freetds.conf"
24
+ "*** The specified dataserver should have an entry in /etc/freetds/freetds.conf"
24
25
  end
25
-
26
+
26
27
  if username == "" ||
27
28
  password == "" then
28
29
  puts "*** Warning - you will normally need to specify both a username and password for the tinytds driver to work correctly."
29
30
  end
30
31
 
31
- @connection = ::TinyTds::Client.new( :username => username, :password => password, :database => database, :dataserver => dataserver )
32
- end
32
+ hash = Hash["username", username, "password", password, "database", database, "dataserver", dataserver]
33
+ if !uri.query.nil? then
34
+ cgi = CGI.parse( uri.query )
35
+ hash["timeout"] = cgi["timeout"][0] if cgi.has_key?( "timeout" )
36
+ end
33
37
 
38
+ @connection = ::TinyTds::Client.new( hash )
39
+ end
40
+
34
41
  def close
35
42
  @connection.close
36
43
  end
@@ -38,7 +45,7 @@ module FluidDb
38
45
  def queryForArray( sql, params )
39
46
  sql = self.format_to_sql( sql, params )
40
47
  results = @connection.execute(sql)
41
-
48
+
42
49
  count = 0
43
50
  tuple = ""
44
51
  results.each do |row|
@@ -80,7 +87,7 @@ module FluidDb
80
87
  results.each do |row|
81
88
  list << row
82
89
  end
83
-
90
+
84
91
  return list
85
92
  end
86
93
 
@@ -89,13 +96,13 @@ module FluidDb
89
96
  sql = self.format_to_sql( sql, params )
90
97
  r = @connection.execute( sql );
91
98
  r.each
92
-
99
+
93
100
  if !expected_affected_rows.nil? and
94
101
  r.affected_rows != expected_affected_rows then
95
102
  raise ExpectedAffectedRowsError.new( "Expected affected rows, #{expected_affected_rows}, Actual affected rows, #{r.affected_rows}")
96
103
  end
97
104
  end
98
-
105
+
99
106
  def insert( sql, params )
100
107
  raise "Pgsql uses SEQUENCES, so possibly easier to use 2 executes"
101
108
  # self.execute( sql, params )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluiddb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-28 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A semantic layer for db interaction
15
15
  email: guy@guyirvine.com