6 changed files with 282 additions and 0 deletions
@ -0,0 +1,82 @@ |
|||||||
|
71900^Tabelle^1^0^0^120^400^1^integer^30^1^1^<<SQL>>\ |
||||||
|
select c.oid::integer,\ |
||||||
|
n.nspname || '.' || c.relname\ |
||||||
|
from pg_catalog.pg_class c\ |
||||||
|
join pg_catalog.pg_namespace n on n.oid=c.relnamespace\ |
||||||
|
where c.relkind in ('r','p','v','m','f')\ |
||||||
|
and n.nspname not in ('pg_catalog','information_schema')\ |
||||||
|
and n.nspname not like 'pg_toast%'\ |
||||||
|
and n.nspname not like 'pg_temp_%'\ |
||||||
|
and has_table_privilege(c.oid,'SELECT')\ |
||||||
|
and 1=(select administration from userinfo where tid=<<UserID>>)\ |
||||||
|
order by n.nspname,c.relname;^ ^ ^ |
||||||
|
71901^Felder^2^0^0^120^250^10^char^255^0^1^<<SQL>>\ |
||||||
|
select a.attname::varchar(255) as apnr,\ |
||||||
|
a.attname::varchar(255) as name\ |
||||||
|
from pg_catalog.pg_attribute a\ |
||||||
|
where a.attrelid=nullif('<<Tabelle>>','')::oid\ |
||||||
|
and a.attnum > 0\ |
||||||
|
and not a.attisdropped\ |
||||||
|
order by a.attnum;^ ^ ^ |
||||||
|
71902^Filterfeld^3^0^0^120^200^1^sql^255^0^1^<<SQL>>\ |
||||||
|
select a.attname,a.attname\ |
||||||
|
from pg_catalog.pg_attribute a\ |
||||||
|
where a.attrelid=nullif('<<Tabelle>>','')::oid\ |
||||||
|
and a.attnum > 0\ |
||||||
|
and not a.attisdropped\ |
||||||
|
order by a.attnum;^ ^ ^ |
||||||
|
71903^Operator^4^0^0^120^120^1^sql^30^0^1^<<SQL>>\ |
||||||
|
select '=' as apnr,'=' as name from xdummy\ |
||||||
|
union all select '<>','<>' from xdummy\ |
||||||
|
union all select '>','>' from xdummy\ |
||||||
|
union all select '>=','>=' from xdummy\ |
||||||
|
union all select '<','<' from xdummy\ |
||||||
|
union all select '<=','<=' from xdummy\ |
||||||
|
union all select 'like','LIKE' from xdummy\ |
||||||
|
union all select 'ilike','ILIKE' from xdummy\ |
||||||
|
union all select 'is null','ist leer' from xdummy\ |
||||||
|
union all select 'is not null','ist nicht leer' from xdummy;^ ^ ^ |
||||||
|
71904^Wert^5^0^0^120^250^1^char^255^0^0^ ^ ^ ^ |
||||||
|
71905^Sortierfeld^6^0^0^120^200^1^sql^255^0^1^<<SQL>>\ |
||||||
|
--Freemarker Template\ |
||||||
|
<#if "<<Felder>>"!="">\ |
||||||
|
select apnr,name\ |
||||||
|
from\ |
||||||
|
(\ |
||||||
|
select '__COUNT__'::varchar(255) as apnr,\ |
||||||
|
'Anzahl'::varchar(255) as name,\ |
||||||
|
0::integer as sortnr\ |
||||||
|
from xdummy\ |
||||||
|
\ |
||||||
|
union all\ |
||||||
|
\ |
||||||
|
select a.attname::varchar(255) as apnr,\ |
||||||
|
a.attname::varchar(255) as name,\ |
||||||
|
a.attnum::integer as sortnr\ |
||||||
|
from pg_catalog.pg_attribute a\ |
||||||
|
where a.attrelid=nullif('<<Tabelle>>','')::oid\ |
||||||
|
and a.attnum > 0\ |
||||||
|
and not a.attisdropped\ |
||||||
|
and a.attname in (<<Felder>>)\ |
||||||
|
) X\ |
||||||
|
order by sortnr;\ |
||||||
|
<#else>\ |
||||||
|
select a.attname,a.attname\ |
||||||
|
from pg_catalog.pg_attribute a\ |
||||||
|
where a.attrelid=nullif('<<Tabelle>>','')::oid\ |
||||||
|
and a.attnum > 0\ |
||||||
|
and not a.attisdropped\ |
||||||
|
order by a.attnum;\ |
||||||
|
</#if>^ ^ ^ |
||||||
|
71906^Sortierung^7^0^0^120^120^1^sql^10^0^1^<<SQL>>\ |
||||||
|
select 'asc','aufsteigend' from xdummy\ |
||||||
|
union all\ |
||||||
|
select 'desc','absteigend' from xdummy;^ ^ ^ |
||||||
|
71907^Limit^8^0^0^120^100^1^integer^10^1^1^<<SQL>>\ |
||||||
|
select 10,'10' from xdummy\ |
||||||
|
union all select 50,'50' from xdummy\ |
||||||
|
union all select 100,'100' from xdummy\ |
||||||
|
union all select 500,'500' from xdummy\ |
||||||
|
union all select 1000,'1.000' from xdummy\ |
||||||
|
union all select 5000,'5.000' from xdummy\ |
||||||
|
order by 1;^ ^100^ |
||||||
@ -0,0 +1 @@ |
|||||||
|
71900^9^ |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
71900^71900^ |
||||||
|
71900^71901^ |
||||||
|
71900^71902^ |
||||||
|
71900^71903^ |
||||||
|
71900^71904^ |
||||||
|
71900^71905^ |
||||||
|
71900^71906^ |
||||||
|
71900^71907^ |
||||||
@ -0,0 +1,182 @@ |
|||||||
|
71900^Tabelleninhalt anzeigen^--Freemarker Template\ |
||||||
|
<#include "SQL_lingua_franca"/>\ |
||||||
|
<#include "SuperX_general"/>\ |
||||||
|
\ |
||||||
|
-- Entwicklermaske: Tabelleninhalt direkt aus PostgreSQL-Metadaten ausgeben.\ |
||||||
|
-- Tabellennamen und Spaltennamen werden nicht frei eingegeben, sondern\ |
||||||
|
-- ueber PostgreSQL-Systemkataloge aufgeloest und mit quote_ident() gequotet.\ |
||||||
|
\ |
||||||
|
<sqlvars>\ |
||||||
|
\ |
||||||
|
<sqlvar name="table_sql">\ |
||||||
|
select quote_ident(n.nspname) || '.' || quote_ident(c.relname)\ |
||||||
|
from pg_catalog.pg_class c\ |
||||||
|
join pg_catalog.pg_namespace n on n.oid=c.relnamespace\ |
||||||
|
where c.oid=<<Tabelle>>\ |
||||||
|
and c.relkind in ('r','p','v','m','f')\ |
||||||
|
and n.nspname not in ('pg_catalog','information_schema')\ |
||||||
|
and n.nspname not like 'pg_toast%'\ |
||||||
|
and n.nspname not like 'pg_temp_%'\ |
||||||
|
and has_table_privilege(c.oid,'SELECT')\ |
||||||
|
and 1=(select administration from userinfo where tid=<<UserID>>)\ |
||||||
|
</sqlvar>\ |
||||||
|
\ |
||||||
|
<sqlvar name="get_felder" type="hashsequence">\ |
||||||
|
select a.attname as feldname,\ |
||||||
|
pg_catalog.format_type(a.atttypid,a.atttypmod) as datentyp,\ |
||||||
|
quote_ident(a.attname) as qname\ |
||||||
|
from pg_catalog.pg_attribute a\ |
||||||
|
where a.attrelid=<<Tabelle>>\ |
||||||
|
and a.attnum > 0\ |
||||||
|
and not a.attisdropped\ |
||||||
|
order by a.attnum\ |
||||||
|
</sqlvar>\ |
||||||
|
\ |
||||||
|
<sqlvar name="filter_field_sql">\ |
||||||
|
select max(quote_ident(a.attname))\ |
||||||
|
from pg_catalog.pg_attribute a\ |
||||||
|
where a.attrelid=<<Tabelle>>\ |
||||||
|
and a.attnum > 0\ |
||||||
|
and not a.attisdropped\ |
||||||
|
and a.attname='<<Filterfeld>>'\ |
||||||
|
</sqlvar>\ |
||||||
|
\ |
||||||
|
<sqlvar name="sort_field_sql">\ |
||||||
|
select max(quote_ident(a.attname))\ |
||||||
|
from pg_catalog.pg_attribute a\ |
||||||
|
where a.attrelid=<<Tabelle>>\ |
||||||
|
and a.attnum > 0\ |
||||||
|
and not a.attisdropped\ |
||||||
|
and a.attname='<<Sortierfeld>>'\ |
||||||
|
</sqlvar>\ |
||||||
|
\ |
||||||
|
</sqlvars>\ |
||||||
|
\ |
||||||
|
<#assign selected_fields="<<Felder>>" />\ |
||||||
|
<#assign aggregate=false />\ |
||||||
|
<#if selected_fields!="">\ |
||||||
|
<#assign aggregate=true />\ |
||||||
|
</#if>\ |
||||||
|
\ |
||||||
|
<#assign field_list="" />\ |
||||||
|
<#foreach feld in get_felder>\ |
||||||
|
<#if !aggregate || selected_fields?index_of("'"+feld.feldname+"'")!=-1>\ |
||||||
|
<#if field_list!="">\ |
||||||
|
<#assign field_list=field_list+", " />\ |
||||||
|
</#if>\ |
||||||
|
<#assign field_list=field_list+feld.qname />\ |
||||||
|
</#if>\ |
||||||
|
</#foreach>\ |
||||||
|
\ |
||||||
|
/* Operator serverseitig auf erlaubte Werte begrenzen */\ |
||||||
|
<#assign operator_sql="" />\ |
||||||
|
<#if "<<Operator>>"="=">\ |
||||||
|
<#assign operator_sql="=" />\ |
||||||
|
<#elseif "<<Operator>>"="<>">\ |
||||||
|
<#assign operator_sql="<>" />\ |
||||||
|
<#elseif "<<Operator>>"=">">\ |
||||||
|
<#assign operator_sql=">" />\ |
||||||
|
<#elseif "<<Operator>>"=">=">\ |
||||||
|
<#assign operator_sql=">=" />\ |
||||||
|
<#elseif "<<Operator>>"="<">\ |
||||||
|
<#assign operator_sql="<" />\ |
||||||
|
<#elseif "<<Operator>>"="<=">\ |
||||||
|
<#assign operator_sql="<=" />\ |
||||||
|
<#elseif "<<Operator>>"="like">\ |
||||||
|
<#assign operator_sql="like" />\ |
||||||
|
<#elseif "<<Operator>>"="ilike">\ |
||||||
|
<#assign operator_sql="ilike" />\ |
||||||
|
<#elseif "<<Operator>>"="is null">\ |
||||||
|
<#assign operator_sql="is null" />\ |
||||||
|
<#elseif "<<Operator>>"="is not null">\ |
||||||
|
<#assign operator_sql="is not null" />\ |
||||||
|
</#if>\ |
||||||
|
\ |
||||||
|
<#assign apply_filter=false />\ |
||||||
|
<#if "<<Filterfeld>>"!="" && operator_sql!="" && filter_field_sql?has_content>\ |
||||||
|
<#if operator_sql="is null" || operator_sql="is not null">\ |
||||||
|
<#assign apply_filter=true />\ |
||||||
|
<#elseif "<<Wert>>"!="">\ |
||||||
|
<#assign apply_filter=true />\ |
||||||
|
</#if>\ |
||||||
|
</#if>\ |
||||||
|
\ |
||||||
|
/* Sortierrichtung nicht ungeprueft aus der Eingabe uebernehmen */\ |
||||||
|
<#assign sort_direction="asc" />\ |
||||||
|
<#if "<<Sortierung>>"="desc">\ |
||||||
|
<#assign sort_direction="desc" />\ |
||||||
|
</#if>\ |
||||||
|
\ |
||||||
|
/* LIMIT ebenfalls auf die in der Maske angebotenen Werte begrenzen */\ |
||||||
|
<#assign row_limit=100 />\ |
||||||
|
<#if "<<Limit>>"="10">\ |
||||||
|
<#assign row_limit=10 />\ |
||||||
|
<#elseif "<<Limit>>"="50">\ |
||||||
|
<#assign row_limit=50 />\ |
||||||
|
<#elseif "<<Limit>>"="100">\ |
||||||
|
<#assign row_limit=100 />\ |
||||||
|
<#elseif "<<Limit>>"="500">\ |
||||||
|
<#assign row_limit=500 />\ |
||||||
|
<#elseif "<<Limit>>"="1000">\ |
||||||
|
<#assign row_limit=1000 />\ |
||||||
|
<#elseif "<<Limit>>"="5000">\ |
||||||
|
<#assign row_limit=5000 />\ |
||||||
|
</#if>\ |
||||||
|
\ |
||||||
|
select\ |
||||||
|
${field_list}<#if aggregate>,\ |
||||||
|
count(*) as anzahl</#if>\ |
||||||
|
from ${table_sql}\ |
||||||
|
where 1=1\ |
||||||
|
<#if apply_filter>\ |
||||||
|
and ${filter_field_sql} ${operator_sql}<#if operator_sql!="is null" && operator_sql!="is not null"> <<Wert>></#if>\ |
||||||
|
</#if>\ |
||||||
|
<#if aggregate>\ |
||||||
|
group by ${field_list}\ |
||||||
|
</#if>\ |
||||||
|
<#if "<<Sortierfeld>>"="__COUNT__" && aggregate>\ |
||||||
|
order by anzahl ${sort_direction}\ |
||||||
|
<#elseif "<<Sortierfeld>>"!="" && sort_field_sql?has_content>\ |
||||||
|
order by ${sort_field_sql} ${sort_direction}\ |
||||||
|
<#elseif aggregate>\ |
||||||
|
order by ${field_list}\ |
||||||
|
</#if>\ |
||||||
|
limit ${row_limit};^--Freemarker Template\ |
||||||
|
<sqlvars>\ |
||||||
|
<sqlvar name="get_felder" type="hashsequence">\ |
||||||
|
select a.attname as feldname,\ |
||||||
|
pg_catalog.format_type(a.atttypid,a.atttypmod) as datentyp,\ |
||||||
|
quote_ident(a.attname) as qname\ |
||||||
|
from pg_catalog.pg_attribute a\ |
||||||
|
where a.attrelid=<<Tabelle>>\ |
||||||
|
and a.attnum > 0\ |
||||||
|
and not a.attisdropped\ |
||||||
|
order by a.attnum\ |
||||||
|
</sqlvar>\ |
||||||
|
</sqlvars>\ |
||||||
|
\ |
||||||
|
<#assign selected_fields="<<Felder>>" />\ |
||||||
|
<#assign aggregate=false />\ |
||||||
|
<#if selected_fields!="">\ |
||||||
|
<#assign aggregate=true />\ |
||||||
|
</#if>\ |
||||||
|
\ |
||||||
|
XIL List\ |
||||||
|
sizable_columns horizontal_scrolling\ |
||||||
|
white_space_color=COLOR_WHITE fixed_columns=1\ |
||||||
|
min_heading_height=35\ |
||||||
|
<#assign i=0 />\ |
||||||
|
<#foreach feld in get_felder>\ |
||||||
|
<#if !aggregate || selected_fields?index_of("'"+feld.feldname+"'")!=-1>\ |
||||||
|
Column CID=${i} heading_text="${feld.feldname}" explanation="PostgreSQL-Datentyp: ${feld.datentyp}" center_heading\ |
||||||
|
row_selectable col_selectable heading_platform readonly\ |
||||||
|
width=20\ |
||||||
|
<#assign i=i+1 />\ |
||||||
|
</#if>\ |
||||||
|
</#foreach>\ |
||||||
|
<#if aggregate>\ |
||||||
|
Column CID=${i} heading_text="Anzahl" explanation="Anzahl der Datensaetze mit dieser Feldkombination" center_heading\ |
||||||
|
row_selectable col_selectable rightJust heading_platform readonly\ |
||||||
|
width=10\ |
||||||
|
</#if>\ |
||||||
|
@@@^ ^ ^Entwicklerwerkzeug zum Anzeigen von PostgreSQL-Tabellen und Views. Bei Auswahl einzelner Felder werden gleiche Kombinationen gruppiert und mit Anzahl ausgegeben. Tabellen- und Spaltenmetadaten kommen direkt aus pg_catalog.^ ^^1^650^500^^0^Keine Feldauswahl zeigt alle Spalten und Datensaetze im Detail. Werden einzelne Felder ausgewaehlt, erfolgt automatisch eine Gruppierung nach diesen Feldern und eine Ausgabe der Spalte "Anzahl".^ |
||||||
Loading…
Reference in new issue