@@ -248,9 +248,9 @@ def column_types
248248 # Public: Opens (actually, "declares") the cursor. Call this before fetching
249249 def open
250250 set_cursor_tuple_fraction
251- @cursor = @options [ :cursor_name ] || SecureRandom . uuid . gsub ( "-" , "" )
251+ @cursor = @options [ :cursor_name ] || ( "cursor_" + SecureRandom . uuid . gsub ( "-" , "" ) )
252252 hold = @options [ :with_hold ] ? 'with hold ' : ''
253- @result = @connection . execute ( "declare cursor_ #{ @cursor } no scroll cursor #{ hold } for #{ @sql } " )
253+ @result = @connection . execute ( "declare #{ @cursor } no scroll cursor #{ hold } for #{ @sql } " )
254254 @block = [ ]
255255 end
256256
@@ -268,7 +268,7 @@ def fetch(options={})
268268 # Private: Fetches the next block of rows into @block
269269 def fetch_block ( block_size = nil )
270270 block_size ||= @block_size ||= @options . fetch ( :block_size ) { 1000 }
271- @result = @connection . execute ( "fetch #{ block_size } from cursor_ #{ @cursor } " )
271+ @result = @connection . execute ( "fetch #{ block_size } from #{ @cursor } " )
272272
273273 if @iterate == :each_array
274274 @block = @result . each_row . collect { |row | row }
@@ -279,7 +279,7 @@ def fetch_block(block_size=nil)
279279
280280 # Public: Closes the cursor
281281 def close
282- @connection . execute ( "close cursor_ #{ @cursor } " )
282+ @connection . execute ( "close #{ @cursor } " )
283283 end
284284
285285 # Private: Open transaction unless with_hold option, specified
0 commit comments