informix table sizeof disk

select tn.partnum , tn.dbsname , (pt.nptotal * pt.pagesize) /1024 as total_kb , (pt.npused * pt.pagesize) /1024 as used_kb , (pt.npused * pt.pagesize) / 1024 /1024/1024 as used_gb , (pt.npdata * pt.pagesize) /1024 as data_kb , tn.owner , tn.tabname , pt.lockid, pt.flags, pt.flags2 , pt.rowsize, pt.ncols, pt.pagesize , dbinfo('utc_to_datetime',pt.created) as created …

Devamını Oku »

Informix lock user sesion list

SELECT s.username tutan_kullanici, s.sid tutan_session, t.username bekleyen_kullanici, t.sid bekleyen_session, l.type locktype, l.dbsname veritabani, l.tabname tablo, l.rowidlk tutulan_rowid FROM sysmaster:syslocks l INNER JOIN sysmaster:syssessions s ON s.sid = l.owner LEFT JOIN sysmaster:syssessions t ON l.waiter = t.sid WHERE l.dbsname <> 'sysmaster' and l.tabname <> 'sysdatabases' ORDER BY veritabani, l.tabname;  

Devamını Oku »

Postgresql Master Detail Query to Json

Bazen yazdığımız bir sorguyu json olarak çıktı vermek isteriz create table testfatura( id serial primary key not null, fatura_no varchar(10) not null, aciklama varchar(100) not null ); create table testfatura_detay( id serial primary key not null, testfatura_id int not null references testfatura(id), stokkodu varchar(50), stokadi varchar(50) ); insert into testfatura …

Devamını Oku »

Postgresql 13 random tckn generator

Öncelikle plpython3 ‘ü yüklüyoruz sudo apt-get install postgresql-contrib postgresql-plpython3-13 CREATE OR REPLACE FUNCTION random_tckn () RETURNS TEXT AS $$ from random import randint tcno = str(randint(100000000, 1000000000)) list_tc = list(map(int, tcno)) tc10 = (sum(list_tc[::2]) * 7 - sum(list_tc[1::2])) % 10 new_tc = tcno + str(tc10) + str((sum(list_tc[:9]) + tc10) % …

Devamını Oku »