DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING. THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
PK_COLUMN Constant used when Constant used when setting or getting the type of columns.ROWID_COLUMN Constant used when setting or getting the row identifier type of columns.
SERVOY_SEQUENCE Constant used when setting or getting the row identifier type of columns.Constant used when setting or getting the sequence type of columns.
UUID_COLUMN Constant used when setting or getting the type of columns.Constant used when setting or getting the flags of columns.Constant used when setting or getting the sequence type of columns.
getSQLName() Get the name Returns a quoted version of the column name, if necessary, as defined by the actual database used.Get the name of the column as known by the database.
getTitle() Get the raw JDBC type of the column, which allows to check database specific types, like sting/byte column type variations.Get the scale of the column as reported by the JDBC driver.Get the title property of the column.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
// handle column with no sequence
break;
case JSColumn.UUID_GENERATOR:
// handle uuid generated column
break;
}
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var dataProviderId = column.getDataProviderID()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var foreignType = column.getForeignType()
if (foreignType != null)
{
var fkTable = databaseManager.getTable('example_data', foreignType)
}
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
if (column.getLength() < 10)
{
// handle short column
}
Get the qualified name (including table name) of the column as known by the database. The name is quoted, if necessary, as defined by the actual database used.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var qualifiedSqlName = column.getQualifiedName()
//use with the raw SQL plugin:
//if the table name contains characters that are illegal in sql, the table name will be quoted
var jsTable = databaseManager.getTable('udm', 'campaigns')
var quotedTableName = jsTable.getQuotedSQLName()
var jsColumn = jsTable.getColumn('active')
var quotedColumnName = jsColumn.getQuotedSQLName()
plugins.rawSQL.executeSQL('udm', quotedTableName, 'select * from ' + quotedTableName + ' where ' + quotedColumnName + ' = ?', [1])
Get the JDBC type of the column. The type reported by the JDBC driver will be mapped to one of: - JSColumn.DATETIME - JSColumn.TEXT - JSColumn.NUMBER - JSColumn.INTEGER - JSColumn.MEDIA
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
// handle text column
break;
case JSColumn.NUMBER:
case JSColumn.INTEGER:
// handle numerical column
break;
}
Check a flag of the column. The flags are a bit pattern consisting of 1 or more of the following bits: - JSColumn.UUID_COLUMN - JSColumn.EXCLUDED_COLUMN
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
// handle uuid column
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
setDatabaseSequenceName
Table Row (tr)
id
name
Table Cell (td)
setDatabaseSequenceName
Table Row (tr)
id
sig
Table Cell (td)
Span
style
margin-right: 5px;
void
Span
style
font-weight: bold;
setDatabaseSequenceName
Span
()
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Set the database sequence name of the column, used for columns with sequence type JSColumn.DATABASE_SEQUENCE.
Table Row (tr)
id
ret
Table Cell (td)
Returns
Div
class
sIndent
void
Table Row (tr)
id
sam
Table Cell (td)
Sample
Div
class
sIndent
Code Block
language
javascript
var server = plugins.maintenance.getServer("example_data");
if (server)
{
// users has uuid pk
var table = server.createNewTable("users");
if (table)
{
var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use <JSColumn.TEXT, 36> for UUIDs)
pk.rowIdentifierType = JSColumn.PK_COLUMN;
pk.setFlag(JSColumn.UUID_COLUMN, true)
pk.sequenceType = JSColumn.UUID_GENERATOR
table.createNewColumn("name", JSColumn.TEXT, 100);
var result = server.synchronizeWithDB(table);
if (result) application.output("Table users successfully created.");
else application.output("Table users not created.");
}
// groups has database sequence pk
table = server.createNewTable("groups");
if (table)
{
pk = table.createNewColumn("id", JSColumn.INTEGER, 0);
pk.rowIdentifierType = JSColumn.PK_COLUMN;
pk.sequenceType = JSColumn.DATABASE_SEQUENCE
pk.setDatabaseSequenceName('mygroupsequence')
table.createNewColumn("name", JSColumn.TEXT, 100);
result = server.synchronizeWithDB(table);
if (result) application.output("Table groups successfully created.");
else application.output("Table groups not created.");
}
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
setFlag-Number_Boolean
Table Row (tr)
id
name
Table Cell (td)
setFlag
Table Row (tr)
id
sig
Table Cell (td)
Span
style
margin-right: 5px;
void
Span
style
font-weight: bold;
setFlag
Span
(flag, set)
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Set or clear a flag of a new column. The flags are a bit pattern consisting of 1 or more of the following bits: - JSColumn.UUID_COLUMN; - JSColumn.EXCLUDED_COLUMN;
Table Row (tr)
id
prs
Table Cell (td)
Parameters
Div
class
sIndent
{Number} flag - the flag to set {Boolean} set - true for set flag, false for clear flag
Table Row (tr)
id
ret
Table Cell (td)
Returns
Div
class
sIndent
void
Table Row (tr)
id
sam
Table Cell (td)
Sample
Div
class
sIndent
Code Block
language
javascript
var server = plugins.maintenance.getServer("example_data");
if (server)
{
var table = server.createNewTable("users");
if (table)
{
var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use (JSColumn.TEXT, 36) for UUIDs
pk.rowIdentifierType = JSColumn.PK_COLUMN;
pk.setFlag(JSColumn.UUID_COLUMN, true)
pk.sequenceType = JSColumn.UUID_GENERATOR
var c = table.createNewColumn("name", JSColumn.TEXT, 100);
c.allowNull = false
table.createNewColumn("age", JSColumn.INTEGER, 0);
table.createNewColumn("last_login", JSColumn.DATETIME, 0);
var result = server.synchronizeWithDB(table);
if (result) application.output("Table successfully created.");
else application.output("Table not created.");
}
}
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
// handle column with no sequence
break;
case JSColumn.UUID_GENERATOR:
// handle uuid generated column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
DATETIME
Table Row (tr)
id
name
Table Cell (td)
DATETIME
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant used when setting or getting the type of columns.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
// handle text column
break;
case JSColumn.NUMBER:
case JSColumn.INTEGER:
// handle numerical column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
EXCLUDED_COLUMN
Table Row (tr)
id
name
Table Cell (td)
EXCLUDED_COLUMN
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant used when setting or getting the flags of columns. This flag identifies columns that are skipped in the sql.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
// handle text column
break;
case JSColumn.NUMBER:
case JSColumn.INTEGER:
// handle numerical column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
MEDIA
Table Row (tr)
id
name
Table Cell (td)
MEDIA
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant used when setting or getting the type of columns.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
// handle text column
break;
case JSColumn.NUMBER:
case JSColumn.INTEGER:
// handle numerical column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
NONE
Table Row (tr)
id
name
Table Cell (td)
NONE
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant for column information indicating unset values.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
// handle column with no sequence
break;
case JSColumn.UUID_GENERATOR:
// handle uuid generated column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
NUMBER
Table Row (tr)
id
name
Table Cell (td)
NUMBER
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant used when setting or getting the type of columns.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
// handle text column
break;
case JSColumn.NUMBER:
case JSColumn.INTEGER:
// handle numerical column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
PK_COLUMN
Table Row (tr)
id
name
Table Cell (td)
PK_COLUMN
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant used when setting or getting the row identifier type of columns. This value identifies columns that are defined as primary key in the database.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getRowIdentifierType())
{
case JSColumn.NONE:
// handle normal column
break;
case JSColumn.PK_COLUMN:
// handle database pk column
break;
case JSColumn.ROWID_COLUMN:
// handle developer defined pk column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
ROWID_COLUMN
Table Row (tr)
id
name
Table Cell (td)
ROWID_COLUMN
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant used when setting or getting the row identifier type of columns. This value identifies columns that are defined as primary key by the developer (but not in the database).
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
// handle column with no sequence
break;
case JSColumn.UUID_GENERATOR:
// handle uuid generated column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
TEXT
Table Row (tr)
id
name
Table Cell (td)
TEXT
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant used when setting or getting the type of columns.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
// handle text column
break;
case JSColumn.NUMBER:
case JSColumn.INTEGER:
// handle numerical column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
UUID_COLUMN
Table Row (tr)
id
name
Table Cell (td)
UUID_COLUMN
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Constant used when setting or getting the flags of columns. This flag identifies columns whose values are treated as UUID.
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
// handle column with no sequence
break;
case JSColumn.UUID_GENERATOR:
// handle uuid generated column
break;
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
HTML Table
id
property
class
servoy sDetail
Colgroup Tag
Col
colspan
2
width
100%
Col
Table Head (thead)
Table Row (tr)
style
height: 30px;
Table Head (th)
colspan
2
Property Details
Table Body (tbody)
id
allowNull
Table Row (tr)
id
name
Table Cell (td)
allowNull
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Get or set the allow-null flag of a new column. Note that when a column is added to an existing table, allowNull will always be set. For a primary key column, the allowNull flag will be always off, for other columns the flag is set by default.
var server = plugins.maintenance.getServer("example_data");
if (server)
{
var table = server.createNewTable("users");
if (table)
{
var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use (JSColumn.TEXT, 36) for UUIDs
pk.rowIdentifierType = JSColumn.PK_COLUMN;
pk.setFlag(JSColumn.UUID_COLUMN, true)
pk.sequenceType = JSColumn.UUID_GENERATOR
var c = table.createNewColumn("name", JSColumn.TEXT, 100);
c.allowNull = false
table.createNewColumn("age", JSColumn.INTEGER, 0);
table.createNewColumn("last_login", JSColumn.DATETIME, 0);
var result = server.synchronizeWithDB(table);
if (result) application.output("Table successfully created.");
else application.output("Table not created.");
}
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
rowIdentifierType
Table Row (tr)
id
name
Table Cell (td)
rowIdentifierType
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Get or set the row identifier type of the column. The sequence type is one of: - JSColumn.PK_COLUMN - JSColumn.ROWID_COLUMN - JSColumn.NONE
var server = plugins.maintenance.getServer("example_data");
if (server)
{
// users has uuid pk
var table = server.createNewTable("users");
if (table)
{
var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use <JSColumn.TEXT, 36> for UUIDs)
pk.rowIdentifierType = JSColumn.PK_COLUMN;
pk.setFlag(JSColumn.UUID_COLUMN, true)
pk.sequenceType = JSColumn.UUID_GENERATOR
table.createNewColumn("name", JSColumn.TEXT, 100);
var result = server.synchronizeWithDB(table);
if (result) application.output("Table users successfully created.");
else application.output("Table users not created.");
}
// groups has database sequence pk
table = server.createNewTable("groups");
if (table)
{
pk = table.createNewColumn("id", JSColumn.INTEGER, 0);
pk.rowIdentifierType = JSColumn.PK_COLUMN;
pk.sequenceType = JSColumn.DATABASE_SEQUENCE
pk.setDatabaseSequenceName('mygroupsequence')
table.createNewColumn("name", JSColumn.TEXT, 100);
result = server.synchronizeWithDB(table);
if (result) application.output("Table groups successfully created.");
else application.output("Table groups not created.");
}
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
Table Body (tbody)
id
sequenceType
Table Row (tr)
id
name
Table Cell (td)
sequenceType
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
Get or set the sequence type of the column. The sequence type is one of: - JSColumn.NONE - JSColumn.SERVOY_SEQUENCE - JSColumn.DATABASE_SEQUENCE - JSColumn.DATABASE_IDENTITY - JSColumn.UUID_GENERATOR;
var server = plugins.maintenance.getServer("example_data");
if (server)
{
// users has uuid pk
var table = server.createNewTable("users");
if (table)
{
var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use <JSColumn.TEXT, 36> for UUIDs)
pk.rowIdentifierType = JSColumn.PK_COLUMN;
pk.setFlag(JSColumn.UUID_COLUMN, true)
pk.sequenceType = JSColumn.UUID_GENERATOR
table.createNewColumn("name", JSColumn.TEXT, 100);
var result = server.synchronizeWithDB(table);
if (result) application.output("Table users successfully created.");
else application.output("Table users not created.");
}
// groups has database sequence pk
table = server.createNewTable("groups");
if (table)
{
pk = table.createNewColumn("id", JSColumn.INTEGER, 0);
pk.rowIdentifierType = JSColumn.PK_COLUMN;
pk.sequenceType = JSColumn.DATABASE_SEQUENCE
pk.setDatabaseSequenceName('mygroupsequence')
table.createNewColumn("name", JSColumn.TEXT, 100);
result = server.synchronizeWithDB(table);
if (result) application.output("Table groups successfully created.");
else application.output("Table groups not created.");
}
}
Table Row (tr)
class
lastDetailRow
Table Cell (td)
Â
SmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow MEDIAname
MEDIA
dessIndentConstant used when setting or getting the type of columns.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow NONEname
NONE
dessIndentConstant for column information indicating unset values.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow NUMBERname
NUMBER
dessIndentConstant used when setting or getting the type of columns.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow PK_COLUMNname
PK_COLUMN
dessIndentConstant used when setting or getting the row identifier type of columns. This value identifies columns that are defined as primary key in the database.ret
dessIndentConstant used when setting or getting the row identifier type of columns. This value identifies columns that are defined as primary key by the developer (but not in the database).ret
dessIndentGet or set the allow-null flag of a new column. Note that when a column is added to an existing table, allowNull will always be set. For a primary key column, the allowNull flag will be always off, for other columns the flag is set by default.ret
dessIndentGet or set the row identifier type of the column. The sequence type is one of: - JSColumn.PK_COLUMN - JSColumn.ROWID_COLUMN - JSColumn.NONEret
dessIndentGet or set the sequence type of the column. The sequence type is one of: - JSColumn.NONE - JSColumn.SERVOY_SEQUENCE - JSColumn.DATABASE_SEQUENCE - JSColumn.DATABASE_IDENTITY - JSColumn.UUID_GENERATOR;ret
dessIndentGet the qualified name (including table name) of the column as known by the database. The name is quoted, if necessary, as defined by the actual database used.ret
dessIndentReturns a quoted version of the column name, if necessary, as defined by the actual database used.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow getSQLNamename
getSQLName()
dessIndentGet the name of the column as known by the database.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow getSQLTypename
getSQLType()
dessIndentGet the raw JDBC type of the column, which allows to check database specific types, like sting/byte column type variations.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow getScalename
getScale()
dessIndentGet the scale of the column as reported by the JDBC driver.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow getTitlename
getTitle()
dessIndentGet the title property of the column.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow getTypename
getType()
dessIndentGet the JDBC type of the column. The type reported by the JDBC driver will be mapped to one of: - JSColumn.DATETIME - JSColumn.TEXT - JSColumn.NUMBER - JSColumn.INTEGER - JSColumn.MEDIAret
dessIndentGet the name JDBC type of the column. The same mapping as defined in JSColumn.getType() is applied.ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow hasFlagname
hasFlag(flag)
dessIndentCheck a flag of the column. The flags are a bit pattern consisting of 1 or more of the following bits: - JSColumn.UUID_COLUMN - JSColumn.EXCLUDED_COLUMNprs
dessIndentSet the database sequence name of the column, used for columns with sequence type JSColumn.DATABASE_SEQUENCE.prs
Parameters
sIndentsequenceNamethe sequence nameret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRow setFlagname
setFlag(flag, set)
dessIndentSet or clear a flag of a new column. The flags are a bit pattern consisting of 1 or more of the following bits: - JSColumn.UUID_COLUMN; - JSColumn.EXCLUDED_COLUMN;prs
Parameters
sIndentflagthe flag to setsettrue for set flag, false for clear flagret