@@ -234,47 +234,30 @@ def jdbc_columns(table_name, name = nil)
234234 # +binds+ as the bind substitutes. +name+ is logged along with
235235 # the executed +sql+ statement.
236236 def exec_query ( sql , name = 'SQL' , binds = [ ] ) # :nodoc:
237- do_exec ( sql , name , binds , :query )
237+ log ( sql , name || 'SQL' ) { @connection . execute_query ( to_sql ( sql , binds ) ) }
238238 end
239239
240240 # Executes insert +sql+ statement in the context of this connection using
241241 # +binds+ as the bind substitutes. +name+ is the logged along with
242242 # the executed +sql+ statement.
243243 def exec_insert ( sql , name , binds , pk = nil , sequence_name = nil ) # :nodoc:
244- do_exec ( sql , name , binds , :insert )
244+ log ( sql , name || 'SQL' ) { @connection . execute_insert ( to_sql ( sql , binds ) ) }
245245 end
246246
247247 # Executes delete +sql+ statement in the context of this connection using
248248 # +binds+ as the bind substitutes. +name+ is the logged along with
249249 # the executed +sql+ statement.
250250 def exec_delete ( sql , name , binds ) # :nodoc:
251- do_exec ( sql , name , binds , :delete )
251+ log ( sql , name || 'SQL' ) { @connection . execute_delete ( to_sql ( sql , binds ) ) }
252252 end
253253
254254 # Executes update +sql+ statement in the context of this connection using
255255 # +binds+ as the bind substitutes. +name+ is the logged along with
256256 # the executed +sql+ statement.
257257 def exec_update ( sql , name , binds ) # :nodoc:
258- do_exec ( sql , name , binds , :update )
258+ log ( sql , name || 'SQL' ) { @connection . execute_update ( to_sql ( sql , binds ) ) }
259259 end
260260
261- # TODO is it really useful to have do_exec now ?!
262- def do_exec ( sql , name , binds , type )
263- sql = to_sql ( sql , binds )
264- log ( sql , name || 'SQL' ) do
265- if type == :insert
266- @connection . execute_insert ( sql )
267- elsif type == :update
268- @connection . execute_update ( sql )
269- elsif type == :delete
270- @connection . execute_delete ( sql )
271- else # type == :query
272- @connection . execute_query ( sql )
273- end
274- end
275- end
276- protected :do_exec
277-
278261 # Similar to {#exec_query} except it returns "raw" results in an array
279262 # where each rows is a hash with keys as columns (just like Rails used to
280263 # do up until 3.0) instead of wrapping them in a {#ActiveRecord::Result}.
@@ -283,7 +266,6 @@ def exec_query_raw(sql, name = 'SQL', binds = [], &block) # :nodoc:
283266 @connection . execute_query_raw ( to_sql ( sql , binds ) , &block )
284267 end
285268 end
286- alias_method :exec_raw_query , :exec_query_raw
287269
288270 def select_rows ( sql , name = nil )
289271 exec_query_raw ( sql , name ) . map! ( &:values )
0 commit comments