DaDaBIK
This forum is devoted to the discussion about the software DaDaBIK database front-end
the PHP Database application generator for MySQL, PostgreSQL and SQLite; also available for Wordpress.

Welcome! Log In Create A New Profile

Advanced

Materialized Views

Posted by darren 
Materialized Views
January 17, 2019 10:22AM
Hello,

I have requested before to allow dadabik to be able to recognise materialized views on postgres, I wrote some code in my previous post that allowed for that however, since the switch to ioncube I cannot manually go into source files and change the code so that dadabik can be able to recognize materialized views. I have to use the db_functions_pdo from dadabik 8 in order for it to work. I would like to be able to fully upgrade, so if it is possible to intergrate my code changes and send me the ioncube version or if there is no significant reason to not use the dadabik 8 version of db_functions_pdo I will continue to do what I am doing.

I changed the line from
select table_name as name, 'table' as type, table_schema from information_schema.tables where table_schema not in ('pg_catalog','information_schema') union select table_name as name, 'view' as type, table_schema  from information_schema.views where table_schema not in ( 'pg_catalog','information_schema')


to

select table_name as name, 'table' as type, table_schema from information_schema.tables where table_schema not in ('pg_catalog','information_schema') union select table_name as name, 'view' as type, table_schema  from information_schema.views where table_schema not in ( 'pg_catalog','information_schema') union select matviewname as name, 'view' as type, schemaname as table_schema from pg_matviews order by name


I just added a third union

and the other line

SELECT column_name, data_type, is_nullable, character_maximum_length FROM information_schema.columns WHERE table_name ='".$table_name."' order by ordinal_position"


to

select attname as column_name, format_type(atttypid, atttypmod) as data_type, case when attnotnull::integer = '0' then 'YES' else 'NO' end as is_nullable, null as character_maximum_length from pg_catalog.pg_attribute where attrelid = '".$table_name."'::regclass and not attisdropped and attstattarget != '0' order by attnum


it selects from the pg_catalog.pg_attribute table which is much more comprehensive than information_schema.columns

You are using DaDaBIK version 9.2-Monterosso enterprise, installed on Nov 8, 2018

You are not running the last release of DaDaBIK, the release you are running might have bugs and security holes, see the official change log for further information. You can upgrade DaDaBIK here.

PHP Version: 7.2.13-1+ubuntu16.04.1+deb.sury.org+1

postgres version: 10.6 (Ubuntu 10.6-1.pgdg16.04+1)

Web server: Apache/2.4.18 (Ubuntu)

Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Re: Materialized Views
January 17, 2019 11:09AM
Hello Darren,
mixing files belonging to different versions is not a good idea, it might work (apparently) but you could have unexpected (and hidden) behaviours.

You are right, your modification is useful and it hasn't been introduced in the official DaDaBIK distribution yet, we'll do it.

The db_functions_pdo.php file, however, shouldn't be encrypted so you should be able to modify it, can you check it?

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK developer and project admin
Re: Materialized Views
January 23, 2019 09:50AM
Your right, I assumed too much, thinking that you encoded all files in ioncube not just certain ones
Sorry, only registered users may post in this forum.

Click here to login