Skip to content

Commit

Permalink
Move #exec_insert to abstract adapter's database statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
metaskills committed Apr 22, 2011
1 parent 724a786 commit 3fff212
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ def execute(sql, name = nil)
def exec_query(sql, name = 'SQL', binds = [])
end

# Executes insert +sql+ statement in the context of this connection using
# +binds+ as the bind substitutes. +name+ is the logged along with
# the executed +sql+ statement.
def exec_insert(sql, name, binds)
exec_query(sql, name, binds)
end

# Returns the last auto-generated ID from the affected table.
#
# +id_value+ will be returned unless the value is nil, in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,6 @@ def exec_query(sql, name = 'SQL', binds = [])
end
end

def exec_insert(sql, name, binds)
exec_query(sql, name, binds)
end

def last_inserted_id(result)
@connection.insert_id
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,6 @@ def exec_query(sql, name = 'SQL', binds = [])
end
end

def exec_insert(sql, name, binds)
exec_query(sql, name, binds)
end

def sql_for_insert(sql, pk, id_value, sequence_name, binds)
unless pk
_, table = extract_schema_and_table(sql.split(" ", 4)[2])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ def exec_query(sql, name = nil, binds = [])
end
end

def exec_insert(sql, name, binds)
exec_query(sql, name, binds)
end

def last_inserted_id(result)
@connection.last_insert_row_id
end
Expand Down

0 comments on commit 3fff212

Please sign in to comment.