{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:class=servoy sSummery}{colgroup}{column:width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{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:class=servoy sDetail}{colgroup}{column:width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=66DD3B86-EDE1-48A4-8EC1-8739437F457C}{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:66DD3B86-EDE1-48A4-8EC1-8739437F457C_des|text=|trigger=button}{sub-section}{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_des|trigger=none|class=sIndent}Creates in this server a new table with the specified name.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_prs|trigger=none}tableName -- The name of the table to create.
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_ret|text=|trigger=button}{sub-section}{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_ret|trigger=none|class=sIndent}[JSTableObject] -- JSTableObject created table.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_see|text=|trigger=button}{sub-section}{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_see|text=|trigger=button}{sub-section}{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_sam|text=|trigger=button}{sub-section}{sub-section:66DD3B86-EDE1-48A4-8EC1-8739437F457C_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}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=4824183C-C015-4D0E-BF4E-B1C13161DD83}{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:4824183C-C015-4D0E-BF4E-B1C13161DD83_des|text=|trigger=button}{sub-section}{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_des|trigger=none|class=sIndent}Drops the table with the specified name from this server.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_prs|trigger=none}tableName -- The name of the table to drop.
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_ret|text=|trigger=button}{sub-section}{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_ret|trigger=none|class=sIndent}[Boolean] -- boolean success.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_see|text=|trigger=button}{sub-section}{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_see|text=|trigger=button}{sub-section}{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_sam|text=|trigger=button}{sub-section}{sub-section:4824183C-C015-4D0E-BF4E-B1C13161DD83_sam|class=sIndent|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}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=2E82B5BF-824F-4959-8FD3-24A4A49FD0C1}{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:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_des|text=|trigger=button}{sub-section}{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_des|trigger=none|class=sIndent}Returns a JSTable instance corresponding to the table with the specified name from this server.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_prs|trigger=none}tableName -- The name of the table to retrieve.
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_ret|text=|trigger=button}{sub-section}{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_ret|trigger=none|class=sIndent}[JSTableObject] -- JSTableObject table.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_see|text=|trigger=button}{sub-section}{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_see|text=|trigger=button}{sub-section}{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_sam|text=|trigger=button}{sub-section}{sub-section:2E82B5BF-824F-4959-8FD3-24A4A49FD0C1_sam|class=sIndent|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}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=83A35B70-46CD-41BC-B76B-FEA4E3845406}{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:83A35B70-46CD-41BC-B76B-FEA4E3845406_des|text=|trigger=button}{sub-section}{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_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=prs}{td}*Parameters*\\{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_ret|text=|trigger=button}{sub-section}{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_ret|trigger=none|class=sIndent}[String]\[] -- Array of String table names.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_see|text=|trigger=button}{sub-section}{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_see|text=|trigger=button}{sub-section}{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_sam|text=|trigger=button}{sub-section}{sub-section:83A35B70-46CD-41BC-B76B-FEA4E3845406_sam|class=sIndent|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}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=464CF12F-99DA-42B5-B153-75CB176D194F}{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:464CF12F-99DA-42B5-B153-75CB176D194F_des|text=|trigger=button}{sub-section}{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_des|trigger=none|class=sIndent}Get valid state for the server.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_ret|text=|trigger=button}{sub-section}{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_ret|trigger=none|class=sIndent}[Boolean] -- boolean valid state.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_see|text=|trigger=button}{sub-section}{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_see|text=|trigger=button}{sub-section}{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_sam|text=|trigger=button}{sub-section}{sub-section:464CF12F-99DA-42B5-B153-75CB176D194F_sam|class=sIndent|trigger=none}{code:language=javascript}
var server = plugins.maintenance.getServer("example_data");
if (!server.isValid()) {
			application.output("Server not valid!");
}
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=9297FF80-1CA1-4F52-B89E-8BF66CDC6866}{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:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_des|text=|trigger=button}{sub-section}{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_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=prs}{td}*Parameters*\\{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_ret|text=|trigger=button}{sub-section}{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_see|text=|trigger=button}{sub-section}{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_see|text=|trigger=button}{sub-section}{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_sam|text=|trigger=button}{sub-section}{sub-section:9297FF80-1CA1-4F52-B89E-8BF66CDC6866_sam|class=sIndent|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}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=97148AD8-F547-4985-8567-18E27BB5A351}{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:97148AD8-F547-4985-8567-18E27BB5A351_des|text=|trigger=button}{sub-section}{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_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}{tr:id=prs}{td}*Parameters*\\{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_prs|trigger=none}table -- A JSTableObject instance that should be synchronized.
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_ret|text=|trigger=button}{sub-section}{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_ret|trigger=none|class=sIndent}[Boolean] -- boolean success.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_see|text=|trigger=button}{sub-section}{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_see|text=|trigger=button}{sub-section}{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_sam|text=|trigger=button}{sub-section}{sub-section:97148AD8-F547-4985-8567-18E27BB5A351_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}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}