Child pages
  • JSServer

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{hidden}
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden}
{sub-section:description|text=}{sub-section}\\ 

{table:id=|class=servoy sSummery}{colgroup}{column:padding=0px|width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method SummarySummery{th}{tr}{tbody}{tr}{td}[JSTableObject]{td}{td}[#createNewTable]\(tableName)
Creates in this server a new table with the specified name.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#dropTable]\(tableName)
Drops the table with the specified name from this server.{td}{tr}{tbody}{tbody}{tr}{td}[JSTableObject]{td}{td}[#getTable]\(tableName)
Returns a JSTable instance corresponding to the table with the specified name from this server.{td}{tr}{tbody}{tbody}{tr}{td}[String]\[]{td}{td}[#getTableNames]\()
Returns an array with the names of all tables in this server.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#isValid]\()
Get valid state for the server.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#reloadDataModel]\()
Reloads the datamodel from the database, if changed externally or via rawSQL plugin.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#synchronizeWithDB]\(table)
Synchronizes a JSTable instance with the database.{td}{tr}{tbody}{table}\\ 

{table:id=function|class=servoy sDetail}{colgroup}{column:padding=0px|width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=3ADCDF9B-E2FD-42D7-82DC-A547D3353136createNewTable|class=node}{tr:id=name}{td}h6.createNewTable{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSTableObject]{span}{span:id=iets|style=float: left; font-weight: bold;}createNewTable{span}{span:id=iets|style=float: left;}\(tableName){span}{td}{tr}{tr:id=des}{td}{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136createNewTable_des|text=|trigger=button}{sub-section}{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136createNewTable_des|trigger=none|class=sIndent}Creates in this server a new table with the specified name.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_prscreateNewTable_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_prssub-section:createNewTable_snc|trigger=none|class=sIndent}tableName --Replace Thewith name of the table to create.
version info{sub-section}{divtd}{tdtr}{trbuilder-show}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_retcreateNewTable_prs|text=|trigger=button}{sub-section}{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_retcreateNewTable_prs|trigger=none|class=sIndent}\{[JSTableObjectString]} tableName -- JSTableObject createdThe name of the table to create.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_seecreateNewTable_ret|text=|trigger=button}{sub-section}{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_seecreateNewTable_ret|trigger=none|class=sIndent|trigger=none}}[JSTableObject] -- JSTableObject created table.{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136createNewTable_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_link|class=sIndentcreateNewTable_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_samcreateNewTable_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:3ADCDF9B-E2FD-42D7-82DC-A547D3353136_sam|class=sIndentcreateNewTable_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:createNewTable_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:createNewTable_sam|trigger=none}{code:language=javascript}
var server = plugins.maintenance.getServer("example_data");
if (server)
{
	var table = server.createNewTable("new_table");
	if (table) {
		table.createNewColumn("new_table_id", JSColumn.INTEGER, 0, false, true);
		if (server.synchronizeWithDB(table))
			application.output("New table created in the database.");
		else
			application.output("New table not created in database.");
	}
	else application.output("New table not created at all.");
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=34C8DC57-3546-4210-81D9-C0B9125E9E60dropTable|class=node}{tr:id=name}{td}h6.dropTable{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}dropTable{span}{span:id=iets|style=float: left;}\(tableName){span}{td}{tr}{tr:id=des}{td}{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60dropTable_des|text=|trigger=button}{sub-section}{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60dropTable_des|trigger=none|class=sIndent}Drops the table with the specified name from this server.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_prsdropTable_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_prsdropTable_snc|trigger=none|class=sIndent}tableName --Replace Thewith name of the table to drop.
version info{sub-section}{divtd}{tdtr}{trbuilder-show}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_retdropTable_prs|text=|trigger=button}{sub-section}{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_retdropTable_prs|trigger=none|class=sIndent}\{[BooleanString]} tableName -- boolean success. The name of the table to drop.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also see*Returns*\\{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_seedropTable_ret|text=|trigger=button}{sub-section}{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_seedropTable_ret|trigger=none|class=sIndent|trigger=none}}[Boolean] -- boolean success.{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60dropTable_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_link|class=sIndent|dropTable_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_samdropTable_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:34C8DC57-3546-4210-81D9-C0B9125E9E60_sam|class=sIndent|dropTable_link|trigger=none}{sub-section}{code:language=javascript}
var server div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:dropTable_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:dropTable_sam|trigger=none}{code:language=javascript}
var server = plugins.maintenance.getServer("example_data");
if (server) {
	var result = server.dropTable("new_table");
	if (result)
		application.output("Table dropped.");
	else
	application.output("Table not dropped.");
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=C282D533-5121-4FB1-AD8E-D77DCFFCF5C9getTable|class=node}{tr:id=name}{td}h6.getTable{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSTableObject]{span}{span:id=iets|style=float: left; font-weight: bold;}getTable{span}{span:id=iets|style=float: left;}\(tableName){span}{td}{tr}{tr:id=des}{td}{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9getTable_des|text=|trigger=button}{sub-section}{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9getTable_des|trigger=none|class=sIndent}Returns a JSTable instance corresponding to the table with the specified name from this server.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_prsgetTable_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_prsgetTable_snc|trigger=none|class=sIndent}tableName --Replace Thewith name of the table to retrieve.
version info{sub-section}{divtd}{tdtr}{trbuilder-show}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_retgetTable_prs|text=|trigger=button}{sub-section}{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_retgetTable_prs|trigger=none|class=sIndent}\{[JSTableObjectString]} tableName -- JSTableObjectThe name of the table to retrieve.
{sub-section}{td}{tr}{builder-showtr:permissionid=editret}{tr:id=see}{td}*Also seeReturns*\\{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_seegetTable_ret|text=|trigger=button}{sub-section}{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_seegetTable_ret|trigger=none|class=sIndent|trigger=none}}[JSTableObject] -- JSTableObject table.{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9getTable_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_link|class=sIndent|getTable_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_samgetTable_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C282D533-5121-4FB1-AD8E-D77DCFFCF5C9_sam|class=sIndentgetTable_link|trigger=none}{sub-section}{code:language=javascript}
var div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getTable_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getTable_sam|trigger=none}{code:language=javascript}
var server = plugins.maintenance.getServer("example_data");
if (server) {
	var table = server.getTable("employees");
	if (table) {
		var colNames = table.getColumnNames()
		application.output("Table has " + colNames.length + " columns.");
		for (var i=0; i<colNames.length; i++)
			application.output("Column " + i + ": " + colNames[i]);
	}
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=CC70065F-9296-423C-BC29-BB8C698F9038getTableNames|class=node}{tr:id=name}{td}h6.getTableNames{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]\[]{span}{span:id=iets|style=float: left; font-weight: bold;}getTableNames{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038getTableNames_des|text=|trigger=button}{sub-section}{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038getTableNames_des|trigger=none|class=sIndent}Returns an array with the names of all tables in this server.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_prsgetTableNames_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_prsgetTableNames_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_retgetTableNames_prs|text=|trigger=button}{sub-section}{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_retgetTableNames_prs|trigger=none|class=sIndent}[String]\[] -- Array of String table names.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_seegetTableNames_ret|text=|trigger=button}{sub-section}{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_seegetTableNames_ret|trigger=none|class=sIndent|trigger=none}}[String]\[] -- Array of String table names.{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038getTableNames_see|text=|trigger=button}{sub-section}{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_link|div:class=sIndent|trigger=none}{sub-section}{:getTableNames_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_samgetTableNames_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:CC70065F-9296-423C-BC29-BB8C698F9038_sam|class=sIndent|getTableNames_link|trigger=none}{sub-section}{code:language=javascript}
var serverdiv}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getTableNames_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getTableNames_sam|trigger=none}{code:language=javascript}
var server = plugins.maintenance.getServer("example_data");
if (server) {
	var tableNames = server.getTableNames();
	application.output("There are " + tableNames.length + " tables.");
	for (var i=0; i<tableNames.length; i++)
		application.output("Table " + i + ": " + tableNames[i]);
	}
else {
	plugins.dialogs.showInfoDialog("Attention","Server 'example_data' cannot be found.","OK");
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=C2D9B035-FFE3-4436-9DA4-97882D038E13isValid|class=node}{tr:id=name}{td}h6.isValid{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}isValid{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13isValid_des|text=|trigger=button}{sub-section}{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13isValid_des|trigger=none|class=sIndent}Get valid state for the server.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_prsisValid_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_prsisValid_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_retisValid_prs|text=|trigger=button}{sub-section}{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_retisValid_prs|trigger=none|class=sIndent}[Boolean] -- boolean valid state.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_seeisValid_ret|text=|trigger=button}{sub-section}{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_seeisValid_ret|trigger=none|class=sIndent|trigger=none}}[Boolean] -- boolean valid state.{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13isValid_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_link|class=sIndentisValid_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_samisValid_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C2D9B035-FFE3-4436-9DA4-97882D038E13_sam|class=sIndent|trigger=none}{code:isValid_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:isValid_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:isValid_sam|trigger=none}{code:language=javascript}
var server = plugins.maintenance.getServer("example_data");
if (!server.isValid()) {
			application.output("Server not valid!");
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=8D8AC16D-5607-4994-94F5-42BBB162B297=reloadDataModel|class=node}{tr:id=name}{td}h6.reloadDataModel{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}reloadDataModel{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297reloadDataModel_des|text=|trigger=button}{sub-section}{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297reloadDataModel_des|trigger=none|class=sIndent}Reloads the datamodel from the database, if changed externally or via rawSQL plugin.

This call is not needed after a call to synchronizeWithDB().{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_prsreloadDataModel_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_prssub-section:reloadDataModel_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_retreloadDataModel_prs|text=|trigger=button}{sub-section}{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_retreloadDataModel_prs|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_seereloadDataModel_ret|text=|trigger=button}{sub-section}{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_seereloadDataModel_ret|trigger=none|class=sIndent|trigger=none}void{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297reloadDataModel_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_link|class=sIndentreloadDataModel_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_samreloadDataModel_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:8D8AC16D-5607-4994-94F5-42BBB162B297_sam|class=sIndent|reloadDataModel_link|trigger=none}{code:language=javascript}
var sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:reloadDataModel_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:reloadDataModel_sam|trigger=none}{code:language=javascript}
var server = plugins.maintenance.getServer("example_data");
var result = plugins.rawSQL.executeSQL("example_data", null, 'CREATE TABLE raw_table (raw_table_id INTEGER)');
if (result) {
	application.output("Table created through rawSQL plugin.");
	if (server) {
		server.reloadDataModel();
		// All existing JSTableObject/JSColumn object references are invalid now! Use getTable to get new ones.
		var table = server.getTable("raw_table");
		if (table) {
			var colNames = table.getColumnNames()
			application.output("Table has " + colNames.length + " columns.");
			for (var i=0; i<colNames.length; i++)
				application.output("Column " + i + ": " + colNames[i]);
		}
	}
}
else {
	application.output("Raw table creation failed: " + plugins.rawSQL.getException());
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=589129AE-0A30-46D5-86AB-3CA7E94EC321synchronizeWithDB|class=node}{tr:id=name}{td}h6.synchronizeWithDB{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}synchronizeWithDB{span}{span:id=iets|style=float: left;}\(table){span}{td}{tr}{tr:id=des}{td}{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321_dessynchronizeWithDB_des|text=|trigger=button}{sub-section}{sub-section:synchronizeWithDB_des|trigger=none|class=sIndent}Synchronizes a JSTable instance with the database. If columns were added to or removed from the JSTable instance, all these changes will now be persisted to the database.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:synchronizeWithDB_snc|text=|trigger=button}{sub-section}{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321_dessynchronizeWithDB_snc|trigger=none|class=sIndent}Synchronizes a JSTableReplace instance with the database. If columns were added to or removed from the JSTable instance, all these changes will now be persisted to the database.version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321-section:synchronizeWithDB_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321synchronizeWithDB_prs|trigger=none|class=sIndent}\{[JSTableObject]} table -- A JSTableObject instance that should be synchronized.
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321synchronizeWithDB_ret|text=|trigger=button}{sub-section}{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321synchronizeWithDB_ret|trigger=none|class=sIndent}[Boolean] -- boolean success.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321synchronizeWithDB_see|text=|trigger=button}{sub-section}{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321div:class=sIndent}{sub-section:synchronizeWithDB_see|class=sIndent|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321_seesynchronizeWithDB_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321synchronizeWithDB_link|class=sIndent|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321synchronizeWithDB_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:589129AE-0A30-46D5-86AB-3CA7E94EC321synchronizeWithDB_sam|class=sIndent|trigger=none}{code:language=javascript}
var server = plugins.maintenance.getServer("example_data");
if (server)
{
	var table = server.createNewTable("new_table");
	if (table) {
		table.createNewColumn("new_table_id", JSColumn.INTEGER, 0, false, true);
		if (server.synchronizeWithDB(table))
			application.output("New table created in the database.");
		else
			application.output("New table not created in database.");
	}
	else application.output("New table not created at all.");
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}