how to create database column within developer

Questions and answers regarding general SQL and backend databases

how to create database column within developer

Postby stevek » Sat Oct 25, 2014 1:59 am

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
stevek
 
Posts: 53
Joined: Thu Jan 25, 2007 7:19 pm

Re: how to create database column within developer

Postby deezzub » Mon Oct 27, 2014 4:21 pm

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 );
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: how to create database column within developer

Postby mboegem » Mon Oct 27, 2014 5:54 pm

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.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: how to create database column within developer

Postby stevek » Tue Oct 28, 2014 4:54 am

Thank you!
stevek
 
Posts: 53
Joined: Thu Jan 25, 2007 7:19 pm


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 5 guests