From ae7d9a4bf852eea4b394e3d0e49ed755a34295c9 Mon Sep 17 00:00:00 2001 From: Marc Worrell Date: Mon, 18 Jan 2010 20:38:07 +0100 Subject: [PATCH] Added column_names/2 to fetch a normalized list of column names of a table. --- src/dbdrivers/postgresql/z_db.erl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dbdrivers/postgresql/z_db.erl b/src/dbdrivers/postgresql/z_db.erl index 72e20a853d..30354c3320 100644 --- a/src/dbdrivers/postgresql/z_db.erl +++ b/src/dbdrivers/postgresql/z_db.erl @@ -48,6 +48,7 @@ delete/3, select/3, columns/2, + column_names/2, update_sequence/3, table_exists/2, @@ -383,6 +384,11 @@ columns(Table, Context) -> Cols end. +%% @doc Return a list with the column names of a table. The names are sorted. +%% @spec column_names(Table, Context) -> [ atom, ... ] +column_names(Table, Context) -> + lists:sort(proplists:get_keys(columns(Table, Context))). + %% @doc Update the sequence of the ids in the table. They will be renumbered according to their position in the id list. %% @spec update_sequence(Table, IdList, Context) -> void()