JSTable

Methods Summary

TypeNameSummary

Returns a JSColumn for the named column (or column dataproviderID)..

Returns an array containing the names of all table columns..

Returns the table data source uri..

Returns a quoted version of the table name, if necessary, as defined by the actual database used..

Returns an array containing the names of the identifier (PK) column(s)..

Returns the table name as defined in the database..

Returns the Servoy server name..

Returns whether table was flagged as metadata table..

Methods Details

getColumn(name)

Returns a JSColumn for the named column (or column dataproviderID).

Parameters String name The name of the column to return the value from.

Returns JSColumn JSColumn column.

Sample

var jsTable = databaseManager.getTable('udm', 'campaigns')
var jsColumn = jsTable.getColumn('campaign_name')

getColumnNames()

Returns an array containing the names of all table columns. If the table is in mem, then the internal rowid column name is not returned.

Returns Array String array of column names.

Sample

var jsTable = databaseManager.getTable('udm', 'campaigns')
var columnNames = jsTable.getColumnNames()

getDataSource()

Returns the table data source uri.

Returns String String datasource uri.

Sample

var jsTable = databaseManager.getTable('udm', 'campaigns')
var dataSource = jsTable.getDataSource()

getQuotedSQLName()

Returns a quoted version of the table name, if necessary, as defined by the actual database used.

Returns String String table name, quoted if needed.

Sample

//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])

getRowIdentifierColumnNames()

Returns an array containing the names of the identifier (PK) column(s). Please note that if the table is in mem, then the internal rowid column name is also returned.

Returns Array String array of row identifier column names.

Sample

var jsTable = databaseManager.getTable('udm', 'campaigns')
var identifierColumnNames = jsTable.getRowIdentifierColumnNames()

getSQLName()

Returns the table name as defined in the database.

Returns String String table sql name.

Sample

var jsTable = databaseManager.getTable('udm', 'campaigns')
var tableNameForQuery = jsTable.getSQLName()

getServerName()

Returns the Servoy server name.

Returns String String server name.

Sample

var jsTable = databaseManager.getTable('udm', 'campaigns')
var serverName = jsTable.getServerName()

isMetadataTable()

Returns whether table was flagged as metadata table.

Returns Boolean boolean is metadata

Sample

var jsTable = databaseManager.getTable('udm', 'campaigns')
var isMetaDataTable = jsTable.isMetadataTable()

Last updated