Browse files

Fixed reordering of edges by preventing double-nesting of db transact…

…ion.
  • Loading branch information...
1 parent 4a20df5 commit cc14eb8cd3b18b9f28ea52f5ddf068aed0b36062 @arjan arjan committed Feb 12, 2011
Showing with 11 additions and 10 deletions.
  1. +1 −1 modules/mod_admin/templates/_rsc_edge.tpl
  2. +10 −9 src/dbdrivers/postgresql/z_db.erl
View
2 modules/mod_admin/templates/_rsc_edge.tpl
@@ -4,7 +4,7 @@
<li id="{{ #unlink_wrapper }}" class="rsc-edge do_unlink">
<span class="clearfix">
<span class="unlink-mover"></span>
- <span id="{{ #unlink }}" class="unlink-cross do_tooltip" title=_"Disconnect"></span>
+ <span id="{{ #unlink }}" class="unlink-cross"></span>
<span class="unlink-item"><a href="{% url admin_edit_rsc id=object_id %}">{{ title }}</a></span>
</span>
</li>
View
19 src/dbdrivers/postgresql/z_db.erl
@@ -508,15 +508,16 @@ update_sequence(Table, Ids, Context) when is_atom(Table) ->
update_sequence(Table, Ids, Context) ->
assert_table_name(Table),
Args = lists:zip(Ids, lists:seq(1, length(Ids))),
- Updater = fun(Ctx) ->
- C = get_connection(Ctx),
- try
- [ {ok, _} = pgsql:equery1(C, "update \""++Table++"\" set seq = $2 where id = $1", Arg) || Arg <- Args ]
- after
- return_connection(C, Ctx)
- end
- end,
- ok = transaction(Updater, Context).
+ case get_connection(Context) of
+ none -> [];
+ C ->
+ try
+ [ {ok, _} = pgsql:equery1(C, "update \""++Table++"\" set seq = $2 where id = $1", Arg) || Arg <- Args ]
+ after
+ return_connection(C, Context)
+ end
+ end.
+
%% @doc Check the information schema if a certain table exists in the context database.

0 comments on commit cc14eb8

Please sign in to comment.