Child pages
  • Database Manager

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rev: 1383305479300
Div
styledisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Enter additional information related to this 'class' inside the {div} macro with 'id=description'

Div
iddescription



HTML Table
id
classservoy sReturnTypes
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Return Types
Table Row (tr)
Table Cell (td)
Span
classsWordList
JSFoundSet
Span
classsWordList
JSRecord



HTML Table
id
classservoy sSummary
Colgroup Tag

...

Col

...

width80px
Col

...

Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
getDataSource(serverName, tableName)
Returns the datasource corresponding to the given server/table.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
getDataSourceServerName(dataSource)
Returns the server name from the datasource, or null if not a database datasource.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
getDataSourceTableName(dataSource)
Returns the table name from the datasource, or null if the specified argument is not a database datasource.
Table Row (tr)
Table Cell (td)
JSFoundSet
Table Cell (td)
getFoundSet(dataSource)
Returns a foundset object for a specified datasource or server and tablename.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
hasRecords(foundset)
Returns true if the (related)foundset exists and has records.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
hasRecords(record, relationString)
Returns true if the (related)foundset exists and has records.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
saveData()
Saves all outstanding (unsaved) data and exits the current record.



HTML Table
idfunction
classservoy sDetail
Colgroup Tag

...

Col

...

colspan

...

2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan

...

2
Method Details
Table Body (tbody)
idgetDataSource-String_String
Table Row (tr)
idname
Table Cell (td)

getDataSource

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getDataSource
Span
(serverName, tableName)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the datasource corresponding to the given server/table.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} serverName - The name of the table's server.
{String} tableName - The table's name.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String - The datasource of the given table/server.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var datasource = databaseManager.getDataSource('example_data', 'categories');
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetDataSourceServerName-String
Table Row (tr)
idname
Table Cell (td)

getDataSourceServerName

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getDataSourceServerName
Span
(dataSource)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the server name from the datasource, or null if not a database datasource.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} dataSource - The datasource string to get the server name from.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String - The servername of the datasource.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var servername = databaseManager.getDataSourceServerName(datasource);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetDataSourceTableName-String
Table Row (tr)
idname
Table Cell (td)

getDataSourceTableName

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getDataSourceTableName
Span
(dataSource)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the table name from the datasource, or null if the specified argument is not a database datasource.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} dataSource - The datasource string to get the tablename from.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String - The tablename of the datasource.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var theTableName = databaseManager.getDataSourceTableName(datasource);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetFoundSet-String
Table Row (tr)
idname
Table Cell (td)

getFoundSet

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSFoundSet
Span
stylefont-weight: bold;
getFoundSet
Span
(dataSource)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a foundset object for a specified datasource or server and tablename.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} dataSource - The datasource to get a JSFoundset for.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSFoundSet - A new JSFoundset for that datasource.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// type the foundset returned from the call with JSDoc, fill in the right server/tablename
/** @type {JSFoundset<db:/servername/tablename>} */
var fs = databaseManager.getFoundSet(controller.getDataSource())
var ridx = fs.newRecord()
var record = fs.getRecord(ridx)
record.emp_name = 'John'
databaseManager.saveData()
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idhasRecords-JSFoundSet
Table Row (tr)
idname
Table Cell (td)

hasRecords

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
hasRecords
Span
(foundset)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the (related)foundset exists and has records.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{JSFoundSet} foundset - A JSFoundset to test.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean - true if the foundset/relation has records.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (elements.customer_id.hasRecords(orders_to_orderitems))
{
	//do work on relatedFoundSet
}
//if (elements.customer_id.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
//	//do work on deeper relatedFoundSet
//}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idhasRecords-JSRecord_String
Table Row (tr)
idname
Table Cell (td)

hasRecords

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
hasRecords
Span
(record, relationString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the (related)foundset exists and has records.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{JSRecord} record - A JSRecord to test.
{String} relationString - The relation name.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean - true if the foundset/relation has records.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (elements.customer_id.hasRecords(orders_to_orderitems))
{
	//do work on relatedFoundSet
}
//if (elements.customer_id.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
//	//do work on deeper relatedFoundSet
//}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idsaveData
Table Row (tr)
idname
Table Cell (td)

saveData

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
saveData
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Saves all outstanding (unsaved) data and exits the current record.
Optionally, by specifying a record or foundset, can save a single record or all records from foundset instead of all the data.

NOTE: The fields focus may be lost in user interface in order to determine the edits.
SaveData called from table events (like afterRecordInsert) is only partially supported depeding on how first saveData (that triggers the event) is called.
If first saveData is called with no arguments, all saveData from table events are returning immediatelly with true value and records will be saved as part of first save.
If first saveData is called with record(s) as arguments, saveData from table event will try to save record(s) from arguments that are different than those in first call.
SaveData with no arguments inside table events will always return true without saving anything.

Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean - true if the save was done without an error.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
databaseManager.saveData();
//databaseManager.saveData(foundset.getRecord(1));//save specific record
//databaseManager.saveData(foundset);//save all records from foundset

// when creating many records in a loop do a batch save on an interval as every 10 records (to save on memory and roundtrips)
// for (var recordIndex = 1; recordIndex <= 5000; recordIndex++)
// {
//		foundset.newRecord();
//		someColumn = recordIndex;
//		anotherColumn = "Index is: " + recordIndex;
//		if (recordIndex % 10 == 0) databaseManager.saveData();
// }
Table Row (tr)
classlastDetailRow
Table Cell (td)