May 19, 2024 13:45 Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Parameters Returns Supported Clients Sample Parameters Supported Clients Sample Parameters Supported Clients SampleSupported Clients
SmartClient
WebClient
NGClient
Constants Summary
Number
DATABASE_IDENTITY
Constant used when setting or getting the sequence type of columns.
Number
DATABASE_SEQUENCE
Constant used when setting or getting the sequence type of columns.
Number
DATETIME
Constant used when setting or getting the type of columns.
Number
EXCLUDED_COLUMN
Constant used when setting or getting the flags of columns.
Number
INTEGER
Constant used when setting or getting the type of columns.
Number
MEDIA
Constant used when setting or getting the type of columns.
Number
NONE
Constant for column information indicating unset values.
Number
NUMBER
Constant used when setting or getting the type of columns.
Number
PK_COLUMN
Constant used when setting or getting the row identifier type of columns.
Number
ROWID_COLUMN
Constant used when setting or getting the row identifier type of columns.
Number
SERVOY_SEQUENCE
Constant used when setting or getting the sequence type of columns.
Number
TEXT
Constant used when setting or getting the type of columns.
Number
UUID_COLUMN
Constant used when setting or getting the flags of columns.
Number
UUID_GENERATOR
Constant used when setting or getting the sequence type of columns.
Property Summary
Boolean
allowNull
Get or set the allow-null flag of a new column.
Number
rowIdentifierType
Get or set the row identifier type of the column.
Number
sequenceType
Get or set the sequence type of the column.
Methods Summary
String
getDataProviderID()
Get the data provider id for this column (which is the same as name if not explicitly defined otherwise).
String
getDefaultFormat()
Get the default format of the column.
String
getDescription()
Get the description property of the column.
String
getForeignType()
Get the foreign type of the column.
Number
getLength()
Get the length of the column as reported by the JDBC driver.
String
getQualifiedName()
Get the qualified name (including table name) of the column as known by the database.
String
getQuotedSQLName()
Returns a quoted version of the column name, if necessary, as defined by the actual database used.
String
getSQLName()
Get the name of the column as known by the database.
Number
getSQLType()
Get the raw JDBC type of the column, which allows to check database specific types, like sting/byte column type variations.
Number
getScale()
Get the scale of the column as reported by the JDBC driver.
String
getTitle()
Get the title property of the column.
Number
getType()
Get the JDBC type of the column.
String
getTypeAsString()
Get the name JDBC type of the column.
Boolean
hasFlag(flag)
Check a flag of the column.
void
setDatabaseSequenceName(sequenceName)
Set the database sequence name of the column, used for columns with sequence type JSColumn.
void
setFlag(flag, set)
Set or clear a flag of a new column.
Constants Details
DATABASE_IDENTITY
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;
}
DATABASE_SEQUENCE
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;
}
DATETIME
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;
}
EXCLUDED_COLUMN
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
// handle uuid column
}
INTEGER
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;
}
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;
}
NONE
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;
}
NUMBER
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;
}
PK_COLUMN
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;
}
ROWID_COLUMN
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;
}
SERVOY_SEQUENCE
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;
}
TEXT
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;
}
UUID_COLUMN
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
// handle uuid column
}
UUID_GENERATOR
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;
}
Property Details
allowNull
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.");
}
}
rowIdentifierType
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.");
}
}
sequenceType
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.");
}
}
Methods Details
getDataProviderID()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var dataProviderId = column.getDataProviderID()
getDefaultFormat()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var format = column.getDefaultFormat()
getDescription()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
var desc = column.getDescription()
getForeignType()
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)
}
getLength()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
if (column.getLength() < 10)
{
// handle short column
}
getQualifiedName()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var qualifiedSqlName = column.getQualifiedName()
getQuotedSQLName()
//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])
getSQLName()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var sqlName = column.getSQLName()
getSQLType()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var sqlType = column.getSQLType();
getScale()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
var scale = column.getScale()
getTitle()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
var title = column.getTitle()
getType()
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;
}
getTypeAsString()
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var typeName = column.getTypeAsString()
hasFlag(flag)
Number
flag
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
// handle uuid column
}
setDatabaseSequenceName(sequenceName)
String
sequenceName
the sequence name
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.");
}
}
setFlag(flag, set)
Number
flag
the flag to set
Boolean
set
true for set flag, false for clear flag
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.");
}
}