Child pages
  • Database Manager

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
{div:style=}
Wiki Markup
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



Enter additional information related to this 'class'

inside

the

\

{div}

macro

with

'id=description'

{div} {div:id=description}{div}\\ {table:id=|class=servoy sReturnTypes}{tr:style=height: 30px;}{th}Return Types{th}{tr}{tr}{td}{span:class=sWordList}[JSFoundSet]{span}{span:class=sWordList}[JSRecord]{span}{td}{tr}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[String]{td}{td}[#getDataSource]\(serverName, tableName) Returns the datasource corresponding to the given server/table.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getDataSourceServerName]\(dataSource) Returns the server name from the datasource, or null if not a database datasource.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getDataSourceTableName]\(dataSource) Returns the table name from the datasource, or null if the specified argument is not a database datasource.{td}{tr}{tbody}{tbody}{tr}{td}[JSFoundSet]{td}{td}[#getFoundSet]\(dataSource) Returns a foundset object for a specified datasource or server and tablename.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#hasRecords]\(foundset) Returns true if the (related)foundset exists and has records.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#hasRecords]\(record, relationString) Returns true if the (related)foundset exists and has records.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#saveData]\() Saves all outstanding (unsaved) data and exits the current record.{td}{tr}{tbody}{table}\\ {table:id=property|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{table}\\ {table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=getDataSource-String_String}{tr:id=name}{td}h6.getDataSource{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getDataSource{span}{span}\(serverName, tableName){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the datasource corresponding to the given server/table.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} serverName -- The name of the table's server. \{[String]} tableName -- The table's name. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- The datasource of the given table/server.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

Div
iddescription


HTML Table
id
classservoy sReturnTypes
Table Row (tr)
styleheight: 30px;
Table Head (th)
Return Types
Table Row (tr)
Table Cell (td)
Span
classsWordList
JSFoundSet
Span
classsWordList
JSRecord

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getDataSource(serverName, tableName)
Returns the datasource corresponding to the given server/table.
Table Body (tbody)
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 Body (tbody)
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 Body (tbody)
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 Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasRecords(foundset)
Returns true if the (related)foundset exists and has records.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasRecords(record, relationString)
Returns true if the (related)foundset exists and has records.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#saveData()
Saves all outstanding (unsaved) data and exits the current record.

HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Property Details

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
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');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getDataSourceServerName-String}{tr:id=name}{td}h6.getDataSourceServerName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getDataSourceServerName{span}{span}\(dataSource){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the server name from the datasource, or null if not a database datasource.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- The datasource string to get the server name from. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- The servername of the datasource.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getDataSourceTableName-String}{tr:id=name}{td}h6.getDataSourceTableName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getDataSourceTableName{span}{span}\(dataSource){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the table name from the datasource, or null if the specified argument is not a database datasource.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- The datasource string to get the tablename from. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- The tablename of the datasource.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getFoundSet-String}{tr:id=name}{td}h6.getFoundSet{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSFoundSet]{span}{span:style=font-weight: bold;}getFoundSet{span}{span}\(dataSource){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a foundset object for a specified datasource or server and tablename.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- The datasource to get a JSFoundset for. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSFoundSet] -- A new JSFoundset for that datasource.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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()
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=hasRecords-JSFoundSet}{tr:id=name}{td}h6.hasRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}hasRecords{span}{span}\(foundset){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns true if the (related)foundset exists and has records.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[JSFoundSet]} foundset -- A JSFoundset to test. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if the foundset/relation has records.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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
//}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasRecords-JSRecord_String
}{
Table Row (tr)
:
id
=
name
}{td}h6.hasRecords{td}{tr}{tr:id=sig}{td}{span:style=
Table Cell (td)
hasRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}[
Boolean
]{span}{span:style=
Span
stylefont-weight:
bold;
}
hasRecords
{span}{span}\
Span
(record,
relationString)
{span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns true if the
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the (related)foundset
exists
and
has
records.
{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[JSRecord]} record -- A JSRecord to test. \{[String]} relationString -- The relation name. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if the foundset/relation has records.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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
//}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=saveData}{tr:id=name}{td}h6.saveData{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}saveData{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Saves all outstanding (unsaved) data and exits the current record. Optionally, by specifying a record or foundset, can save a single record or all reacords from foundset instead of all the data. NOTE: The fields focus may be lost in user interface in order to determine the edits.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if the save was done without an error.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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 reacords from foundset instead of all the data.

NOTE: The fields focus may be lost in user interface in order to determine the edits.

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();
// }
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
Table Row (tr)
classlastDetailRow
Table Cell (td)