fluiddb 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/FluidDb.rb CHANGED
@@ -159,6 +159,21 @@ module FluidDb
159
159
  def execute( sql, params, expected_affected_rows )
160
160
  raise NotImplementedError.new("You must implement 'execute'.")
161
161
  end
162
+
163
+ # Transaction Semantics
164
+ def Begin
165
+ @connection.execute( "BEGIN", [] )
166
+ end
167
+
168
+ # Transaction Semantics
169
+ def Commit
170
+ @connection.execute( "COMMIT", [] )
171
+ end
172
+
173
+ # Transaction Semantics
174
+ def Rollback
175
+ @connection.execute( "ROLLBACK", [] )
176
+ end
162
177
 
163
178
  end
164
179
 
data/lib/FluidDb/Db.rb CHANGED
@@ -21,6 +21,10 @@ module FluidDb
21
21
  when "mock"
22
22
  require "FluidDb/Mock"
23
23
  return FluidDb::Mock.new( uri )
24
+ when "tinytds"
25
+ require "FluidDb/TinyTds"
26
+ return FluidDb::TinyTds.new( uri )
27
+
24
28
  else
25
29
  abort("Scheme, #{uri.scheme}, not recognised when configuring creating db connection");
26
30
  end
@@ -140,6 +140,22 @@ module FluidDb
140
140
  # self.execute( sql, params )
141
141
  #return @connection.last_id
142
142
  end
143
+
144
+ # Transaction Semantics
145
+ def Begin
146
+ @connection.connection.transaction()
147
+ end
148
+
149
+ # Transaction Semantics
150
+ def Commit
151
+ @connection.connection.commit()
152
+ end
153
+
154
+ # Transaction Semantics
155
+ def Rollback
156
+ @connection.connection.rollback()
157
+ end
158
+
143
159
 
144
160
  end
145
161
 
@@ -35,7 +35,11 @@ module FluidDb
35
35
  hash[:timeout] = cgi["timeout"][0].to_i if cgi.has_key?( "timeout" )
36
36
  end
37
37
 
38
- @connection = ::TinyTds::Client.new( hash )
38
+ @connection = ::TinyTds::Client.new( hash )
39
+
40
+ if !@connection.active? then
41
+ raise "Unable to connect to the database"
42
+ end
39
43
  end
40
44
 
41
45
  def close
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.1.4
4
+ version: 0.1.6
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-08-20 00:00:00.000000000 Z
12
+ date: 2013-09-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A semantic layer for db interaction
15
15
  email: guy@guyirvine.com