category::list::rewrite_query (public)
category::list::rewrite_query -object_column object_column \ [ -category_column category_column ] [ -dbn dbn ] sql
Defined in packages/categories/tcl/category-list-procs.tcl
Takes a sql-query and adds an outer join to category_object_map
- Switches:
- -object_column (required)
- column name that holds the object_id of the categorized object.
- -category_column (optional, defaults to
"category_id"
)- column name of the mapped category_id.
- -dbn (optional)
- Parameters:
- sql (required)
- sql-query to be rewritten
- Author:
- Timo Hentschel <timo@timohentschel.de>
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set driverkey [db_driverkey $dbn] switch $driverkey { oracle { set new_sql "select s.*, m.category_id as $category_column from ($sql) s, category_object_map m where s.$object_column = m.object_id(+) order by s.$object_column" } postgresql { set new_sql "select s.*, m.category_id as $category_column from ($sql) s left outer join category_object_map m on (s.$object_column = m.object_id) order by s.$object_column" } } return $new_sqlXQL Not present: Generic, PostgreSQL, Oracle