Home » SIDU
 

Optional sidu_fk table

1 # 2013-01-02 00:00 | Forum
sidu_fk is an optional table helps you and SIDU work better for foreign keys, enum, or meta data.

SIDU will produce drop-down select menu for data edit window based on instruction in table sidu_fk;

If sidu_fk has not been created or data not found in sidu_fk, SIDU will still produce drop-down select menu for MysQL enums or PostgreSQL foreign keys;

If select options are more than 200 values, SIDU will use input text field instead.

1. create sidu_fk table in each database
CREATE TABLE sidu_fk (
tab varchar(80) NOT NULL,
col varchar(80) NOT NULL,
ref_tab varchar(80) NOT NULL,
ref_cols varchar(255) NOT NULL,
where_sort varchar(255),
PRIMARY KEY (tab,col)
);


2. Example one: foreign key

table: customer(cid,title_id,name,age,...)
table: title(title_id,title_name)

sidu_fk(tab,col,ref_tab,ref_cols,where_sort)
eg. sidu_fk('customer','title_id','title','title_id;title_name','order by 1')

3. Example two: meta table

table: invoice(id,status,ccy,ts,amt,...)
table: meta_tab(meta,col,var)
eg. meta_tab('ccy','1','USD'),('ccy','2','EUR')
eg. meta_tab('status','1','New'),('status','2','Paid')

sidu_fk(tab,col,ref_tab,ref_cols,where_sort)
eg. sidu_fk('invoice','ccy','meta_tab','col;var',"where meta='ccy'")

4. How sidu_fk improves the display of PosgreSQL system catalog tables:

This is part of a system catalog table: pg_class
pg_class

Now we add several rows into public.sidu_fk
pg_class

Now let's show the pg_class table in SIDU again:
pg_class
Read: 58833 | Reply: 1050Updated: 2013-10-06 23:46

Back « How to install databases
Next » SIDU hotkey list

You can not reply # 3

Category

CMS (5)
SIDU (10)
BensonBank (2)
General (3)
PageMaker (2)
Blog (8)


Top Read

» How to install databases
» Godaddy Magic Quotes Problem
» Benson Bank 5.0 Released on 28 Oct 2013
» SIDU 5.1 released on 15 Oct 2013
» Topnew Blog, Forum, Support 4.0
» Optional sidu_fk table
» Topnew CMS 4.0 Released
» Blog Docs 1 - Basic and quick setup
» SMINT menu bar: fixed when scrolling
» SIDU import/export data clean
» A list of PHP functions that I checked
» Page Maker 5.0 Released 2014-01-05
» Howto create a Topnew CMS theme
» Blog Docs 5 - Themes
» Secure PHP login with database js for http sites

New Replies

» SIDU hotkey list
» Blog Docs 4 - Category
» Topnew CMS 5.0 Released - 2013.12.28
» Blog Docs 2 - Advanced Setup: Customize
» Blog Docs 3 - Owner, Staff, Friends
» pinyin
» BensonBank Tutorial 1 - Get started
» SIDU SQL in charts: howto
» Blog Docs 7 - Developer: System Tables
» Login logout and password
» SIDU Support and Help Desk
» SIDU feature request and bug
» Blog Docs 6 - Admin
» Screenfly / Test Your Website at Different Screen Resolutions
» PageMaker Doc 1 - Quick Setup Guide

Archive

» 2014 (1)
Jan (1);
2014-01-05 (1)

» 2013 (18)
Dec (5);
2013-12-29 (1)
2013-12-28 (1)
2013-12-17 (1)
2013-12-11 (1)
2013-12-10 (1)
Nov (2);
2013-11-22 (1)
2013-11-18 (1)
Oct (4);
2013-10-28 (1)
2013-10-26 (1)
2013-10-23 (1)
2013-10-15 (1)
Jan (7);
2013-01-11 (1)
2013-01-08 (1)
2013-01-05 (1)
2013-01-04 (1)
2013-01-03 (1)
2013-01-02 (1)
2013-01-01 (1)

» 2012 (6)
Dec (5);
2012-12-31 (1)
2012-12-30 (1)
2012-12-29 (2)
2012-12-28 (1)
Nov (1);
2012-11-26 (1)

» 2011 (5)
Aug (5);
2011-08-31 (1)
2011-08-30 (2)
2011-08-29 (1)
2011-08-28 (1)

2017-09-23 14:23