Connector for JSONB columns in Postgresql 9.4 and later


#1

Hi,
I;m trying to take the advantage of the DHX Data processor technology and the new Postgresql column data type, namely JSONB. Kindlylet me know if the PHP Connectors cater to this new column type of JSONB. Actually this greatly reduces the application complexity and even the number of database objects. If I have one JSONB column in a table I can store an array of JSONB. This will help me improve performance right from the DB level, as the JSONB data type is a binary representation and we can use indexes on this data type in such a way that the parse tree is very small.

Kindly help me out in this regard.

Regards
Manish


#2

Kindly help me out. I’m working on this product using DHX, PHP and Postgres, wherein I want to render a MASTER - DETAIL FORM-GRID STRUCTURE using JSONB column data for the grid to display the details. Also I feel using the DHX Connectors, I’m insulated from the details of the DML that I’d perform.


#3

The connector doesn’t provide such kind of functionality.
It can be used with Postgresql, but only with common ( string, number ) column types.


#4

What if the data is serialized to a plain json string then stored in a single json column within the table phpConnector is using? Also is it possible to store the grid config as a json or xml string in a separate table and load that into the page assuming phpConnector is setup properly?

edit: I think I found a clue to the config question here docs.dhtmlx.com/connector__php_ … cture.html. What would this script look like if all the config lines were already stored as a json string in a table column?

<?php require_once("../codebase/connector/grid_config.php"); require_once("../codebase/connector/grid_connector.php"); $res=mysql_connect("localhost","root",""); mysql_select_db("tasks"); $conn = new GridConnector($res); $config = new GridConfiguration(); $config->setHeader("Item Name,Item CD"); $config->attachHeader("Item Name Test,#rspan"); $config->attachFooter("Item Name,Item CD", Array("background: #ff0000;", "background: #00ff00;")); $config->attachFooter("Item Name Test,#rspan", "background: #0000ff;color:white;"); $config->setColIds("col1,col2"); $config->setInitWidths('120,*'); $config->setColSorting("connector,connector"); $config->setColColor("null,#dddddd"); $config->setColHidden("false,false"); $config->setColTypes("ro,ed"); $config->setColAlign('center,center'); $conn->set_config($config); $conn->render_table("grid50000","id","item_nm,item_cd"); ?>

Still need help with serializing the data as a single json string for retrieving/saving from a table. Don’t care about updating individual elements, just want to save the entire dataset to the table…manually by using a “save” button.


#5

The client side component provides a serialize API, which returns a state of the component as XML string.
You can use ajax api to send this string to a server-side, where it can be saved in a DB

docs.dhtmlx.com/api__dhtmlxgrid_serialize.html