JSTableObject
Overview
The JSTableObject
is an enhanced version of JSTable
, designed to represent a table that can be modified programmatically before being finalized in the database. This object supports dynamic schema modifications, such as adding or deleting columns. The changes made to a JSTableObject
do not immediately impact the database and must be explicitly synchronized using methods like JSServer.synchronizeWithDB
.
Developers can create new columns in the table by specifying attributes such as the column name, data type, length, and whether the column allows null values. Primary key configurations can also be set programmatically. This flexibility is particularly useful when working with dynamically generated tables or when adjustments to a schema are needed during runtime.
Methods Summarized
Creates a new column in this table.
Creates a new column in this table.
Creates a new column in this table.
void
Deletes the column with the specified name from this table.
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 Detailed
createNewColumn(columnName, type, length)
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.
Parameters
Sample
createNewColumn(columnName, type, length, allowNull)
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.
Parameters
Sample
createNewColumn(columnName, type, length, allowNull, pkColumn)
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.
Parameters
Sample
deleteColumn(columnName)
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.
Parameters
Returns: void
Sample
getColumn(name)
Returns a JSColumn for the named column (or column dataproviderID).
Parameters
Sample
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.
Sample
getDataSource()
Returns the table data source uri.
Sample
getQuotedSQLName()
Returns a quoted version of the table name, if necessary, as defined by the actual database used.
Sample
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.
Sample
getSQLName()
Returns the table name as defined in the database.
Sample
getServerName()
Returns the Servoy server name.
Sample
isMetadataTable()
Returns whether table was flagged as metadata table.
Sample
Last updated
Was this helpful?