Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
Table Body (tbody) |
---|
id | createNewColumn-String_Number_Number |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
createNewColumn |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
(columnName, type, length) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Creates a new column in this table. The name, type and length of the new column must be specified. For specifying the type of the column, use the JSColumn constants. The column is not actually created in the database until this table is synchronized with the database using the JSServer.synchronizeWithDB method. The method returns a JSColumn instance that corresponds to the newly created column. If any error occurs and the column cannot be created, then the method returns null. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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.");
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | createNewColumn-String_Number_Number_Boolean |
---|
| }{:=}{td}h6.createNewColumn{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
createNewColumn |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Creates a new column in this table. The name, type and length of the new column must be specified. For specifying the
type of the column, use the JSColumn constants. The column is not actually created in the database until this
table is synchronized with the database using the JSServer.synchronizeWithDB method.
The method returns a JSColumn instance that corresponds to the newly created column. If any error occurs and the column cannot be created, then the method
returns null.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} columnName
\{[Number]} type
\{[Number]} length
\{[Boolean]} allowNull
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSColumnObject]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Creates a new column in this table. The name, type and length of the new column must be specified. For specifying the type of the column, use the JSColumn constants. The column is not actually created in the database until this table is synchronized with the database using the JSServer.synchronizeWithDB method. The method returns a JSColumn instance that corresponds to the newly created column. If any error occurs and the column cannot be created, then the method returns null. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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.");
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id= Table Body (tbody) |
---|
id | createNewColumn-String_Number_Number_Boolean_Boolean |
---|
| }{:=}{td}h6.createNewColumn{td}{tr}{tr:id=sig}{td}{span:style= | Table Cell (td) |
---|
createNewColumn |
|
| }[]{span}{span:style= }{span}{span}\ {span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Creates a new column in this table. The name, type and length of the new column must be specified. For specifying the
type of the column, use the JSColumn constants. The column is not actually created in the database until this
table is synchronized with the database using the JSServer.synchronizeWithDB method.
The method returns a JSColumn instance that corresponds to the newly created column. If any error occurs and the column cannot be created, then the method
returns null.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} columnName
\{[Number]} type
\{[Number]} length
\{[Boolean]} allowNull
\{[Boolean]} pkColumn
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSColumnObject]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Creates a new column in this table. The name, type and length of the new column must be specified. For specifying the type of the column, use the JSColumn constants. The column is not actually created in the database until this table is synchronized with the database using the JSServer.synchronizeWithDB method. The method returns a JSColumn instance that corresponds to the newly created column. If any error occurs and the column cannot be created, then the method returns null. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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.");
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=deleteColumn-String}{tr:id=name}{td}h6.deleteColumn{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}deleteColumn{span}{span}\(columnName){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Deletes the column with the specified name from this table. The column is not actually deleted from the database until this
table is synchronized with the database using the JSServer.synchronizeWithDB method.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} columnName
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
deleteColumn |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Deletes the column with the specified name from this table. The column is not actually deleted from the database until this table is synchronized with the database using the JSServer.synchronizeWithDB method. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var server = plugins.maintenance.getServer("example_data");
if (server) {
var table = server.getTable("users");
if (table) {
table.deleteColumn("last_login");
server.synchronizeWithDB(table);
}
}
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getColumn-String}{tr:id=name}{td}h6.getColumn{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSColumn]{span}{span:style=font-weight: bold;}getColumn{span}{span}\(name){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a JSColumn for the named column (or column dataproviderID).{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} name -- The name of the column to return the value from.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSColumn] -- JSColumn column.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns a JSColumn for the named column (or column dataproviderID). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters
Div |
---|
| {String} name – The name of the column to return the value from. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var jsTable = databaseManager.getTable('udm', 'campaigns')
var jsColumn = jsTable.getColumn('campaign_name')
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getColumnNames}{tr:id=name}{td}h6.getColumnNames{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]\[]{span}{span:style=font-weight: bold;}getColumnNames{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns an array containing the names of all table columns.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String]\[] -- String array of column names.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getColumnNames |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns an array containing the names of all table columns. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| String[] – String array of column names. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var jsTable = databaseManager.getTable('udm', 'campaigns')
var columnNames = jsTable.getColumnNames()
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getDataSource}{tr:id=name}{td}h6.getDataSource{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getDataSource{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the table data source uri.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String datasource uri.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getDataSource |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the table data source uri. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| String – String datasource uri. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var jsTable = databaseManager.getTable('udm', 'campaigns')
var dataSource = jsTable.getDataSource()
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getQuotedSQLName}{tr:id=name}{td}h6.getQuotedSQLName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getQuotedSQLName{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a quoted version of the table name, if necessary, as defined by the actual database used.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String table name, quoted if needed.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getQuotedSQLName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns a quoted version of the table name, if necessary, as defined by the actual database used. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| String – String table name, quoted if needed. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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()
plugins.rawSQL.executeSQL('udm', quotedTableName, 'select * from ' + quotedTableName + ' where is_active = ?', [1])
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getRowIdentifierColumnNames}{tr:id=name}{td}h6.getRowIdentifierColumnNames{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]\[]{span}{span:style=font-weight: bold;}getRowIdentifierColumnNames{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns an array containing the names of the identifier (PK) column(s).{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String]\[] -- String array of row identifier column names.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | getRowIdentifierColumnNames |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getRowIdentifierColumnNames |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
| getRowIdentifierColumnNames |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns an array containing the names of the identifier (PK) column(s). |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| String[] – String array of row identifier column names. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var jsTable = databaseManager.getTable('udm', 'campaigns')
var identifierColumnNames = jsTable.getRowIdentifierColumnNames()
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getSQLName}{tr:id=name}{td}h6.getSQLName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getSQLName{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the table name.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String table name.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getSQLName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the table name. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| String – String table name. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var jsTable = databaseManager.getTable('udm', 'campaigns')
var tableNameForDisplay = jsTable.getSQLName()
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getServerName}{tr:id=name}{td}h6.getServerName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getServerName{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the Servoy server name.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String server name.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getServerName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the Servoy server name. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns
Div |
---|
| String – String server name. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var jsTable = databaseManager.getTable('udm', 'campaigns')
var serverName = jsTable.getServerName()
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=isMetadataTable}{tr:id=name}{td}h6.isMetadataTable{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}isMetadataTable{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns whether table was flagged as metadata table.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean is metadata{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns whether table was flagged as metadata table. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var jsTable = databaseManager.getTable('udm', 'campaigns')
var isMetaDataTable = jsTable.isMetadataTable()
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table} |