Page 1 of 1

how to create database column within developer

PostPosted: Sat Oct 25, 2014 1:59 am
by stevek
Hello All1

I am using Servoy 6.5 and Postgresql 9.3

I need to create a column in a table with properties of JSON to take advantage of the query possibilities it has. Currently I have jsons stored in varchar column and find it very difficult to query specific strings within it.

I can create the column uisng PGAdmin (postgres) ie json_data and the properties of the column are json

I cannot do this within servoy developer as that choice is not available.

can someone recommend how to create a json column to use in servoy?

Thanks

Re: how to create database column within developer

PostPosted: Mon Oct 27, 2014 4:21 pm
by deezzub
Code: Select all
var server = plugins.maintenance.getServer( serverName );
var table = server.getTable( tableName );
table.createNewColumn( columnName, type, length, allowNull, pkColumn );


or maybe you could try

Code: Select all
plugins.rawSQL.executeSQL( serverName, tableName, sql, sql_args );

Re: how to create database column within developer

PostPosted: Mon Oct 27, 2014 5:54 pm
by mboegem
stevek wrote:can someone recommend how to create a json column to use in servoy?


There's no way to do it from Servoy.
You need to do this manually.
Then see what column type the driver is returning in Servoy (probably text)
Normally the driver should take care of the conversion from Servoy to the JSON data type.

Re: how to create database column within developer

PostPosted: Tue Oct 28, 2014 4:54 am
by stevek
Thank you!